Commit 0345fdec authored by 潘栩锋's avatar 潘栩锋 🚴

删除 删除以前的 纵向趋势图

parent fdaa6221
......@@ -186,17 +186,7 @@
<Compile Include="UiModule\TrendGraph2\TrendGraphParam2s.cs" />
<Compile Include="UiModule\TrendGraph2\TrendGraphVm2.cs" />
<Compile Include="UiModule\TrendGraph2\TrendGraphVm2Ut.cs" />
<Compile Include="UiModule\TrendGraph2\UiModule2_TrendGraph2.cs" />
<Compile Include="UiModule\TrendGraph\TrendGraph.xaml.cs">
<DependentUpon>TrendGraph.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\TrendGraph\TrendGraphConfig.xaml.cs">
<DependentUpon>TrendGraphConfig.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\TrendGraph\TrendGraphItemParam.cs" />
<Compile Include="UiModule\TrendGraph\TrendGraphParams.cs" />
<Compile Include="UiModule\TrendGraph\TrendGraphVm.cs" />
<Compile Include="UiModule\TrendGraph\UiModule2_TrendGraph.cs" />
<Compile Include="UiModule\TrendGraph2\UiModule2_TrendGraph.cs" />
<Compile Include="WdIOTip.xaml.cs">
<DependentUpon>WdIOTip.xaml</DependentUpon>
</Compile>
......@@ -303,14 +293,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\TrendGraph\TrendGraph.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\TrendGraph\TrendGraphConfig.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdIOTip.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
......@@ -61,7 +61,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
private void button_version_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start(@"版本说明.txt");
//System.Diagnostics.Process.Start(@"版本说明.txt");
}
private void button_instruction_Click(object sender, RoutedEventArgs e)
......
<UserControl x:Class="FLY.Thick.Blowing.UI.Fix.Client.UiModule.TrendGraph"
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:ControlLibrary="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<ControlLibrary:GraphRange x:Name="graphrange"/>
</Grid>
</UserControl>
using FLY.ControlLibrary;
using FLY.Thick.Blowing.Common;
using FLY.Thick.Blowing.IService;
using System;
using System.Collections.ObjectModel;
using System.Windows.Controls;
using System.Windows.Data;
using Unity;
namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
{
/// <summary>
/// TrendGraph.xaml 的交互逻辑
/// </summary>
public partial class TrendGraph : UserControl
{
TrendGraphVm viewModel;
public TrendGraph()
{
InitializeComponent();
}
[InjectionMethod]
public void Init(int id,
IBulkDbService bulkDb,
IBlowingFixProfileService profileService)
{
var graphparam = TrendGraphParams.Current.Items.Find(p => p.ID == id);
if (graphparam == null)
{
graphparam = new TrendGraphItemParam() { ID = id };
TrendGraphParams.Current.Items.Add(graphparam);
TrendGraphParams.Current.Save();
}
viewModel = new TrendGraphVm();
viewModel.Init(graphparam, bulkDb, profileService.Param, graphrange);
}
}
}
<flyctrllib:WindowBigClose x:Class="FLY.Thick.Blowing.UI.Fix.Client.UiModule.TrendGraphConfig"
xmlns:flyctrllib="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
Title="Window_graphtrend"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="WhiteSmoke"
SizeToContent="WidthAndHeight"
>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid TextBlock.FontSize="24" TextBlock.FontStyle="Normal" Width="400">
<StackPanel Margin="5,20">
<WrapPanel Orientation="Horizontal">
<StackPanel Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="混合数" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Mix}" />
</StackPanel>
</StackPanel>
<StackPanel Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="长度" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Len}" />
</StackPanel>
</StackPanel>
<StackPanel Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="曲线类型"/>
<ComboBox HorizontalAlignment="Left" MinWidth="100">
<ComboBoxItem IsSelected="{Binding Type, Converter={StaticResource e2bconv}, ConverterParameter={x:Static flyctrllib:GraphRangeType.Sigma2} }">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" FontSize="32" Text="2σ"/>
</ComboBoxItem>
<ComboBoxItem IsSelected="{Binding Type, Converter={StaticResource e2bconv}, ConverterParameter={x:Static flyctrllib:GraphRangeType.Avg}}">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" FontSize="32" Text="均值"/>
</ComboBoxItem>
<ComboBoxItem IsSelected="{Binding Type, Converter={StaticResource e2bconv}, ConverterParameter={x:Static flyctrllib:GraphRangeType.All}}" >
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" FontSize="32" >
<Run Text="2σ+"/><Run Text="均值"/>
</TextBlock>
</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="X轴类型" />
<ComboBox HorizontalAlignment="Left" MinWidth="100">
<ComboBoxItem IsSelected="{Binding XType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static flyctrllib:GraphRangeXAxisType.Time}}">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" FontSize="32" Text="时间"/>
</ComboBoxItem>
<ComboBoxItem IsSelected="{Binding XType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static flyctrllib:GraphRangeXAxisType.Index}}">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" FontSize="32" Text="序号"/>
</ComboBoxItem>
</ComboBox>
</StackPanel>
</WrapPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="自动目标值" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding IsAutoTarget}" />
</StackPanel>
<StackPanel Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="%显示" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding IsPercent}" />
</StackPanel>
<StackPanel Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="Y轴比例" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding YRangePercent}" />
</StackPanel>
</StackPanel>
</StackPanel>
<Button Style="{StaticResource ButtonStyle2}" Content="保存" Width="auto" Margin="5" Click="button_save_Click"/>
</StackPanel>
</Grid>
</flyctrllib:WindowBigClose >
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.ComponentModel;
using FLY.Thick.Base.UI.Converter;
using FLY.ControlLibrary;
namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
{
/// <summary>
/// Window_graphtrend.xaml 的交互逻辑
/// </summary>
public partial class TrendGraphConfig : FLY.ControlLibrary.WindowBigClose
{
public TrendGraphConfig()
{
InitializeComponent();
}
public event EventHandler SaveEvent;
private void button_save_Click(object sender, RoutedEventArgs e)
{
if (SaveEvent != null)
SaveEvent.Invoke(this, new EventArgs());
}
}
}
using MultiLayout.UiModule;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
{
/// <summary>
/// 纵向图的参数
/// </summary>
public class TrendGraphItemParam : UIModuleParam
{
/// <summary>
/// 数据量
/// </summary>
public int Len { get; set; } = 100;
/// <summary>
/// 曲线类型
/// </summary>
public FLY.ControlLibrary.GraphRangeType Type { get; set; } = FLY.ControlLibrary.GraphRangeType.Avg;
/// <summary>
/// X轴类型
/// </summary>
public FLY.ControlLibrary.GraphRangeXAxisType XType { get; set; } = FLY.ControlLibrary.GraphRangeXAxisType.Time;
/// <summary>
/// Y轴比例
/// </summary>
public double YRangePercent { get; set; } = 3;
/// <summary>
/// 混合图
/// </summary>
public int Mix { get; set; } = 1;
/// <summary>
/// 自动目标值
/// </summary>
public bool IsAutoTarget { get; set; } = true;
/// <summary>
/// % 显示
/// </summary>
public bool IsPercent { get; set; } = true;
}
}
using MultiLayout;
using MultiLayout.UiModule;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
{
/// <summary>
/// 全部扫描图的参数
/// </summary>
public class TrendGraphParams : UIModuleParams<TrendGraphItemParam>
{
public TrendGraphParams()
{
string path = System.IO.Path.Combine(FlyLayout.BasePath, "trendgraph.json");
FilePath = path;
}
static TrendGraphParams current = null;
public static TrendGraphParams Current
{
get
{
if (current == null)
{
current = new TrendGraphParams();
current.Load();
}
return current;
}
}
}
}
using FLY.ControlLibrary;
using FLY.Thick.Blowing.Common;
using FLY.Thick.Blowing.IService;
using Misc;
using OfficeOpenXml.ConditionalFormatting;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
{
public class TrendGraphVm : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public int Target { get; set; }
public int Alarm { get; set; }
ObservableCollection<GraphRangeData> Values = new ObservableCollection<GraphRangeData>();
public string Info => $"{Time:MM-dd HH:mm:ss} ID:{Id} 混合数:{Mix}";
/// <summary>
/// 测量时间
/// </summary>
public DateTime Time { get; private set; }
/// <summary>
/// 数据库中的序号
/// </summary>
public long Id { get; private set; } = -1;
public int Mix { get; private set; } = 1;
FLY.ControlLibrary.GraphRange graph;
TrendGraphItemParam graphparam;
IBulkDbService bulkDb;
BlowingFixProfileParam profileParam;
public void Init(
TrendGraphItemParam graphparam,
IBulkDbService bulkDb,
BlowingFixProfileParam profileParam,
FLY.ControlLibrary.GraphRange graphRange)
{
this.graph = graphRange;
this.graphparam = graphparam;
this.bulkDb = bulkDb;
this.profileParam = profileParam;
Init();
}
void Init() {
Misc.BindingOperations.SetBinding(profileParam,
new string[] {
nameof(profileParam.Target),
nameof(profileParam.TolerancePercent) },
() =>{
this.Target = (int)(profileParam.Target * 100);
this.Alarm = (int)(profileParam.TolerancePercent * this.Target);
});
graph.Title = "纵向图";
graph.SetBinding(GraphRange.DataCntProperty, new Binding(nameof(graphparam.Len)) { Source = graphparam});
graph.SetBinding(GraphRange.IsAutoTargetProperty, new Binding(nameof(graphparam.IsAutoTarget)) { Source = graphparam });
graph.SetBinding(GraphRange.IsPercentProperty, new Binding(nameof(graphparam.IsPercent)) { Source = graphparam });
graph.SetBinding(GraphRange.YRangePercentProperty, new Binding(nameof(graphparam.YRangePercent)) { Source = graphparam });
graph.SetBinding(GraphRange.TypeProperty, new Binding(nameof(graphparam.Type)) { Source = graphparam });
graph.SetBinding(GraphRange.XAxisTypeProperty, new Binding(nameof(graphparam.XType)) { Source = graphparam });
graph.SetBinding(GraphRange.TargetProperty, new Binding(nameof(Target)) { Source = this });
graph.SetBinding(GraphRange.AlarmProperty, new Binding(nameof(Alarm)) { Source = this });
graph.SetBinding(GraphRange.Title2Property, new Binding(nameof(Info)) { Source = this });
graph.DataSource = Values;
graph.ShowSettingDialogEvent += new EventHandler(delegate (object sender, EventArgs e)
{
TrendGraphConfig w = new TrendGraphConfig();
TrendGraphItemParam graphparam_src = this.graphparam;
w.DataContext = graphparam_src;
w.SaveEvent += (s, ea) =>
{
TrendGraphParams.Current.Save();
};
w.Owner = FLY.ControlLibrary.COMMON.GetWindow(graph);
w.ShowDialog();
});
Misc.BindingOperations.SetBinding(graphparam, nameof(graphparam.Mix), this, nameof(Mix));
Id = -1;
UpdateId();
bulkDb.PropertyChanged += BulkDb_PropertyChanged;
graphparam.PropertyChanged += Graphparam_PropertyChanged;
}
private void Graphparam_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(graphparam.Mix))
{
Id = -1;
UpdateId();
}
else if (e.PropertyName == nameof(graphparam.Len))
{
UpdateId();
}
}
private void BulkDb_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(bulkDb.LastScanDataId))
{
UpdateId();
}
else if (e.PropertyName == nameof(FObjBase.FObjServiceClient.IsConnected))
{
if ((bulkDb as FObjBase.FObjServiceClient).IsConnected)
{
UpdateId();
}
}
}
void UpdateId()
{
Update4IdChanged();
}
void Update4IdChanged()
{
int cnt;
if (Id == -1)
{
cnt = graphparam.Len;
Values.Clear();
}
else
{
cnt = (int)(bulkDb.LastScanDataId - Id);
if (cnt > graphparam.Len)
cnt = graphparam.Len;
}
//限制Values长度
{
int remove_cnt = Values.Count() - graphparam.Len;
for (int i = 0; i < remove_cnt; i++)
Values.RemoveAt(0);
}
if (cnt == 0)
return;
bulkDb.GetTrend(
new Pack_GetTrendRequest() { Id = 0, Mix = graphparam.Mix, Count = cnt },
(object AsyncContext, object retData) =>
{
Pack_GetTrendReponse reponse = retData as Pack_GetTrendReponse;
//向Values 后面添加数据
if (reponse.Values != null && reponse.Values.Count > 0)
{
//从尾向前排的!!!!
for (int i = 0; i < reponse.Values.Count(); i++)
{
int index = reponse.Values.Count() - 1 - i;
Values.Add(new GraphRangeData()
{
Time = reponse.Values[index].Time,
Avg = (int)(reponse.Values[index].Value * 100),
Sigma = (int)(reponse.Values[index].Sigma * 100)
});
}
//限制Values长度
int remove_cnt = Values.Count() - graphparam.Len;
for (int i = 0; i < remove_cnt; i++)
Values.RemoveAt(0);
Id = reponse.ScanDataId;
Time = reponse.Values[0].Time;
}
}, this);
}
}
}
......@@ -32,7 +32,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
/// <returns></returns>
public FrameworkElement GetComponent(int id, IUnityContainer container)
{
return container.Resolve<TrendGraph>(new Unity.Resolution.ParameterOverride("id", id));
return container.Resolve<TrendGraph2>(new Unity.Resolution.ParameterOverride("id", id));
}
......@@ -53,7 +53,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
/// <param name="IDs"></param>
public void MatchParam(int[] IDs)
{
TrendGraphParams.Current.MatchParam(IDs);
TrendGraphParam2s.Current.MatchParam(IDs);
}
}
}
using MultiLayout.UiModule;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Unity;
namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
{
/// <summary>
/// 扫描图控件模块
/// </summary>
public class UiModule2_TrendGraph2 : IUiModule2
{
/// <summary>
/// 控件标题
/// 它的值取决于culture
/// </summary>
public string Title => "测厚.纵向图2";
public ComponentType Type => ComponentType.Graph;
public bool IsUnique => false;
/// <summary>
/// 控件
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetComponent(int id, IUnityContainer container)
{
return container.Resolve<TrendGraph2>(new Unity.Resolution.ParameterOverride("id", id));
}
/// <summary>
/// 控件缩略图,用于编辑界面时,大致看看
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetThumbnail()
{
return new Grid();
}
/// <summary>
/// 给出全部控件ID, 控件自行删除没有的参数
/// </summary>
/// <param name="IDs"></param>
public void MatchParam(int[] IDs)
{
TrendGraphParams.Current.MatchParam(IDs);
}
}
}
......@@ -95,7 +95,7 @@ namespace FLY.Thick.BlowingScan.UI.Client
private void button_version_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start(@"版本说明.txt");
//System.Diagnostics.Process.Start(@"版本说明.txt");
}
private void button_instruction_Click(object sender, RoutedEventArgs e)
......
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