Commit 3ed9d4ca authored by 潘栩锋's avatar 潘栩锋 🚴

1. 称重的流量图,可以选择看某个流量

2.IBC,与称重的图,当不是最新,10秒后会自动按 最新
parent e181b1fe
...@@ -162,6 +162,7 @@ ...@@ -162,6 +162,7 @@
<Compile Include="UIModule\Window_K123.xaml.cs"> <Compile Include="UIModule\Window_K123.xaml.cs">
<DependentUpon>Window_K123.xaml</DependentUpon> <DependentUpon>Window_K123.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UnitTests\UnitTests_BufferWindow.cs" />
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
......
...@@ -18,6 +18,7 @@ using System.Windows.Media; ...@@ -18,6 +18,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Threading;
namespace FLY.IBC.UI.Client.UIModule namespace FLY.IBC.UI.Client.UIModule
{ {
...@@ -36,10 +37,8 @@ namespace FLY.IBC.UI.Client.UIModule ...@@ -36,10 +37,8 @@ namespace FLY.IBC.UI.Client.UIModule
iBCCtrlGraphModelView = new IBCCtrlGraphModelView(); iBCCtrlGraphModelView = new IBCCtrlGraphModelView();
iBCCtrlGraphModelView.InitData(); iBCCtrlGraphModelView.InitData();
this.DataContext = iBCCtrlGraphModelView; grid_modelview.DataContext = iBCCtrlGraphModelView;
grid_bufferwindow.DataContext = iBCCtrlGraphModelView.bufferWindow;
stackpanel_window.DataContext = iBCCtrlGraphModelView.bufferWindow;
} }
private void button_info_Click(object sender, RoutedEventArgs e) private void button_info_Click(object sender, RoutedEventArgs e)
{ {
...@@ -70,14 +69,31 @@ namespace FLY.IBC.UI.Client.UIModule ...@@ -70,14 +69,31 @@ namespace FLY.IBC.UI.Client.UIModule
} }
public class IBCCtrlGraphModelView : INotifyPropertyChanged public class IBCCtrlGraphModelView : INotifyPropertyChanged
{ {
/// <summary>
/// 当前现在不是最新,而且没有移动动作,20秒自动按 Newest()
/// </summary>
DispatcherTimer timer;
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
FLY.IBC.Client.IBCSystemClient iBCSystemClient; FLY.IBC.Client.IBCSystemClient iBCSystemClient;
public FLY.OBJComponents.Client.BufferWindow<FlyData_IBCCtrl> bufferWindow; public FLY.OBJComponents.Client.BufferWindow<FlyData_IBCCtrl> bufferWindow;
public IBCCtrlGraphParams graphParams; public IBCCtrlGraphParams graphParams;
/// <summary>
/// 画面只显示200个数据, 就算设置画面设置显示1000个数,也会整合为200个数据
/// </summary>
const int ValuesCap = 200; const int ValuesCap = 200;
/// <summary>
/// 自动按保持最新值,总时间
/// </summary>
const int AutoKeepNewestTimeCounter = 10;
#region property #region property
/// <summary>
///自动按保持最新值,剩余时间
/// </summary>
public int AutoKeepNewestTimeRemaining { get; set; }
/// <summary> /// <summary>
/// 曲线, 是有 bufferWindow.Record 生成的 /// 曲线, 是有 bufferWindow.Record 生成的
/// Values 最大数量只有 ValuesCap /// Values 最大数量只有 ValuesCap
...@@ -230,8 +246,38 @@ namespace FLY.IBC.UI.Client.UIModule ...@@ -230,8 +246,38 @@ namespace FLY.IBC.UI.Client.UIModule
Update_d_y(); Update_d_y();
} }
}; };
}
//当不是最新数据时,10秒内无操作,自动按 [最新]
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
bufferWindow.PropertyChanged += BufferWindow_PropertyChanged;
}
private void Timer_Tick(object sender, EventArgs e)
{
AutoKeepNewestTimeRemaining--;
if (AutoKeepNewestTimeRemaining <= 0)
{
AutoKeepNewestTimeRemaining = AutoKeepNewestTimeCounter;
bufferWindow.MoveNewest();
}
}
private void BufferWindow_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "IsKeepNewest")
{
if (!bufferWindow.IsKeepNewest)
{
//当前不是最新,开始倒计时
AutoKeepNewestTimeRemaining = AutoKeepNewestTimeCounter;
timer.Start();
}
else
{
timer.Stop();
}
}
}
void Update_filmwidth_y() void Update_filmwidth_y()
{ {
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace FLY.IBC.UI.Client.UnitTests
{
public class UnitTests_BufferWindow : INotifyPropertyChanged
{
public bool IsFirstPage { get; set; }
public bool IsLastPage { get; set; }
public bool IsKeepNewest { get; set; }
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
public class UnitTests_FlowGraphModelView : INotifyPropertyChanged
{
/// <summary>
///自动按保持最新值,剩余时间
/// </summary>
public int AutoKeepNewestTimeRemaining { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FLY.IBC.UI.Client.UnitTests"
xmlns:ibc_common="clr-namespace:FLY.IBC.Common;assembly=FLY.IBC"> xmlns:ibc_common="clr-namespace:FLY.IBC.Common;assembly=FLY.IBC">
<ibc_common:IBCData x:Key="unitests_ibc" <ibc_common:IBCData x:Key="unitests_ibc"
IsIBCAuto = "True" IsIBCAuto = "True"
...@@ -18,5 +19,14 @@ ...@@ -18,5 +19,14 @@
L="3002" L="3002"
BubbleCorrA="23" BubbleCorrA="23"
/> />
<local:UnitTests_BufferWindow x:Key="unittests_bufferwindow"
IsFirstPage ="False"
IsLastPage="True"
IsKeepNewest="False"
CurrentPage="10"
TotalPages="10"
/>
<local:UnitTests_FlowGraphModelView x:Key="unittests_flowgraphmv"
AutoKeepNewestTimeRemaining ="10"
/>
</ResourceDictionary> </ResourceDictionary>
\ No newline at end of file
...@@ -132,14 +132,12 @@ ...@@ -132,14 +132,12 @@
<Compile Include="UIModule\Window_GraphSet.xaml.cs"> <Compile Include="UIModule\Window_GraphSet.xaml.cs">
<DependentUpon>Window_GraphSet.xaml</DependentUpon> <DependentUpon>Window_GraphSet.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UnitTests\UnitTests_BufferWindow.cs" />
<Compile Include="UnitTests\WeighterCsService.cs" /> <Compile Include="UnitTests\WeighterCsService.cs" />
<Compile Include="WeighterColorDB.cs" /> <Compile Include="WeighterColorDB.cs" />
<Compile Include="Window_Frequency.xaml.cs"> <Compile Include="Window_Frequency.xaml.cs">
<DependentUpon>Window_Frequency.xaml</DependentUpon> <DependentUpon>Window_Frequency.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Window_GraphSet.xaml.cs">
<DependentUpon>Window_GraphSet.xaml</DependentUpon>
</Compile>
<Compile Include="Window_Ingredient.xaml.cs"> <Compile Include="Window_Ingredient.xaml.cs">
<DependentUpon>Window_Ingredient.xaml</DependentUpon> <DependentUpon>Window_Ingredient.xaml</DependentUpon>
</Compile> </Compile>
...@@ -253,10 +251,6 @@ ...@@ -253,10 +251,6 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Window_GraphSet.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Window_Ingredient.xaml"> <Page Include="Window_Ingredient.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
......
...@@ -20,6 +20,7 @@ using System.Windows.Media; ...@@ -20,6 +20,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Threading;
namespace FLY.Weight.UI.Client.UIModule namespace FLY.Weight.UI.Client.UIModule
{ {
...@@ -37,14 +38,18 @@ namespace FLY.Weight.UI.Client.UIModule ...@@ -37,14 +38,18 @@ namespace FLY.Weight.UI.Client.UIModule
{ {
flowGraphModelView = new FlowGraphModelView(); flowGraphModelView = new FlowGraphModelView();
flowGraphModelView.InitData(); flowGraphModelView.InitData();
this.DataContext = flowGraphModelView;
stackpanel_window.DataContext = flowGraphModelView.bufferWindow; grid_modelview.DataContext = flowGraphModelView;
grid_bufferwindow.DataContext = flowGraphModelView.bufferWindow;
} }
/// <summary>
/// 测试界面用
/// </summary>
public void Debug() public void Debug()
{ {
flowGraphModelView = new FlowGraphModelView(); flowGraphModelView = new FlowGraphModelView();
flowGraphModelView.InitData_Debug(); flowGraphModelView.InitData_Debug();
this.DataContext = flowGraphModelView; grid_modelview.DataContext = flowGraphModelView;
//TODO 有问题 //TODO 有问题
//itemsControl.ItemsSource = flowGraphModelView.Series; //itemsControl.ItemsSource = flowGraphModelView.Series;
//stackpanel_window.DataContext = flowGraphModelView.bufferWindow; //stackpanel_window.DataContext = flowGraphModelView.bufferWindow;
...@@ -105,17 +110,44 @@ namespace FLY.Weight.UI.Client.UIModule ...@@ -105,17 +110,44 @@ namespace FLY.Weight.UI.Client.UIModule
} }
} }
private void button_select_Click(object sender, RoutedEventArgs e)
{
flowGraphModelView.SelectABC(((Button)sender).Tag as FlowGraphModelView_Item);
}
private void button_selectall_Click(object sender, RoutedEventArgs e)
{
flowGraphModelView.SelectAll();
}
} }
public class FlowGraphModelView : INotifyPropertyChanged public class FlowGraphModelView : INotifyPropertyChanged
{ {
/// <summary>
/// 当前现在不是最新,而且没有移动动作,20秒自动按 Newest()
/// </summary>
DispatcherTimer timer;
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
WeightSystemClient weightSystemClient; WeightSystemClient weightSystemClient;
public BufferWindow<FlyData_Flow> bufferWindow; public BufferWindow<FlyData_Flow> bufferWindow;
public FlowGraphParams graphParams; public FlowGraphParams graphParams;
/// <summary>
/// 画面只显示200个数据, 就算设置画面设置显示1000个数,也会整合为200个数据
/// </summary>
const int ValuesCap = 200; const int ValuesCap = 200;
/// <summary>
/// 自动按保持最新值,总时间
/// </summary>
const int AutoKeepNewestTimeCounter = 10;
#region property #region property
/// <summary>
///自动按保持最新值,剩余时间
/// </summary>
public int AutoKeepNewestTimeRemaining { get; set; }
/// <summary> /// <summary>
/// 曲线, 是由 bufferWindow.Record 生成的 /// 曲线, 是由 bufferWindow.Record 生成的
/// Values 最大数量只有 ValuesCap /// Values 最大数量只有 ValuesCap
...@@ -167,6 +199,8 @@ namespace FLY.Weight.UI.Client.UIModule ...@@ -167,6 +199,8 @@ namespace FLY.Weight.UI.Client.UIModule
/// 曲线 /// 曲线
/// </summary> /// </summary>
public SeriesCollection Series { get; set; } = new SeriesCollection(); public SeriesCollection Series { get; set; } = new SeriesCollection();
public ObservableCollection<FlowGraphModelView_Item> Items { get; } = new ObservableCollection<FlowGraphModelView_Item>();
#endregion #endregion
public FlowGraphModelView() public FlowGraphModelView()
...@@ -233,7 +267,40 @@ namespace FLY.Weight.UI.Client.UIModule ...@@ -233,7 +267,40 @@ namespace FLY.Weight.UI.Client.UIModule
} }
}; };
//当不是最新数据时,10秒内无操作,自动按 [最新]
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
bufferWindow.PropertyChanged += BufferWindow_PropertyChanged;
}
private void Timer_Tick(object sender, EventArgs e)
{
AutoKeepNewestTimeRemaining--;
if (AutoKeepNewestTimeRemaining <= 0)
{
AutoKeepNewestTimeRemaining = AutoKeepNewestTimeCounter;
bufferWindow.MoveNewest();
}
}
private void BufferWindow_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "IsKeepNewest")
{
if (!bufferWindow.IsKeepNewest)
{
//当前不是最新,开始倒计时
AutoKeepNewestTimeRemaining = AutoKeepNewestTimeCounter;
timer.Start();
}
else
{
timer.Stop();
}
}
} }
class GetMapperOfFlyData_Flow class GetMapperOfFlyData_Flow
...@@ -270,6 +337,8 @@ namespace FLY.Weight.UI.Client.UIModule ...@@ -270,6 +337,8 @@ namespace FLY.Weight.UI.Client.UIModule
series.Configuration = new GetMapperOfFlyData_Flow(i).GetCartesianMapper(); series.Configuration = new GetMapperOfFlyData_Flow(i).GetCartesianMapper();
Series.Add(series); Series.Add(series);
} }
} }
else if (Series.Count > weightSystemClient.Items.Count) else if (Series.Count > weightSystemClient.Items.Count)
{ {
...@@ -279,6 +348,22 @@ namespace FLY.Weight.UI.Client.UIModule ...@@ -279,6 +348,22 @@ namespace FLY.Weight.UI.Client.UIModule
Series.RemoveAt(Series.Count - 1); Series.RemoveAt(Series.Count - 1);
} }
} }
if (Items.Count != Series.Count)
{
Items.Clear();
foreach (StackedAreaSeries series in Series)
{
FlowGraphModelView_Item item = new FlowGraphModelView_Item
{
Title = series.Title,
Fill = series.Fill,
Visibility = Visibility.Visible
};
series.SetBinding(StackedAreaSeries.VisibilityProperty, new Binding("Visibility") { Source = item });
Items.Add(item);
}
}
} }
void ToValues() void ToValues()
{ {
...@@ -300,6 +385,8 @@ namespace FLY.Weight.UI.Client.UIModule ...@@ -300,6 +385,8 @@ namespace FLY.Weight.UI.Client.UIModule
{ {
BeginTime = Values.First().Time; BeginTime = Values.First().Time;
EndTime = Values.Last().Time; EndTime = Values.Last().Time;
UpdateAxisYTarget();
} }
else else
{ {
...@@ -374,9 +461,7 @@ namespace FLY.Weight.UI.Client.UIModule ...@@ -374,9 +461,7 @@ namespace FLY.Weight.UI.Client.UIModule
BeginTime = DateTime.MinValue; BeginTime = DateTime.MinValue;
EndTime = DateTime.MinValue; EndTime = DateTime.MinValue;
} }
AxisYTarget = flows.Sum();
for (int i = 0; i < flows.Count(); i++) for (int i = 0; i < flows.Count(); i++)
{ {
...@@ -398,22 +483,88 @@ namespace FLY.Weight.UI.Client.UIModule ...@@ -398,22 +483,88 @@ namespace FLY.Weight.UI.Client.UIModule
MaxValue = AxisYTarget + graphParams.AxisYRange; MaxValue = AxisYTarget + graphParams.AxisYRange;
MinValue = AxisYTarget - graphParams.AxisYRange; MinValue = AxisYTarget - graphParams.AxisYRange;
} }
UpdateAxisYTarget();
} }
void UpdateAxisYTarget()
{
FlyData_Flow flows = Values.Last();
double target = 0;
for (int i = 0; i < flows.Items.Count(); i++)
{
if (Items[i].Visibility == Visibility.Visible)
target += flows.Items[i].Flow;
Items[i].Value = flows.Items[i].Flow;
}
AxisYTarget = (int)target;
}
public void Newest() public void Newest()
{ {
AutoKeepNewestTimeRemaining = AutoKeepNewestTimeCounter;
bufferWindow.MoveNewest(); bufferWindow.MoveNewest();
} }
public void Next() public void Next()
{ {
AutoKeepNewestTimeRemaining = AutoKeepNewestTimeCounter;
bufferWindow.MoveNextPage(); bufferWindow.MoveNextPage();
} }
public void Pre() public void Pre()
{ {
AutoKeepNewestTimeRemaining = AutoKeepNewestTimeCounter;
bufferWindow.MovePrePage(); bufferWindow.MovePrePage();
} }
public void SelectAll()
{
foreach (FlowGraphModelView_Item i in Items)
{
i.Visibility = Visibility.Visible;
}
UpdateAxisYTarget();
}
public void SelectABC(FlowGraphModelView_Item item)
{
foreach (FlowGraphModelView_Item i in Items)
{
if (i != item )
{
i.Visibility = Visibility.Hidden;
}
else
{
i.Visibility = Visibility.Visible;
}
}
UpdateAxisYTarget();
}
} }
public class FlowGraphModelView_Item : INotifyPropertyChanged
{
public string Title { get; set; }
/// <summary>
/// 颜色
/// </summary>
public Brush Fill { get; set; }
/// <summary>
/// 显示
/// </summary>
public Visibility Visibility { get; set; }
/// <summary>
/// 值
/// </summary>
public double Value { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
public class FlowGraphParams : INotifyPropertyChanged, Misc.ISaveToXml public class FlowGraphParams : INotifyPropertyChanged, Misc.ISaveToXml
{ {
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
......
...@@ -29,7 +29,11 @@ ...@@ -29,7 +29,11 @@
<sys:Double x:Key="FontSize_unit">12</sys:Double> <sys:Double x:Key="FontSize_unit">12</sys:Double>
<sys:Double x:Key="FontSize_context_min">32</sys:Double> <sys:Double x:Key="FontSize_context_min">32</sys:Double>
<sys:Double x:Key="FontSize_context_max">48</sys:Double> <sys:Double x:Key="FontSize_context_max">48</sys:Double>
<sys:Double x:Key="MaxHeight_viewer1">130</sys:Double>
<Style TargetType="Viewbox" x:Key="ViewerStyle">
<Setter Property="MaxHeight" Value="130"/>
<Setter Property="MaxWidth" Value="240"/>
</Style>
</ResourceDictionary> </ResourceDictionary>
</Page.Resources> </Page.Resources>
<Viewbox Stretch="Uniform" VerticalAlignment="Top" HorizontalAlignment="Left"> <Viewbox Stretch="Uniform" VerticalAlignment="Top" HorizontalAlignment="Left">
...@@ -41,7 +45,7 @@ ...@@ -41,7 +45,7 @@
<Border Margin="5" CornerRadius="5" Background="{StaticResource Color_theme_background}"> <Border Margin="5" CornerRadius="5" Background="{StaticResource Color_theme_background}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Viewbox Margin="15,5" MaxHeight="{StaticResource MaxHeight_viewer1}"> <Viewbox Margin="15,5">
<Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="button_ratio_Click" Margin="30,5"> <Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="button_ratio_Click" Margin="30,5">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
...@@ -70,7 +74,7 @@ ...@@ -70,7 +74,7 @@
</StackPanel> </StackPanel>
</Button> </Button>
</Viewbox> </Viewbox>
<Viewbox Margin="15,5" MaxHeight="90"> <Viewbox Margin="15,5" MaxHeight="90" Style="{StaticResource ViewerStyle}">
<StackPanel Orientation="Horizontal" > <StackPanel Orientation="Horizontal" >
<control:PieChart Width="60" Height="60" Margin="10" <control:PieChart Width="60" Height="60" Margin="10"
ItemValueBinding="CumulativeProduction" ItemColorBinding="Color" ItemValueBinding="CumulativeProduction" ItemColorBinding="Color"
...@@ -109,7 +113,7 @@ ...@@ -109,7 +113,7 @@
</Grid> </Grid>
</StackPanel> </StackPanel>
</Viewbox> </Viewbox>
<Viewbox Margin="15,5" MaxHeight="{StaticResource MaxHeight_viewer1}"> <Viewbox Margin="15,5" Style="{StaticResource ViewerStyle}">
<Grid > <Grid >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
...@@ -162,7 +166,7 @@ ...@@ -162,7 +166,7 @@
</Grid> </Grid>
</Viewbox> </Viewbox>
<Viewbox Margin="15,5" MaxHeight="{StaticResource MaxHeight_viewer1}"> <Viewbox Margin="15,5" Style="{StaticResource ViewerStyle}">
<Grid > <Grid >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
...@@ -289,7 +293,7 @@ ...@@ -289,7 +293,7 @@
<Border CornerRadius="5" Margin="5" Background="{StaticResource Color_theme_background}" > <Border CornerRadius="5" Margin="5" Background="{StaticResource Color_theme_background}" >
<StackPanel Margin="4"> <StackPanel Margin="4">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="±" /> <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="±" />
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding AxisYRange}"/> <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding AxisYRange}"/>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="um" /> <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="kg/h" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
......
using FLY.Weight.UI.Client.UIModule;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
namespace FLY.Weight.UI.Client.UnitTests
{
public class UnitTests_BufferWindow : INotifyPropertyChanged
{
public bool IsFirstPage { get; set; }
public bool IsLastPage { get; set; }
public bool IsKeepNewest { get; set; }
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
public class UnitTests_FlowGraphModelView : INotifyPropertyChanged
{
/// <summary>
///自动按保持最新值,剩余时间
/// </summary>
public int AutoKeepNewestTimeRemaining { get; set; } = 10;
public List<FlowGraphModelView_Item> Items { get; set; }
public UnitTests_FlowGraphModelView()
{
Items = new List<FlowGraphModelView_Item>();
Items.Add(new FlowGraphModelView_Item() { Title = "A", Value=103.1, Visibility = Visibility.Hidden });
Items.Add(new FlowGraphModelView_Item() { Title = "B", Value = 10, Visibility = Visibility.Visible });
Items.Add(new FlowGraphModelView_Item() { Title = "C", Value = 23, Visibility = Visibility.Hidden });
Items.Add(new FlowGraphModelView_Item() { Title = "D", Value = 46.7, Visibility = Visibility.Hidden });
Items.Add(new FlowGraphModelView_Item() { Title = "E", Value = 80, Visibility = Visibility.Hidden });
foreach (FlowGraphModelView_Item s in Items)
{
s.Fill = WeighterColorDB.GetSelf(s.Title);
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
...@@ -6,5 +6,13 @@ ...@@ -6,5 +6,13 @@
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<local:UnitTests_Weights x:Key="unittests_weighters" /> <local:UnitTests_Weights x:Key="unittests_weighters" />
<local:UnitTests_BufferWindow x:Key="unittests_bufferwindow"
IsFirstPage ="False"
IsLastPage="True"
IsKeepNewest="False"
CurrentPage="10"
TotalPages="10"
/>
<local:UnitTests_FlowGraphModelView x:Key="unittests_flowgraphmv"/>
</ResourceDictionary> </ResourceDictionary>
\ No newline at end of file
<flyctrllib:WindowBigClose x:Class="FLY.Weight.UI.Client.Window_GraphSet"
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:flyctrllib="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
xmlns:local="clr-namespace:FLY.Weight.UI.Client"
mc:Ignorable="d"
Title="Window_GraphSet" WindowStartupLocation="CenterScreen" Height="410.994" Width="405.484" >
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight.UI.Client;component/Themes/LightSkin.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Weight.UI.Client;component/Themes/Dictionary_MainSingleWeight.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<StackPanel Orientation="Vertical" Margin="5,20">
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="流量数据" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="44" />
</StackPanel>
<StackPanel x:Name="stackpanel_sys" Orientation="Horizontal" >
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="时间间隔" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding FlowInterval}"/>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="s" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="总数量" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding FlowListSize}"/>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="个" />
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel x:Name="stackpanel_show" Orientation="Horizontal">
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="显示个数" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding XRange}"/>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="个" />
</StackPanel>
</StackPanel>
</StackPanel>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
</Grid>
<Button Style="{StaticResource ButtonStyle2}" Content="确定" Width="auto" Margin="5" Click="button_ok_Click" />
</StackPanel>
</flyctrllib:WindowBigClose>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
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;
namespace FLY.Weight.UI.Client
{
/// <summary>
/// Window_GraphSet.xaml 的交互逻辑
/// </summary>
public partial class Window_GraphSet : FLY.ControlLibrary.WindowBigClose, INotifyPropertyChanged
{
private int flowinterval = 2;
/// <summary>
/// 流量记录周期,单位min
/// </summary>
public int FlowInterval
{
get
{
return flowinterval;
}
set
{
if (value < 1)
value = 1;
if (flowinterval != value)
{
flowinterval = value;
NotifyPropertyChanged("FlowInterval");
}
}
}
private int flowlistsize = 400;
/// <summary>
/// 流量列表长度,单位个
/// </summary>
public int FlowListSize
{
get
{
return flowlistsize;
}
set
{
if (flowlistsize != value)
{
flowlistsize = value;
NotifyPropertyChanged("FlowListSize");
}
}
}
private int flowsaverows = 200;
/// <summary>
/// 流量保存周期,单位个
/// </summary>
public int FlowSaveRows
{
get
{
return flowsaverows;
}
set
{
if (flowsaverows != value)
{
flowsaverows = value;
NotifyPropertyChanged("FlowSaveRows");
}
}
}
private int xrange;
public int XRange
{
get { return xrange; }
set
{
if (xrange != value)
{
xrange = value;
NotifyPropertyChanged("XRange");
}
}
}
public Window_GraphSet()
{
InitializeComponent();
this.DataContext = this;
}
private void button_ok_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
this.Close();
}
protected void NotifyPropertyChanged(string propertyname)
{
if (PropertyChanged != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyname));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
...@@ -43,9 +43,10 @@ namespace WpfApplication1 ...@@ -43,9 +43,10 @@ namespace WpfApplication1
//FLY.IBC.UI.Client.UIModule.Page_Main p = new FLY.IBC.UI.Client.UIModule.Page_Main(); //FLY.IBC.UI.Client.UIModule.Page_Main p = new FLY.IBC.UI.Client.UIModule.Page_Main();
//FLY.Winder.UI.Client.UIModule.Page_Main p = new FLY.Winder.UI.Client.UIModule.Page_Main(); //FLY.Winder.UI.Client.UIModule.Page_Main p = new FLY.Winder.UI.Client.UIModule.Page_Main();
FLY.Weight.UI.Client.UIModule.Page_Main p = new FLY.Weight.UI.Client.UIModule.Page_Main(); //FLY.Weight.UI.Client.UIModule.Page_Main p = new FLY.Weight.UI.Client.UIModule.Page_Main();
FLY.Weight.UI.Client.UIModule.FlowGraph p = new FLY.Weight.UI.Client.UIModule.FlowGraph();
p.Init(0); p.Init(0);
//FLY.Weight.UI.Client.UIModule.FlowGraph p= new FLY.Weight.UI.Client.UIModule.FlowGraph();
//graph.Init(0); //graph.Init(0);
Frame f1 = new Frame(); Frame f1 = new Frame();
f1.Content = p; f1.Content = p;
......
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