首次提交:添加src文件夹代码
This commit is contained in:
49
Cowain.Bake.Main/Views/AddBatteryView.xaml
Normal file
49
Cowain.Bake.Main/Views/AddBatteryView.xaml
Normal file
@@ -0,0 +1,49 @@
|
||||
<Window x:Class="Cowain.Bake.Main.Views.AddBatteryView"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.Main.Views"
|
||||
xmlns:prism ="http://prismlibrary.com/"
|
||||
|
||||
mc:Ignorable="d"
|
||||
Title="添加电芯" Height="336" Width="380" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid Background="DodgerBlue">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="4*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel>
|
||||
<WrapPanel Margin="10,30,0,0" >
|
||||
<TextBlock Text="电芯条码:" Margin="50,10,10,0" ></TextBlock>
|
||||
<TextBox HorizontalAlignment="Center" Text="{Binding BatteryCode}" Width="230" ></TextBox>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="夹具行号:" Margin="50,10,10,0" ></TextBlock>
|
||||
<ComboBox HorizontalAlignment="Center" ItemsSource="{Binding PositionXRange}" SelectedValue="{Binding SelectedPositionX, Mode=TwoWay}" VerticalAlignment="Center" Width="230"></ComboBox>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="夹具列号:" Margin="50,10,10,0" ></TextBlock>
|
||||
<ComboBox HorizontalAlignment="Center" ItemsSource="{Binding PositionYRange}" SelectedValue="{Binding SelectedPositionY, Mode=TwoWay}" VerticalAlignment="Center" Width="230"></ComboBox>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="电芯状态:" Margin="50,10,10,0" ></TextBlock>
|
||||
<ComboBox HorizontalAlignment="Center" ItemsSource="{Binding EnumOptions}"
|
||||
DisplayMemberPath="Value"
|
||||
SelectedValuePath="Key"
|
||||
SelectedValue="{Binding SelectedEnum, Mode=TwoWay}" VerticalAlignment="Center" Width="230"></ComboBox>
|
||||
</WrapPanel>
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<TextBlock Text="是否水含量电芯:" Margin="15,10,10,0" ></TextBlock>
|
||||
<ComboBox HorizontalAlignment="Center" VerticalAlignment="Center" Width="230" SelectedItem="{Binding SelectedOption}" ItemsSource="{Binding Options}">
|
||||
</ComboBox>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<WrapPanel Margin="10,10,0,0" >
|
||||
<Button Content="增 加" Margin="135,10,10,0" Width="80" Command="{Binding AddCommand}"></Button>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
27
Cowain.Bake.Main/Views/AddBatteryView.xaml.cs
Normal file
27
Cowain.Bake.Main/Views/AddBatteryView.xaml.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
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.Shapes;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// AddBatteryView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AddBatteryView : Window
|
||||
{
|
||||
public AddBatteryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
70
Cowain.Bake.Main/Views/BasicInfoView.xaml
Normal file
70
Cowain.Bake.Main/Views/BasicInfoView.xaml
Normal file
@@ -0,0 +1,70 @@
|
||||
<UserControl x:Class="Cowain.Bake.Main.Views.BasicInfoView"
|
||||
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:Cowain.Bake.Main.Views"
|
||||
mc:Ignorable="d"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid Background="#66FFFFFF">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.03*"/>
|
||||
<RowDefinition Height="0.07*"/>
|
||||
<RowDefinition Height="0.07*"/>
|
||||
<RowDefinition Height="0.07*"/>
|
||||
<RowDefinition Height="0.07*"/>
|
||||
<RowDefinition Height="0.07*"/>
|
||||
<RowDefinition Height="0.07*"/>
|
||||
<RowDefinition Height="0.07*"/>
|
||||
<RowDefinition Height="0.07*"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.05*"/>
|
||||
<ColumnDefinition Width="0.4*"/>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
<ColumnDefinition Width="0.05*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="1" Text="用户:" Grid.Row="1"
|
||||
Height="34" FontSize="16" Background="Transparent"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding UserId,UpdateSourceTrigger=PropertyChanged}" Grid.Row="1"
|
||||
Height="34" FontSize="16" Background="Transparent"/>
|
||||
|
||||
<TextBlock Grid.Column="1" Text="姓名:" Grid.Row="2"
|
||||
Height="34" FontSize="16" Background="Transparent"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding UserName,UpdateSourceTrigger=PropertyChanged}" Grid.Row="2"
|
||||
Height="34" FontSize="16" Background="Transparent"/>
|
||||
|
||||
<TextBlock Text="工单:" Grid.Row="3" FontSize="16" Background="Transparent" Grid.Column="1"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding CurrentJobNum,UpdateSourceTrigger=PropertyChanged}" Grid.Row="3"
|
||||
Height="34" FontSize="16" Background="Transparent"/>
|
||||
|
||||
<TextBlock Text="工艺:" Grid.Row="4" FontSize="16" Background="Transparent" Grid.Column="1"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding CurrentOperation,UpdateSourceTrigger=PropertyChanged}" Grid.Row="4"
|
||||
Height="34" FontSize="16" Background="Transparent"/>
|
||||
|
||||
<TextBlock Text="露点温度:" Grid.Row="5" FontSize="16" Background="Transparent" Grid.Column="1"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding FailPointData,UpdateSourceTrigger=PropertyChanged}" Grid.Row="5"
|
||||
Height="34" FontSize="16" Background="Transparent"/>
|
||||
|
||||
<TextBlock Text="设备状态:" Grid.Row="6" FontSize="16" Background="Transparent" Grid.Column="1"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding DeviceStatusName,UpdateSourceTrigger=PropertyChanged}" Grid.Row="6"
|
||||
Height="34" FontSize="16" Background="Transparent"/>
|
||||
|
||||
<TextBlock Text="调度模式:" Grid.Row="7" FontSize="16" Background="Transparent" Grid.Column="1"/>
|
||||
<TextBlock Grid.Column="2" Text="{Binding DispMode,UpdateSourceTrigger=PropertyChanged}" Grid.Row="7" FontWeight="Bold"
|
||||
Height="34" FontSize="16" Background="Transparent" Foreground="Blue"/>
|
||||
|
||||
<TextBlock Text="MOM状态:" FontSize="16" Grid.Row="8" Grid.Column="1"/>
|
||||
<Border Grid.Row="8" Grid.Column="2" CornerRadius="20" HorizontalAlignment="Left" Margin="4,0,0,13" Background="{Binding StatusColor}" Height="15" Width="15" />
|
||||
|
||||
<GroupBox Header="触发信号" Grid.ColumnSpan="4" Grid.Row="9">
|
||||
<ListBox ItemsSource="{Binding EventList}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
25
Cowain.Bake.Main/Views/BasicInfoView.xaml.cs
Normal file
25
Cowain.Bake.Main/Views/BasicInfoView.xaml.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// BasicInfoView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class BasicInfoView : UserControl
|
||||
{
|
||||
public BasicInfoView(IUnityContainer unityContainer, IRegionManager regionManager)
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
97
Cowain.Bake.Main/Views/CavityDtlView.xaml
Normal file
97
Cowain.Bake.Main/Views/CavityDtlView.xaml
Normal file
@@ -0,0 +1,97 @@
|
||||
<Window x:Class="Cowain.Bake.Main.Views.CavityDtlView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:convertor="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Height="586" Width="1000"
|
||||
MinWidth="1000"
|
||||
MaxWidth="1000"
|
||||
MinHeight="586"
|
||||
MaxHeight="586">
|
||||
<Window.Resources>
|
||||
<convertor:BatteryStatusConvertor x:Key="cellStatusConvertor"></convertor:BatteryStatusConvertor>
|
||||
</Window.Resources>
|
||||
<Grid Background="DodgerBlue">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="101*"/>
|
||||
<ColumnDefinition Width="66*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBox x:Name="stationName" FontWeight="Bold" IsReadOnly="True" HorizontalAlignment="Left" Height="23" Margin="90,15,0,0" TextWrapping="Wrap" Text="{Binding StationName,Mode=TwoWay}" VerticalAlignment="Top" Width="120"/>
|
||||
<DataGrid x:Name="mainGrid" IsReadOnly="True" ItemsSource="{Binding BatteryDtl2}" AutoGenerateColumns="False" HorizontalAlignment="Left" Height="435" Margin="7,145,0,0"
|
||||
SelectedItem="{Binding BatteryInfoSelectedItem, Mode=TwoWay}" VerticalAlignment="Top" Width="990" Grid.ColumnSpan="2">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding BatteryCode}" Width="220" Header="电池条码"/>
|
||||
<DataGridTextColumn Binding="{Binding BatteryStatus, Converter={StaticResource cellStatusConvertor}}" Width="100" Header="电池状态"/>
|
||||
<DataGridTextColumn Binding="{Binding PositionX}" Width="95" Header="电池行坐标"/>
|
||||
<DataGridTextColumn Binding="{Binding PositionY}" Width="95" Header="电池列坐标"/>
|
||||
<!--<DataGridTextColumn Binding="{Binding DummyFlag}" Width="95" Header="水含量电芯"/>-->
|
||||
<DataGridTemplateColumn Header="水含量电芯" Width="80" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox HorizontalAlignment="Center" IsChecked="{Binding DummyFlag,Mode=TwoWay}" >
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<i:InvokeCommandAction Command="{Binding DataContext.ChangeDummyCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</CheckBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTextColumn Binding="{Binding BindingTime,StringFormat='yyyy-MM-dd HH:mm:ss'}" Width="170" Header="与托盘绑定时间"/>
|
||||
<DataGridTemplateColumn Header="操作" Width="80">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBlock Margin="3,0" >
|
||||
<Hyperlink Foreground="Red" Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding}">删除</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Label Content="工站名称:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="0,16,0,0" VerticalAlignment="Top" Width="90"/>
|
||||
<Label Content="托盘条码:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="190,16,0,0" VerticalAlignment="Top" Width="90"/>
|
||||
<!--<TextBox Text="{Binding PalletCode}" FontWeight="Bold" HorizontalAlignment="Left" Height="23" Margin="285,15,0,0" VerticalAlignment="Top" Width="101"/>-->
|
||||
<ComboBox x:Name="palletCode" SelectedValue="{Binding PalletCode}" ItemsSource="{Binding PalletList}" FontWeight="Bold" IsReadOnly="True" HorizontalAlignment="Left" Height="23" Margin="285,15,0,0" VerticalAlignment="Top" Width="135"/>
|
||||
<Label Content="是否可用:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="540,16,0,0" VerticalAlignment="Top" Width="64"/>
|
||||
<TextBox x:Name="stationEnable" Text="{Binding StationEnable}" FontWeight="Bold" IsEnabled="False" HorizontalAlignment="Left" Height="23" Margin="3.2,15,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="55" Grid.Column="1"/>
|
||||
<Label Content="当前烘次:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="66,16,0,0" VerticalAlignment="Top" Width="64" Grid.Column="1"/>
|
||||
<TextBlock x:Name="rebakingNum" Text="{Binding BakingCount}" FontWeight="Bold" HorizontalAlignment="Left" Height="23" Margin="130.2,21,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="45" Grid.Column="1"/>
|
||||
<TextBlock x:Name="bakingBatteryNum" Text="{Binding BatteryCount}" FontWeight="Bold" HorizontalAlignment="Left" Height="24" Margin="216,21,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="40" Grid.Column="1"/>
|
||||
<Label Content="最后一盘:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="250,15,0,0" VerticalAlignment="Top" Width="66" Grid.Column="1"/>
|
||||
<ComboBox ItemsSource="{Binding LastPalletList}" IsEnabled ="{Binding LastEnabled}" FontWeight="Bold" SelectedValue="{Binding LastValue,Mode=TwoWay}" HorizontalAlignment="Left" Margin="325,15,0,0" VerticalAlignment="Top" Width="60" Grid.Column="1"/>
|
||||
<Label Content="电芯数量:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="146,15,0,0" VerticalAlignment="Top" Width="66" Grid.Column="1"/>
|
||||
<Label Content="所属工单:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="514,62,0,0" VerticalAlignment="Top" Width="90"/>
|
||||
<ComboBox ItemsSource="{Binding ArrJobNum}" SelectedValue="{Binding SelectedJobNum,Mode=TwoWay}" FontWeight="Bold" IsReadOnly="True" HorizontalAlignment="Left" Height="23" Margin="4.2,62,0,0" VerticalAlignment="Top" Width="228" Grid.Column="1"/>
|
||||
<Button Content="绑定" Command="{Binding BindJobNum}" HorizontalAlignment="Left" Width="66" Margin="250,62,0,0" VerticalAlignment="Top" Grid.Column="1"/>
|
||||
<Button Content="解绑" Command="{Binding UnBindJobNum}" HorizontalAlignment="Left" Width="66" Margin="320,62,0,0" VerticalAlignment="Top" Grid.Column="1"/>
|
||||
|
||||
|
||||
<ComboBox ItemsSource="{Binding PalletStatus}" FontWeight="Bold" SelectedValue="{Binding SelectedValue,Mode=TwoWay}" IsReadOnly="True" HorizontalAlignment="Left" Margin="285,57,0,0" VerticalAlignment="Top" Width="135"/>
|
||||
<Label Content="托盘状态:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="214,62,0,0" VerticalAlignment="Top" Width="66"/>
|
||||
<Button Content="更新" Command="{Binding UpdatePalletStatus}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="56" Margin="422,57,0,0" />
|
||||
<Label Content="水份判断:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="0,62,0,0" VerticalAlignment="Top" Width="90"/>
|
||||
<Button Content="水分值输入" x:Name="moistureInput" IsEnabled ="{Binding IsEnabled}" Command="{Binding MoistureInput}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Margin="90,60,0,0"/>
|
||||
<Button Content="绑定" Command="{Binding UpdatePalletCode}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="56" Margin="421,15,0,0"/>
|
||||
<Button Content="解绑" Command="{Binding UpdatePalletNoneCode}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="56" Margin="477,15,0,0"/>
|
||||
<Label Content="是否带水:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="25,102,0,0" VerticalAlignment="Top" Width="66"/>
|
||||
<TextBox x:Name="IsWater" Text="{Binding IsWaterValue}" FontWeight="Bold" IsEnabled="False" HorizontalAlignment="Left" Height="23" Margin="90,100,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="50"/>
|
||||
<Button Content="增加电芯" Command="{Binding AddBatteryCommand}" IsEnabled ="{Binding IsEnabledAdd}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="70" Margin="145,100,0,0"/>
|
||||
<Label Content="信息绑定:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="190,102,0,0" VerticalAlignment="Top" Width="90"/>
|
||||
<TextBox Text="{Binding VirtualId}" FontWeight="Bold" HorizontalAlignment="Left" Height="23" Margin="285,100,0,0" VerticalAlignment="Top" Width="135"/>
|
||||
<Button Content="绑定" Command="{Binding UpdateVirtualId}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="56" Margin="421,100,0,0"/>
|
||||
<Label Content="工站备注:" Foreground="White" FontWeight="Bold" Style="{DynamicResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" Margin="534,102,0,0" VerticalAlignment="Top" Width="66"/>
|
||||
<TextBox x:Name="stationRemark" FontWeight="Bold" HorizontalAlignment="Left" Height="23" Margin="5,102,0,0" TextWrapping="Wrap" Text="{Binding Remark,Mode=TwoWay}" VerticalAlignment="Top" Width="310" Grid.Column="1"/>
|
||||
<Button Content="备注" Command="{Binding AddRemark}" HorizontalAlignment="Left" Width="66" Margin="320,102,0,0" VerticalAlignment="Top" Grid.Column="1"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
34
Cowain.Bake.Main/Views/CavityDtlView.xaml.cs
Normal file
34
Cowain.Bake.Main/Views/CavityDtlView.xaml.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Prism.Services.Dialogs;
|
||||
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.Shapes;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// StationDtl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CavityDtlView : Window
|
||||
{
|
||||
ViewModels.CavityDtlViewModel viewModel = null;
|
||||
public CavityDtlView(string stationNameIn, IUnityContainer unityContainer)
|
||||
{
|
||||
InitializeComponent();
|
||||
viewModel = new ViewModels.CavityDtlViewModel(unityContainer);
|
||||
this.DataContext = viewModel;
|
||||
viewModel.StationName = stationNameIn;
|
||||
viewModel.GetInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
152
Cowain.Bake.Main/Views/ComboBoxDictionary.xaml
Normal file
152
Cowain.Bake.Main/Views/ComboBoxDictionary.xaml
Normal file
@@ -0,0 +1,152 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Cowain.Bake.Main.Views">
|
||||
<!--ComboBox-->
|
||||
<!--ComBoBox项选中背景色-->
|
||||
<SolidColorBrush x:Key="ComboBoxSelectdBackground" Color="#ff8c69"/>
|
||||
<!--ComBoBox项鼠标经过背景色-->
|
||||
<SolidColorBrush x:Key="ComboBoxMouseOverBackground" Color="#ff3030"/>
|
||||
<!--ComBoBox项选中前景色-->
|
||||
<SolidColorBrush x:Key="ComboBoxSelectedForeground" Color="Black"/>
|
||||
<!--ComBoBox项鼠标经过前景色-->
|
||||
<SolidColorBrush x:Key="ComboBoxMouseOverForegrond" Color="White"/>
|
||||
|
||||
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
||||
<Grid Height="25" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="30"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Background="White" Grid.ColumnSpan="2" Opacity="0"/>
|
||||
<Path x:Name="Arrow" Grid.Column="1" Data="M 0 0 6 6 12 0 Z" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="None" Fill="#999" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter TargetName="Arrow" Property="RenderTransform">
|
||||
<Setter.Value>
|
||||
<RotateTransform CenterX="6" CenterY="3" Angle="180"></RotateTransform>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter TargetName="Arrow" Property="Margin" Value="0 0 0 2"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
|
||||
|
||||
<!--MultiComboBox普通样式-->
|
||||
<Style TargetType="{x:Type controls:MultiComboBox}">
|
||||
<Setter Property="Width" Value="200" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="MaxDropDownHeight" Value="400" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:MultiComboBox}">
|
||||
<Grid>
|
||||
<Border x:Name="Bg" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
|
||||
BorderBrush="#E0E0E0" CornerRadius="4"
|
||||
BorderThickness="1" >
|
||||
<Grid x:Name="PART_Root">
|
||||
|
||||
<Grid x:Name="PART_InnerGrid" Margin="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="0.3*" MaxWidth="30" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Margin="1" x:Name="PART_ListBoxChk" Background="#ADE5EF" SelectionMode="Multiple" BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Disabled">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Orientation="Horizontal" VirtualizingStackPanel.IsVirtualizing="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="IsSelected" Value="True"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<CheckBox BorderThickness="0" Background="#212f3e" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Center" Content="{Binding ViewName}" IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
|
||||
<!--下拉按钮-->
|
||||
<ToggleButton x:Name="PART_DropDownToggle" IsTabStop="False"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Grid.Column="1" Template="{StaticResource ComboBoxToggleButton}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!--弹出多选列表-->
|
||||
<Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" StaysOpen="False"
|
||||
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
|
||||
<Grid Width="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}" MaxHeight="{Binding MaxDropDownHeight, RelativeSource={RelativeSource TemplatedParent}}" >
|
||||
<ListBox x:Name="PART_ListBox" SelectionMode="Multiple" BorderThickness="1 0 1 1" Background="White" ItemsSource="{Binding ItemsSource,RelativeSource={RelativeSource TemplatedParent}}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="#eaeaea" >
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}" >
|
||||
<Grid Height="22">
|
||||
<Border x:Name="bg" BorderBrush="#eaeaea" BorderThickness="0"/>
|
||||
<ContentPresenter x:Name="content" />
|
||||
<Border Background="White" Opacity="0"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="bg" Property="Background" Value="#ADD6FF" />
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsMouseOver" Value="true" />
|
||||
<Condition Property="IsSelected" Value="false"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="bg" Property="Background" Value="#009BDB" />
|
||||
<Setter TargetName="bg" Property="Opacity" Value="0.7"/>
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="bg" Property="Opacity" Value="0.3" />
|
||||
<Setter Property="Foreground" Value="Gray" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<CheckBox x:Name="chk" Visibility="Hidden" IsChecked="{Binding IsCheck,Mode=TwoWay}" VerticalAlignment="Center"/>
|
||||
<CheckBox VerticalAlignment="Center" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=ListBoxItem}}" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Mode=TwoWay}" Content="{Binding Path=ViewName}" />
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="true">
|
||||
<Setter TargetName="chk" Property="IsChecked" Value="true"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="false">
|
||||
<Setter TargetName="chk" Property="IsChecked" Value="false"/>
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Popup>
|
||||
</Grid>
|
||||
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
208
Cowain.Bake.Main/Views/EquipmentMonitorView.xaml
Normal file
208
Cowain.Bake.Main/Views/EquipmentMonitorView.xaml
Normal file
@@ -0,0 +1,208 @@
|
||||
<UserControl x:Class="Cowain.Bake.Main.Views.EquipmentMonitorView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
Loaded="EquipmentMonitorView_Loaded"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="DefaultToolTipStyle" TargetType="{x:Type ToolTip}">
|
||||
<Setter Property="Foreground" Value="Yellow"/>
|
||||
<Setter Property = "Background" Value="Blue"/>
|
||||
<Setter Property = "FontSize" Value="14"/>
|
||||
<Setter Property="BorderBrush" Value="White"/>
|
||||
</Style>
|
||||
<Style x:Key="MyButton" TargetType="Button">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="LightBlue"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Canvas x:Name="mainCanvas" Margin="0,0,0,0" Height="auto" Width="auto" Loaded="Canvas_Loaded">
|
||||
<Canvas.Background>
|
||||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
|
||||
<!-- 起点颜色 -->
|
||||
<GradientStop Color="LightBlue" Offset="0" />
|
||||
<!-- 终点颜色 -->
|
||||
<GradientStop Color="LightBlue" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</Canvas.Background>
|
||||
<Grid Canvas.Left="0" Canvas.Top="0" Width="700" Height="30">
|
||||
<!-- 定义一行七列 -->
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 为每一列设置单独的背景色和内容 -->
|
||||
<Border Grid.Column="0" Background="White">
|
||||
<TextBlock Text="空夹具" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontSize="16"/>
|
||||
</Border>
|
||||
<Border Grid.Column="1" Background="Bisque">
|
||||
<TextBlock Text="上料中" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" FontSize="16"/>
|
||||
</Border>
|
||||
<Border Grid.Column="2" Background="Purple">
|
||||
<TextBlock Text="满载" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||
</Border>
|
||||
<Border Grid.Column="3" Background="DarkOrange">
|
||||
<TextBlock Text="烘烤中" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||
</Border>
|
||||
<Border Grid.Column="4" Background="Green">
|
||||
<TextBlock Text="烘烤完成" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||
</Border>
|
||||
<Border Grid.Column="5" Background="gold">
|
||||
<TextBlock Text="待测结果" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||
</Border>
|
||||
<Border Grid.Column="6" Background="PaleGreen">
|
||||
<TextBlock Text="检测OK" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||
</Border>
|
||||
<Border Grid.Column="7" Background="DeepPink">
|
||||
<TextBlock Text="检测NG" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Column="8" Background="LightSteelBlue">
|
||||
<TextBlock Text="下料中" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Column="9" Background="Tan">
|
||||
<TextBlock Text="维修中" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||
</Border>
|
||||
<Border Grid.Column="10" Background="red">
|
||||
<TextBlock Text="异常" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Grid Canvas.Left="0" Canvas.Top="45" Width="500" Height="60">
|
||||
<hc:StepBar x:Name="StepBarControl" StepIndex="{Binding StepIndex}" >
|
||||
<hc:StepBarItem Content="无任务"/>
|
||||
<hc:StepBarItem Content="移至取位">
|
||||
<hc:StepBarItem.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="发送指令" Command="{Binding ReSendCommand}"
|
||||
CommandParameter="10" />
|
||||
</ContextMenu>
|
||||
</hc:StepBarItem.ContextMenu>
|
||||
</hc:StepBarItem>
|
||||
<hc:StepBarItem Content="取盘">
|
||||
<hc:StepBarItem.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="发送指令" Command="{Binding ReSendCommand}"
|
||||
CommandParameter="20"/>
|
||||
</ContextMenu>
|
||||
</hc:StepBarItem.ContextMenu>
|
||||
</hc:StepBarItem>
|
||||
|
||||
<hc:StepBarItem Content="移至放位">
|
||||
<hc:StepBarItem.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="发送指令" Command="{Binding ReSendCommand}"
|
||||
CommandParameter="11" />
|
||||
</ContextMenu>
|
||||
</hc:StepBarItem.ContextMenu>
|
||||
</hc:StepBarItem>
|
||||
|
||||
<hc:StepBarItem Content="放盘">
|
||||
<hc:StepBarItem.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="发送指令" Command="{Binding ReSendCommand}"
|
||||
CommandParameter="30" />
|
||||
</ContextMenu>
|
||||
</hc:StepBarItem.ContextMenu>
|
||||
</hc:StepBarItem>
|
||||
|
||||
<hc:StepBarItem Content="完成"/>
|
||||
</hc:StepBar>
|
||||
</Grid>
|
||||
<Grid Canvas.Right="0" Canvas.Top="40" Width="700" Height="50">
|
||||
<!-- 定义一行七列 -->
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1.5*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1.2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 为每一列设置单独的背景色和内容 -->
|
||||
<Border Grid.Row="0" Background="Transparent">
|
||||
<TextBlock Text="取盘位置:" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="White" FontSize="14"/>
|
||||
</Border>
|
||||
<Border Grid.Row="0" Grid.Column="1" Background="Transparent">
|
||||
<TextBlock Text="{Binding CavitySourceName}" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Center" Foreground="White" FontSize="16"/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="0" Grid.Column="2" Background="Transparent">
|
||||
<TextBlock Text="任务状态:" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="White" FontSize="14"/>
|
||||
</Border>
|
||||
<Border Grid.Row="0" Grid.Column="3" Background="Transparent">
|
||||
<TextBlock Text="{Binding TaskStatusName}" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Center" Foreground="White" FontSize="16"/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="0" Grid.Column="4" Background="Transparent">
|
||||
<TextBlock Text="任务类型:" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="White" FontSize="14"/>
|
||||
</Border>
|
||||
<Border Grid.Row="0" Grid.Column="5" Background="Transparent">
|
||||
<TextBlock Text="{Binding TaskTypeName}" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Center" Foreground="White" FontSize="16"/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Grid.Column="0" Background="Transparent">
|
||||
<TextBlock Text="放盘位置:" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="White" FontSize="14"/>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Grid.Column="1" Background="Transparent">
|
||||
<TextBlock Text="{Binding CavityTargetName}" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Center" Foreground="White" FontSize="16"/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Grid.Column="2" Background="Transparent">
|
||||
<TextBlock Text="夹具条码:" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="White" FontSize="14"/>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Grid.Column="3" Background="Transparent">
|
||||
<TextBlock Text="{Binding PalletCode}" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Center" Foreground="White" FontSize="16"/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Grid.Column="4" Background="Transparent">
|
||||
<TextBlock Text="开始时间:" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="White" FontSize="14"/>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Grid.Column="5" Background="Transparent">
|
||||
<TextBlock Text="{Binding StartTime,StringFormat=yyyy-MM-dd HH:mm:ss}" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Center" Foreground="White" FontSize="16"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Button Content="" x:Name="AGV" HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top" Width="80" Height="73" Canvas.Left="14" Canvas.Top="{Binding HandMachineYLocation}" Panel.ZIndex="101">
|
||||
<Button.RenderTransform>
|
||||
<TranslateTransform x:Name="machineAnimation"/>
|
||||
</Button.RenderTransform>
|
||||
<Button.Template>
|
||||
<ControlTemplate>
|
||||
<Grid>
|
||||
<Label Name="handMachineLabel" Panel.ZIndex="100" HorizontalContentAlignment="Center" Foreground="Black" FontSize="13px" Content="{Binding RgvPalletCode}" Width="80" Height="30" Style="{StaticResource BaseStyle}" Margin="0,0,0,0">
|
||||
</Label>
|
||||
<Image Source="{Binding ImageSource}"></Image>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
<Canvas x:Name="pathCanvas" Panel.ZIndex="99" Margin="0,0,0,0" Height="auto" Width="auto"></Canvas>
|
||||
</Canvas>
|
||||
</UserControl>
|
||||
39
Cowain.Bake.Main/Views/EquipmentMonitorView.xaml.cs
Normal file
39
Cowain.Bake.Main/Views/EquipmentMonitorView.xaml.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Cowain.Bake.Main.ViewModels;
|
||||
using Prism.Regions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// CutAndFlodView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class EquipmentMonitorView : UserControl, IRegionMemberLifetime
|
||||
{
|
||||
//IUnityContainer _unityContainer = null;
|
||||
public EquipmentMonitorViewModel vm;
|
||||
public bool KeepAlive => false; // 确保视图被缓存
|
||||
public EquipmentMonitorView(IUnityContainer unityContainer, Prism.Events.IEventAggregator eventAggregator)
|
||||
{
|
||||
InitializeComponent();
|
||||
vm = this.DataContext as EquipmentMonitorViewModel;
|
||||
vm.frameworkElement = this;
|
||||
vm.machineAnimation = machineAnimation;
|
||||
vm.mainCanvas = mainCanvas;
|
||||
vm.pathCanvas = pathCanvas;
|
||||
}
|
||||
|
||||
private void Canvas_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void EquipmentMonitorView_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
vm._localScreenWidth = mainCanvas.ActualWidth;// SystemParameters.PrimaryScreenWidth; //1536
|
||||
vm._localScreenHeight = mainCanvas.ActualHeight;// SystemParameters.PrimaryScreenHeight;
|
||||
vm.Init();
|
||||
Loaded -= EquipmentMonitorView_Loaded; //不加这个,切换到主界面时,会触发多次
|
||||
}
|
||||
}
|
||||
}
|
||||
64
Cowain.Bake.Main/Views/LogManagement.xaml
Normal file
64
Cowain.Bake.Main/Views/LogManagement.xaml
Normal file
@@ -0,0 +1,64 @@
|
||||
<UserControl x:Class="Cowain.Bake.Main.Views.LogManagement"
|
||||
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:Cowain.Bake.Main.Views"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal" Height="30">
|
||||
<!--<Label Content="{DynamicResource DateTime}" BorderThickness="0" Background="Transparent"
|
||||
Margin="10,0,0,0" Foreground="Gray" Visibility="Collapsed"/>
|
||||
<hc:DatePicker Width="150" x:Name="datePick" Visibility="Collapsed"/>
|
||||
<Button Content="{DynamicResource Query}" Margin="10,0,0,0" Click="findLog_Click" x:Name="findLog" Visibility="Collapsed"/>
|
||||
<Button Content="{DynamicResource RealTimeLog}" Margin="10,0,0,0" Click="realTime_Click" x:Name="realTime" Visibility="Collapsed"/>-->
|
||||
<!--<hc:Divider Orientation="Vertical" LineStrokeThickness="5"
|
||||
LineStroke="#3D99A0"/>-->
|
||||
<!--<Label Content="{DynamicResource Filter}" BorderThickness="0" Background="Transparent"
|
||||
Margin="0,0,0,0" Foreground="Gray"/>-->
|
||||
<local:MultiComboBox x:Name="mucombo" SelectionChanged="mucombo_SelectionChanged" Margin="5,0,0,0.4" Width="200"/>
|
||||
<Label x:Name="labstate" Background="Transparent" BorderThickness="0"
|
||||
Margin="10,0,0,0" Foreground="YellowGreen"/>
|
||||
</StackPanel>
|
||||
<hc:ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
CanMouseWheel="true"
|
||||
IsInertiaEnabled="True"
|
||||
>
|
||||
<ListBox x:Name="loglist" Background="LightGray"
|
||||
hc:ScrollViewer.IsInertiaEnabled="True">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Line X1="0" X2="0" Y1="0" Y2="{Binding ActualHeight,RelativeSource={RelativeSource Mode=Self}}"
|
||||
StrokeThickness="1" Stroke="#551e90ff" HorizontalAlignment="Center"/>
|
||||
<Ellipse Width="6" Height="6" Fill="#AA1e90ff" VerticalAlignment="Top" Margin="0,4,1,0"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding LogLevel}" FontSize="12" Foreground="{Binding FontColor}" Margin="5,0,0,0"></TextBlock>
|
||||
<TextBlock>:</TextBlock>
|
||||
<TextBlock Text="{Binding LogText,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap"
|
||||
Foreground="{Binding Foreground, ElementName=onelogs}"
|
||||
FontSize="12" Margin="0,0,0,5"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding LogTime,StringFormat='yyyy-MM-dd HH:mm:ss'}" FontSize="11" Margin="5,5,0,10" Opacity="0.6" />
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</hc:ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
172
Cowain.Bake.Main/Views/LogManagement.xaml.cs
Normal file
172
Cowain.Bake.Main/Views/LogManagement.xaml.cs
Normal file
@@ -0,0 +1,172 @@
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Configuration;
|
||||
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;
|
||||
using System.Windows.Threading;
|
||||
using Cowain.Bake.Main.Views;
|
||||
using Cowain.Bake.Main.Models;
|
||||
using Cowain.Bake.Common;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// LogManagement.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class LogManagement : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private ObservableCollection<LogModel> bindingData { set; get; } = new ObservableCollection<LogModel>();
|
||||
/// <summary>
|
||||
/// 实时数据
|
||||
/// </summary>
|
||||
private List<LogModel> realTimeDatas { set; get; } = new List<LogModel>();
|
||||
|
||||
private BlockingCollection<LogModel> logQueue = new BlockingCollection<LogModel>();
|
||||
private Dictionary<string, MultiComboBox.MultiCbxBaseData> IsHaveKeyDic { set; get; } = new Dictionary<string, MultiComboBox.MultiCbxBaseData>();
|
||||
public LogManagement()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (loglist.ItemsSource == null)
|
||||
{
|
||||
loglist.ItemsSource = bindingData;
|
||||
}
|
||||
|
||||
Task.Run(() => DispatcherTimer_Tick());
|
||||
Unloaded += LogManagement_Unloaded;
|
||||
}
|
||||
|
||||
private void LogManagement_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新队列
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void DispatcherTimer_Tick()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (Global.AppExit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LogModel model = logQueue.Take();
|
||||
if (null == model)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var item = realTimeDatas.Find(x => x.LogText == model.LogText);
|
||||
if (null != item) //表示有相同的数据
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//显示数据
|
||||
if (IsHaveKeyDic.ContainsKey(model.LogLevel) && IsHaveKeyDic[model.LogLevel].IsCheck)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
bindingData.Insert(0, model);
|
||||
if (bindingData.Count > Global.MAX_LOG_QTY)
|
||||
{
|
||||
bindingData.RemoveAt(bindingData.Count - 1);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
//实时数据
|
||||
realTimeDatas.Insert(0, model);
|
||||
if (realTimeDatas.Count > Global.MAX_LOG_QTY)
|
||||
{
|
||||
realTimeDatas.RemoveAt(realTimeDatas.Count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region [日志内容入口]
|
||||
|
||||
private static readonly DependencyProperty LoglistItemProperty = DependencyProperty.Register(
|
||||
"LoglistItem", typeof(LogModel), typeof(LogManagement), new PropertyMetadata(null, OnLoglistSourceChange));
|
||||
|
||||
private static void OnLoglistSourceChange(DependencyObject o, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (o is LogManagement log)
|
||||
{
|
||||
var model = e.NewValue as LogModel;
|
||||
//入队
|
||||
log.logQueue.Add(model);
|
||||
}
|
||||
}
|
||||
|
||||
public LogModel LoglistItem
|
||||
{
|
||||
get => (LogModel)GetValue(LoglistItemProperty);
|
||||
set => SetValue(LoglistItemProperty, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region [日志等级源]
|
||||
|
||||
private static readonly DependencyProperty LogLevelSourceProperty = DependencyProperty.Register(
|
||||
"LogLevelSource", typeof(ObservableCollection<MultiComboBox.MultiCbxBaseData>), typeof(LogManagement),
|
||||
new PropertyMetadata(null, OnLogLevelSourceChange));
|
||||
|
||||
private static void OnLogLevelSourceChange(DependencyObject o, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (o is LogManagement log)
|
||||
{
|
||||
log.mucombo.ItemsSource = e.NewValue as ObservableCollection<MultiComboBox.MultiCbxBaseData>;
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<MultiComboBox.MultiCbxBaseData> LogLevelSource
|
||||
{
|
||||
get => (ObservableCollection<MultiComboBox.MultiCbxBaseData>)GetValue(LogLevelSourceProperty);
|
||||
set => SetValue(LogLevelSourceProperty, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private void mucombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Source is MultiComboBox multiComboBox && multiComboBox.ItemsSource is ObservableCollection<MultiComboBox.MultiCbxBaseData> list)
|
||||
{
|
||||
IsHaveKeyDic = list.ToDictionary(d => d.ViewName, d => d);
|
||||
bindingData.Clear();
|
||||
foreach (var item in realTimeDatas)
|
||||
{
|
||||
if (IsHaveKeyDic.ContainsKey(item.LogLevel) && IsHaveKeyDic[item.LogLevel].IsCheck)
|
||||
{
|
||||
bindingData.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
31
Cowain.Bake.Main/Views/MainHeaderView.xaml
Normal file
31
Cowain.Bake.Main/Views/MainHeaderView.xaml
Normal file
@@ -0,0 +1,31 @@
|
||||
<UserControl x:Class="Cowain.Bake.Main.Views.MainHeaderView"
|
||||
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:Fluent="urn:fluent-ribbon"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.Main.Views"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Cowain.Bake.Common;component/Styles/BaseResources.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Cowain.Bake.Common;component/Styles/ToggleButtonStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid x:Name="maingrid" >
|
||||
<Fluent:Ribbon Height="auto" BorderBrush="LightGray" BorderThickness="1" Grid.Row="0" x:Name="mainRibbon" ShowQuickAccessToolBarAboveRibbon="True" SelectedTabIndex="2">
|
||||
<Fluent:Ribbon.Menu>
|
||||
<Fluent:Backstage Header="工具栏"></Fluent:Backstage>
|
||||
</Fluent:Ribbon.Menu>
|
||||
</Fluent:Ribbon>
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
496
Cowain.Bake.Main/Views/MainHeaderView.xaml.cs
Normal file
496
Cowain.Bake.Main/Views/MainHeaderView.xaml.cs
Normal file
@@ -0,0 +1,496 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Model;
|
||||
using Fluent;
|
||||
using Prism.Ioc;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Unity;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Newtonsoft.Json;
|
||||
using Cowain.Bake.Main.ViewModels;
|
||||
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// MainHeaderView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainHeaderView : UserControl
|
||||
{
|
||||
private static Dictionary<string, RibbonGroupBox> parentGroupBoxDic = new Dictionary<string, RibbonGroupBox>();
|
||||
private static IUnityContainer _unityContainer;
|
||||
public static Dictionary<string, Label> toggleButtonLabelDic = new Dictionary<string, Label>();
|
||||
public static Dictionary<string, Fluent.Button> ribbonButtonDic = new Dictionary<string, Fluent.Button>();
|
||||
private static List<Fluent.ToggleButton> toggleButton = new List<Fluent.ToggleButton>();
|
||||
private static Views.MainHeaderView MainHeaderViewForPublic;
|
||||
private static List<Label> toggleBtnLabel = new List<Label>();
|
||||
private static List<TMenuInfo> menuInfos;
|
||||
public static Dictionary<int, StackPanel> dicStackPanel = new Dictionary<int, StackPanel>();
|
||||
Fluent.DropDownButton splitButton = new Fluent.DropDownButton();
|
||||
private static IRegionManager _regionManager = null;
|
||||
private List<string> _theme = new List<string>();
|
||||
public MainHeaderView(IUnityContainer unityContainer, IRegionManager regionManager)
|
||||
{
|
||||
InitializeComponent();
|
||||
_regionManager = regionManager;
|
||||
_unityContainer = unityContainer;
|
||||
//mainRibbonForPublic = mainRibbon;
|
||||
MainHeaderViewForPublic = this;
|
||||
menuInfos = _unityContainer.Resolve<MenuInfoService>().GetMenuInfoList();
|
||||
GenerateMenuImage();
|
||||
ClearWindows();
|
||||
Init();
|
||||
SetTheme();
|
||||
}
|
||||
void SetTheme()
|
||||
{
|
||||
/*
|
||||
“Red”, “Green”, “Blue”, “Purple”, “Orange”, “Lime”, “Emerald”, “Teal”, “Cyan”, “Cobalt”, “Indigo”, “Violet”, “Pink”, “Magenta”, “Crimson”, “Amber”, “Yellow”, “Brown”, “Olive”, “Steel”, “Mauve”, “Taupe”, “Sienna”
|
||||
and these base colors: “Light”, “Dark”
|
||||
*/
|
||||
//var theme = ControlzEx.Theming.ThemeManager.Current.DetectTheme(Application.Current);
|
||||
_theme.Add("Light.Blue");
|
||||
_theme.Add("Light.Amber");
|
||||
|
||||
_theme.Add("Light.Magenta");
|
||||
_theme.Add("Dark.Green");
|
||||
_theme.Add("Light.Green");
|
||||
_theme.Add("Dark.Lime");
|
||||
|
||||
ChangeSkin(SettingProvider.Instance.SkinType);
|
||||
_unityContainer.Resolve<MainWindow>().ChangeSkin(SettingProvider.Instance.SkinType);
|
||||
}
|
||||
public void ChangeSkin(int i)
|
||||
{
|
||||
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(App.Current, _theme[i]);
|
||||
}
|
||||
public void ClearWindows()
|
||||
{
|
||||
parentGroupBoxDic.Clear();
|
||||
toggleButtonLabelDic.Clear();
|
||||
ribbonButtonDic.Clear();
|
||||
mainRibbon.Tabs.Clear();
|
||||
dicStackPanel.Clear();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
AddMenuFatherLabelItems();
|
||||
AddStackPanel();
|
||||
AddMenuGroupBoxItems();
|
||||
|
||||
|
||||
MainWindow.mainShowWindow.Title = "产量查询";
|
||||
_regionManager.RequestNavigate("MainContentRegion", "ProductionsInfoView");
|
||||
|
||||
if (EDispatchMode.Manual == SettingProvider.Instance.DispMode)
|
||||
{
|
||||
ribbonButtonDic["Manual"].IsEnabled = false;
|
||||
ribbonButtonDic["Auto"].IsEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ribbonButtonDic["Manual"].IsEnabled = true;
|
||||
ribbonButtonDic["Auto"].IsEnabled = false;
|
||||
}
|
||||
mainRibbon.Tabs[0].IsSelected = true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加菜单标签列表
|
||||
/// </summary>
|
||||
/// <param name="parentId"></param>
|
||||
private void AddMenuFatherLabelItems(int parentId = 0)
|
||||
{
|
||||
var menuParentInfos = menuInfos.Where(p => p.ParentId == parentId);
|
||||
foreach (var item in menuParentInfos)
|
||||
{
|
||||
RibbonTabItem ribbonTabItem = new RibbonTabItem()
|
||||
{
|
||||
Header = item.Header,
|
||||
Name = item.HeaderName
|
||||
};
|
||||
RibbonGroupBox ribbonGroupBox = new RibbonGroupBox();
|
||||
ribbonGroupBox.Name = $"{item.Header}GroupBox";
|
||||
|
||||
ribbonTabItem.Groups.Add(ribbonGroupBox);
|
||||
mainRibbon.Tabs.Add(ribbonTabItem);
|
||||
parentGroupBoxDic.Add(item.Id.ToString(), ribbonGroupBox);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加工具栏功能列表
|
||||
/// </summary>
|
||||
private void AddMenuGroupBoxItems()
|
||||
{
|
||||
var roleContainNodes = _unityContainer.Resolve<UserService>().GetCurrentUserAuthority();
|
||||
//var strTolist = CommonCoreHelper.Instance.StringToListConverter(roleContainNodes); && strTolist.Contains(p.HeaderName)
|
||||
|
||||
var menuParentIds = menuInfos.Where(p => p.ParentId == 0).ToList();
|
||||
var btnContentMenuItems = menuInfos.Where(p => menuParentIds.Select(x => x.Id).Contains(p.ParentId)).OrderBy(p => p.ParentId).ThenBy(p => p.MenuIndex);
|
||||
foreach (var item in btnContentMenuItems)
|
||||
{
|
||||
|
||||
switch ((EMenuType)item.MenuType)
|
||||
{
|
||||
case EMenuType.Cmd:
|
||||
case EMenuType.Region:
|
||||
case EMenuType.ShowDialog:
|
||||
FillRibbonButton(item);
|
||||
break;
|
||||
case EMenuType.FunctionSwitch:
|
||||
DrawToggleButton(item);
|
||||
break;
|
||||
case EMenuType.DropDown:
|
||||
DrawSplitButton(item);
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 事件
|
||||
//0.按键:弹界面
|
||||
//1.按键:功能,如开始,停止
|
||||
//2.开关:功能开关,如是否启用MOM
|
||||
private static void RibbonButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string btnName = "";
|
||||
var type = sender.GetType();
|
||||
if (type == typeof(Fluent.Button))
|
||||
{
|
||||
btnName = (sender as Fluent.Button).Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
btnName = (sender as Fluent.ToggleButton).Name;
|
||||
}
|
||||
TMenuInfo menuInfo = menuInfos.FirstOrDefault(p => p.HeaderName == btnName);
|
||||
if (null == menuInfo)
|
||||
{
|
||||
LogHelper.Instance.GetCurrentClassWarn("查找按键信息失败!", true);
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((EMenuType)menuInfo.MenuType)
|
||||
{
|
||||
case EMenuType.ShowDialog:
|
||||
ShowDialog(menuInfo);
|
||||
break;
|
||||
case EMenuType.Region:
|
||||
ShowWindowsRegion(menuInfo);
|
||||
break;
|
||||
case EMenuType.Cmd:
|
||||
case EMenuType.FunctionSwitch:
|
||||
ExecuteMethod(menuInfo);
|
||||
break;
|
||||
default:
|
||||
LogHelper.Instance.Warn($"没有这个菜单[{btnName}]类型:{(int)menuInfo.MenuType}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.GetCurrentClassDebug(ex.Message);
|
||||
}
|
||||
}
|
||||
private static void ShowDialog(TMenuInfo menuInfo)
|
||||
{
|
||||
TMenuInfo asmBaseName = menuInfos.FirstOrDefault(p => p.ParentId == 0 && p.Id == menuInfo.ParentId);
|
||||
if (null == asmBaseName)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Info($"当前'{asmBaseName.Header}'目标路径不正确,请在数据库中重新配置!!");
|
||||
return;
|
||||
}
|
||||
|
||||
System.Reflection.Assembly asm = System.Reflection.Assembly.Load(asmBaseName.TargetView);// 通过类型的完整限定名和程序集获取类型
|
||||
Type viewNameType = asm.GetType(menuInfo.TargetView);
|
||||
if (null == viewNameType)
|
||||
{
|
||||
LogHelper.Instance.Info($"当前'{menuInfo.Header}'类型的完整限定名不正确,请在数据库中重新配置!", true);
|
||||
return;
|
||||
}
|
||||
|
||||
var dlg = (System.Windows.Window)_unityContainer.Resolve(viewNameType);
|
||||
if (dlg.ShowDialog().Value)
|
||||
{
|
||||
_unityContainer.Resolve<BasicInfoViewModel>().ShowInfo();
|
||||
HandyControl.Controls.MessageBox.Success("切换用户成功");
|
||||
_unityContainer.Resolve<LogService>().AddLog($@"切换用户成功!", E_LogType.Operate.ToString());
|
||||
}
|
||||
//object typeInstance = Activator.CreateInstance(viewNameType); //不会传参数
|
||||
//Window dlg = typeInstance as Window;
|
||||
//dlg.ShowDialog();
|
||||
}
|
||||
|
||||
private static void ShowWindowsRegion(TMenuInfo menuInfo)
|
||||
{
|
||||
MainWindow.mainShowWindow.Title = menuInfo.Header;
|
||||
_regionManager.RequestNavigate("MainContentRegion", menuInfo.TargetView);
|
||||
}
|
||||
|
||||
private static void ExecuteMethod(TMenuInfo menuInfo)
|
||||
{
|
||||
dynamic d = JsonConvert.DeserializeObject<dynamic>(menuInfo.JSON);
|
||||
string methodName = d.CMD;
|
||||
string param = d.Parameter;
|
||||
Type type = Type.GetType(Cowain.Bake.Common.MyPath.HEAD_CMD);
|
||||
object[] instancePara = new object[1];
|
||||
instancePara[0] = _unityContainer;
|
||||
object obj = System.Activator.CreateInstance(type, instancePara);
|
||||
MethodInfo method = type.GetMethod(methodName, new Type[] { typeof(string) });
|
||||
object[] parameters = new object[] { param };
|
||||
method.Invoke(obj, parameters);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 内部方法
|
||||
|
||||
|
||||
private void FillRibbonButton(TMenuInfo menuInfo)
|
||||
{
|
||||
var ribbonGroup = parentGroupBoxDic[menuInfo.ParentId.ToString()];
|
||||
Fluent.Button button = new Fluent.Button();
|
||||
button.Name = menuInfo.HeaderName;
|
||||
button.Header = menuInfo.Header;
|
||||
button.Width = 60; //MyAppContainer.Current.Resolve<UserService>().IsHasAuthority(menuInfo.HeaderName == null ? "" : menuInfo.HeaderName);
|
||||
button.IsEnabled = _unityContainer.Resolve<UserService>().IsHasAuthority(menuInfo.HeaderName == null ? "" : menuInfo.HeaderName);
|
||||
string imagePath = Environment.CurrentDirectory + $@"\images\{menuInfo.Header}.png";
|
||||
if (File.Exists(imagePath))
|
||||
{
|
||||
button.LargeIcon = imagePath; //imagePath;
|
||||
}
|
||||
button.Click += RibbonButton_Click;
|
||||
|
||||
if (ribbonGroup != null)
|
||||
{
|
||||
ribbonGroup.Items.Add(button);
|
||||
}
|
||||
|
||||
if (!ribbonButtonDic.ContainsKey(menuInfo.HeaderName))
|
||||
{
|
||||
ribbonButtonDic.Add(menuInfo.HeaderName, button);
|
||||
}
|
||||
}
|
||||
|
||||
private void SplitButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//if (sender is Fluent.MenuItem item)
|
||||
//{
|
||||
// var name = item.Tag.ToString().Replace("_", ".");
|
||||
// maingrid.Background = new ImageBrush
|
||||
// {
|
||||
// ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri($"pack://application:,,,/Cowain.Bake.Main;component/Images/UserControls/{name}"))
|
||||
// };
|
||||
//}
|
||||
Fluent.MenuItem currentMenu = (Fluent.MenuItem)sender;
|
||||
splitButton.IsDropDownOpen = false;
|
||||
|
||||
for (int i = 0; i < splitButton.Items.Count; ++i)
|
||||
{
|
||||
Fluent.MenuItem menu = (Fluent.MenuItem)splitButton.Items.GetItemAt(i);
|
||||
if (menu.Header != currentMenu.Header
|
||||
&& menu.IsChecked)
|
||||
{
|
||||
menu.IsChecked = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentMenu.IsChecked)
|
||||
{
|
||||
int value = (int)EnumHelper.GetValueByDescription<ESkin>((string)currentMenu.Header);
|
||||
ChangeSkin(value);
|
||||
_unityContainer.Resolve<MainWindow>().ChangeSkin(value);
|
||||
SettingProvider.Instance.SkinType = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Fluent.MenuItem CreateSplitButtonMenu(ESkin eskin, bool isCheck)
|
||||
{
|
||||
var menu = new Fluent.MenuItem
|
||||
{
|
||||
Header = eskin.GetDescription(),
|
||||
Tag = eskin.ToString(),
|
||||
IsCheckable = true,
|
||||
IsChecked = isCheck, // 默认选中
|
||||
};
|
||||
menu.Click += SplitButton_Click;
|
||||
return menu;
|
||||
}
|
||||
private void DrawSplitButton(TMenuInfo menuInfo)
|
||||
{
|
||||
splitButton.Header = menuInfo.Header;
|
||||
// 设置大图标(LargeIcon)new BitmapImage(new Uri("pack://application:,,,/Images/LargeIcon.png"));
|
||||
splitButton.LargeIcon = new System.Windows.Media.Imaging.BitmapImage
|
||||
(new Uri(Environment.CurrentDirectory + $@"\images\{menuInfo.Header}.png"));
|
||||
// 其他属性(尺寸、边距等)
|
||||
splitButton.Width = 60;
|
||||
//splitButton.Margin = new Thickness(1);
|
||||
//splitButton.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
//splitButton.VerticalAlignment = VerticalAlignment.Top;
|
||||
|
||||
foreach (ESkin skin in System.Enum.GetValues(typeof(ESkin)))
|
||||
{
|
||||
splitButton.Items.Add(CreateSplitButtonMenu(skin, SettingProvider.Instance.SkinType == (int)skin));
|
||||
}
|
||||
|
||||
var ribbonGroup = parentGroupBoxDic[menuInfo.ParentId.ToString()];
|
||||
ribbonGroup.Items.Add(splitButton);
|
||||
}
|
||||
private static void AddStackPanel()
|
||||
{
|
||||
var toggles = menuInfos.Where(x => x.MenuType == (int)EMenuType.FunctionSwitch && x.State == true).ToList();
|
||||
int count = toggles.Count();
|
||||
var ribbonGroupBox = parentGroupBoxDic[toggles[0].ParentId.ToString()];
|
||||
count = (int)Math.Ceiling((double)count / 2); //两个一组
|
||||
StackPanel h = new StackPanel { Orientation = Orientation.Horizontal }; //行
|
||||
ribbonGroupBox.Items.Add(h);
|
||||
for (int i = 1; i <= count; i++ )
|
||||
{
|
||||
StackPanel v = new StackPanel { Orientation = Orientation.Vertical }; //列
|
||||
h.Children.Add(v);
|
||||
dicStackPanel[i] = v;
|
||||
}
|
||||
}
|
||||
private static void DrawToggleButton(TMenuInfo item)
|
||||
{
|
||||
var header = item.Header;
|
||||
var model = Newtonsoft.Json.JsonConvert.DeserializeObject<ParaJSON>(item.JSON);
|
||||
var ribbonGroupBox = parentGroupBoxDic[item.ParentId.ToString()];
|
||||
|
||||
if (ribbonGroupBox == null) return;
|
||||
|
||||
var paraValue = _unityContainer.Resolve<MenuInfoService>().GetMenuParam(header);
|
||||
var isChecked = paraValue == 1;
|
||||
var labelContent = isChecked ? model.Value1 : model.Value0;
|
||||
var toggleButton = CreateToggleButton(item, isChecked);
|
||||
var labelRight = CreateLabel(header, labelContent);
|
||||
var labelLeft = CreateLabelLeft(header, model.Text);
|
||||
var canvas = new Canvas { Height = 25, Width = 200 };
|
||||
canvas.Children.Add(toggleButton);
|
||||
canvas.Children.Add(labelLeft);
|
||||
canvas.Children.Add(labelRight);
|
||||
//ribbonGroupBox.Items.Add(canvas);
|
||||
toggleButtonLabelDic.Add(header, labelRight);
|
||||
|
||||
int index = (int)Math.Ceiling((double)item.MenuIndex / 2);
|
||||
if (dicStackPanel.ContainsKey(index)) //如果MenuIndex编号乱编,会导致溢出
|
||||
{
|
||||
dicStackPanel[index].Children.Add(canvas);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static Label CreateLabelLeft(string header, object content)
|
||||
{
|
||||
var label = new Label
|
||||
{
|
||||
BorderThickness = new Thickness(0),
|
||||
Name = header + "HeaderLabelLeft",
|
||||
Content = content
|
||||
};
|
||||
label.SetValue(System.Windows.Window.LeftProperty, 0d);
|
||||
label.SetValue(System.Windows.Window.TopProperty, 0d);
|
||||
return label;
|
||||
}
|
||||
|
||||
private static Label CreateLabel(string header, object content)
|
||||
{
|
||||
var label = new Label
|
||||
{
|
||||
BorderThickness = new Thickness(0),
|
||||
Name = header + "HeaderLabel",
|
||||
Content = content
|
||||
};
|
||||
label.SetValue(System.Windows.Window.LeftProperty, 120d);
|
||||
label.SetValue(System.Windows.Window.TopProperty, 0d);
|
||||
return label;
|
||||
}
|
||||
|
||||
private static ToggleButton CreateToggleButton(TMenuInfo item, bool isChecked)
|
||||
{
|
||||
var toggleButton = new ToggleButton
|
||||
{
|
||||
Name = item.HeaderName,
|
||||
Content = item.Header,
|
||||
Header = item.Header,
|
||||
Width = 50,
|
||||
Style = MainHeaderViewForPublic.FindResource("ToggleButtonStyle") as Style,
|
||||
IsChecked = isChecked
|
||||
};
|
||||
toggleButton.Click += RibbonButton_Click;
|
||||
toggleButton.SetValue(System.Windows.Window.LeftProperty, 69d);
|
||||
toggleButton.SetValue(System.Windows.Window.TopProperty, 5d);
|
||||
return toggleButton;
|
||||
}
|
||||
|
||||
private void ChangeModeColor(Fluent.ComboBox comboBox)
|
||||
{
|
||||
string comboBoxColor = Colors.Black.ToString();
|
||||
switch ((int)comboBox.SelectedValue)
|
||||
{
|
||||
case (int)EMOMMode.OnLine:
|
||||
comboBoxColor = Colors.Green.ToString();
|
||||
break;
|
||||
|
||||
case (int)EMOMMode.OffLine:
|
||||
comboBoxColor = Colors.Red.ToString();
|
||||
break;
|
||||
}
|
||||
comboBox.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(comboBoxColor));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
private void GenerateMenuImage()//获取菜单图标
|
||||
{
|
||||
var table = _unityContainer.Resolve<MenuInfoService>().GetImage();
|
||||
byte[] imageByte = null;
|
||||
string path = Environment.CurrentDirectory + "/images";
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
foreach (DataRow item in table.Rows)
|
||||
{
|
||||
imageByte = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(item["MenuImage"].ToString());
|
||||
CreateFile(imageByte, path + "/" + item["Header"] + ".png");
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateFile(byte[] fileBuffer, string newFilePath)
|
||||
{
|
||||
if (File.Exists(newFilePath))
|
||||
{
|
||||
File.Delete(newFilePath);
|
||||
}
|
||||
FileStream fs = new FileStream(newFilePath, FileMode.CreateNew);
|
||||
BinaryWriter bw = new BinaryWriter(fs);
|
||||
bw.Write(fileBuffer, 0, fileBuffer.Length); //用文件流生成一个文件
|
||||
bw.Close();
|
||||
fs.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public class ParaJSON
|
||||
{
|
||||
public string CMD { get; set; }
|
||||
public string Parameter { get; set; }
|
||||
public string Value0 { get; set; }
|
||||
public string Value1 { get; set; }
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
||||
185
Cowain.Bake.Main/Views/MainWindow.xaml
Normal file
185
Cowain.Bake.Main/Views/MainWindow.xaml
Normal file
@@ -0,0 +1,185 @@
|
||||
<Window 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
xmlns:ad="https://github.com/Dirkster99/AvalonDock"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
x:Class="Cowain.Bake.Main.Views.MainWindow"
|
||||
xmlns:converter="clr-namespace:Cowain.Bake.Common.Converter;assembly=Cowain.Bake.Common"
|
||||
xmlns:bllConverter="clr-namespace:Cowain.Bake.BLL.Converter;assembly=Cowain.Bake.BLL"
|
||||
xmlns:control="clr-namespace:Cowain.Bake.Main.Views"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.Main.ViewModels"
|
||||
mc:Ignorable="d"
|
||||
WindowState="Maximized"
|
||||
Closing="Window_Closing"
|
||||
Title="{Binding MainTitle}" Height="900" Width="1600" Loaded="Window_Loaded">
|
||||
<Window.Resources>
|
||||
<converter:BindingColor x:Key="ColorConverter"/>
|
||||
<bllConverter:StationIdConverter x:Key="StationIdConverter"/>
|
||||
<Style x:Key="DefaultToolTipStyle" TargetType="{x:Type ToolTip}">
|
||||
<Setter Property="Foreground" Value="Yellow"/>
|
||||
<Setter Property = "Background" Value="Blue"/>
|
||||
<Setter Property = "FontSize" Value="14"/>
|
||||
<Setter Property="BorderBrush" Value="White"/>
|
||||
</Style>
|
||||
<Style x:Key="MyButton" TargetType="Button">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="LightBlue"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type TabItem}" x:Key="BaseTabItem">
|
||||
<Setter Property="Header" Value="{Binding DataContext.PageTitle}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Margin" Value="2,0"/>
|
||||
<Setter Property="Foreground" Value="#444"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||
<Grid Background="{TemplateBinding Background}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="auto" MaxWidth="30" MinWidth="10"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{TemplateBinding Header}" VerticalAlignment="Center" Margin="10,5"/>
|
||||
<Grid Grid.Column="1" x:Name="close_grid" Width="30" Visibility="Collapsed">
|
||||
<Button Foreground="{TemplateBinding Foreground}"
|
||||
Visibility="Collapsed" x:Name="close_btn" Height="24"
|
||||
Command="{Binding DataContext.CloseCommand}"
|
||||
CommandParameter="{Binding DataContext.NavUri}"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding DataContext.IsCanClose}" Value="True">
|
||||
<Setter TargetName="close_grid" Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible" TargetName="close_btn"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible" TargetName="close_btn"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#EEE"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#FF0ABEFF"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="88" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
<ContentControl prism:RegionManager.RegionName="MainHeaderRegion" Grid.Row="0"></ContentControl>
|
||||
<!--工作窗口-->
|
||||
<DockingManager x:Name="dockingManager" Grid.Row="1">
|
||||
<DockingManager.Background>
|
||||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
|
||||
<!-- 起点颜色 -->
|
||||
<GradientStop Color="LightBlue" Offset="0" />
|
||||
<!-- 终点颜色 -->
|
||||
<GradientStop Color="LightBlue" Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
</DockingManager.Background>
|
||||
|
||||
<DockingManager.Theme>
|
||||
<Vs2013BlueTheme/>
|
||||
</DockingManager.Theme>
|
||||
|
||||
<LayoutRoot>
|
||||
<LayoutPanel Orientation="Horizontal">
|
||||
<LayoutAnchorablePane DockWidth="200">
|
||||
<!--<LayoutAnchorable Title="菜单栏" CanClose="False" CanFloat="False" CanHide="False" ContentId="Solution">
|
||||
-->
|
||||
<!--放置菜单的区域-->
|
||||
<!--
|
||||
<ContentControl prism:RegionManager.RegionName="LeftMenuTreeRegion"/>
|
||||
</LayoutAnchorable>-->
|
||||
<LayoutAnchorable Title="基础信息" CanClose="False" CanFloat="False" CanHide="False" ContentId="Solution">
|
||||
<!--基础-->
|
||||
<ContentControl prism:RegionManager.RegionName="BasicInfoRegion"/>
|
||||
</LayoutAnchorable>
|
||||
<LayoutAnchorable Title="日志信息" CanClose="False" CanFloat="False" CanHide="False" ContentId="Solution">
|
||||
<!--日志-->
|
||||
<control:LogManagement x:Name="logManagement1" LogLevelSource="{Binding LogLevelModel1}"
|
||||
LoglistItem="{Binding InfoLogModel,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<!--<ContentControl prism:RegionManager.RegionName="LogInfoRegion" x:Name="logManagement1"/>-->
|
||||
</LayoutAnchorable>
|
||||
</LayoutAnchorablePane>
|
||||
<LayoutPanel Orientation="Vertical">
|
||||
<LayoutDocumentPane IsMaximized="True" x:Name="tabPanel">
|
||||
<LayoutDocument Title="主窗口" CanClose="False" ContentId="second" IsSelected="True">
|
||||
<ContentControl prism:RegionManager.RegionName="StationInfoRegion"/>
|
||||
</LayoutDocument>
|
||||
<LayoutDocument Title="报警窗口" CanClose="False" ContentId="second">
|
||||
<Grid>
|
||||
<TabControl>
|
||||
<TabItem Header="实时告警">
|
||||
<DataGrid ItemsSource="{Binding Alarms}" AutoGenerateColumns="False" IsReadOnly="True" HorizontalAlignment="Left" Height="850" VerticalAlignment="Top" Width="1387" Margin="15,15,15,15">
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="Blue"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Foreground" Value="{Binding Status, Converter={StaticResource ColorConverter}}"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="工站名称" Binding="{Binding StationId,Converter={StaticResource StationIdConverter}}" Width="100" Visibility="Visible"/>
|
||||
<DataGridTextColumn Header="报警内容" Binding="{Binding Desc}" Width="500"/>
|
||||
<DataGridTextColumn Header="开始时间" Binding="{Binding StartTime,StringFormat='yyyy/MM/dd HH:mm:ss'}" Width="200"/>
|
||||
<DataGridTextColumn Header="结束时间" Binding="{Binding StopTime,StringFormat='yyyy/MM/dd HH:mm:ss'}" Width="200" Visibility="Hidden"/>
|
||||
<DataGridTextColumn Header="状态" Binding="{Binding Status}" Width="100"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
<TabItem Header="记录查询">
|
||||
<Grid>
|
||||
<DataGrid Margin="0,50,0,0" AutoGenerateColumns="False" ItemsSource="{Binding HistoryAlarmsData}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="工站名称" Binding="{Binding StationId,Converter={StaticResource StationIdConverter}}" Width="100"/>
|
||||
<DataGridTextColumn Header="报警内容" Binding="{Binding Desc}" Width="500"/>
|
||||
<DataGridTextColumn Header="开始时间" Binding="{Binding StartTime,StringFormat='yyyy/MM/dd HH:mm:ss'}" Width="200"/>
|
||||
<DataGridTextColumn Header="结束时间" Binding="{Binding StopTime,StringFormat='yyyy/MM/dd HH:mm:ss'}" Width="200" />
|
||||
<DataGridTextColumn Header="状态" Binding="{Binding Status}" Width="100"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<hc:DatePicker HorizontalAlignment="Left" Text="{Binding AlarmStartTime,Mode=TwoWay}" VerticalAlignment="Top" Width="131" Margin="8,9,0,0"/>
|
||||
<hc:DatePicker HorizontalAlignment="Left" Text="{Binding AlarmEndTime,Mode=TwoWay}" VerticalAlignment="Top" Width="140" Margin="144,9,0,0"/>
|
||||
<Button Content="查询" Style="{StaticResource ButtonInfo}" Name="alarmReport" Command="{Binding AlarmQueryCommand}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="297,9,0,0"/>
|
||||
<Button Content="导出Excel" Style="{StaticResource ButtonInfo}" x:Name="alarmExportExcel" Command="{Binding AlarmExportExcel}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="391,10,0,0"/>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<hc:DateTimePicker HorizontalAlignment="Left" VerticalAlignment="Top" Width="195"/>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</LayoutDocument>
|
||||
<LayoutDocument x:Name="showWindow" Title="" CanClose="False" ContentId="second">
|
||||
<!--数据展示-->
|
||||
<ContentControl prism:RegionManager.RegionName="MainContentRegion" />
|
||||
</LayoutDocument>
|
||||
</LayoutDocumentPane>
|
||||
</LayoutPanel>
|
||||
</LayoutPanel>
|
||||
</LayoutRoot>
|
||||
</DockingManager>
|
||||
<!--底部消息-->
|
||||
<!--<hc:RunningBlock AutoReverse="False" Grid.Row="2" Height="50" Content="{Binding PromptContent,Mode=TwoWay}" FontSize="18" FontWeight="Bold" Foreground="OrangeRed" Duration="0:0:20" VerticalAlignment="Center"/>-->
|
||||
</Grid>
|
||||
</Window>
|
||||
76
Cowain.Bake.Main/Views/MainWindow.xaml.cs
Normal file
76
Cowain.Bake.Main/Views/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using AvalonDock.Layout;
|
||||
using AvalonDock.Themes;
|
||||
using Cowain.Bake.BLL;
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Communication.Interface;
|
||||
using Cowain.Bake.Model;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// MainWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public static LayoutDocument mainShowWindow; //为了设置Title,直接Binding无效
|
||||
IUnityContainer _unityContainer = null;
|
||||
List<Theme> _theme = new List<Theme>();
|
||||
//public static MainWindowViewModel mainWindowModel = null;
|
||||
public MainWindow(IUnityContainer unityContainer)
|
||||
{
|
||||
InitializeComponent();
|
||||
_unityContainer = unityContainer;
|
||||
mainShowWindow = showWindow;
|
||||
_theme.Add(new MetroTheme()); //GenericTheme
|
||||
_theme.Add(new AeroTheme());
|
||||
_theme.Add(new Vs2013BlueTheme());
|
||||
_theme.Add(new Vs2013DarkTheme());
|
||||
_theme.Add(new Vs2013LightTheme());
|
||||
_theme.Add(new ExpressionDarkTheme());
|
||||
}
|
||||
|
||||
public void ChangeSkin(int i)
|
||||
{
|
||||
dockingManager.Theme = _theme[i]; //MetroTheme
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
}
|
||||
void CloseAllHandle()
|
||||
{
|
||||
System.Collections.Generic.List<TDeviceConfig> plcList = _unityContainer.Resolve<DeviceConfigService>().GetConfig(EDeviceType.PLC);
|
||||
foreach (var item in plcList)
|
||||
{
|
||||
IPLCDevice plc = _unityContainer.Resolve<IPLCDevice>(item.Name); //几个PLC,就实例化几个
|
||||
|
||||
if (null != plc && plc.IsConnect)
|
||||
{
|
||||
plc.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
// 执行窗体的 Closing 事件的逻辑
|
||||
if (MessageBoxResult.OK == HandyControl.Controls.MessageBox.Ask("是否退出自动真空烘烤系统?", "退出"))
|
||||
{
|
||||
Global.AppExit = true;
|
||||
CloseAllHandle();
|
||||
//Thread.Sleep(3000);
|
||||
//await Task.Delay(10000); async
|
||||
e.Cancel = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Cowain.Bake.Main/Views/ManualTask.xaml
Normal file
17
Cowain.Bake.Main/Views/ManualTask.xaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<Window x:Class="Cowain.Bake.Main.Views.ManualTask"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.Main.Views"
|
||||
mc:Ignorable="d"
|
||||
Title="手动任务" Height="300" Width="380" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Label Content="取:" Style="{StaticResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40,60,0,0" Width="30"/>
|
||||
<Label Content="放:" Style="{StaticResource BaseStyle}" HorizontalContentAlignment="Right" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40,136,0,0" Width="30"/>
|
||||
<TextBox FontWeight="Bold" Foreground="Black" IsReadOnly="True" Text="{Binding SelectFromValue,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="75,60,0,0" VerticalAlignment="Top" Width="215"/>
|
||||
<ComboBox ItemsSource="{Binding StationDtl}" SelectedValue="{Binding SelectToValue,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="80,131,0,0" VerticalAlignment="Top" Width="210"/>
|
||||
<Button Content="生成任务" Command="{Binding GenerateTaskCommand}" Style="{StaticResource ButtonInfo}" HorizontalAlignment="Left" Height="35" Margin="80,195,0,0" VerticalAlignment="Top" Width="210"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
36
Cowain.Bake.Main/Views/ManualTask.xaml.cs
Normal file
36
Cowain.Bake.Main/Views/ManualTask.xaml.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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.Shapes;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// ManualTask.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ManualTask : Window
|
||||
{
|
||||
ViewModels.ManualTaskViewModel manualTaskViewModel = null;
|
||||
//private IUnityContainer _unityContainer;
|
||||
public ManualTask(string fromStation, IUnityContainer unityContainer)
|
||||
{
|
||||
InitializeComponent();
|
||||
//_unityContainer = unityContainer;
|
||||
manualTaskViewModel = new ViewModels.ManualTaskViewModel(unityContainer);
|
||||
manualTaskViewModel.GetStationDtl();
|
||||
manualTaskViewModel.SelectFromValue = fromStation;
|
||||
this.DataContext = manualTaskViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
119
Cowain.Bake.Main/Views/MoistureValueView.xaml
Normal file
119
Cowain.Bake.Main/Views/MoistureValueView.xaml
Normal file
@@ -0,0 +1,119 @@
|
||||
<Window x:Class="Cowain.Bake.Main.Views.MoistureValueView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
Height="220" Width="420" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="70"/>
|
||||
<RowDefinition Height="60"/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<DockPanel Grid.Row="0" Grid.Column="0">
|
||||
<Label Content="正极水分:"
|
||||
Foreground="Black"
|
||||
FontWeight="Bold"
|
||||
Style="{DynamicResource BaseStyle}"
|
||||
Margin="0,25,0,0"
|
||||
Width="65" />
|
||||
<TextBox
|
||||
Text="{Binding AnodeWaterJudge}"
|
||||
FontWeight="Bold" Height="30"
|
||||
TextWrapping="Wrap"
|
||||
Width="65" />
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Row="0" Grid.Column="1">
|
||||
<Label
|
||||
Content="负极水分:"
|
||||
Foreground="Black"
|
||||
FontWeight="Bold"
|
||||
Style="{DynamicResource BaseStyle}"
|
||||
Margin="0,25,0,0"
|
||||
Width="65" />
|
||||
<TextBox
|
||||
Text="{Binding CathodeWaterJudge}"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Center"
|
||||
Width="65"/>
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Row="0" Grid.Column="2">
|
||||
<Label
|
||||
Content="隔膜水分:"
|
||||
Foreground="Black"
|
||||
FontWeight="Bold"
|
||||
Style="{DynamicResource BaseStyle}"
|
||||
Margin="0,25,0,0"
|
||||
Width="65" />
|
||||
<TextBox
|
||||
Text="{Binding SeptumWaterJudge}"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Center"
|
||||
Width="65" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Grid.Row="1" Grid.Column="0" Visibility="Hidden">
|
||||
<Label Content="正极水分2:"
|
||||
Foreground="Black"
|
||||
FontWeight="Bold"
|
||||
Style="{DynamicResource BaseStyle}"
|
||||
Margin="0,25,0,0"
|
||||
Width="65" />
|
||||
<TextBox
|
||||
Text="{Binding AnodeWaterJudge2}"
|
||||
FontWeight="Bold" Height="30"
|
||||
TextWrapping="Wrap"
|
||||
Width="65" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Grid.Row="1" Grid.Column="1" Visibility="Hidden">
|
||||
<Label
|
||||
Content="负极水分2:"
|
||||
Foreground="Black"
|
||||
FontWeight="Bold"
|
||||
Style="{DynamicResource BaseStyle}"
|
||||
Margin="0,25,0,0"
|
||||
Width="65" />
|
||||
<TextBox
|
||||
Text="{Binding CathodeWaterJudge2}"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Center"
|
||||
Width="65"/>
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Row="1" Grid.Column="2" Visibility="Hidden">
|
||||
<Label
|
||||
Content="隔膜水分2:"
|
||||
Foreground="Black"
|
||||
FontWeight="Bold"
|
||||
Style="{DynamicResource BaseStyle}"
|
||||
Margin="0,25,0,0"
|
||||
Width="65" />
|
||||
<TextBox
|
||||
Text="{Binding SeptumWaterJudge2}"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="Wrap"
|
||||
VerticalAlignment="Center"
|
||||
Width="65" />
|
||||
</DockPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
|
||||
<Button Content="判定" x:Name="judge" Background="DeepSkyBlue" Command="{Binding Judge}" Margin="20,0,0,0" Width="90" />
|
||||
<!--<Button Content="退出" x:Name="Close" Background="DeepSkyBlue" Command="{Binding CloseCommand}" Margin="30,0,0,0" Width="90" />-->
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
35
Cowain.Bake.Main/Views/MoistureValueView.xaml.cs
Normal file
35
Cowain.Bake.Main/Views/MoistureValueView.xaml.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Cowain.Bake.Main.ViewModels;
|
||||
using Opc.Ua;
|
||||
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.Shapes;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// MoistureValue.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MoistureValueView : Window
|
||||
{
|
||||
ViewModels.MoistureValueViewMode viewModel = null;
|
||||
public MoistureValueView(IUnityContainer unityContainer, CavityDtlViewModel station)
|
||||
{
|
||||
InitializeComponent();
|
||||
viewModel = new ViewModels.MoistureValueViewMode(unityContainer);
|
||||
//viewModel.WaterValueModel = WaterValueModel;
|
||||
viewModel.thatParent = station;
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
124
Cowain.Bake.Main/Views/PalletIdInputWindow.xaml
Normal file
124
Cowain.Bake.Main/Views/PalletIdInputWindow.xaml
Normal file
@@ -0,0 +1,124 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
x:Class="Cowain.Bake.Main.Views.PalletIdInputWindow"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d"
|
||||
Background="#5f94c3"
|
||||
Title="{Binding Title}" Height="170" Width="380">
|
||||
<Window.Resources>
|
||||
<Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Style.BasedOn>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="hc:BorderElement.CornerRadius" Value="4"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<hc:SimplePanel>
|
||||
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding (hc:BorderElement.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{Binding (hc:BorderElement.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<StackPanel HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Orientation="Horizontal" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||
<Path x:Name="PathMain" Data="{TemplateBinding hc:IconElement.Geometry}" Fill="{TemplateBinding Foreground}" Height="{TemplateBinding hc:IconElement.Height}" Stretch="Uniform" SnapsToDevicePixels="True" Width="{TemplateBinding hc:IconElement.Width}"/>
|
||||
<ContentPresenter x:Name="ContentPresenterMain" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Margin="6,0,0,0" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</hc:SimplePanel>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Content" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="ContentPresenterMain" Value="Collapsed"/>
|
||||
</Trigger>
|
||||
<Trigger Property="hc:IconElement.Geometry" Value="{x:Null}">
|
||||
<Setter Property="Visibility" TargetName="PathMain" Value="Collapsed"/>
|
||||
<Setter Property="Margin" TargetName="ContentPresenterMain" Value="0"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#5f62c3"></Setter>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.BasedOn>
|
||||
<Style TargetType="{x:Type ButtonBase}">
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Padding" Value="10,6"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Style.BasedOn>
|
||||
<Style TargetType="{x:Type Control}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="FocusVisualStyle">
|
||||
<Setter.Value>
|
||||
<Style>
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle RadiusY="4" RadiusX="4">
|
||||
<Rectangle.Style>
|
||||
<Style TargetType="{x:Type Rectangle}">
|
||||
<Setter Property="Margin" Value="-2"/>
|
||||
<Setter Property="Opacity" Value="0.6"/>
|
||||
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||
<Setter Property="Stroke" Value="{DynamicResource SecondaryBorderBrush}"/>
|
||||
<Setter Property="StrokeThickness" Value="2"/>
|
||||
<Setter Property="StrokeDashArray" Value="1 1"/>
|
||||
</Style>
|
||||
</Rectangle.Style>
|
||||
</Rectangle>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Style.BasedOn>
|
||||
</Style>
|
||||
</Style.BasedOn>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value="0.9"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Opacity" Value="0.6"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Style.BasedOn>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<DockPanel HorizontalAlignment="Center" Margin="3,20,0,20">
|
||||
<Label DockPanel.Dock="Left" Background="#5f94c3" BorderThickness="0" FontSize="15" Content="{Binding MsgContent}" Margin="0,0,0,0"/>
|
||||
<Button DockPanel.Dock="Right" Click="Button_Click" Width=" 50" Height="29" Foreground="White" Background="#6e9bc5" Margin="20,0,0,0" Content="确定" Style="{DynamicResource ButtonStyle1}" BorderThickness="0" />
|
||||
</DockPanel>
|
||||
|
||||
<TextBox x:Name="InputBox" Width="300" Height="30" Margin="0,0,0,10"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
51
Cowain.Bake.Main/Views/PalletIdInputWindow.xaml.cs
Normal file
51
Cowain.Bake.Main/Views/PalletIdInputWindow.xaml.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Cowain.Bake.Main.ViewModels;
|
||||
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.Shapes;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// PalletIdInputWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PalletIdInputWindow : Window
|
||||
{
|
||||
public string _btnMsg = "";
|
||||
public string PalletId { get; set; }
|
||||
public PalletIdInputWindow(string title, string msg, string btnMsg)
|
||||
{
|
||||
InitializeComponent();
|
||||
PalletIdInputWindowViewModel vm = this.DataContext as PalletIdInputWindowViewModel;
|
||||
vm.Title = title; //;
|
||||
vm.MsgContent = msg; // ;
|
||||
_btnMsg = btnMsg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string ConfirmPalletId()
|
||||
{
|
||||
return PalletId;
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBoxResult result = HandyControl.Controls.MessageBox.Show(_btnMsg, "确认", MessageBoxButton.YesNo,MessageBoxImage.Information);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
PalletId = InputBox.Text;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user