瀏覽代碼

参数配置

样式分支
pry 2 年之前
父節點
當前提交
73de27797a
共有 7 個檔案被更改,包括 238 行新增253 行删除
  1. +4
    -0
      BPASmartClient.ViewModel/Model/DeviceConfigModel.cs
  2. +25
    -1
      BPASmartClient.ViewModel/NewShopWindowModel.cs
  3. +46
    -1
      BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
  4. +61
    -21
      BPASmartClient/Control/ShopDeviceConfigView.xaml
  5. +92
    -220
      BPASmartClient/DialogWindow/NewShopWindow.xaml
  6. +9
    -9
      BPASmartClient/DialogWindow/NewShopWindow.xaml.cs
  7. +1
    -1
      BPASmartClient/MainWindow.xaml.cs

+ 4
- 0
BPASmartClient.ViewModel/Model/DeviceConfigModel.cs 查看文件

@@ -73,6 +73,10 @@ namespace BPASmartClient.ViewModel.Model
private string _mCommunicationModule = string.Empty;


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



}



+ 25
- 1
BPASmartClient.ViewModel/NewShopWindowModel.cs 查看文件

@@ -3,7 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using Microsoft.Toolkit.Mvvm.Messaging;

namespace BPASmartClient.ViewModel
{
@@ -11,7 +14,28 @@ namespace BPASmartClient.ViewModel
{
public NewShopWindowModel()
{

CloseWindowCommand = new RelayCommand(() => { WeakReferenceMessenger.Default.Send("", "CloseWindow"); });
CancelCommand = new RelayCommand(() => { WeakReferenceMessenger.Default.Send("", "CloseWindow"); });
DefineCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("ShopPar", new string[] { ShopName, ShopId });
WeakReferenceMessenger.Default.Send("", "CloseWindow");
});
}

public RelayCommand CloseWindowCommand { get; set; }

public RelayCommand CancelCommand { get; set; }

public RelayCommand DefineCommand { get; set; }

public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } }
private string _mShopName;

public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } }
private string _mShopId;



}
}

+ 46
- 1
BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs 查看文件

@@ -3,7 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.ViewModel.Model;
using System.Collections.ObjectModel;

namespace BPASmartClient.ViewModel
{
@@ -11,9 +15,50 @@ namespace BPASmartClient.ViewModel
{
public ShopDeviceConfigViewModel()
{
//NewCommand = new Action(() => {ActionManager });
ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o != null && o is string[] par)
{
if (par.Length == 2)
{
ShopName = par[0];
ShopId = par[1];
}
}
}), "ShopPar");

ObservableCollection<DeviceModel> deviceModels = new ObservableCollection<DeviceModel>();
ObservableCollection<CommunicationModel> communicationModels = new ObservableCollection<CommunicationModel>();
communicationModels.Add(new CommunicationModel() { CommunicationName = "通讯1", CommunicationModule = "qidong" });
deviceModels.Add(new DeviceModel() { DeviceName = "设备1", DeviceId = "10", DeviceModule = "aa", communicationDevcies = communicationModels });
deviceConfig = new DeviceConfigModel()
{
ShopName = "且时且多",
ShopId = "10",
deviceModels = deviceModels
};

NewDeviceCommand = new RelayCommand<string>((o) =>
{

});
}

public Action NewCommand { get; set; }

public RelayCommand<string> NewDeviceCommand { get; set; }

public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } }
private string _mShopName = "店铺名称";

public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } }
private string _mShopId;

public ObservableCollection<DeviceConfigModel> deviceConfig = new ObservableCollection<DeviceConfigModel>();

//public DeviceConfigModel deviceConfig { get { return _mdeviceConfig; } set { _mdeviceConfig = value; OnPropertyChanged(); } }
//private DeviceConfigModel _mdeviceConfig;


}
}

+ 61
- 21
BPASmartClient/Control/ShopDeviceConfigView.xaml 查看文件

@@ -7,6 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
xmlns:vmm="clr-namespace:BPASmartClient.ViewModel.Model;assembly=BPASmartClient.ViewModel"
d:DesignHeight="900"
d:DesignWidth="1200"
mc:Ignorable="d">
@@ -399,32 +400,70 @@
</Grid.ColumnDefinitions>

<Grid>
<TreeView Background="Transparent" BorderThickness="1">
<!-- 设置店铺 -->
<TreeViewItem Header="且时且多店铺" Style="{StaticResource TreeviewItemStyle}">

<TreeView ItemsSource="{Binding deviceConfig}" Background="Transparent" BorderThickness="0">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type vmm:DeviceConfigModel}" ItemsSource="{Binding deviceModels}">
<StackPanel>
<TextBlock Text="{Binding DeviceName}" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.Resources>
</TreeView>

<!--<TreeView
Background="Transparent"
BorderThickness="1"
ItemsSource="{Binding deviceConfig}">
-->
<!-- 设置店铺 -->
<!--
<TreeViewItem Header="{Binding ShopName}" Style="{StaticResource TreeviewItemStyle}">
<TreeViewItem.ContextMenu>
<ContextMenu>
<MenuItem Header="新建设备" />
<MenuItem
Command="{Binding DataContent.NewDeviceCommand}"
CommandParameter="{Binding ShopName}"
Header="新建设备" />
</ContextMenu>
</TreeViewItem.ContextMenu>
<!-- 设置多个设备 -->
<TreeViewItem Header="煮面机设备" Style="{StaticResource TreeviewItemStyle}">
<TreeViewItem.ContextMenu>
<ContextMenu>
<MenuItem Header="新建通讯" />
<MenuItem Header="删除设备" />
</ContextMenu>
</TreeViewItem.ContextMenu>
<!-- 设置通讯 -->
<TreeViewItem Header="步科PLC通讯" Style="{StaticResource TreeviewItemStyle}">
-->
<!-- 设置多个设备 -->
<!--
<TreeView
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding deviceConfig.deviceModels}">
<TreeViewItem Header="{Binding DeviceName}" Style="{StaticResource TreeviewItemStyle}">
<TreeViewItem.ContextMenu>
<ContextMenu>
<MenuItem Header="删除" />
<MenuItem Header="新建通讯" />
<MenuItem Header="删除设备" />
</ContextMenu>
</TreeViewItem.ContextMenu>

-->
<!-- 设置通讯 -->
<!--
<TreeView
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding communicationDevcies}">
<TreeViewItem Header="{Binding CommunicationName}" Style="{StaticResource TreeviewItemStyle}">
<TreeViewItem.ContextMenu>
<ContextMenu>
<MenuItem Header="删除" />
</ContextMenu>
</TreeViewItem.ContextMenu>
</TreeViewItem>
</TreeView>

</TreeViewItem>
</TreeViewItem>
<TreeViewItem Header="冰淇淋机设备" Style="{StaticResource TreeviewItemStyle}">


</TreeView>
-->
<!--<TreeViewItem Header="冰淇淋机设备" Style="{StaticResource TreeviewItemStyle}">
<TreeViewItem.ContextMenu>
<ContextMenu>
<MenuItem Header="新建通讯" />
@@ -445,9 +484,10 @@
</ContextMenu>
</TreeViewItem.ContextMenu>
</TreeViewItem>
</TreeViewItem>
</TreeViewItem>-->
<!--
</TreeViewItem>
</TreeView>
</TreeView>-->
</Grid>

<Grid Grid.Column="1" Margin="10">
@@ -482,7 +522,7 @@
Width="170"
HorizontalAlignment="Left"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Minute}" />
Text="{Binding ShopName}" />

<TextBlock
Grid.Column="4"
@@ -495,7 +535,7 @@
Width="170"
HorizontalAlignment="Left"
Style="{StaticResource TextBoxStyle}"
Text="" />
Text="{Binding ShopId}" />

</Grid>



+ 92
- 220
BPASmartClient/DialogWindow/NewShopWindow.xaml 查看文件

@@ -8,8 +8,8 @@
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
Title="NewShopWindow"
Width="850"
Height="450"
Width="400"
Height="300"
AllowsTransparency="True"
Background="{x:Null}"
Opacity="0.8"
@@ -85,7 +85,6 @@
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
<RowDefinition Height="50" />
</Grid.RowDefinitions>

<!--#region 标题栏设置-->
@@ -126,238 +125,111 @@
Visibility="Hidden" />
<Button
Name="ButClose"
Command="{Binding CloseCommand}"
Content="&#xe602;"
Command="{Binding CloseWindowCommand}"
Content="X"
FontSize="30"
Style="{StaticResource TitleBarStyle}" />
</UniformGrid>
<!--#endregion-->

<!--#region 表单数据-->
<Grid Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<Grid Margin="10">

<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="200" />
<RowDefinition />
</Grid.RowDefinitions>

<!-- 店铺信息 -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>

<Grid>
<pry:TitleTextBlock />
<TextBlock
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="雅黑"
FontSize="20"
Foreground="Yellow"
Text="店铺信息" />
</Grid>

<Grid Grid.Row="1">
<TextBlock
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="请输入店铺名称:" />

<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />
</Grid>

<Grid Grid.Row="2">
<TextBlock
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="请输入店铺ID:" />

<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />
</Grid>

</Grid>

<!-- 设备信息 -->
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>

<Grid>
<pry:TitleTextBlock />
<TextBlock
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="雅黑"
FontSize="20"
Foreground="Yellow"
Text="设备信息" />
</Grid>

<!--#region 使用列表包裹-->
<Grid Grid.Row="1">
<TextBlock
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="请输入设备名称:" />

<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />
</Grid>

<Grid Grid.Row="2">
<TextBlock
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="请输入设备ID:" />

<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />
</Grid>

<Grid Grid.Row="3">
<TextBlock
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="请选择启动模块:" />

<ComboBox
Grid.Column="5"
Margin="170,0,20,0"
VerticalAlignment="Center"
BorderBrush="#FF23CACA"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
ItemsSource="{Binding Path=Device.PlcTypes}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding Path=Device.PlcType}" />
</Grid>

<Grid Grid.Row="4">
<TextBlock
HorizontalAlignment="Left"
Style="{StaticResource TextBlockStyle}"
Text="请选择通讯模块:" />

<ComboBox
Grid.Column="5"
Margin="170,0,20,0"
VerticalAlignment="Center"
BorderBrush="#FF23CACA"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
ItemsSource="{Binding Path=Device.PlcTypes}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding Path=Device.PlcType}" />
</Grid>
<!--#endregion-->

<!--<pry:IcoButton
Grid.Row="4"
Content="添加设备"
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;"
Style="{StaticResource NewButtonStyle}" />-->
</Grid>

<Grid Margin="10">

<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="60" />
<RowDefinition Height="30" />
</Grid.RowDefinitions>

<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.6*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="请输入店铺名称:" />

<TextBox
Grid.Column="1"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding ShopName}" />
</Grid>

<Grid Grid.Row="2">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.6*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Right"
Style="{StaticResource TextBlockStyle}"
Text="请输入店铺ID:" />

<TextBox
Grid.Column="1"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding ShopId}" />

</Grid>

<TextBlock
Grid.Row="3"
Margin="10,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="20"
Foreground="Red"
Text="错误提示" />

<Grid Grid.Row="4">

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Grid.Column="0"
VerticalAlignment="Center"
Command="{Binding CancelCommand}"
Content="取消"
Style="{StaticResource buttonStyle}" />

<Button
Grid.Column="1"
VerticalAlignment="Center"
Command="{Binding DefineCommand}"
Content="确认"
Style="{StaticResource buttonStyle}" />
</Grid>
</ScrollViewer>

</Grid>
</Grid>
<!--#endregion-->

<!--#region 信息取-->
<Grid Grid.Row="2" Background="#11dddddd">

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<!--<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />-->
</Grid.ColumnDefinitions>

<!--<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="20"
Foreground="Yellow"
Text="请选择需要继续制作的订单,取消或关闭将删除所有订单。" />-->

<Button
Grid.Column="0"
VerticalAlignment="Center"
Command="{Binding CancelCommand}"
Content="取消"
Style="{StaticResource buttonStyle}" />

<Button
Grid.Column="1"
VerticalAlignment="Center"
Command="{Binding ConfirmCommand}"
Content="确认"
Style="{StaticResource buttonStyle}" />
</Grid>
<!--#endregion-->

</Grid>


+ 9
- 9
BPASmartClient/DialogWindow/NewShopWindow.xaml.cs 查看文件

@@ -1,4 +1,5 @@
using System;
using Microsoft.Toolkit.Mvvm.Messaging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -27,14 +28,13 @@ namespace BPASmartClient.DialogWindow
this.DragMove();
};

//WeakReferenceMessenger.Default.Register<string, string>(this, "Close", (o, e) =>
//{
// App.Current.Dispatcher.Invoke(new Action(() =>
// {
// this.DialogResult = Convert.ToBoolean(e);
// this.Close();
// }));
//});
WeakReferenceMessenger.Default.Register<string, string>(this, "CloseWindow", (o, e) =>
{
App.Current.Dispatcher.Invoke(new Action(() =>
{
this.Close();
}));
});
}




+ 1
- 1
BPASmartClient/MainWindow.xaml.cs 查看文件

@@ -55,7 +55,7 @@ namespace BPASmartClient
else if (this.WindowState == WindowState.Normal)
this.WindowState = WindowState.Maximized;
}
this.DragMove();
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
MenuItem_Click(new MenuItem() { Tag = "LogView", Header = "日志监视" }, null);



Loading…
取消
儲存