Commit 07126efe authored by 潘栩锋's avatar 潘栩锋 🚴

画完界面!!!!

parent fb509589
......@@ -128,6 +128,14 @@
<Project>{973f0eed-3181-4fb9-abd6-196a9e816b77}</Project>
<Name>FLY.HeatingHelper</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.Weight2\FLY.Weight2.UI.Client\FLY.Weight2.UI.Client.csproj">
<Project>{75e96277-7745-4680-90d7-0d9c34ceca06}</Project>
<Name>FLY.Weight2.UI.Client</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.Weight2\FLY.Weight2\FLY.Weight2.csproj">
<Project>{b47f09de-9a6e-421f-b7c0-2ea87cc09570}</Project>
<Name>FLY.Weight2</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.Weight\FLY.Weight.UI.Client\FLY.Weight.UI.Client.csproj">
<Project>{654515f2-caae-450b-a344-547321836e8f}</Project>
<Name>FLY.Weight.UI.Client</Name>
......
......@@ -81,6 +81,9 @@
<Compile Include="UiModule\FlowGraph.xaml.cs">
<DependentUpon>FlowGraph.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\MainGraph.xaml.cs">
<DependentUpon>MainGraph.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\MenuSetting.xaml.cs">
<DependentUpon>MenuSetting.xaml</DependentUpon>
</Compile>
......@@ -145,6 +148,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UiModule\MainGraph.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\MenuSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -197,7 +204,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Dictionary_MainSingleWeight.xaml">
<Page Include="Themes\UcWeighterItemStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
......
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="Color_title" Color="#FF919191"/>
<SolidColorBrush x:Key="Color_unit" Color="#FF919191"/>
<SolidColorBrush x:Key="Color_text" Color="#FFf1f1f1"/>
<SolidColorBrush x:Key="Color_title" Color="#A0FFFFFF"/>
<SolidColorBrush x:Key="Color_unit" Color="#80FFFFFF"/>
<SolidColorBrush x:Key="Color_text" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="Color_title_activity" Color="#FF008BE5"/>
<SolidColorBrush x:Key="Color_text_activity" Color="#FFa8ddff"/>
<SolidColorBrush x:Key="Color_background" Color="#FF282828"/>
<SolidColorBrush x:Key="Color_background" Color="#FF384064"/>
<SolidColorBrush x:Key="Color_background2" Color="#50587c"/>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FLY.Weight2.UI.Client">
<SolidColorBrush x:Key="Color_g1#1" Color="#FFeb6877"/>
<SolidColorBrush x:Key="Color_g1#2" Color="#FFe5004f"/>
<SolidColorBrush x:Key="Color_g1#3" Color="#FFa40035"/>
<SolidColorBrush x:Key="Color_g1#4" Color="#FF7d0022"/>
<SolidColorBrush x:Key="Color_g1#5" Color="#FFff0045"/>
<SolidColorBrush x:Key="Color_g2#1" Color="#FFae5da1"/>
<SolidColorBrush x:Key="Color_g2#2" Color="#FF920783"/>
<SolidColorBrush x:Key="Color_g2#3" Color="#FF6a005f"/>
<SolidColorBrush x:Key="Color_g2#4" Color="#FF500047"/>
<SolidColorBrush x:Key="Color_g2#5" Color="#FFff00e1"/>
<SolidColorBrush x:Key="Color_g3#1" Color="#FF5f52a0"/>
<SolidColorBrush x:Key="Color_g3#2" Color="#FF1d2088"/>
<SolidColorBrush x:Key="Color_g3#3" Color="#FF100964"/>
<SolidColorBrush x:Key="Color_g3#4" Color="#FF03004c"/>
<SolidColorBrush x:Key="Color_g3#5" Color="#FF0900ff"/>
<SolidColorBrush x:Key="Color_g4#1" Color="#FF448aca"/>
<SolidColorBrush x:Key="Color_g4#2" Color="#FF0068b7"/>
<SolidColorBrush x:Key="Color_g4#3" Color="#FF004986"/>
<SolidColorBrush x:Key="Color_g4#4" Color="#FF003567"/>
<SolidColorBrush x:Key="Color_g4#5" Color="#FF0084ff"/>
<SolidColorBrush x:Key="Color_g5#1" Color="#FF32b16c"/>
<SolidColorBrush x:Key="Color_g5#2" Color="#FF009944"/>
<SolidColorBrush x:Key="Color_g5#3" Color="#FF007130"/>
<SolidColorBrush x:Key="Color_g5#4" Color="#FF00561f"/>
<SolidColorBrush x:Key="Color_g5#5" Color="#FF00ff5d"/>
<SolidColorBrush x:Key="Color_g1#0" Color="#FFFFC0C0" />
<SolidColorBrush x:Key="Color_g2#0" Color="#FFBCD676"/>
<SolidColorBrush x:Key="Color_g3#0" Color="#FF5c9de6"/>
<SolidColorBrush x:Key="Color_g4#0" Color="#FF949494"/>
<SolidColorBrush x:Key="Color_g5#0" Color="#FFff8afb"/>
<SolidColorBrush x:Key="Color_g1#0" Color="#FF3269ac" />
<SolidColorBrush x:Key="Color_g2#0" Color="#FF4cc5f4"/>
<SolidColorBrush x:Key="Color_g3#0" Color="#FFe44c63"/>
<SolidColorBrush x:Key="Color_g4#0" Color="#FF12a7ad"/>
<SolidColorBrush x:Key="Color_g5#0" Color="#FFf9b14d"/>
</ResourceDictionary>
\ No newline at end of file
......@@ -5,12 +5,12 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/DarkSkin.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/LightSkin.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/UnitTests/UnitTests_Weights.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Dictionary_MainSingleWeight.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<sys:Double x:Key="d100">100</sys:Double>
......@@ -24,4 +24,12 @@
<Setter Property="MaxHeight" Value="130"/>
<Setter Property="MaxWidth" Value="240"/>
</Style>
<SolidColorBrush x:Key="Color_button1_b" Color="#FF008BE5"/>
<SolidColorBrush x:Key="Color_button2_b" Color="#FF919191"/>
<SolidColorBrush x:Key="Color_button_f" Color="#FFf1f1f1"/>
</ResourceDictionary>
\ No newline at end of file
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing">
xmlns:sys="clr-namespace:System;assembly=mscorlib" >
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="Color_button1_b" Color="#FF008BE5"/>
<SolidColorBrush x:Key="Color_button2_b" Color="#FF919191"/>
<SolidColorBrush x:Key="Color_button_f" Color="#FFf1f1f1"/>
<sys:Double x:Key="FontSize_title">18</sys:Double>
<sys:Double x:Key="FontSize_unit">18</sys:Double>
<sys:Double x:Key="FontSize_text">48</sys:Double>
<Style x:Key="TextBlockStyle_title" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="{StaticResource FontSize_title}"/>
<Setter Property="Foreground" Value="{DynamicResource Color_title}"/>
</Style>
......@@ -35,34 +31,8 @@
<Setter Property="FontSize" Value="{StaticResource FontSize_text}"/>
<Setter Property="Foreground" Value="{DynamicResource Color_text_activity}"/>
</Style>
<Style TargetType="{x:Type ToggleButton}" x:Key="ToggleButtonStyle_mode" >
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Canvas Height="55" Width="110" >
<Rectangle x:Name="Path_background" Height="55" Width="110" Fill="{StaticResource Color_button1_b}"/>
<Rectangle x:Name="Path_block" Height="45" Width="25" Fill="{StaticResource Color_button_f}" Canvas.Left="80" Canvas.Top="5" />
<TextBlock x:Name="TB_Off" Visibility="Hidden" Text="手动" Foreground="{StaticResource Color_button_f}" FontSize="24" Canvas.Left="45" Canvas.Top="10"/>
<TextBlock x:Name="TB_On" Text="自动" Foreground="{StaticResource Color_button_f}" FontSize="24" Canvas.Left="15" Canvas.Top="10" />
</Canvas>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="TB_On" Property="Visibility" Value="Hidden"/>
<Setter TargetName="TB_Off" Property="Visibility" Value="Visible"/>
<Setter TargetName="Path_block" Property="Canvas.Left" Value="5"/>
<Setter TargetName="Path_background" Property="Fill" Value="{StaticResource Color_button2_b}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Border" x:Key="BorderStyle_block">
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="Background" Value="{StaticResource Color_theme_background}"/>
<Setter Property="Background" Value="{StaticResource Color_background}"/>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -10,12 +10,7 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/LightSkin.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Dictionary_MainSingleWeight.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Converter/Dictionary_MyConv.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/UnitTests/UnitTests_Weights.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/UcWeighterItemStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type Path}" x:Key="PathStyle_icon">
......@@ -37,7 +32,7 @@
<Border Style="{StaticResource BorderStyle_module}"
DataContext="{Binding DataContext,ElementName=grid_weighter}">
DataContext="{Binding DataContext,ElementName=grid_weighter}" Background="{StaticResource Color_background}">
<StackPanel Orientation="Vertical">
......@@ -56,8 +51,8 @@
<StackPanel Orientation="Horizontal">
<TextBlock Margin="4" >
<Run Text="{Binding Accessory.TotalFlow,StringFormat={}{0:F1}}" Style="{StaticResource RunStyle_text}" FontSize="50" />
<Run Text="kg/h" Style="{StaticResource RunStyle_unit}"/>
</TextBlock>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="kg/h" FontSize="20" />
</StackPanel>
</Viewbox>
</StackPanel>
......@@ -70,18 +65,18 @@
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Text="平均厚度" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#FF3B3B3B" />
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Text="{Binding Accessory.Thickness, StringFormat={}{0:F1}}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource Color_theme_activity}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="um" FontSize="12" />
</StackPanel>
<TextBlock Style="{StaticResource TextBlockStyle_title}" Text="平均厚度" FontSize="12" />
<TextBlock Margin="5,0">
<Run Text="{Binding Accessory.Thickness,StringFormat={}{0:F1}}" Style="{StaticResource RunStyle_text}" FontSize="24" />
<Run Text="um" Style="{StaticResource RunStyle_unit}" FontSize="12"/>
</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="2" >
<TextBlock Text="边料" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#FF3B3B3B" />
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Text="{Binding Accessory.RimCharge, StringFormat={}{0:F1}}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource Color_theme_activity}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="kg/h" FontSize="12" />
</StackPanel>
<TextBlock Style="{StaticResource TextBlockStyle_title}" Text="边料" FontSize="12" />
<TextBlock Margin="5,0">
<Run Text="{Binding Accessory.RimCharge,StringFormat={}{0:F1}}" Style="{StaticResource RunStyle_text}" FontSize="24" />
<Run Text="kg/h" Style="{StaticResource RunStyle_unit}" FontSize="12"/>
</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
......
......@@ -16,7 +16,7 @@
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/LightSkin.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/UnitTests/UnitTests_Weights.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Dictionary_MainSingleWeight.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/UcWeighterItemStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<conv:OpacityConverter x:Key="OpacityConverter"></conv:OpacityConverter>
......
......@@ -669,7 +669,7 @@ namespace FLY.Weight2.UI.Client.UiModule
/// 控件标题
/// 它的值取决于culture
/// </summary>
public string Title=> "称重流量";
public string Title=> "称重单组分流量";
public ComponentType Type => ComponentType.Graph;
public bool IsUnique => false;
......
<UserControl x:Class="FLY.Weight2.UI.Client.UiModule.MainGraph"
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:FLY.Weight2.UI.Client.UiModule"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" >
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/UcWeighterItemStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Viewbox Stretch="Uniform" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid Name="root_grid" d:DataContext="{StaticResource unittests_weighters}">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition />
</Grid.RowDefinitions>
<local:UcTotalFlow x:Name="ucTotalFlow" Margin="5" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<local:UcThickness x:Name="ucThickness" Margin="5"/>
<ItemsControl x:Name="itemsControl" Grid.Column="1" ItemsSource="{Binding Items}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:UcWeighterItem Margin="5" WeightSystemService="{Binding DataContext,ElementName=root_grid}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Grid>
</Viewbox>
</UserControl>
using FLY.OBJComponents.Client;
using FLY.Weight2.Client;
using FLY.Weight2.Common;
using FLY.Weight2.IService;
using MultiLayout;
using MultiLayout.UiModule;
using System;
using System.Collections.Generic;
using System.Globalization;
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 Unity;
namespace FLY.Weight2.UI.Client.UiModule
{
/// <summary>
/// Page_Main.xaml 的交互逻辑
/// </summary>
public partial class MainGraph : UserControl
{
IWeightSystemService weightSystemService;
List<SetPLCUpdatePlan> setPlan_items = new List<SetPLCUpdatePlan>();
public MainGraph()
{
InitializeComponent();
}
[InjectionMethod]
public void Init(
IUnityContainer container,
IWeightSystemService weightSystemService)
{
ucTotalFlow.Init(weightSystemService);
ucThickness.Init(weightSystemService);
this.weightSystemService = weightSystemService;
root_grid.DataContext = this.weightSystemService;
for (int i = 0; i < this.weightSystemService.Items.Count(); i++)
{
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.weightSystemService.PLCos,
this.weightSystemService.Items[i],
UcWeighterItem.item_update_propertynames);
setPlan_items.Add(plan);
}
if (weightSystemService is WeightSystemServiceClient) {
(weightSystemService as WeightSystemServiceClient).ResetItemsEvent += MWeighterCsService_ResetItemsEvent;
}
}
private void MWeighterCsService_ResetItemsEvent()
{
//把多出来的删除
int remove_cnt = setPlan_items.Count() - weightSystemService.Items.Count();
if (remove_cnt > 0)
{
for (int i = 0; i < remove_cnt; i++)
{
SetPLCUpdatePlan plan = setPlan_items[setPlan_items.Count() - 1 - i];
plan.Dispose();
}
setPlan_items.RemoveRange(setPlan_items.Count() - remove_cnt, remove_cnt);
}
else
{
int start_idx = setPlan_items.Count();
int add_cnt = -remove_cnt;
for (int i = 0; i < add_cnt; i++)
{
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
weightSystemService.PLCos,
weightSystemService.Items[start_idx+i],
UcWeighterItem.item_update_propertynames);
setPlan_items.Add(plan);
}
}
}
}
public class UiModule2_MainGraph : IUiModule2
{
/// <summary>
/// 控件标题
/// 它的值取决于culture
/// </summary>
public string Title => "称重单组分主界面";
public ComponentType Type => ComponentType.Graph;
public bool IsUnique => true;
/// <summary>
/// 控件
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetComponent(int id, IUnityContainer container)
{
MainGraph graph = new MainGraph();
container.BuildUp(graph);
return graph;
}
/// <summary>
/// 控件缩略图,用于编辑界面时,大致看看
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetThumbnail()
{
return new System.Windows.Controls.Grid();
}
/// <summary>
/// 给出全部控件ID, 控件自行删除没有的参数
/// </summary>
/// <param name="IDs"></param>
public void MatchParam(int[] IDs)
{
}
}
}
......@@ -51,7 +51,7 @@ namespace FLY.Weight2.UI.Client.UiModule
/// 控件标题
/// 它的值取决于culture
/// </summary>
public string Title => "称重菜单";
public string Title => "称重单组分菜单";
public ComponentType Type => ComponentType.Menu;
public bool IsUnique => true;
......
......@@ -4,13 +4,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FLY.Weight2.UI.Client.UiModule"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:flyctrl="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
d:DesignWidth="300"
mc:Ignorable="d" >
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Styles.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/UcWeighterItemStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
......@@ -27,7 +27,10 @@
</StackPanel>
<StackPanel Margin="3" >
<TextBlock Text="边料不回收" Style="{StaticResource TextBlockStyle_title_activity}"/>
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Accessory.IsRimNoRecycle}" HorizontalAlignment="Left" IsEnabled="False"/>
<flyctrl:ToggleButtonOnOff IsEnabled="False"
IsChecked="{Binding Accessory.IsRimNoRecycle}"
OffLabel="否" OffBrush="#e44c65"
OnLabel="是" OnBrush="#10a8a9"/>
</StackPanel>
<StackPanel Margin="3" >
<TextBlock Text="切边" Style="{StaticResource TextBlockStyle_title_activity}"/>
......@@ -36,7 +39,7 @@
<Run Text="mm" Style="{StaticResource RunStyle_unit}" />
</TextBlock>
</StackPanel>
<StackPanel Margin="3" Background="#FF636363" >
<StackPanel Margin="3" Background="{StaticResource Color_background2}" >
<TextBlock Text="收卷宽度" Style="{StaticResource TextBlockStyle_title}" Foreground="White"/>
<TextBlock >
<Run Text="{Binding Accessory.ActFilmWidth,StringFormat={}{0:F0}}" Style="{StaticResource RunStyle_text}" Foreground="White"/>
......@@ -51,7 +54,7 @@
</TextBlock>
</StackPanel>
<StackPanel Margin="3" Background="#FF636363">
<StackPanel Margin="3" Background="{StaticResource Color_background2}">
<TextBlock Text="理论线速度" Style="{StaticResource TextBlockStyle_title}" Foreground="White"/>
<TextBlock >
<Run Text="{Binding Accessory.TargetVelocity,StringFormat={}{0:F1}}" Style="{StaticResource RunStyle_text}" Foreground="White"/>
......
......@@ -86,7 +86,7 @@ namespace FLY.Weight2.UI.Client.UiModule
/// 控件标题
/// 它的值取决于culture
/// </summary>
public string Title => "称重厚度";
public string Title => "称重单组分厚度";
public ComponentType Type => ComponentType.Graph;
......
......@@ -10,14 +10,19 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Styles.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/UcWeighterItemStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Border Style="{StaticResource BorderStyle_block}" d:DataContext="{StaticResource unittests_weighters}">
<Viewbox MaxHeight="120" HorizontalAlignment="Left" VerticalAlignment="Top">
<StackPanel Orientation="Horizontal">
<Viewbox Margin="15,5" MaxHeight="90" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Viewbox Margin="15,5" MaxHeight="90" HorizontalAlignment="Left">
<Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="button_ratio_Click" Margin="30,5">
<StackPanel Orientation="Horizontal">
......@@ -46,7 +51,7 @@
</StackPanel>
</Button>
</Viewbox>
<StackPanel Orientation="Horizontal" Grid.Column="1">
<Viewbox Margin="15,5" MaxHeight="90" >
<Grid >
<Grid.RowDefinitions>
......@@ -92,10 +97,9 @@
<Button Grid.Column="1" Style="{StaticResource ButtonStyle_empty}" Background="Transparent" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-5,0,0" Click="button_aclear_Click">
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Grid Width="50" Height="50">
<Ellipse Fill="White" Stretch="Uniform"/>
<Path Data="{StaticResource Geometry_close-circle}" Fill="Red" Stretch="Uniform" />
<Ellipse Fill="White" Stretch="Uniform" Margin="2"/>
<Path Data="{StaticResource Geometry_close-circle}" Fill="#ee4765" Stretch="Uniform" />
</Grid>
<TextBlock Text="清空" Padding="2" Background="Red" Foreground="White" FontSize="15" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,-10"/>
</Grid>
</Button>
</Grid>
......@@ -149,10 +153,9 @@
<Button Grid.Column="1" Style="{StaticResource ButtonStyle_empty}" Background="Transparent" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-5,0,0" Click="button_bclear_Click">
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Grid Width="50" Height="50">
<Ellipse Fill="White" Stretch="Uniform"/>
<Path Data="{StaticResource Geometry_close-circle}" Fill="Red" Stretch="Uniform" />
<Ellipse Fill="White" Stretch="Uniform" Margin="2"/>
<Path Data="{StaticResource Geometry_close-circle}" Fill="#ee4765" Stretch="Uniform" />
</Grid>
<TextBlock Text="清空" Padding="2" Background="Red" Foreground="White" FontSize="15" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,-10"/>
</Grid>
</Button>
</Grid>
......@@ -160,7 +163,7 @@
</Grid>
</Viewbox>
</StackPanel>
</Viewbox>
</Grid>
</Border>
</UserControl>
......@@ -34,6 +34,8 @@ namespace FLY.Weight2.UI.Client.UiModule
{
InitializeComponent();
}
[InjectionMethod]
public void Init(IWeightSystemService weightSystemService)
{
this.weightSystemService = weightSystemService;
......
......@@ -12,60 +12,87 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Styles.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/UcWeighterItemStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Border Style="{StaticResource BorderStyle_block}" d:DataContext="{StaticResource unittests_weighters}">
<Viewbox Margin="{StaticResource ControlMargin}" d:DataContext="{Binding Items[0]}" HorizontalAlignment="Left" VerticalAlignment="Top">
<Viewbox Margin="{StaticResource ControlMargin}" d:DataContext="{Binding Items[4]}" HorizontalAlignment="Left" VerticalAlignment="Top">
<StackPanel >
<Border Background="{Binding Color}" Margin="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Border Width="100" Height="100" Background="{Binding Color}" Margin="3">
<TextBlock Text="{Binding Number}" FontSize="100" FontWeight="Bold" Foreground="{StaticResource Color_theme_background}" Margin="-10,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</Border>
<Grid Width="50" >
<TextBlock Text="{Binding Number}" FontSize="100" FontWeight="Bold" Foreground="{StaticResource Color_background}" VerticalAlignment="Top" HorizontalAlignment="Right" FontFamily="Arial" Margin="0,-20,0,0"/>
</Grid>
<StackPanel Margin="3" Grid.Column="1" >
<StackPanel Orientation="Horizontal">
<TextBlock Text="产量" Style="{StaticResource TextBlockStyle_title}" Margin="3,0"/>
<TextBlock Text="当前产量" Style="{StaticResource TextBlockStyle_title}" Margin="3,0" />
<TextBlock >
<Run Text="{Binding CurrentFlowAuto,StringFormat={}{0:F0}}" Style="{StaticResource RunStyle_text}" FontSize="30" />
<Run Text="kg" Style="{StaticResource RunStyle_unit}" />
</TextBlock>
</StackPanel>
<Viewbox Width="200" Height="72" HorizontalAlignment="Left">
<Viewbox Width="200" Height="80" HorizontalAlignment="Left">
<TextBlock >
<Run Text="{Binding CurrentFlow,StringFormat={}{0:F1}}" Style="{StaticResource RunStyle_text}" FontSize="60" />
<Run Text="kg/h" Style="{StaticResource RunStyle_unit}" />
</TextBlock>
</Viewbox>
</StackPanel>
<Button Grid.Row="1" Grid.Column="1" Margin="3" Height="200" Style="{StaticResource ButtonStyle_empty}"
Background="Transparent" Click="button_ratio_Click"
Tag="{Binding .}"
>
</Grid>
</Border>
<Border x:Name="border_p" Background="{StaticResource Color_background2}" Height="30" Margin="2">
<Rectangle HorizontalAlignment="Left" Fill="{Binding Color}">
<Rectangle.Width>
<MultiBinding Converter="{StaticResource ratioconv}" Mode="OneWay">
<Binding Path="ScrewPDisp" />
<Binding Source="{StaticResource d100}" />
<Binding Path="ActualWidth" ElementName="border_p"/>
</MultiBinding>
</Rectangle.Width>
</Rectangle>
</Border>
<Button Grid.Row="1" Grid.Column="1" Margin="3" Style="{StaticResource ButtonStyle_empty}" Click="button_ratio_Click" Tag="{Binding .}">
<Grid>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" >
<TextBlock HorizontalAlignment="Center">
<Run Text="{Binding ScrewPDispAuto,StringFormat={}{0:F1}}" Style="{StaticResource RunStyle_text_activity}" FontSize="30" />
<Run Text="%" Style="{StaticResource RunStyle_unit}" />
</TextBlock>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Margin="3">
<TextBlock Text="当前比例" Style="{StaticResource TextBlockStyle_title}"/>
<TextBlock>
<Run Text="{Binding ScrewPDisp,StringFormat={}{0:F1}}" Style="{StaticResource RunStyle_text}" FontSize="60" />
<Run Text="%" Style="{StaticResource RunStyle_unit}" />
</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" Margin="3">
<TextBlock Text="设置比例" Style="{StaticResource TextBlockStyle_title_activity}"/>
<TextBlock >
<Run Text="{Binding ScrewPDispAuto,StringFormat={}{0:F1}}" Style="{StaticResource RunStyle_text_activity}"/>
<Run Text="%" Style="{StaticResource RunStyle_unit}" />
</TextBlock>
</StackPanel>
</Grid>
</Button>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
</Grid>
<Grid>
......@@ -112,10 +139,8 @@
<TextBlock Text="螺杆操作" Style="{StaticResource TextBlockStyle_title_activity}"/>
<flyctrl:NoToggleButton
IsChecked="{Binding ScrewMotorIsOn}"
OffLabel="关闭"
OffBrush="DarkRed"
OnLabel="启动"
OnBrush="Green"
OffLabel="关闭" OffBrush="#e44c65"
OnLabel="启动" OnBrush="#10a8a9"
>
<i:Interaction.Behaviors>
<flyctrl:ResetBehavior Binding="{Binding ScrewMotorOnSet}"/>
......@@ -124,9 +149,10 @@
</StackPanel>
<StackPanel Margin="3" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" Visibility="{Binding IsChecked,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Hidden, ElementName=togglebutton_screw}">
<TextBlock Text="螺杆模式" Style="{StaticResource TextBlockStyle_title_activity}"/>
<flyctrl:ToggleButtonOnOff IsChecked="{Binding ScrewIsAutoMode}"
OffLabel="手动"
OnLabel="自动"/>
<flyctrl:ToggleButtonOnOff
IsChecked="{Binding ScrewIsAutoMode}"
OffLabel="手动" OffBrush="#e44c65"
OnLabel="自动" OnBrush="#10a8a9"/>
</StackPanel>
</StackPanel>
......
......@@ -25,9 +25,19 @@ namespace FLY.Weight2.UI.Client.UiModule
/// </summary>
public partial class UcWeighterItem : UserControl
{
IUnityContainer container;
IWeightSystemService weightSystemService;
public IWeightSystemService WeightSystemService
{
get { return (IWeightSystemService)GetValue(WeightSystemServiceProperty); }
set { SetValue(WeightSystemServiceProperty, value); }
}
// Using a DependencyProperty as the backing store for WeightSystemService. This enables animation, styling, binding, etc...
public static readonly DependencyProperty WeightSystemServiceProperty =
DependencyProperty.Register("WeightSystemService", typeof(IWeightSystemService), typeof(UcWeighterItem), new PropertyMetadata(null));
List<SetPLCUpdatePlan> setPlan_items = new List<SetPLCUpdatePlan>();
int Index = 0;
public UcWeighterItem()
......@@ -37,12 +47,10 @@ namespace FLY.Weight2.UI.Client.UiModule
[InjectionMethod]
public void Init(
IUnityContainer container,
int id,
IWeightSystemService weightSystemService)
{
this.container = container;
this.weightSystemService = weightSystemService;
this.WeightSystemService = weightSystemService;
//查找参数
if (WeighterItemParams.Current.Indexs.ContainsKey(id))
......@@ -51,7 +59,7 @@ namespace FLY.Weight2.UI.Client.UiModule
}
else
{
for (int i = 0; i < this.weightSystemService.Items.Count(); i++)
for (int i = 0; i < this.WeightSystemService.Items.Count(); i++)
{
if (!WeighterItemParams.Current.Indexs.ContainsValue(i))
{
......@@ -63,18 +71,18 @@ namespace FLY.Weight2.UI.Client.UiModule
}
int idx = Index;
if (idx >= this.weightSystemService.Items.Count())
idx = this.weightSystemService.Items.Count() - 1;
if (idx >= this.WeightSystemService.Items.Count())
idx = this.WeightSystemService.Items.Count() - 1;
else if (idx < 0)
idx = 0;
this.DataContext = this.weightSystemService.Items[idx];
this.DataContext = this.WeightSystemService.Items[idx];
for (int i = 0; i < this.weightSystemService.Items.Count(); i++)
for (int i = 0; i < this.WeightSystemService.Items.Count(); i++)
{
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
this.weightSystemService.PLCos,
this.weightSystemService.Items[i],
this.WeightSystemService.PLCos,
this.WeightSystemService.Items[i],
item_update_propertynames);
setPlan_items.Add(plan);
}
......@@ -86,7 +94,7 @@ namespace FLY.Weight2.UI.Client.UiModule
private void MWeighterCsService_ResetItemsEvent()
{
//把多出来的删除
int remove_cnt = setPlan_items.Count() - weightSystemService.Items.Count();
int remove_cnt = setPlan_items.Count() - WeightSystemService.Items.Count();
if (remove_cnt > 0)
{
for (int i = 0; i < remove_cnt; i++)
......@@ -103,14 +111,14 @@ namespace FLY.Weight2.UI.Client.UiModule
for (int i = 0; i < add_cnt; i++)
{
SetPLCUpdatePlan plan = new SetPLCUpdatePlan(
weightSystemService.PLCos,
weightSystemService.Items[start_idx + i],
WeightSystemService.PLCos,
WeightSystemService.Items[start_idx + i],
item_update_propertynames);
setPlan_items.Add(plan);
}
}
}
string[] item_update_propertynames = new string[] {
public static string[] item_update_propertynames = new string[] {
"CurrentFlow",
"ScrewPDisp",
"CurrentFlowAuto",
......@@ -143,7 +151,7 @@ namespace FLY.Weight2.UI.Client.UiModule
{
WdRatioSet w = new WdRatioSet();
w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this);
w.Init(weightSystemService);
w.Init(WeightSystemService);
w.ShowDialog();
}
......@@ -171,7 +179,7 @@ namespace FLY.Weight2.UI.Client.UiModule
public ComponentType Type => ComponentType.Graph;
public bool IsUnique => true;
public bool IsUnique => false;
/// <summary>
/// 控件
......
......@@ -10,14 +10,8 @@
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/UcWeighterItemStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/LightSkin.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Dictionary_MainSingleWeight.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/UnitTests/UnitTests_Weights.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
......
......@@ -13,7 +13,7 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/LightSkin.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/UnitTests/UnitTests_Weights.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Dictionary_MainSingleWeight.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Styles.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
......
......@@ -10,10 +10,7 @@
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/LightSkin.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/UnitTests/UnitTests_Weights.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Dictionary_MainSingleWeight.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/UcWeighterItemStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
......
......@@ -16,7 +16,6 @@ namespace FLY.Weight2.UI.Client
class WeighterColor
{
public Brush Self;
public List<Brush> Items = new List<Brush>();
public WeighterColor()
{
}
......@@ -26,13 +25,13 @@ namespace FLY.Weight2.UI.Client
{
if (File.Exists("weighterColorDb.json"))
{
string json = File.ReadAllText("weighterColorDb.json");
mWeighters = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, WeighterColor>>(json);
}
else
{
//if (File.Exists("weighterColorDb.json"))
//{
// string json = File.ReadAllText("weighterColorDb.json");
// mWeighters = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, WeighterColor>>(json);
//}
//else
//{
ResourceDictionary r = new ResourceDictionary()
{
Source = new Uri("pack://application:,,,/FLY.Weight2.UI.Client;component/Themes/Dictionary_CellColor.xaml")
......@@ -45,14 +44,9 @@ namespace FLY.Weight2.UI.Client
WeighterColor c = new WeighterColor();
string color_name = "Color_g" + (i + 1).ToString() + "#0";
c.Self = r[color_name] as Brush;
for (int j = 0; j < 5; j++)
{
color_name = "Color_g" + (i + 1).ToString() + "#" + (j + 1).ToString();
c.Items.Add(r[color_name] as Brush);
}
mWeighters.Add("" + (char)('A' + i), c);
}
}
//}
}
public static Brush GetSelf(string number)
......@@ -61,18 +55,6 @@ namespace FLY.Weight2.UI.Client
return null;
return mWeighters[number].Self;
}
public static Brush GetItem(string number, int index)
{
if (!mWeighters.ContainsKey(number))
return null;
int cnt = mWeighters[number].Items.Count();
if (index >= cnt || index < 0)
{
Random r = new Random();
index = r.Next(cnt - 1);
}
return mWeighters[number].Items[index];
}
}
public class Number2ColorValueConverter : IValueConverter
{
......@@ -86,18 +68,4 @@ namespace FLY.Weight2.UI.Client
throw new NotImplementedException();
}
}
public class Number2ColorItemValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string number = value as string;
int index = (int)parameter;
return WeighterColorDB.GetItem(number, index);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment