Commit 2c9d6c0f authored by 潘栩锋's avatar 潘栩锋 🚴

修复定点图样式

parent f503cd7b
......@@ -80,7 +80,7 @@
<Version>10.1.1</Version>
</PackageReference>
<PackageReference Include="NLog">
<Version>5.1.0</Version>
<Version>4.6.8</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>4.1.0</Version>
......
using FLY.Thick.Base.Client;
using FLY.Thick.Base.Common;
using FLY.Thick.Base.IService;
using MultiLayout.UiModule;
using FObjBase;
using LiveCharts;
using Misc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FLY.Thick.Base.IService;
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;
using FLY.Thick.Base.UI;
using Unity;
namespace FLY.Thick.Base.UI.UiModule
......@@ -38,7 +17,7 @@ namespace FLY.Thick.Base.UI.UiModule
InitializeComponent();
}
[InjectionMethod]
public void Init(int id, IUnityContainer container,
public void Init(int id, IUnityContainer container,
IFixService fixService, ITDGageService gageService)
{
//查找参数
......@@ -68,27 +47,6 @@ namespace FLY.Thick.Base.UI.UiModule
w.ShowDialog();
viewModel.IsPaused = isPaused;
}
private void button_pause_Click(object sender, RoutedEventArgs e)
{
viewModel.IsPaused = !viewModel.IsPaused;
}
private void button_save_Click(object sender, RoutedEventArgs e)
{
viewModel.PreSave();
WdSaveDatas w = new WdSaveDatas();
w.Init(viewModel);
w.ShowDialog();
}
private void button_analyze_Click(object sender, RoutedEventArgs e)
{
viewModel.GetDatas(out double intervalms, out List<double> datas);
PgFixAnalyze p = new PgFixAnalyze();
p.Init(intervalms, datas);
MultiLayout.FlyLayoutManager.NavigationService.Navigate(p);
}
}
......
......@@ -11,6 +11,7 @@ using System.Text;
using System.Threading.Tasks;
using FLY.Thick.Base.UI;
using FLY.Thick.Base.Common;
using CommunityToolkit.Mvvm.Input;
namespace FLY.Thick.Base.UI.UiModule
{
......@@ -61,9 +62,9 @@ namespace FLY.Thick.Base.UI.UiModule
/// </summary>
public double Min { get; set; }
/// <summary>
/// 3sigma
/// 2sigma
/// </summary>
public double Sigma3 { get; set; }
public double Sigma2 { get; set; }
#endregion
#region 状态
......@@ -92,6 +93,12 @@ namespace FLY.Thick.Base.UI.UiModule
/// </summary>
public bool IsADMode { get; private set; }
#endregion
public RelayCommand PauseCmd { get; private set; }
public RelayCommand SaveCmd { get; private set; }
public RelayCommand AnalyzeCmd { get; private set; }
public RelayCommand ClearCmd { get; private set; }
/// <summary>
/// 真实接收的数据,与 Values 不一样, Values只是mDatas的一部分
/// </summary>
......@@ -119,6 +126,11 @@ namespace FLY.Thick.Base.UI.UiModule
DynArea dynArea;
public FixGraphVm()
{
PauseCmd = new RelayCommand(Pause);
SaveCmd = new RelayCommand(Save);
AnalyzeCmd = new RelayCommand(Analyze);
ClearCmd = new RelayCommand(UpdateIsADMode);
#region 与数据无关界面参数
XFormatter = (x) =>
{
......@@ -147,7 +159,26 @@ namespace FLY.Thick.Base.UI.UiModule
IsPaused = this.dynArea.ControllerState != CTRL_STATE.FIX;
}
private void Analyze()
{
GetDatas(out double intervalms, out List<double> datas);
var p = new FLY.Thick.Base.UI.UiModule.PgFixAnalyze();
p.Init(intervalms, datas);
MultiLayout.FlyLayoutManager.NavigationService.Navigate(p);
}
private void Save()
{
PreSave();
WdSaveDatas w = new WdSaveDatas();
w.Init(this);
w.ShowDialog();
}
private void Pause()
{
IsPaused = !IsPaused;
}
private void DynArea_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(DynArea.ControllerState)) {
......@@ -426,7 +457,7 @@ namespace FLY.Thick.Base.UI.UiModule
Max = double.NaN;
Min = double.NaN;
Average = double.NaN;
Sigma3 = double.NaN;
Sigma2 = double.NaN;
AutoTarget = double.NaN;
return;
}
......@@ -434,7 +465,7 @@ namespace FLY.Thick.Base.UI.UiModule
Max = mDatas.Max();
Min = mDatas.Min();
Average = mDatas.Average();
Sigma3 = mDatas.Sigma() * 3;
Sigma2 = mDatas.Sigma() * 2;
if (mDatas.Count > 100)
{
......
......@@ -73,23 +73,23 @@ namespace FLY.Thick.Base.UI
/// <returns></returns>
public static bool Authorize(string uiName, out int pwLv, string msg=null)
{
pwLv = 0;
//从容器获取
var container = Application.Current.Properties["container"] as IUnityContainer;
if (container == null)
return true;
return Authorize(uiName, 0, out pwLv, msg);
}
var passwordAuthorize = container.Resolve<PasswordAuthorize>();
int level = passwordAuthorize.GetLv(uiName);
if (level <= 0)
return true;
/// <summary>
///
/// </summary>
/// <param name="level">要求的级别</param>
/// <param name="pwLv">当密码正确时,密码的级别</param>
/// <returns></returns>
public static bool Authorize(int level, out int pwLv)
{
return Authorize(null, level, out pwLv);
}
WdPassword w = new WdPassword();
w.Init(passwordAuthorize, level, msg);
w.Owner = Application.Current.MainWindow;
bool ret = (bool)w.ShowDialog();
pwLv = w.PwLv;
return ret;
public static bool Authorize(int level, string msg)
{
return Authorize(null, level, out int pwLv, msg);
}
/// <summary>
......@@ -98,7 +98,7 @@ namespace FLY.Thick.Base.UI
/// <param name="level">要求的级别</param>
/// <param name="pwLv">当密码正确时,密码的级别</param>
/// <returns></returns>
public static bool Authorize(int level, out int pwLv)
public static bool Authorize(string uiName, int level, out int pwLv, string msg = null)
{
pwLv = 0;
//从容器获取
......@@ -107,11 +107,16 @@ namespace FLY.Thick.Base.UI
return true;
var passwordAuthorize = container.Resolve<PasswordAuthorize>();
if (!string.IsNullOrEmpty(uiName))
{
level = passwordAuthorize.GetLv(uiName);
}
if (level <= 0)
return true;
WdPassword w = new WdPassword();
w.Init(passwordAuthorize, level);
w.Init(passwordAuthorize, level, msg);
w.Owner = Application.Current.MainWindow;
bool ret = (bool)w.ShowDialog();
pwLv = w.PwLv;
......
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