Преглед изворни кода

控制类库界面分离

样式分支
pry пре 2 година
родитељ
комит
7bf7e0e960
18 измењених фајлова са 658 додато и 193 уклоњено
  1. +91
    -0
      BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml
  2. +1
    -1
      BPASmartClient.CustomResource/Themes/GenricStyle.xaml
  3. +3
    -1
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  4. +25
    -0
      BPASmartClient.MorkS/View/Debug.xaml
  5. +28
    -0
      BPASmartClient.MorkS/View/Debug.xaml.cs
  6. +25
    -0
      BPASmartClient.MorkS/View/Monitor.xaml
  7. +28
    -0
      BPASmartClient.MorkS/View/Monitor.xaml.cs
  8. +147
    -0
      BPASmartClient.MorkS/View/ParSet.xaml
  9. +28
    -0
      BPASmartClient.MorkS/View/ParSet.xaml.cs
  10. +18
    -0
      BPASmartClient.MorkS/ViewModel/DebugViewModel.cs
  11. +17
    -0
      BPASmartClient.MorkS/ViewModel/MonitorViewModel.cs
  12. +17
    -0
      BPASmartClient.MorkS/ViewModel/ParSetViewModel.cs
  13. +104
    -0
      BPASmartClient.ViewModel/DeviceMonitorViewModel.cs
  14. +0
    -181
      BPASmartClient.ViewModel/Model/DeviceConfigModel.cs
  15. +2
    -1
      BPASmartClient/App.xaml
  16. +5
    -0
      BPASmartClient/BPASmartClient.csproj
  17. +119
    -9
      BPASmartClient/Control/DeviceMonitorView.xaml
  18. BIN
     

+ 91
- 0
BPASmartClient.CustomResource/RecDictionarys/BeveledRadioButtonStyle.xaml Прегледај датотеку

@@ -86,4 +86,95 @@
</Style>
<!--#endregion-->

<!--#region 长方形按钮-->
<Style x:Key="RectangleRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="Width" Value="100" />
<Setter Property="IsChecked" Value="False" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Foreground" Value="#ff2AB2E7" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid SnapsToDevicePixels="True">

<Border
x:Name="bb"
BorderBrush="#4B8EC4"
BorderThickness="0,0,0,2" />

<ContentPresenter
x:Name="contentPresenter"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<!--<Setter TargetName="bb" Property="Background" Value="#4B8EC4" />-->
<Setter TargetName="bb" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="bb" Property="Visibility" Value="Hidden" />
<!--<Setter TargetName="bb" Property="Background" Value="Transparent" />-->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 长方形左侧按钮-->
<Style x:Key="RectangleLeftRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="Width" Value="100" />
<Setter Property="IsChecked" Value="False" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Foreground" Value="#ff2AB2E7" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid SnapsToDevicePixels="True">

<Border x:Name="bb">
<Border.Background>
<ImageBrush ImageSource="../Image/leftImageSub.png" />
</Border.Background>
</Border>

<ContentPresenter
x:Name="contentPresenter"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="bb" Property="Visibility" Value="Visible" />
<!--<Setter TargetName="bb" Property="Background" Value="#4B8EC4" />-->
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="bb" Property="Visibility" Value="Hidden" />
<!--<Setter TargetName="bb" Property="Background" Value="Transparent" />-->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</ResourceDictionary>

+ 1
- 1
BPASmartClient.CustomResource/Themes/GenricStyle.xaml Прегледај датотеку

@@ -1273,7 +1273,7 @@
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="Foreground" Value="#abf4ff" />
<Setter Property="BorderBrush" Value="#abf4ff"></Setter>
<Setter Property="BorderBrush" Value="#abf4ff" />
<Setter Property="FontSize" Value="10" />
<Setter Property="Template">
<Setter.Value>


+ 3
- 1
BPASmartClient.MorkS/BPASmartClient.MorkS.csproj Прегледај датотеку

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
@@ -10,9 +10,11 @@

<ItemGroup>
<PackageReference Include="BPA.Models" Version="1.0.10" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.EventBus\BPASmartClient.EventBus.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />


+ 25
- 0
BPASmartClient.MorkS/View/Debug.xaml Прегледај датотеку

@@ -0,0 +1,25 @@
<UserControl
x:Class="BPASmartClient.MorkS.View.Debug"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkS.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkS.ViewModel"
Name="调试界面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:DebugViewModel />
</UserControl.DataContext>

<Grid>
<Label
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="调试界面"
FontSize="40" />
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.MorkS/View/Debug.xaml.cs Прегледај датотеку

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkS.View
{
/// <summary>
/// Debug.xaml 的交互逻辑
/// </summary>
public partial class Debug : UserControl
{
public Debug()
{
InitializeComponent();
}
}
}

+ 25
- 0
BPASmartClient.MorkS/View/Monitor.xaml Прегледај датотеку

@@ -0,0 +1,25 @@
<UserControl
x:Class="BPASmartClient.MorkS.View.Monitor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkS.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkS.ViewModel"
Name="监控画面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:MonitorViewModel />
</UserControl.DataContext>

<Grid>
<Label
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="监控画面"
FontSize="40" />
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.MorkS/View/Monitor.xaml.cs Прегледај датотеку

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkS.View
{
/// <summary>
/// Monitor.xaml 的交互逻辑
/// </summary>
public partial class Monitor : UserControl
{
public Monitor()
{
InitializeComponent();
}
}
}

+ 147
- 0
BPASmartClient.MorkS/View/ParSet.xaml Прегледај датотеку

@@ -0,0 +1,147 @@
<UserControl
x:Class="BPASmartClient.MorkS.View.ParSet"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkS.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.MorkS.ViewModel"
Name="参数设置界面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:ParSetViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="35" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<CheckBox
Grid.Row="0"
Grid.Column="2"
Height="20"
Margin="10"
VerticalAlignment="Top"
Background="#FF2AB2E7"
Content="开机启动"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding IsSelected}"
Template="{StaticResource CbTemplate}" />

<StackPanel
Grid.Row="1"
HorizontalAlignment="Right"
Orientation="Horizontal">

<TextBlock Style="{StaticResource TextBlockStyle}" Text="请点击按钮保存参数:" />

<pry:IcoButton
Grid.Column="5"
Width="140"
HorizontalAlignment="Left"
Command="{Binding SaveInfoCommand}"
Content="保存配置"
FontSize="16"
IcoText="&#xe936;"
Style="{StaticResource NewButtonStyle}">
<pry:IcoButton.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</pry:IcoButton.Foreground>
</pry:IcoButton>


</StackPanel>

<!-- 参数放置面板 -->
<Grid Grid.Row="2">
<ItemsControl ItemsSource="{Binding parSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding TextBlockContext}" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(分)" />
<TextBox
Width="100"
Margin="0,10"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Second}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(秒)" />

<CheckBox
Height="20"
Margin="10"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="{Binding CheckBoxContext}"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding IsShield}"
Template="{StaticResource CbTemplate}" />

</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</Grid>

</Grid>


</UserControl>

+ 28
- 0
BPASmartClient.MorkS/View/ParSet.xaml.cs Прегледај датотеку

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkS.View
{
/// <summary>
/// ParSet.xaml 的交互逻辑
/// </summary>
public partial class ParSet : UserControl
{
public ParSet()
{
InitializeComponent();
}
}
}

+ 18
- 0
BPASmartClient.MorkS/ViewModel/DebugViewModel.cs Прегледај датотеку

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;


namespace BPASmartClient.MorkS.ViewModel
{
public class DebugViewModel : ObservableObject
{
public DebugViewModel()
{

}
}
}

+ 17
- 0
BPASmartClient.MorkS/ViewModel/MonitorViewModel.cs Прегледај датотеку

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.MorkS.ViewModel
{
public class MonitorViewModel : ObservableObject
{
public MonitorViewModel()
{

}
}
}

+ 17
- 0
BPASmartClient.MorkS/ViewModel/ParSetViewModel.cs Прегледај датотеку

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.MorkS.ViewModel
{
public class ParSetViewModel : ObservableObject
{
public ParSetViewModel()
{

}
}
}

+ 104
- 0
BPASmartClient.ViewModel/DeviceMonitorViewModel.cs Прегледај датотеку

@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using BPASmartClient.Helper;
using System.IO;
using Newtonsoft.Json;
using BPASmartClient.Model;
using System.Reflection;
using Microsoft.Toolkit.Mvvm.Input;
using System.Windows;

namespace BPASmartClient.ViewModel
{
public class DeviceMonitorViewModel : ObservableObject
{
public DeviceMonitorViewModel()
{
DeviceSwitch = new RelayCommand<object>((o) =>
{
if (o is string nameSpace)
{
DeviceMonitors.Clear();
Assembly.Load(nameSpace.Substring(0, nameSpace.LastIndexOf("."))).GetTypes().ToList().ForEach((type) =>
{
if (type?.BaseType?.Name == "UserControl")
{
var fe = type.GetConstructor(Type.EmptyTypes).Invoke(null) as FrameworkElement;
DeviceMonitors.Add(new Device() { Name = fe.Name, Namespace = type?.FullName, fe = fe });
}
});
}
});

DeviceWindowSwitch = new RelayCommand<object>((o) =>
{
if (o != null && o is string nameSpace)
{
var fe = DeviceMonitors.FirstOrDefault(p => p.Namespace == nameSpace);
if (fe != null) MainContent = fe.fe;
}
});

GetData();
}



private void GetData()
{
var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig");
string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json";
if (File.Exists(path))
{
string JsonString = File.ReadAllText(path);
var result = JsonConvert.DeserializeObject<ObservableCollection<DeviceConfigModelJson>>(JsonString);
if (result != null)
{
foreach (var shop in result)//店铺集合
{
foreach (var device in shop.deviceModels)//设备集合
{
Devices.Add(new Device() { Name = device.DeviceName, Namespace = device.DeviceNamespace });
}
}
}
}
}

public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } }
private FrameworkElement _mMainContent;

public RelayCommand<object> DeviceSwitch { get; set; }

public RelayCommand<object> DeviceWindowSwitch { get; set; }

public ObservableCollection<Device> Devices { get; set; } = new ObservableCollection<Device>();

public ObservableCollection<Device> DeviceMonitors { get; set; } = new ObservableCollection<Device>();

}

public class Device : ObservableObject
{

public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } }
private string _mName;


public string Namespace { get { return _mNamespace; } set { _mNamespace = value; OnPropertyChanged(); } }
private string _mNamespace;

public FrameworkElement fe { get; set; }
}






}

+ 0
- 181
BPASmartClient.ViewModel/Model/DeviceConfigModel.cs Прегледај датотеку

@@ -1,181 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using Microsoft.Toolkit.Mvvm.ComponentModel;
//using System.Collections.ObjectModel;
//using Microsoft.Toolkit.Mvvm.Input;
//using System.Windows;

//namespace BPASmartClient.ViewModel.Model
//{
// /// <summary>
// /// 店铺设备
// /// </summary>
// public class DeviceConfigModel : ObservableObject
// {
// /// <summary>
// /// 店铺名称
// /// </summary>
// public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } }
// private string _mShopName = string.Empty;

// /// <summary>
// /// 店铺ID
// /// </summary>
// public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } }
// private string _mShopId = string.Empty;

// /// <summary>
// /// 设备集合
// /// </summary>
// public ObservableCollection<DeviceModel> deviceModels { get; set; } = new ObservableCollection<DeviceModel>();
// }

// /// <summary>
// /// 启动模块
// /// </summary>
// public class DeviceModel : ObservableObject
// {
// /// <summary>
// /// 设备名称
// /// </summary>
// public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
// private string _mDeviceName = string.Empty;

// /// <summary>
// /// 启动设备模块
// /// </summary>
// public string DeviceModule { get { return _mDeviceModule; } set { _mDeviceModule = value; OnPropertyChanged(); } }
// private string _mDeviceModule = string.Empty;

// public string DeviceNamespace { get; set; }


// public string Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
// private string _mId = string.Empty;


// /// <summary>
// /// 设备ID
// /// </summary>
// public string DeviceId { get { return _mDeviceId; } set { _mDeviceId = value; OnPropertyChanged(); } }
// private string _mDeviceId = string.Empty;

// /// <summary>
// /// 通讯模块
// /// </summary>
// public ObservableCollection<CommunicationModel> communicationDevcies { get; set; } = new ObservableCollection<CommunicationModel>();

// }

// /// <summary>
// /// 通讯模块
// /// </summary>
// public class CommunicationModel : ObservableObject
// {
// /// <summary>
// /// 通讯启动模块
// /// </summary>
// public string CommunicationModule { get { return _mCommunicationModule; } set { _mCommunicationModule = value; OnPropertyChanged(); } }
// private string _mCommunicationModule = string.Empty;

// public string CommunicationNamespace { get; set; }

// public string CommunicationName { get { return _mCommunicationName; } set { _mCommunicationName = value; OnPropertyChanged(); } }
// private string _mCommunicationName = string.Empty;

// public string DeviceModelId { get { return _mDeviceModelId; } set { _mDeviceModelId = value; OnPropertyChanged(); } }
// private string _mDeviceModelId = string.Empty;

// public CommunicationPar communicationPar { get { return _mcommunicationPar; } set { _mcommunicationPar = value; OnPropertyChanged(); } }
// private CommunicationPar _mcommunicationPar = new CommunicationPar();

// }

// /// <summary>
// /// 通讯参数
// /// </summary>
// public class CommunicationPar : ObservableObject
// {
// /// <summary>
// /// 选择网口通讯
// /// </summary>
// public bool IsNetworkPort { get { return _mIsNetworkPort; } set { _mIsNetworkPort = value; OnPropertyChanged(); } }
// private bool _mIsNetworkPort = false;

// /// <summary>
// /// 选择串口通讯
// /// </summary>
// public bool IsSerialPort { get { return _mIsSerialPort; } set { _mIsSerialPort = value; OnPropertyChanged(); } }
// private bool _mIsSerialPort = true;

// /// <summary>
// /// IP地址
// /// </summary>
// public string IPAddress { get { return _mIPAddress; } set { _mIPAddress = value; OnPropertyChanged(); } }
// private string _mIPAddress;

// /// <summary>
// /// IP 端口号
// /// </summary>
// public int IPPort { get { return _mIPPort; } set { _mIPPort = value; OnPropertyChanged(); } }
// private int _mIPPort;

// /// <summary>
// /// ip 串口 站号
// /// </summary>
// public int StationNo { get { return _mStationNo; } set { _mStationNo = value; OnPropertyChanged(); } }
// private int _mStationNo;


// /// <summary>
// /// 串口单口号
// /// </summary>
// public string SerialPort { get { return _mSerialPort; } set { _mSerialPort = value; OnPropertyChanged(); } }
// private string _mSerialPort;

// /// <summary>
// /// 波特率
// /// </summary>
// public int BaudRate { get { return _mBaudRate; } set { _mBaudRate = value; OnPropertyChanged(); } }
// private int _mBaudRate;

// /// <summary>
// /// 数据位
// /// </summary>
// public int DataBits { get { return _mDataBits; } set { _mDataBits = value; OnPropertyChanged(); } }
// private int _mDataBits = 8;

// /// <summary>
// /// 停止位
// /// </summary>
// public string StopBits { get { return _mStopBits; } set { _mStopBits = value; OnPropertyChanged(); } }
// private string _mStopBits = "1";

// /// <summary>
// /// 校验位
// /// </summary>
// public string Parity { get { return _mParity; } set { _mParity = value; OnPropertyChanged(); } }
// private string _mParity;

// public ObservableCollection<Variable> variables { get; set; } = new ObservableCollection<Variable>();
// }

// public class Variable : ObservableObject
// {
// public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
// private int _mId;


// public string Address { get { return _mAddress; } set { _mAddress = value; OnPropertyChanged(); } }
// private string _mAddress;


// public int ReadLeng { get { return _mReadLeng; } set { _mReadLeng = value; OnPropertyChanged(); } }
// private int _mReadLeng;


// }
//}

+ 2
- 1
BPASmartClient/App.xaml Прегледај датотеку

@@ -26,7 +26,8 @@
</ResourceDictionary>

<ResourceDictionary>
<ImageBrush x:Key="hbl" ImageSource="pack://application:,,,/BPASmartClient.CustomResource;component/Image/HBL.png" />
<ImageBrush x:Key="hbl" ImageSource="/BPASmartClient.CustomResource;component/Image/HBL.png" />
<ImageBrush x:Key="dbxt" ImageSource="/BPASmartClient.CustomResource;component/Image/顶部线条.png" />
</ResourceDictionary>

</ResourceDictionary.MergedDictionaries>


+ 5
- 0
BPASmartClient/BPASmartClient.csproj Прегледај датотеку

@@ -7,8 +7,13 @@
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<StartupObject>BPASmartClient.App</StartupObject>
<ApplicationIcon>hbl.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<Content Include="hbl.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1185.39" />
</ItemGroup>


+ 119
- 9
BPASmartClient/Control/DeviceMonitorView.xaml Прегледај датотеку

@@ -1,13 +1,123 @@
<UserControl x:Class="BPASmartClient.Control.DeviceMonitorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Control"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl
x:Class="BPASmartClient.Control.DeviceMonitorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:DeviceMonitorViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<!--#region ListBox样式-->
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="border" CornerRadius="8">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<!--<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="border" Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0.5" Color="#FF6B6B6B" />
<GradientStop Offset="0.5" Color="#FF535353" />
<GradientStop Offset="0.022" Color="#FF535353" />
<GradientStop Offset="0.991" Color="#FF555555" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>-->
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
</UserControl.Resources>

<Grid>
<Label FontSize="100" >设备流程监视界面</Label>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>

<!-- 第一行是设备切换行 -->
<ListBox
x:Name="lstEnt"
Margin="100,0,0,0"
Background="{x:Null}"
BorderBrush="{x:Null}"
BorderThickness="0"
ItemContainerStyle="{StaticResource ResourceKey=ListBoxItemStyle1}"
ItemsSource="{Binding Devices}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<RadioButton
Margin="0,0,10,0"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding DataContext.DeviceSwitch, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
CommandParameter="{Binding Namespace}"
Content="{Binding Name}"
GroupName="Devices"
Style="{StaticResource RectangleRadioButtonStyle}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>


<!-- 第二行是设备功能行 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<ItemsControl ItemsSource="{Binding DeviceMonitors}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<RadioButton
Margin="0,10,0,10"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding DataContext.DeviceWindowSwitch, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding Namespace}"
Content="{Binding Name}"
FontSize="16"
GroupName="DeviceMotion"
Style="{StaticResource RectangleLeftRadioButtonStyle}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

<ContentControl Grid.Column="1" Content="{Binding MainContent}" />

</Grid>


</Grid>
</UserControl>


Loading…
Откажи
Сачувај