Commit 59014699 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 删除 FLY.ControlLibrary 全部 图表控件

2. 添加 MISC 添加 JsonDbHelper.cs 方便参数保存
3. 修改 livecharts 项目名称修改
parent d45877b4
......@@ -313,7 +313,7 @@
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
<Version>3.4.1</Version>
</PackageReference>
<PackageReference Include="Unity">
<Version>5.11.2</Version>
......
......@@ -63,23 +63,11 @@
<Compile Include="Converter\Item2IndexConverter.cs" />
<Compile Include="Converter\RatioConverter.cs" />
<Compile Include="DrapMoveXBehavior.cs" />
<Compile Include="GraphRange_coslight.cs" />
<Compile Include="GraphScan3.cs" />
<Compile Include="GraphScan4.xaml.cs">
<DependentUpon>GraphScan4.xaml</DependentUpon>
</Compile>
<Compile Include="GraphScan_coslight.cs" />
<Compile Include="Converter\Equals2BoolConverter.cs" />
<Compile Include="Converter\Equals2VisibleConverter.cs" />
<Compile Include="Converter\PercentConverter.cs" />
<Compile Include="Converter\TimeSpan2MinConverter.cs" />
<Compile Include="Converter\VisibilityConverter.cs" />
<Compile Include="GraphRange.xaml.cs">
<DependentUpon>GraphRange.xaml</DependentUpon>
</Compile>
<Compile Include="GraphScanCircular.xaml.cs">
<DependentUpon>GraphScanCircular.xaml</DependentUpon>
</Compile>
<Compile Include="PercentRing.xaml.cs">
<DependentUpon>PercentRing.xaml</DependentUpon>
</Compile>
......@@ -94,10 +82,6 @@
<Compile Include="ToggleAction.cs" />
<Compile Include="UI.OSK\IVirtualKeyboard.cs" />
<Compile Include="UI.OSK\KeyboardBehavior.cs" />
<Compile Include="GraphScan.xaml.cs">
<DependentUpon>GraphScan.xaml</DependentUpon>
</Compile>
<Compile Include="GraphScan2.cs" />
<Compile Include="IGraphBase.cs" />
<Compile Include="MyMessageBox.xaml.cs">
<DependentUpon>MyMessageBox.xaml</DependentUpon>
......@@ -150,22 +134,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="GraphRange.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GraphScan.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="GraphScan4.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="GraphScanCircular.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MyMessageBox.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -317,7 +285,7 @@
<Version>1.10.0</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
<Version>3.4.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
......
<UserControl x:Class="FLY.ControlLibrary.GraphRange"
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:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
xmlns:local="clr-namespace:FLY.ControlLibrary"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" >
<UserControl.Resources>
<local:IsValidConverter x:Key="isvalidconv"/>
<ControlTemplate x:Key="picture_button" TargetType="Button">
<Border Name="border" BorderThickness="1" CornerRadius="5">
<ContentPresenter Content="{TemplateBinding Content}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="LightBlue"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="LightGray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</UserControl.Resources>
<Grid Name="grid" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="18" />
<RowDefinition Height="22" />
<RowDefinition Height="258*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="225*" />
</Grid.ColumnDefinitions>
<Rectangle Name="rectangle" Grid.ColumnSpan="2" Fill="#FF579aab"/>
<TextBlock Grid.ColumnSpan="2" HorizontalAlignment="Center" FontSize="18" VerticalAlignment="Bottom" Grid.RowSpan="2">
<TextBlock.Inlines>
<Run Name="run_title" FontWeight="SemiBold" />
<Run Name="run_title2" Foreground="#FF585858" />
</TextBlock.Inlines>
</TextBlock>
<WindowsFormsHost Grid.ColumnSpan="2" Grid.Row="2">
<Chr:Chart x:Name="chart1" />
</WindowsFormsHost>
<Button x:Name="m_LogoImageButtonUC" Height="40" Width="40" Click="Button_Click" Grid.RowSpan="2" Template="{StaticResource ResourceKey=picture_button}">
<Grid >
<Image Source="/FLY.ControlLibrary;component/Images/info.png" />
</Grid>
</Button>
</Grid>
</UserControl>
<UserControl x:Class="FLY.ControlLibrary.GraphScan"
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:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
xmlns:local="clr-namespace:FLY.ControlLibrary"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" >
<UserControl.Resources>
<local:IsValidConverter x:Key="isvalidconv"/>
<local:LeftRightConverter x:Key="lrconv"/>
<ControlTemplate x:Key="picture_button" TargetType="Button">
<Border Name="border" BorderThickness="1" CornerRadius="5">
<ContentPresenter Content="{TemplateBinding Content}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="LightBlue"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="LightGray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</UserControl.Resources>
<Grid Name="grid" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="258*" />
</Grid.RowDefinitions>
<Grid Name="grid_title">
<Grid.RowDefinitions>
<RowDefinition Height="18" />
<RowDefinition Height="22" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Rectangle Name="rectangle" Fill="{Binding IsValid,Converter={StaticResource ResourceKey=isvalidconv}}" Grid.ColumnSpan="4"/>
<Button x:Name="m_LogoImageButtonUC" Height="40" Width="40" Click="Button_Click" Template="{StaticResource ResourceKey=picture_button}" Grid.RowSpan="2">
<Grid >
<Image Source="/FLY.ControlLibrary;component/Images/info.png" />
</Grid>
</Button>
<Grid Grid.RowSpan="2" Grid.Column="1" Margin="2" Name="grid_left">
<TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="左">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="LIsL">
<Binding Path="LeftRightIsVisable"/>
<Binding Path="LeftRightIsReversed"/>
</MultiBinding>
</TextBlock.Visibility>
</TextBlock>
<TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="右">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="LIsR">
<Binding Path="LeftRightIsVisable"/>
<Binding Path="LeftRightIsReversed"/>
</MultiBinding>
</TextBlock.Visibility>
</TextBlock>
</Grid>
<TextBlock HorizontalAlignment="Center" FontSize="18" VerticalAlignment="Bottom" Grid.Row="1" Grid.Column="2">
<Run Name="run_title" Text="{Binding Title}" FontWeight="SemiBold" />
<Run Name="run_title2" Text="{Binding Title2}" Foreground="#FF585858" />
</TextBlock>
<Grid Grid.RowSpan="2" Grid.Column="3" Margin="2" Name="grid_right">
<TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="左">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="RIsL">
<Binding Path="LeftRightIsVisable"/>
<Binding Path="LeftRightIsReversed"/>
</MultiBinding>
</TextBlock.Visibility>
</TextBlock>
<TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="右">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="RIsR">
<Binding Path="LeftRightIsVisable"/>
<Binding Path="LeftRightIsReversed"/>
</MultiBinding>
</TextBlock.Visibility>
</TextBlock>
</Grid>
</Grid>
<WindowsFormsHost Grid.Row="1">
<Chr:Chart x:Name="chart1" />
</WindowsFormsHost>
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace FLY.ControlLibrary
{
public class GraphScan2:GraphScan
{
public GraphScan2():base()
{
mRefresh = new Refresh(this);
}
#region 刷新率控制
class Refresh
{
/// <summary>
/// 控制刷新率
/// </summary>
System.Windows.Threading.DispatcherTimer timer;
bool updatedata_flag = false;
/// <summary>
/// 最快0.1s 刷新一次
/// </summary>
TimeSpan REFRESH_RATE = TimeSpan.FromSeconds(0.1);
public Refresh(GraphScan2 graph)
{
timer = new System.Windows.Threading.DispatcherTimer();
timer.Tick += new EventHandler(delegate(object sender, EventArgs e)
{
if (UpdateData)
{
UpdateData = false;
graph.DataBindAll2();
}
timer.Stop();
});
timer.Interval = REFRESH_RATE;
timer.Start();
}
public bool UpdateData
{
get { return updatedata_flag; }
set
{
updatedata_flag = value;
if (value)
{
if (!timer.IsEnabled)
timer.Start();
}
}
}
}
Refresh mRefresh;
#endregion
protected override void Test()
{
base.Test();
ObservableCollection<int> datasource = new ObservableCollection<int>();
// Populate series data
Random random = new Random();
for (int i = 0; i < 40; i++)
{
datasource.Add(random.Next(3000) - 1500 + Target);
}
DataSource2 = datasource;
}
protected override void InitializeComponent2()
{
base.InitializeComponent2();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
series1.BorderColor = System.Drawing.Color.DarkBlue;
series1.BorderWidth = 2;
series1.ChartArea = "Default";
//TODO
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
//series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
series1.Color = System.Drawing.Color.Blue;
series1.Legend = "Default";
series1.Name = "Series 2";
series1.ShadowColor = System.Drawing.Color.Black;
series1.ShadowOffset = 2;
series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32;
series1.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
this.chart1.Series.Add(series1);
}
/// <summary>
/// 数据源
/// </summary>
private ObservableCollection<int> _datasource;
public virtual ObservableCollection<int> DataSource2
{
get
{
return _datasource;
}
set
{
_datasource = value;
_datasource.CollectionChanged += dataSource_CollectionChanged;
mRefresh.UpdateData = true;
}
}
/// <summary>
/// DataSource 里面的数据都是 EmptyValue 组成, 当修改数据时,应该clear ,再添加
/// </summary>
private bool DataSourceIsEmpty = false;
/// <summary>
/// 当一个数据都没有时,需要添加空数据
/// </summary>
public void CheckDataSourceEmpty2()
{
if ((DataSource2 == null) || (DataSource2.Count() == 0))
{
chart1.Series["Series 2"].Points.Clear();
chart1.Series["Series 2"].Points.AddXY(FirstBoltNo, EmptyValue);
chart1.Series["Series 2"].Points[0].IsEmpty = true;
DataSourceIsEmpty = true;
}
else
{
DataSourceIsEmpty = false;
}
}
void dataSource_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
mRefresh.UpdateData = true;
}
public void DataBindAll2()
{
double multi = Multi;
int emptyvalue = EmptyValue;
chart1.Series["Series 2"].Points.Clear();
if (DataSource2 != null)
{
for (int i = 0; i < DataSource2.Count(); i++)
{
UpdateOnePoint2(i);
}
}
CheckDataSourceEmpty2();
}
public virtual void UpdateOnePoint2(int index)
{
double multi = Multi;
int emptyvalue = EmptyValue;
System.Windows.Forms.DataVisualization.Charting.DataPoint point;
int x = FirstBoltNo + index;
double y = (double)DataSource2.ElementAt(index);
y = y / multi;
if (index >= chart1.Series["Series 2"].Points.Count)
{
chart1.Series["Series 2"].Points.AddXY(x, y);
point = chart1.Series["Series 2"].Points[index];
}
else
{
point = chart1.Series["Series 2"].Points[index];
point.XValue = x;
point.YValues[0] = y;
}
//设定空数据
if (DataSource2[index] == emptyvalue)
{
point.IsEmpty = true;
}
else
{
point.IsEmpty = false;
}
}
void GraphScan2_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "AutoTarget")
{
if (IsAutoTarget)
{
mRefresh.UpdateData = true;
}
}
if ((e.PropertyName == "Target") || (e.PropertyName == "Alarm") || (e.PropertyName == "YRange") || (e.PropertyName == "YRangePercent") || (e.PropertyName == "IsAutoTarget") || (e.PropertyName == "IsPercent") || (e.PropertyName == "AutoTarget"))
{
mRefresh.UpdateData = true;
}
}
}
}
<UserControl x:Class="FLY.ControlLibrary.GraphScan4"
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:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
xmlns:local="clr-namespace:FLY.ControlLibrary"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" >
<UserControl.Resources>
<local:IsValidConverter x:Key="isvalidconv"/>
<local:LeftRightConverter x:Key="lrconv"/>
<ControlTemplate x:Key="picture_button" TargetType="Button">
<Border Name="border" BorderThickness="1" CornerRadius="5">
<ContentPresenter Content="{TemplateBinding Content}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="LightBlue"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="LightGray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</UserControl.Resources>
<Grid Name="grid" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="258*" />
</Grid.RowDefinitions>
<Grid Name="grid_title">
<Grid.RowDefinitions>
<RowDefinition Height="18" />
<RowDefinition Height="22" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Rectangle Name="rectangle" Fill="{Binding IsValid,Converter={StaticResource ResourceKey=isvalidconv}}" Grid.ColumnSpan="4"/>
<Button Height="40" Width="40" Click="Button_Click" Template="{StaticResource ResourceKey=picture_button}" Grid.RowSpan="2">
<Grid >
<Image Source="/FLY.ControlLibrary;component/Images/info.png" />
</Grid>
</Button>
<Grid Grid.RowSpan="2" Grid.Column="1" Margin="2" Name="grid_left">
<TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="左">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="LIsL">
<Binding Path="LeftRightIsVisable"/>
<Binding Path="LeftRightIsReversed"/>
</MultiBinding>
</TextBlock.Visibility>
</TextBlock>
<TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="右">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="LIsR">
<Binding Path="LeftRightIsVisable"/>
<Binding Path="LeftRightIsReversed"/>
</MultiBinding>
</TextBlock.Visibility>
</TextBlock>
</Grid>
<Button Click="Button2_Click" Template="{StaticResource ResourceKey=picture_button}" Grid.Row="1" Grid.Column="2">
<TextBlock HorizontalAlignment="Center" FontSize="18" VerticalAlignment="Bottom" >
<Run Name="run_title" Text="{Binding Title}" FontWeight="SemiBold" />
<Run Name="run_title2" Text="{Binding Title2}" Foreground="#FF585858" />
</TextBlock>
</Button>
<Grid Grid.RowSpan="2" Grid.Column="3" Margin="2" Name="grid_right">
<TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="左">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="RIsL">
<Binding Path="LeftRightIsVisable"/>
<Binding Path="LeftRightIsReversed"/>
</MultiBinding>
</TextBlock.Visibility>
</TextBlock>
<TextBlock HorizontalAlignment="Center" FontSize="24" VerticalAlignment="Bottom" FontWeight="SemiBold" Text="右">
<TextBlock.Visibility>
<MultiBinding Converter="{StaticResource lrconv}" ConverterParameter="RIsR">
<Binding Path="LeftRightIsVisable"/>
<Binding Path="LeftRightIsReversed"/>
</MultiBinding>
</TextBlock.Visibility>
</TextBlock>
</Grid>
</Grid>
<WindowsFormsHost Grid.Row="1">
<Chr:Chart x:Name="chart1" />
</WindowsFormsHost>
</Grid>
</UserControl>
<UserControl x:Class="FLY.ControlLibrary.GraphScanCircular"
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.ControlLibrary"
mc:Ignorable="d"
d:DesignHeight="315" d:DesignWidth="430" Loaded="UserControl_Loaded">
<UserControl.Resources>
<ControlTemplate x:Key="picture_button" TargetType="Button">
<Border Name="border" BorderThickness="1" CornerRadius="5">
<ContentPresenter Content="{TemplateBinding Content}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="LightBlue"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="LightGray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</UserControl.Resources>
<Grid Name="grid" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="18" />
<RowDefinition Height="22" />
</Grid.RowDefinitions>
<Rectangle Name="rectangle" Fill="#FF579aab"/>
<TextBlock HorizontalAlignment="Center" FontSize="18" VerticalAlignment="Bottom" Grid.RowSpan="2">
<TextBlock.Inlines>
<Run Name="run_title" Text="{Binding Title}" FontWeight="SemiBold" />
<Run Name="run_title2" Text="{Binding Title2}" Foreground="#FF585858" />
</TextBlock.Inlines>
</TextBlock>
</Grid>
<StackPanel Orientation="Horizontal">
<Button x:Name="m_LogoImageButtonUC" Height="40" Width="40" Click="Button_Click" Template="{StaticResource ResourceKey=picture_button}">
<Image Source="/FLY.ControlLibrary;component/Images/info.png" />
</Button>
</StackPanel>
<Viewbox Grid.Row="1" Margin="6">
<Canvas x:Name="LayoutRoot" Width="600" Height="600" />
</Viewbox>
<TextBlock Name="run_calstate" Grid.Row="1" HorizontalAlignment="Left" FontSize="18" VerticalAlignment="Bottom" Margin="6">
<TextBlock.Inlines>
<Run Text="Max:" FontWeight="SemiBold" />
<Run Text="{Binding CalState_Max}" FontWeight="SemiBold" />
<LineBreak/>
<Run Text="Min:" FontWeight="SemiBold" />
<Run Text="{Binding CalState_Min}" FontWeight="SemiBold" />
<LineBreak/>
<Run Text="Avg:" FontWeight="SemiBold" />
<Run Text="{Binding CalState_Avg}" FontWeight="SemiBold" />
<LineBreak/>
<Run Text="2σ:" FontWeight="SemiBold" />
<Run Text="{Binding CalState_2Sigma}" FontWeight="SemiBold" />
</TextBlock.Inlines>
</TextBlock>
</Grid>
</UserControl>
......@@ -78,7 +78,7 @@
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
<Version>3.4.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -83,7 +83,7 @@
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
<Version>3.4.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
using AutoMapper;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Misc
{
public class JsonDbHelper<T, J>
{
public Mapper Mapper { get; protected set; }
public JsonDbHelper()
{
Mapper = new AutoMapper.Mapper(new MapperConfiguration(c =>
{
c.CreateMap<T, J>().ReverseMap();
}));
}
public bool Save(string file_path, T src)
{
try
{
var p = Mapper.Map<J>(src);
File.WriteAllText(file_path, JsonConvert.SerializeObject(p, Formatting.Indented));
return true;
}
catch
{
//异常,没有json 编码失败
}
return false;
}
public bool Load(string file_path, T src)
{
try
{
if (File.Exists(file_path))
{
string json = File.ReadAllText(file_path);
var p = JsonConvert.DeserializeObject<J>(json);
Mapper.Map(p, src);
return true;
}
}
catch
{
//异常,没有json 解码失败
}
return false;
}
}
}
......@@ -83,6 +83,7 @@
<Compile Include="DATARANGE.cs" />
<Compile Include="Enumerable.cs" />
<Compile Include="IgnoreAttribute.cs" />
<Compile Include="JsonDbHelper.cs" />
<Compile Include="ParamDictionary.cs" />
<Compile Include="IPEndPointJsonConverter.cs" />
<Compile Include="IsErrorAttribute.cs" />
......@@ -127,11 +128,14 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper">
<Version>10.1.1</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
<Version>3.4.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -86,7 +86,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
<Version>3.4.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -128,7 +128,7 @@
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
<Version>3.4.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -520,19 +520,19 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\livecharts\Core40\LiveCharts.csproj">
<Project>{f261c3d7-6194-4625-9516-044081b06028}</Project>
<Project>{7e95ecd3-1840-439e-9a2d-a660e90d21a5}</Project>
<Name>LiveCharts</Name>
</ProjectReference>
<ProjectReference Include="..\..\livecharts\Feng\Core40\LiveCharts.Feng.csproj">
<Project>{d5e281b5-b784-41bf-a3e8-edb9a00c7760}</Project>
<Project>{349cdc12-8ca8-4606-957e-f378e118b93d}</Project>
<Name>LiveCharts.Feng</Name>
</ProjectReference>
<ProjectReference Include="..\..\livecharts\Feng\WpfView\LiveCharts.Feng.Wpf.csproj">
<Project>{95b28c86-57cb-4dd4-ba3c-6e1b56b99edc}</Project>
<Project>{a7acd496-9d04-4f8e-b97e-c6c29ce2de06}</Project>
<Name>LiveCharts.Feng.Wpf</Name>
</ProjectReference>
<ProjectReference Include="..\..\livecharts\WpfView\LiveCharts.Wpf.csproj">
<Project>{4d253423-ae05-47f6-a59d-9162ec0bb1f2}</Project>
<Project>{6b294d41-5ad1-42fa-882d-4f18deaaa730}</Project>
<Name>LiveCharts.Wpf</Name>
</ProjectReference>
<ProjectReference Include="..\..\MultiLayout\MultiLayout.csproj">
......@@ -671,7 +671,7 @@
<Version>5.4.1.1</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
<Version>3.4.1</Version>
</PackageReference>
<PackageReference Include="Unity">
<Version>5.11.2</Version>
......
......@@ -155,7 +155,7 @@
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
<Version>3.4.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
......
......@@ -237,6 +237,7 @@ namespace FLY.Thick.Base.Server
string json = File.ReadAllText(file_path);
var p = JsonConvert.DeserializeObject<RejectJsonDb>(json);
Mapper.Map(p, src);
return true;
}
}
catch
......
Subproject commit bc3185c8b8e30b943bc3e8286e9a2c57c156f82e
Subproject commit 4ed21f891f894ac67a2048af145b7ccc9261ed05
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