Commit fd2f4630 authored by LiGuohua's avatar LiGuohua

分离分析和监视数据

parent 45f4a56a
......@@ -34,10 +34,11 @@ namespace FLY.HeatingHelper.UI.UiModule
private IUnityContainer container;
[InjectionMethod]
public void Init(IUnityContainer container,IThickHeatData dat)
public void Init(IUnityContainer container,[Dependency("forThread")]IThickHeatData dat)
{
this.container = container;
vm = new ViewModel_HeatThickDetector(container.Resolve<FLY.Thick.Blowing.IService.IBlowingService>(), dat);
dat.StartMonitorTask();
this.DataContext = vm;
}
......
......@@ -43,6 +43,7 @@ namespace FLY.HeatingHelper.UI.UiModule
public void Init(IUnityContainer container, IThickHeatData dat)
{
Dat = dat as IThickHeatData;
Dat.LoadMetaDataFromDB();
container.BuildUp(uc_SelectData);
container.BuildUp(uc_airRingShift);
container.BuildUp(uc_heatBoltAnalyst);
......@@ -84,7 +85,7 @@ namespace FLY.HeatingHelper.UI.UiModule
private void Page_Unloaded(object sender, RoutedEventArgs e)
{
Dat.EndUse();
Dat.EndUse();
}
}
......
......@@ -210,6 +210,8 @@ namespace FLY.HeatingHelper.UI.UiModule
//while (rb < 0) rb += cnt;
//while (rb >= cnt) rb -= cnt;
//ResetBolt = rb;
if (correls is null)
return;
TandH_Corel = correls[_NewResetBolt - 1];
}
}
......
......@@ -39,18 +39,7 @@ namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData
public DateTime? TotalDataFrom { get; set; } = null;
public int RecordCount
{
get
{
if (Dat is null) return -1;
return Dat.Dat_Times.Count();
}
set
{
}
}
public int RecordCount { get; set; }
public double[] DS_thick { get; set; }
public double[] DS_2sigma { get; set; }
......@@ -150,7 +139,7 @@ namespace FLY.HeatingHelper.UI.UiModule.UC_SelectData
Dat.LoadDataFromDB(1);
Dat.ResetCluster();
Dat.ClusterOnThickMean();
RecordCount = 1;
RecordCount = Dat.Dat_Times.Count(); ;
OnLoaded();
//UpdateChart();
}
......
......@@ -180,6 +180,8 @@ namespace FLY.HeatingHelper
int DataChanged { get; set; }
//bool IsDataReady { get; }
void StartMonitorTask();
bool BeginUse(bool isAsync = true);
void EndUse();
......
......@@ -31,7 +31,7 @@ namespace FLY.HeatingHelper
{
if (DBName == dbname) return;
DBName = dbname;
StartDBTask();
//StartDBTask();
//worker.WorkerSupportsCancellation = true;
//worker.WorkerReportsProgress = true;
//worker.DoWork += new DoWorkEventHandler((o, e) =>
......@@ -1541,8 +1541,9 @@ namespace FLY.HeatingHelper
#endregion
#region 自动更新数据的任务
private Task taskForDB;
private void StartDBTask()
public void StartMonitorTask()
{
taskForDB = Task.Factory.StartNew(() =>
{
......@@ -1550,10 +1551,9 @@ namespace FLY.HeatingHelper
{
if (BeginUse())
{
bool tmp = IsFilterUnstable;
IsFilterUnstable = true;
IsDataFilter = true;
RefreshData();
IsFilterUnstable = tmp;
EndUse();
Thread.Sleep(1000 * 60);
}
......
......@@ -225,14 +225,15 @@ namespace FLY.HeatingHelper
if ((reload == 0 && _ids.Count() == 0) || (reload == 1))
{
clear = true;
DateTime to = LoadDataTo + new TimeSpan(0, 0, 1);
if(IsFilterUnstable)
cmdstr = string.Format("select * from [ThickHeat] where IsStable=1 and Time>=\"{0}\" and Time<=\"{1}\"",
LoadDataFrom.ToString("yyyy-MM-dd HH:mm:ss"),
LoadDataTo.ToString("yyyy-MM-dd HH:mm:ss"));
to.ToString("yyyy-MM-dd HH:mm:ss"));
else
cmdstr = string.Format("select * from [ThickHeat] where Time>=\"{0}\" and Time<=\"{1}\"",
LoadDataFrom.ToString("yyyy-MM-dd HH:mm:ss"),
LoadDataTo.ToString("yyyy-MM-dd HH:mm:ss"));
to.ToString("yyyy-MM-dd HH:mm:ss"));
}
else
{
......
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