Commit 9d4a2ba7 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 修复 追边测厚, 保存 立式旋转, 膜长变化 按键失效

2. 修复 扫描报警 lcus1 失效
3. 优化 把流延的定时扫描图片保存 迁移到 追边测厚服务器了
parent 3521530f
......@@ -3,6 +3,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="GroupBox"/>
</ResourceDictionary>
</Application.Resources>
</Application>
......@@ -48,6 +48,18 @@
</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="LiveCharts">
<HintPath>..\..\thick_public\dll\LiveCharts.dll</HintPath>
</Reference>
<Reference Include="LiveCharts.Feng">
<HintPath>..\..\thick_public\dll\LiveCharts.Feng.dll</HintPath>
</Reference>
<Reference Include="LiveCharts.Feng.Wpf">
<HintPath>..\..\thick_public\dll\LiveCharts.Feng.Wpf.dll</HintPath>
</Reference>
<Reference Include="LiveCharts.Wpf">
<HintPath>..\..\thick_public\dll\LiveCharts.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
......@@ -72,9 +84,25 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="PicHistory.cs" />
<Compile Include="WindowSavePic.xaml.cs">
<DependentUpon>WindowSavePic.xaml</DependentUpon>
<Compile Include="PgLoading.xaml.cs">
<DependentUpon>PgLoading.xaml</DependentUpon>
</Compile>
<Compile Include="PgMain.xaml.cs">
<DependentUpon>PgMain.xaml</DependentUpon>
</Compile>
<Compile Include="PicHistory\ChartToImage.cs" />
<Compile Include="PicHistory\PicHistory.cs" />
<Compile Include="PicHistory\ScanGraph.xaml.cs">
<DependentUpon>ScanGraph.xaml</DependentUpon>
</Compile>
<Compile Include="PicHistory\ScanGraphVm.cs" />
<Compile Include="PicHistory\ScanGraphVmUt.cs" />
<Compile Include="PicHistory\WdPicHistory.xaml.cs">
<DependentUpon>WdPicHistory.xaml</DependentUpon>
</Compile>
<Compile Include="Themes\Colors.cs" />
<Compile Include="WdSetup.xaml.cs">
<DependentUpon>WdSetup.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
......@@ -88,7 +116,43 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="WindowSavePic.xaml">
<Page Include="PgLoading.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PgMain.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PicHistory\ScanGraph.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PicHistory\WdPicHistory.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\ButtonStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\ChartStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Colors.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Styles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\TextStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdSetup.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
......@@ -130,6 +194,10 @@
<Project>{9c46d98f-6500-490b-9e56-c89dfffa05f8}</Project>
<Name>FLY.AppHelper</Name>
</ProjectReference>
<ProjectReference Include="..\..\thick_public\Project.FLY.ControlLibrary\FLY.ControlLibrary\FLY.ControlLibrary.csproj">
<Project>{119c3adc-f8e1-4f72-b89b-006236ff8586}</Project>
<Name>FLY.ControlLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\..\thick_public\Project.FLY.FlyADBase\FlyADBase\FlyADBase.csproj">
<Project>{dd8a6858-1261-49f7-86be-5ac5c3a0ec34}</Project>
<Name>FlyADBase</Name>
......@@ -155,9 +223,21 @@
<PackageReference Include="Costura.Fody">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="MahApps.Metro">
<Version>2.4.1</Version>
</PackageReference>
<PackageReference Include="MahApps.Metro.IconPacks">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="NLog">
<Version>4.6.8</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
</PackageReference>
<PackageReference Include="System.Data.SQLite">
<Version>1.0.112</Version>
</PackageReference>
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
<PropertyChanged />
</Weavers>
\ No newline at end of file
......@@ -4,6 +4,55 @@
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="TriggerDependentProperties" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the Dependent properties feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EnableIsChangedProperty" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the IsChanged property feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressWarnings" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
......
<Window x:Class="FLY.Thick.Blowing.UI.Fix.Server.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
Icon="/FLY.Thick.Blowing.UI.Fix.Server;component/BlowingFixServer.ico" SizeToContent="WidthAndHeight">
<NavigationWindow x:Class="FLY.Thick.Blowing.UI.Fix.Server.MainWindow"
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:FLY.Thick.Blowing.UI.Fix.Server"
mc:Ignorable="d"
Title="MainWindow" SizeToContent="WidthAndHeight" MinWidth="400" MinHeight="200"
ShowsNavigationUI="False"
Loaded="NavigationWindow_Loaded">
</NavigationWindow>
<Grid TextBlock.FontSize="24" TextBlock.FontStyle="Normal" >
<StackPanel Orientation="Vertical" >
<StackPanel Orientation="Vertical" Margin="5,20">
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Text="本地地址" />
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding LocalEP}" MinWidth="250"/>
</StackPanel>
</StackPanel>
<Button x:Name="btnOpen" Content="打开图片文件夹" FontSize="25" Width="AUTO" Click="button_open_Click"/>
</StackPanel>
</StackPanel>
</Grid>
</Window>
using FLY.Thick.Blowing.Server;
using FLY.Thick.Blowing.Server.OBJProxy;
using System.Windows;
using System.Windows.Navigation;
namespace FLY.Thick.Blowing.UI.Fix.Server
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : NavigationWindow
{
FLY.AppHelper.WindowNotifyIconHelper notifyiconhelper;
TDGage mGage;
OBJProxy mOBJProxy;
PicHistory mPicHistory;
PicHistory picHistory;
public MainWindow()
{
InitializeComponent();
mGage = new TDGage("Gage1");
mOBJProxy = new OBJProxy(0, mGage);
mPicHistory = new PicHistory();
if (!mPicHistory.Enable)
btnOpen.Visibility = Visibility.Collapsed;
mGage.scanWarning.ScanWarningCheck += (s, e) =>
{
mPicHistory.Add(e.profile, e.scandata, e.isWarning);
};
Misc.BindingOperations.SetBinding(mGage.scanWarning, "IsAutoTarget", mPicHistory, "IsAutoTarget");
PgLoading p = new PgLoading();
this.Navigate(p);
this.Title = (new Misc.Ver() { SrcType = typeof(MainWindow) }).ToString();
notifyiconhelper = new AppHelper.WindowNotifyIconHelper(this, this.Title);
}
this.Hide();
private async void NavigationWindow_Loaded(object sender, RoutedEventArgs e)
{
mGage = new TDGage("Gage1");
await mGage.Init();
mOBJProxy = new OBJProxy(0, mGage);
FObjBase.PollModule.Current.Start();
this.DataContext = mGage.sysParam;
}
//周期保存图片
picHistory = new PicHistory();
picHistory.Init(
mGage.bulkDb,
mGage.scanWarning,
mGage.profile.Param);
private void button_open_Click(object sender, RoutedEventArgs e)
{
string path = mPicHistory.RootPath;
System.Diagnostics.Process.Start("explorer.exe", path);
this.Hide();
PgMain p = new PgMain();
p.Init(mGage, picHistory);
this.Navigate(p);
this.NavigationService.RemoveBackEntry();
}
//private void button_open_Click(object sender, RoutedEventArgs e)
//{
// string path = mPicHistory.RootPath;
// System.Diagnostics.Process.Start("explorer.exe", path);
//}
}
}
<Page x:Class="FLY.Thick.Blowing.UI.Fix.Server.PgLoading"
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"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="PgLoading" >
<Grid>
<TextBlock x:Name="message" VerticalAlignment="Center" HorizontalAlignment="Center" Text="初始化中......" FontSize="24"/>
</Grid>
</Page>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace FLY.Thick.Blowing.UI.Fix.Server
{
/// <summary>
/// PgLoading.xaml 的交互逻辑
/// </summary>
public partial class PgLoading : Page
{
public PgLoading()
{
InitializeComponent();
}
}
}
<Page x:Class="FLY.Thick.Blowing.UI.Fix.Server.PgMain"
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.Thick.Blowing.UI.Fix.Server"
mc:Ignorable="d"
Background="White"
Title="PgMain">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:ConnectionValueConverter x:Key="connectionConv"/>
</ResourceDictionary>
</Page.Resources>
<Grid >
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
<Button Style="{StaticResource Styles.Button.Square.Accent2}"
Content="设置" Command="{Binding SetupCmd}"/>
<Button Style="{StaticResource Styles.Button.Square.Accent2}" Width="auto"
Content="图片数据" Command="{Binding PicSetupCmd}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}" >
<StackPanel Margin="{StaticResource ControlMargin}" DataContext="{Binding SysParam}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="服务地址"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding LocalEP}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" DataContext="{Binding InitParam}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="数据库保存时间"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding DBKeepMonth}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="月"/>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}" DataContext="{Binding FlyAd}">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="AD盒地址"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding LocalEP}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="AD盒状态"/>
<TextBlock Text="{Binding IsConnected,Converter={StaticResource connectionConv}}">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldContent}">
<Setter Property="Foreground" Value="Red"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsConnected}" Value="True">
<Setter Property="Foreground" Value="Green"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="AD值"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding AD}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="脉冲"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding Position}"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</Page>
using FLY.Thick.Base.Server;
using FLY.Thick.Blowing.Server;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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;
namespace FLY.Thick.Blowing.UI.Fix.Server
{
/// <summary>
/// PgMain.xaml 的交互逻辑
/// </summary>
public partial class PgMain : Page
{
PgMainVm viewModel;
public PgMain()
{
InitializeComponent();
}
public void Init(TDGage mGage, PicHistory picHistory)
{
viewModel = new PgMainVm();
viewModel.Init(mGage, picHistory);
this.DataContext = viewModel;
}
}
public class PgMainVm : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public SysParam SysParam { get; set; }
public InitParam InitParam { get; set; }
public FlyADBase.FlyAD7 FlyAd { get; set; }
public RelayCommand SetupCmd { get; private set; }
public RelayCommand PicSetupCmd { get; private set; }
PicHistory picHistory;
public PgMainVm()
{
SetupCmd = new RelayCommand(Setup);
PicSetupCmd = new RelayCommand(PicSetup);
}
private void PicSetup()
{
WdPicHistory w = new WdPicHistory();
w.Init(picHistory);
w.Owner = App.Current.MainWindow;
w.ShowDialog();
}
public void Init(TDGage mGage, PicHistory picHistory)
{
SysParam = mGage.sysParam;
InitParam = mGage.initParam;
FlyAd = mGage.flyAd;
this.picHistory = picHistory;
}
private void Setup()
{
//打开设置页面
WdSetup w = new WdSetup();
w.Init(SysParam, FlyAd, InitParam);
w.Owner = App.Current.MainWindow;
w.ShowDialog();
}
}
public class ConnectionValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool? b = (bool?)value;
if (b == null)
return null;
else if (b == true)
return "连接成功";
else
return "连接断开";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace FLY.Thick.Blowing.UI.Fix.Server
{
public static class ChartToImage
{
public static void SaveToJpeg(FrameworkElement visual, string fileName)
{
var encoder = new JpegBitmapEncoder();
EncodeVisual(visual, fileName, encoder);
}
static void EncodeVisual(FrameworkElement visual, string fileName, BitmapEncoder encoder)
{
var bitmap = new RenderTargetBitmap((int)visual.ActualWidth, (int)visual.ActualHeight, 96, 96, PixelFormats.Pbgra32);
bitmap.Render(visual);
var frame = BitmapFrame.Create(bitmap);
encoder.Frames.Add(frame);
using (var stream = File.Create(fileName)) encoder.Save(stream);
}
}
}
using Misc;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace FLY.Thick.Blowing.UI.Fix.Server
{
/// <summary>
/// ColumnRangeScanGraph.xaml 的交互逻辑
/// </summary>
public partial class ScanGraph : UserControl
{
public ScanGraph()
{
InitializeComponent();
}
public void Init(
ScanGraphVm viewModel)
{
this.DataContext = viewModel;
//下面是 livechart 的 bug
//没有 触发 ChartUpdater.Timer 的事件前,就算 axisX.DataContext 有值, binding 也无效, 无法获取数据
axisX_0.SetBinding( LiveCharts.Wpf.Axis.LabelFormatterProperty, new Binding(nameof(viewModel.XFormatter)) { Source = viewModel });
axisX_0.SetBinding( LiveCharts.Wpf.Axis.MinValueProperty, new Binding(nameof(viewModel.XMin)) { Source = viewModel });
axisX_0.SetBinding( LiveCharts.Wpf.Axis.MaxValueProperty, new Binding(nameof(viewModel.XMax)) { Source = viewModel });
axisX_0.Separator.SetBinding( LiveCharts.Wpf.Separator.StepProperty, new Binding(nameof(viewModel.XStep)) { Source = viewModel });
axisY_0.SetBinding( LiveCharts.Wpf.Axis.LabelFormatterProperty, new Binding(nameof(viewModel.YFormatter)) { Source = viewModel });
axisY_0.SetBinding( LiveCharts.Wpf.Axis.MinValueProperty, new Binding(nameof(viewModel.YMin)) { Source = viewModel });
axisY_0.SetBinding( LiveCharts.Wpf.Axis.MaxValueProperty, new Binding(nameof(viewModel.YMax)) { Source = viewModel });
axisY_0.Sections[0].SetBinding( LiveCharts.Wpf.AxisSection.ValueProperty, new Binding(nameof(viewModel.YMax)) { Source = viewModel });
axisY_0.Sections[1].SetBinding( LiveCharts.Wpf.AxisSection.ValueProperty, new Binding(nameof(viewModel.YMin)) { Source = viewModel });
axisY_0.Sections[2].SetBinding( LiveCharts.Wpf.AxisSection.ValueProperty, new Binding(nameof(viewModel.Tolerance2YMax)) { Source = viewModel });
axisY_0.Sections[3].SetBinding( LiveCharts.Wpf.AxisSection.ValueProperty, new Binding(nameof(viewModel.Tolerance2YMin)) { Source = viewModel });
axisY_0.Sections[4].SetBinding( LiveCharts.Wpf.AxisSection.ValueProperty, new Binding(nameof(viewModel.ToleranceYMax)) { Source = viewModel });
axisY_0.Sections[5].SetBinding( LiveCharts.Wpf.AxisSection.ValueProperty, new Binding(nameof(viewModel.ToleranceYMin)) { Source = viewModel });
axisY_0.Sections[6].SetBinding( LiveCharts.Wpf.AxisSection.ValueProperty, new Binding(nameof(viewModel.Target)) { Source = viewModel });
series_0.SetBinding(LiveCharts.Wpf.Column2Series.YAxisCrossingProperty, new Binding(nameof(viewModel.Target)) { Source = viewModel });
series_0.SetBinding(LiveCharts.Wpf.Column2Series.ValuesProperty, new Binding(nameof(viewModel.Values)) { Source = viewModel });
series_0.SetBinding(LiveCharts.Wpf.Column2Series.ConfigurationProperty, new Binding(nameof(viewModel.Mapper)) { Source = viewModel });
}
public void ChartUpdate()
{
chart.Update(true, true); //force chart redraw
}
}
}
using FLY.Thick.Blowing.Server.Model;
using Misc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.UI.Fix.Server
{
public class ScanGraphVmUt: ScanGraphVm
{
public ScanGraphVmUt()
{
SimuData();
}
void SimuData()
{
picHistory = new PicHistory();
picHistory.IsPercent = true;
picHistory.YRangePercent = 3;
picHistory.XStep = 10;
profileParam = new Common.BlowingFixProfileParam();
profileParam.Target = 150;
profileParam.TolerancePercent = 0.02;
profileParam.PName = "hahahah";
profileParam.OrderNo = "00-01212";
profileParam.Number = "13";
#region 数据
double target = profileParam.Target;
double tolerance = target * profileParam.TolerancePercent;
double yrangepercent = picHistory.YRangePercent;
int nbolts = 88;
double[] datas = new double[nbolts];
Random random = new Random();
for (int i = 0; i < nbolts; i++)
{
datas[i] = (Math.Sin(i * Math.PI / nbolts) * 3) * tolerance + target + (random.NextDouble() - 0.5) * 1 - 6;
}
scanData = new Lc_ScanData
{
ID = 1234456,
FilmVelocity = 40.1,
Time = DateTime.Now.AddSeconds(-30),
EndTime = DateTime.Now,
K = 1,
Thicks = datas
};
#endregion
#region 界面数据
UpdateTitle();
UpdateValue(
new IService.Pack_GetFrameReponse()
{
scanData = scanData,
Request = new IService.Pack_GetFrameRequest
{
Mix = 2,
}
}, true);
#endregion
}
}
}
<Window x:Class="FLY.Thick.Blowing.UI.Fix.Server.WdPicHistory"
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:FLY.Thick.Blowing.UI.Fix.Server"
mc:Ignorable="d"
Title="WdPicHistory" Height="450" Width="800">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Blowing.UI.Fix.Server;component/Themes/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid x:Name="grid_root"/>
<Grid Margin="{StaticResource ControlMargin}" >
<local:ScanGraph x:Name="scanGraph" />
</Grid>
<StackPanel Margin="{StaticResource ControlMargin}" Grid.Row="1" >
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="使能"/>
<CheckBox IsChecked="{Binding Enable}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="图片文件夹路径"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding RootPath}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="图片保存时间间隔"/>
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding IntervalMin}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="min"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" DataContext="{Binding PicHistory}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="当前计时"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding CounterSec}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="s"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="图片保存天数"/>
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding KeepDay}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="天"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" DataContext="{Binding PicHistory}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="当前保存图片天数"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding CurrDays}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="天"/>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="图片宽度"/>
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding PicWidth}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="像素"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="图片高度"/>
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding PicHeight}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="像素"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="X轴间隔"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding XStep}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="Y轴比例"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding YRangePercent}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="Y轴%显示"/>
<CheckBox IsChecked="{Binding IsPercent}"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" >
<Button Style="{StaticResource Styles.Button.Square.Accent2}" Content="图片保存" Click="btnSavePicClick" Width="auto"/>
<Button Style="{StaticResource Styles.Button.Square.Accent2}" Content="确定" Command="{Binding OkCmd}" />
</StackPanel>
</StackPanel>
</Grid>
</Window>
using GalaSoft.MvvmLight.Command;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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 FLY.Thick.Blowing.UI.Fix.Server
{
/// <summary>
/// WdPicHistory.xaml 的交互逻辑
/// </summary>
public partial class WdPicHistory : Window
{
WdPicHistoryVm viewModel;
PicHistory picHistory;
public WdPicHistory()
{
InitializeComponent();
}
public void Init(PicHistory picHistory)
{
this.picHistory = picHistory;
viewModel = new WdPicHistoryVm();
this.viewModel.Init(picHistory);
this.DataContext = viewModel;
scanGraph.Init(picHistory.scanGraphVm);
}
private void btnSavePicClick(object sender, RoutedEventArgs e)
{
string strDesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
SaveFileDialog sfd = new SaveFileDialog();
sfd.InitialDirectory = strDesktopPath;
sfd.Filter = "jpg|*.jpg";
sfd.FileName = System.IO.Path.ChangeExtension(System.IO.Path.GetRandomFileName(),".jpg");
if (sfd.ShowDialog() == true)
{
//ChartToImage.SaveToJpeg(scanGraph, sfd.FileName);
picHistory.SavePic(sfd.FileName);
}
}
}
public class WdPicHistoryVm : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public bool Enable { get; set; }
/// <summary>
/// 图片文件夹路径
/// </summary>
public string RootPath { get; set; } = PicHistory.DefaultRootPath;
/// <summary>
/// 图片宽度
/// </summary>
public int PicWidth { get; set; } = 1024;
/// <summary>
/// 图片高度
/// </summary>
public int PicHeight { get; set; } = 768 / 3;
/// <summary>
/// 数据能保存的天数
/// </summary>
public int KeepDay { get; set; } = 360;
/// <summary>
/// X轴间隔
/// </summary>
public int XStep { get; set; } = 10;
/// <summary>
/// Y轴比例
/// </summary>
public double YRangePercent { get; set; } = 3;
/// <summary>
/// 间隔时间
/// </summary>
public double IntervalMin { get; set; } = 1;
/// <summary>
/// Y轴%显示
/// </summary>
public bool IsPercent { get; set; } = true;
public RelayCommand OkCmd { get; private set; }
private PicHistory picHistory;
public PicHistory PicHistory => picHistory;
public WdPicHistoryVm()
{
OkCmd = new RelayCommand(Ok);
}
public void Init(PicHistory picHistory)
{
Enable = picHistory.Enable;
RootPath = picHistory.RootPath;
PicWidth = picHistory.PicWidth;
PicHeight = picHistory.PicHeight;
KeepDay = picHistory.KeepDay;
XStep = picHistory.XStep;
YRangePercent = picHistory.YRangePercent;
IntervalMin = picHistory.IntervalMin;
IsPercent = picHistory.IsPercent;
this.picHistory = picHistory;
}
private void Ok()
{
//检查
if (!System.IO.Directory.Exists(RootPath)) {
try
{
System.IO.Directory.CreateDirectory(RootPath);
}
catch (Exception e) {
MessageBox.Show($"图片文件夹路径 {RootPath} 异常,{e}");
return;
}
}
if (PicWidth < 100 || PicWidth > 2000)
{
MessageBox.Show($"图片宽度 异常, 应该 >=100 and <2000");
return;
}
if (PicHeight < 100 || PicHeight > 2000)
{
MessageBox.Show($"图片高度 异常, 应该 >=100 and <2000");
return;
}
if (KeepDay < 1 || KeepDay > 2000)
{
MessageBox.Show($"数据能保存的天数 异常, 应该 >=1 and <2000");
return;
}
if (XStep < 1)
{
MessageBox.Show($"X轴间隔 异常, 应该 >=1");
return;
}
if (YRangePercent < 1)
{
MessageBox.Show($"Y轴比例 异常, 应该 >=1");
return;
}
if (IntervalMin < 1)
{
MessageBox.Show($"图片保存时间间隔 异常, 应该 >=1min");
return;
}
picHistory.Enable = Enable;
picHistory.RootPath = RootPath;
picHistory.PicWidth = PicWidth;
picHistory.PicHeight = PicHeight;
picHistory.KeepDay = KeepDay;
picHistory.XStep = XStep;
picHistory.YRangePercent = YRangePercent;
picHistory.IntervalMin = IntervalMin;
picHistory.IsPercent = IsPercent;
picHistory.Save();
MessageBox.Show($"设置完成");
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="Styles.Button.Square.Accent2" TargetType="Button" >
<Setter Property="FontSize" Value="20"/>
<Setter Property="Width" Value="100"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="Padding" Value="20,5"/>
</Style>
<Style x:Key="Styles.Button.Square2" TargetType="Button" >
<Setter Property="FontSize" Value="12"/>
<Setter Property="Width" Value="100"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="Padding" Value="20,5"/>
</Style>
</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:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf">
<!--扫描图,纵向趋势图Y轴 标签-->
<Style x:Key="AxisSectionStyle" TargetType="lvc:AxisSection" >
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="DataLabel" Value="True"/>
<Setter Property="DisableAnimations" Value="True"/>
<Setter Property="DataLabelForeground" Value="White"/>
<Setter Property="Opacity" Value="0.5"/>
<Setter Property="Panel.ZIndex" Value="1"/>
</Style>
</ResourceDictionary>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
namespace FLY.Thick.Blowing.UI.Fix.Server.Themes
{
public static class Colors
{
public static List<Brush> AreaColors;
static Colors()
{
var resourceDictionary = new ResourceDictionary() { Source = new Uri("pack://application:,,,/FLY.Thick.Blowing.UI.Fix.Server;component/Themes/Colors.xaml") };
AreaColors = new List<Brush>();
for (int i = 0; i < 5; i++)
AreaColors.Add(resourceDictionary[$"Brushes.ChartArea{i}"] as SolidColorBrush);
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--Blue-->
<!--<SolidColorBrush x:Key="Brushes.ChartArea0" Color="#CC119EDA" />
<SolidColorBrush x:Key="Brushes.ChartArea1" Color="#CC086F9E"/>
<SolidColorBrush x:Key="Brushes.ChartArea2" Color="#CCEB2F2F" />
<SolidColorBrush x:Key="Brushes.ChartArea3" Color="#CCA59F93" />
<SolidColorBrush x:Key="Brushes.ChartArea4" Color="#22000000" />
<SolidColorBrush x:Key="Brushes.ChartAxisLabel0" Color="#FF119EDA" />
<SolidColorBrush x:Key="Brushes.ChartAxisLabel1" Color="#FF086F9E"/>
<SolidColorBrush x:Key="Brushes.ChartAxisLabel2" Color="#FFEB2F2F" />
<SolidColorBrush x:Key="Brushes.ChartAxisLabel3" Color="#FFA59F93" />-->
<!--Green-->
<!--MahApps.Brushes.Accent-->
<SolidColorBrush x:Key="Brushes.ChartArea0" Color="#CC60A917" />
<!--MahApps.Brushes.ValidationSummary4-->
<SolidColorBrush x:Key="Brushes.ChartArea1" Color="#ccfec007"/>
<!--MahApps.Brushes.ValidationSummary2-->
<SolidColorBrush x:Key="Brushes.ChartArea2" Color="#CCCA000C" />
<SolidColorBrush x:Key="Brushes.ChartArea3" Color="#CCA59F93" />
<SolidColorBrush x:Key="Brushes.ChartArea4" Color="#22000000" />
<!--MahApps.Brushes.Accent-->
<SolidColorBrush x:Key="Brushes.ChartAxisLabel0" Color="#FF60A917" />
<!--MahApps.Brushes.ValidationSummary5-->
<SolidColorBrush x:Key="Brushes.ChartAxisLabel1" Color="#FFFD7070"/>
<!--MahApps.Brushes.ValidationSummary2-->
<SolidColorBrush x:Key="Brushes.ChartAxisLabel2" Color="#FFCA000C" />
<SolidColorBrush x:Key="Brushes.ChartAxisLabel3" Color="#FFA59F93" />
<SolidColorBrush x:Key="Brushes.ChartSeparator" Color="LightGray" />
<SolidColorBrush x:Key="Brushes.ChartAxisLabel" Color="Black" />
</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:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="TextStyle.xaml"/>
<ResourceDictionary Source="ButtonStyle.xaml"/>
<ResourceDictionary Source="ChartStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- 标准间隔 -->
<Thickness x:Key="ControlMargin">5</Thickness>
</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">
<!-- 只读项 的标题 -->
<Style TargetType="TextBlock" x:Key="Styles.Text.FieldHeader">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontFamily" Value="YouYuan" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<!-- 只读项 的标题 2行 -->
<Style TargetType="TextBlock" x:Key="Styles.Text.FieldHeader.Row2" BasedOn="{StaticResource Styles.Text.FieldHeader}">
<Setter Property="FontSize" Value="10" />
</Style>
<!-- 可写项 的标题 -->
<Style TargetType="TextBlock" x:Key="Styles.Text.FieldHeader.Editable" BasedOn="{StaticResource Styles.Text.FieldHeader}">
<Setter Property="Foreground" Value="#FF0083D7" />
</Style>
<Style TargetType="TextBlock" x:Key="Styles.Text.FieldHeader.Comment" BasedOn="{StaticResource Styles.Text.FieldHeader}">
<Setter Property="Foreground" Value="#FF888888" />
<Setter Property="FontSize" Value="10" />
</Style>
<!-- 可写项 的标题 2行 -->
<Style TargetType="TextBlock" x:Key="Styles.Text.FieldHeader.Editable.Row2" BasedOn="{StaticResource Styles.Text.FieldHeader.Editable}">
<Setter Property="FontSize" Value="10" />
</Style>
<!-- 只读项 内容 -->
<Style TargetType="TextBlock" x:Key="Styles.Text.FieldContent">
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="15" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="TextAlignment" Value="Left" />
</Style>
<!-- 内容的分割线 -->
<Style TargetType="TextBlock" x:Key="Styles.Text.FieldContent.Separator">
<Setter Property="Foreground" Value="#FF888888" />
<Setter Property="FontSize" Value="15" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Text" Value="|" />
</Style>
<!-- 内容的单位 -->
<Style TargetType="TextBlock" x:Key="Styles.Text.FieldContent.Unit">
<Setter Property="Foreground" Value="#FF888888" />
<Setter Property="FontSize" Value="10" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
<!-- 输入框 内容 -->
<Style TargetType="TextBox" x:Key="Styles.Text.FieldContent.Input" >
<Setter Property="Margin" Value="3" />
<Setter Property="Foreground" Value="#FF3B3B3B" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="15" />
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="MinWidth" Value="30" />
</Style>
</ResourceDictionary>
\ No newline at end of file
<Window x:Class="FLY.Thick.Blowing.UI.Fix.Server.WdSetup"
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:FLY.Thick.Blowing.UI.Fix.Server"
mc:Ignorable="d"
Title="WdSetup" MinHeight="200" MinWidth="400" SizeToContent="WidthAndHeight" >
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}" >
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="服务地址"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding Addr}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="AD盒地址"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding FlyAdAddr}"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
<Button Style="{StaticResource Styles.Button.Square.Accent2}"
Content="确定" Command="{Binding OkCmd}"/>
</StackPanel>
</StackPanel>
</Grid>
</Window>
using FLY.Thick.Base.Server;
using FlyADBase;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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 FLY.Thick.Blowing.UI.Fix.Server
{
/// <summary>
/// WdSetup.xaml 的交互逻辑
/// </summary>
public partial class WdSetup : Window
{
WdSetupVm viewModel;
public WdSetup()
{
InitializeComponent();
}
public void Init(SysParam sysParam,FlyAD7 flyAd, InitParam initParam)
{
viewModel = new WdSetupVm();
viewModel.Init(sysParam, flyAd, initParam);
this.DataContext = viewModel;
}
}
public class WdSetupVm : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public string Addr { get; set; }
public string FlyAdAddr { get; set; }
public RelayCommand OkCmd { get; private set; }
SysParam sysParam;
FlyAD7 flyAd;
InitParam initParam;
public WdSetupVm()
{
OkCmd = new RelayCommand(Ok);
}
public void Init(SysParam sysParam, FlyAD7 flyAd, InitParam initParam)
{
this.sysParam = sysParam;
this.flyAd = flyAd;
this.initParam = initParam;
Addr = sysParam.LocalEP.ToString();
FlyAdAddr = flyAd.LocalEP.ToString();
}
private void Ok()
{
if (MessageBox.Show($"程序必须重启才能执行新的参数, 是否重启?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
{
return;
}
sysParam.LocalEP = Misc.StringConverter.ToIPEndPoint(Addr);
sysParam.Save();
flyAd.LocalEP = Misc.StringConverter.ToIPEndPoint(FlyAdAddr);
System.Environment.CurrentDirectory = "../";
AppHelper.AppJustOne.Restart();
}
}
}
<Window x:Class="FLY.Thick.Blowing.UI.Fix.Server.WindowSavePic"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
Title="WindowSavePic" >
<Grid>
<WindowsFormsHost Background="Black" Width="1024" Height="250">
<Chr:Chart x:Name="chart1" Width="1024" Height="250"/>
</WindowsFormsHost>
</Grid>
</Window>
......@@ -254,7 +254,7 @@
<StackPanel >
<TextBlock Style="{StaticResource Styles.Card.Title}" Text="参数膜距离增量"/>
<StackPanel Orientation="Horizontal">
<Button Content="应用新数据" Style="{StaticResource Styles.Button.Square.Accent2}" Command="{Binding ApplyFilmLength3Cmd}"
<Button Content="应用新数据" Style="{StaticResource Styles.Button.Square.Accent2}" Command="{Binding ApplyFilmLength3DCmd}"
IsEnabled="{Binding Cfl.IsDataReady}"/>
</StackPanel>
......
......@@ -42,7 +42,7 @@ namespace FLY.Thick.Blowing.Server
public event ScanWarningCheckEventHandler ScanWarningCheck;
enum CheckResult
public enum CheckResult
{
Idle,
ToleranceWarning,
......@@ -55,7 +55,7 @@ namespace FLY.Thick.Blowing.Server
/// <param name="tolerancePercent"></param>
/// <param name="data"></param>
/// <returns></returns>
CheckResult Check(double target, double tolerancePercent, double[] data)
public CheckResult Check(double target, double tolerancePercent, double[] data)
{
double avg = data.AverageNoNull();
if (double.IsNaN(avg))
......
......@@ -17,6 +17,7 @@ using FLY.Thick.Base.Server;
using FLY.Thick.RemoteHistory;
using FLY.Thick.BulkDataModule;
using FLY.Thick.Blowing.Server.Model;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.Server
{
......@@ -133,6 +134,7 @@ namespace FLY.Thick.Blowing.Server
#endregion
public TDGage(string nam)
{
mName = nam;
......@@ -171,28 +173,27 @@ namespace FLY.Thick.Blowing.Server
gmRenZiJiaFix = new GM_BlowingFix(flyAd);
#endregion
}
#region 注入初始化
async Task Init_db()
{
//---------------------------------------------------------------------------------------------------------------
//数据库
dbModel.Init();
dbModel.KeepDBSize(initParam.DBKeepMonth);
await Task.Factory.StartNew(() =>
{
dbModel.Init();
dbModel.KeepDBSize(initParam.DBKeepMonth);
});
historyDb.Init(dbModel, localDb);
//orgDbModel.Init();
//orgHistoryDb.Init(orgDbModel);
//orgHistoryDb.KeepDbSize(3);
//PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD, () =>
//{
// //避免1个月都不关程序,每天检查一次
// orgHistoryDb.KeepDbSize(3);
//}, TimeSpan.FromDays(1));
bulkDb.Init(historyDb, localDb, dbModel);
}
public async Task Init()
{
#region 注入初始化
//数据库 配置----------------------------------------
//就只是数据库操作会慢而已!!!!!!
await Init_db();
//---------------------------------------------------------------------------------------------------------------
......
Subproject commit 1131b035b78ea3c8c62ca22c65eadae4ac0b5733
Subproject commit b30a5aa7c5f4c61eb2d391644adcdf637e6e1eb1
......@@ -9,6 +9,7 @@
<alias alias="UserControl" type="System.Windows.Controls.UserControl,PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<container>
<register type="UserControl" mapTo="UcSectionOsk" name="osk" />
<register type="UserControl" mapTo="UcSectionError" name="error" />
</container>
</unity>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,Unity.Configuration" />
</configSections>
<unity>
<assembly name="FLY.Thick.Base.UI" />
<namespace name="FLY.Thick.Base.UI" />
<namespace name="FLY.Thick.Base.UI.OnInit" />
<assembly name="FLY.OBJComponents" />
<namespace name="FLY.OBJComponents.IService" />
<namespace name="FLY.OBJComponents.Client" />
<alias alias="IOnInit" type="MultiLayout.UiModule.IOnInit, MultiLayout" />
<container>
<register type="LCUS1" mapTo="LCUS1_dependOn">
<lifetime type="singleton" />
</register>
</container>
</unity>
</configuration>
\ No newline at end of file
......@@ -6,12 +6,17 @@
<unity>
<assembly name="FLY.Thick.Base.UI" />
<namespace name="FLY.Thick.Base.UI" />
<namespace name="FLY.Thick.Base.UI.OnInit" />
<alias alias="Window" type="System.Windows.Window,PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<alias alias="IOnInit" type="MultiLayout.UiModule.IOnInit, MultiLayout" />
<container>
<register type="LCUS1" mapTo="LCUS1_dependOn">
<register type="Window" mapTo="WdIOTip" name="wdIOTip" />
<register type="IOnInit" mapTo="OnInitError" name="error">
<lifetime type="singleton" />
</register>
<register type="IOnInit" mapTo="OnInitLcus1_One" name="lcus1">
<lifetime type="singleton" />
</register>
<register type="Window" mapTo="WdIOTip" name="wdIOTip" />
</container>
</unity>
</configuration>
\ No newline at end of file
{
"Name": "root",
"Path": [
"root.config"
"root.config",
"lcus1.config"
],
"Children": [
{
......
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