添加项目文件。
This commit is contained in:
15
CapMachine.Shared/CapMachine.Shared.csproj
Normal file
15
CapMachine.Shared/CapMachine.Shared.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
156
CapMachine.Shared/Controls/MeterConfig.xaml
Normal file
156
CapMachine.Shared/Controls/MeterConfig.xaml
Normal file
@@ -0,0 +1,156 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Shared.Controls.MeterConfig"
|
||||
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CapMachine.Shared.Controls"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Name="MeterConfigInstance"
|
||||
d:DesignHeight="330"
|
||||
d:DesignWidth="360"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="24" />
|
||||
<Setter Property="Width" Value="218" />
|
||||
</Style>
|
||||
<Style x:Key="myHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="70" />
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.ColumnSpan="3" Margin="1">
|
||||
<Border
|
||||
Padding="3"
|
||||
Background="LightSteelBlue"
|
||||
CornerRadius="3">
|
||||
<TextBlock
|
||||
FontSize="18"
|
||||
Foreground="Blue"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=MeterName}" />
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="起始速度"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.StartValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="结束速度"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.EndValue}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Margin="5,10,0,0">
|
||||
<TextBox
|
||||
Height="55"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="维持时间"
|
||||
AcceptsReturn="True"
|
||||
FontSize="18"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
Text="{Binding ElementName=MeterConfigInstance, Path=SelectedMeter.KeepTime}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Disabled" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=AddCommand}"
|
||||
Content="增加"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="增加程序步骤内的速度设置" />
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=EditCommand}"
|
||||
Content="修改"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="修改程序步骤内的速度设置,请先选中" />
|
||||
<Button
|
||||
Margin="5,3"
|
||||
Background="IndianRed"
|
||||
Command="{Binding ElementName=MeterConfigInstance, Path=DeleteCommand}"
|
||||
Content="删除"
|
||||
Foreground="White"
|
||||
Style="{StaticResource MaterialDesignRaisedSecondaryLightButton}"
|
||||
ToolTip="删除程序步骤内的速度设置,请先选中" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
Grid.Row="3"
|
||||
Margin="3,0"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="1">
|
||||
<ListView
|
||||
x:Name="listviewMeter"
|
||||
Foreground="Black"
|
||||
ItemsSource="{Binding ElementName=MeterConfigInstance, Path=ListMeter}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding ElementName=MeterConfigInstance, Path=MeterSelectedChangedCmd}" CommandParameter="{Binding ElementName=listviewMeter, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle1}">
|
||||
<GridViewColumn
|
||||
Width="60"
|
||||
DisplayMemberBinding="{Binding StepNo}"
|
||||
Header="序号" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding StartValue}"
|
||||
Header="起始速度" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding EndValue}"
|
||||
Header="终止速度" />
|
||||
<GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding KeepTime}"
|
||||
Header="持续时间" />
|
||||
</GridView>
|
||||
|
||||
</ListView.View>
|
||||
<!-- 设置ListViewItem的背景色,模拟网格效果 -->
|
||||
<!--<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>-->
|
||||
</ListView>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
122
CapMachine.Shared/Controls/MeterConfig.xaml.cs
Normal file
122
CapMachine.Shared/Controls/MeterConfig.xaml.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
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 System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CapMachine.Shared.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// MeterConfig.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MeterConfig : UserControl
|
||||
{
|
||||
public MeterConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string MeterName
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)base.GetValue(MeterConfig.MeterNameProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.SetValue(MeterConfig.MeterNameProperty, value);
|
||||
}
|
||||
}
|
||||
public static readonly DependencyProperty MeterNameProperty = DependencyProperty.Register("MeterName", typeof(string), typeof(MeterConfig), new PropertyMetadata("速度"));
|
||||
|
||||
|
||||
//MeterSlopCell
|
||||
public object SelectedMeter
|
||||
{
|
||||
get
|
||||
{
|
||||
return (MeterSlopCell)base.GetValue(MeterConfig.SelectedMeterProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.SetValue(MeterConfig.SelectedMeterProperty, value);
|
||||
}
|
||||
}
|
||||
public static readonly DependencyProperty SelectedMeterProperty = DependencyProperty.Register("SelectedMeter", typeof(object), typeof(MeterConfig), new PropertyMetadata(null));
|
||||
|
||||
|
||||
//MeterSlopCell
|
||||
public IEnumerable ListMeter
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IEnumerable)base.GetValue(MeterConfig.ListMeterProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
base.SetValue(MeterConfig.ListMeterProperty, value);
|
||||
}
|
||||
}
|
||||
public static readonly DependencyProperty ListMeterProperty = DependencyProperty.Register("ListMeter", typeof(IEnumerable), typeof(MeterConfig), new PropertyMetadata(null));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add 命令
|
||||
/// </summary>
|
||||
public ICommand AddCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(AddCommandProperty); }
|
||||
set { SetValue(AddCommandProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty AddCommandProperty =
|
||||
DependencyProperty.Register("AddCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
||||
|
||||
/// <summary>
|
||||
/// Edit 命令
|
||||
/// </summary>
|
||||
public ICommand EditCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(EditCommandProperty); }
|
||||
set { SetValue(EditCommandProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty EditCommandProperty =
|
||||
DependencyProperty.Register("EditCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
||||
|
||||
/// <summary>
|
||||
/// Delete 命令
|
||||
/// </summary>
|
||||
public ICommand DeleteCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(DeleteCommandProperty); }
|
||||
set { SetValue(DeleteCommandProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty DeleteCommandProperty =
|
||||
DependencyProperty.Register("DeleteCommand", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
||||
|
||||
|
||||
//MeterSelectedChangedCmd
|
||||
/// <summary>
|
||||
/// Add 命令
|
||||
/// </summary>
|
||||
public ICommand MeterSelectedChangedCmd
|
||||
{
|
||||
get { return (ICommand)GetValue(MeterSelectedChangedCmdProperty); }
|
||||
set { SetValue(MeterSelectedChangedCmdProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty MeterSelectedChangedCmdProperty =
|
||||
DependencyProperty.Register("MeterSelectedChangedCmd", typeof(ICommand), typeof(MeterConfig), new PropertyMetadata(default(ICommand)));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
27
CapMachine.Shared/Controls/MeterSlopCell.cs
Normal file
27
CapMachine.Shared/Controls/MeterSlopCell.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Shared.Controls
|
||||
{
|
||||
public class MeterSlopCell
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始值
|
||||
/// </summary>
|
||||
public double StartValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束值
|
||||
/// </summary>
|
||||
public double EndValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 维持时间
|
||||
/// </summary>
|
||||
public double KeepTime { get; set; }
|
||||
}
|
||||
}
|
||||
7
CapMachine.Shared/Themes/Generic.xaml
Normal file
7
CapMachine.Shared/Themes/Generic.xaml
Normal file
@@ -0,0 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/OrpaonChipEpt.Shared;component/Controls/ControllableValve.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/OrpaonChipEpt.Shared;component/Controls/MFC_EPC.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/OrpaonChipEpt.Shared;component/Controls/UnControllableValve.xaml" />-->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user