Bläddra i källkod

弹窗更新

reconfiguration
lyw 3 månader sedan
förälder
incheckning
249e00d353
10 ändrade filer med 691 tillägg och 223 borttagningar
  1. +9
    -1
      BPASmartClient.Academy/App.config
  2. +1
    -1
      BPASmartClient.Academy/Converter/DeviceCtrlConvert.cs
  3. +13
    -1
      BPASmartClient.Academy/Model/DeviceCtrl.cs
  4. +52
    -0
      BPASmartClient.Academy/Model/PipeLineStatus.cs
  5. +275
    -126
      BPASmartClient.Academy/Model/Simens_PLC.cs
  6. +262
    -82
      BPASmartClient.Academy/View/DeviceMotionView.xaml
  7. +45
    -11
      BPASmartClient.Academy/View/DeviceMotionView.xaml.cs
  8. +5
    -0
      BPASmartClient.Academy/ViewModel/DeviceMotionViewModel.cs
  9. +28
    -0
      BPASmartClient.CustomResource/UserControls/MessageShow/NoticeDemoViewModel.cs
  10. +1
    -1
      BPASmartClient.CustomResource/UserControls/MessageShow/Notifiaction.xaml.cs

+ 9
- 1
BPASmartClient.Academy/App.config Visa fil

@@ -14,6 +14,7 @@
<section name="Services" type="System.Configuration.NameValueSectionHandler"/>
<section name="MQTTParam" type="System.Configuration.NameValueSectionHandler"/>
<section name="PLCInfo" type="System.Configuration.NameValueSectionHandler"/>
<section name="Alarm" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<FlexBatchSystem>
@@ -68,8 +69,15 @@
<add key="Port" value="18883"/>
</MQTTParam>
<PLCInfo>
<add key="IpAddress" value="192.168.2.11"/>
<add key="IpAddress" value="192.168.2.1"/>
<add key="Port" value="502"/>
</PLCInfo>
<Alarm>
<add key="DB1.DBX2004.0" value="急停"/>
<add key="DB1.DBX2004.1" value="M101电机异常"/>
<add key="DB1.DBX2004.2" value="M102电机异常"/>
<add key="DB1.DBX2004.3" value="M103电机异常"/>
<add key="DB1.DBX2004.4" value="通讯异常"/>
</Alarm>
</FlexBatchSystem>
</configuration>

+ 1
- 1
BPASmartClient.Academy/Converter/DeviceCtrlConvert.cs Visa fil

@@ -98,7 +98,7 @@ namespace BPASmartClient.Academy.Converter
bool value_get = (bool)value;
if (value_get)
{
return -1;
return 2;
}
else
{


+ 13
- 1
BPASmartClient.Academy/Model/DeviceCtrl.cs Visa fil

@@ -12,12 +12,13 @@ namespace BPASmartClient.Academy.Model
public bool M101 { get { return _m101; } set { _m101 = value;OnPropertyChanged(); } }
private bool _m101 = false;
private int myVar;

public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
public bool IsConnect { get { return _isConnect; } set { _isConnect = value; OnPropertyChanged(); } }
private bool _isConnect = false;
public bool M102 { get { return _m102; } set { _m102 = value; OnPropertyChanged(); } }
private bool _m102 = false;
public bool M103 { get { return _m103; } set { _m103 = value; OnPropertyChanged(); } }
@@ -45,5 +46,16 @@ namespace BPASmartClient.Academy.Model
private bool _vx109 = false;
public bool VX110 { get { return _vx110; } set { _vx110 = value; OnPropertyChanged(); } }
private bool _vx110 = false;
public bool VX111 { get { return _vx111; } set { _vx111 = value; OnPropertyChanged(); } }
private bool _vx111 = false;
public bool VX112 { get { return _vx112; } set { _vx112 = value; OnPropertyChanged(); } }
private bool _vx112 = false;
public bool VX113 { get { return _vx113; } set { _vx113 = value; OnPropertyChanged(); } }
private bool _vx113 = false;
public bool VX114 { get { return _vx114; } set { _vx114 = value; OnPropertyChanged(); } }
private bool _vx114 = false;
public bool VX115 { get { return _vx115; } set { _vx115 = value; OnPropertyChanged(); } }
private bool _vx115 = false;

}
}

+ 52
- 0
BPASmartClient.Academy/Model/PipeLineStatus.cs Visa fil

@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Academy.Model
{
public class PipeLineStatus:NotifyBase
{
private int _direction;

public int Direction
{
get { return _direction; }
set { _direction = value;OnPropertyChanged(); }
}
private bool _fill;

public bool Fill
{
get { return _fill; }
set { _fill = value;OnPropertyChanged(); }
}

}

public class PipeLineMode : NotifyBase
{
private PipeLineStatus _pipeH_1=new PipeLineStatus();

public PipeLineStatus PipeH_1
{
get { return _pipeH_1; }
set { _pipeH_1 = value; OnPropertyChanged(); }
}
private PipeLineStatus _pipeH_2=new PipeLineStatus();

public PipeLineStatus PipeH_2
{
get { return _pipeH_2; }
set { _pipeH_2 = value; OnPropertyChanged(); }
}
private PipeLineStatus _pipeH_3 = new PipeLineStatus();

public PipeLineStatus PipeH_3
{
get { return _pipeH_3; }
set { _pipeH_3 = value; OnPropertyChanged(); }
}
}
}

+ 275
- 126
BPASmartClient.Academy/Model/Simens_PLC.cs Visa fil

@@ -1,7 +1,10 @@
using BPA.Helper;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;
using LiveCharts;
using Microsoft.Windows.Input;
using Newtonsoft.Json.Linq;
using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
@@ -21,8 +24,9 @@ namespace BPASmartClient.Academy.Model
public DataFeedback dataFeedback { get; set; } = new DataFeedback();
public string id { get; set; } = "";
//public SiemensHelper siemens { get; set; } = new SiemensHelper();
public ICommSiemens siemens { get; set; } = CommHelper.Siemens;
public ICommSiemens siemens;
public DeviceCtrl deviceCtrl { get; set; } = new DeviceCtrl();
public ConcurrentDictionary<string,string> AlarmInfo { get; set; }= new ConcurrentDictionary<string, string>();
public bool IsConnected { get; set; } = false;
bool heart = false;
public void Connect()
@@ -32,16 +36,19 @@ namespace BPASmartClient.Academy.Model
var x = (NameValueCollection)ConfigurationManager.GetSection("FlexBatchSystem/PLCInfo");
if (x != null)
{
string ip = x.Get("IpAddress");
//siemens.Connect(S7.Net.CpuType.S7200Smart, x.Get("IpAddress"), Convert.ToInt32(x.Get("Port")));
CommHelper.CreateSiemens(CpuType.S7200Smart, x.Get("IpAddress"));
CommHelper.CreateSiemens(CpuType.S7200Smart, x.Get("IpAddress")).OnSuccess(o =>
{
siemens = o.Content;
IsConnected = true;
});
}
});



}
public void Init()
{
AlarmInfoGet();
ThreadManage.GetInstance.StartLong(() =>
{
ReadStatus();
@@ -55,92 +62,231 @@ namespace BPASmartClient.Academy.Model
ChartDataRead();
}, "曲线数据");
}
public void AlarmInfoGet()
{
var x = (NameValueCollection)ConfigurationManager.GetSection("FlexBatchSystem/Alarm");
if (x!=null)
{
x.AllKeys.ToList().ForEach(o =>
{
if (!AlarmInfo.ContainsKey(o))
{
AlarmInfo.TryAdd(o, x.Get(o));
}
});
}
}
public void AlarmRead()
{
if (IsConnected)
{
AlarmInfo.Keys.ToList().ForEach(o =>
{
siemens.Read<bool>(o).OnSuccess(p =>
{
if (p.Content)
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", Simens_PLC.GetInstance.AlarmInfo[o], 2, 1);
});
}
});
});
}
}
public void ReadStatus()
{
if (IsConnected)
{
deviceCtrl.M101 = siemens.Read<bool>("V2000.0").Content;
deviceCtrl.M102 = siemens.Read<bool>("V2000.1").Content;
deviceCtrl.M103 = siemens.Read<bool>("V2000.2").Content;
deviceCtrl.VX100 = siemens.Read<bool>("V2000.3").Content;
deviceCtrl.VX101 = siemens.Read<bool>("V2000.4").Content;
deviceCtrl.VX102 = siemens.Read<bool>("V2000.5").Content;
deviceCtrl.VX103 = siemens.Read<bool>("V2000.6").Content;
deviceCtrl.VX104 = siemens.Read<bool>("V2000.7").Content;
deviceCtrl.VX105 = siemens.Read<bool>("V2001.0").Content;
deviceCtrl.VX106 = siemens.Read<bool>("V2001.1").Content;
deviceCtrl.VX107 = siemens.Read<bool>("V2001.2").Content;
deviceCtrl.VX108 = siemens.Read<bool>("V2001.3").Content;
deviceCtrl.VX109 = siemens.Read<bool>("V2001.4").Content;
deviceCtrl.VX110 = siemens.Read<bool>("V2001.5").Content;
heart = siemens.Read<bool>("V1003.7").Content;
siemens.Read<bool>("DB1.DBX1003.7").OnSuccess(o =>
{
heart = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.0").OnSuccess(o =>
{
deviceCtrl.M101 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.1").OnSuccess(o =>
{
deviceCtrl.M102 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.2").OnSuccess(o =>
{
deviceCtrl.M103 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.3").OnSuccess(o =>
{
deviceCtrl.VX100 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.4").OnSuccess(o =>
{
deviceCtrl.VX101 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.5").OnSuccess(o =>
{
deviceCtrl.VX102 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.6").OnSuccess(o =>
{
deviceCtrl.VX103 = o.Content;
});
siemens.Read<bool>("DB1.DBX2000.7").OnSuccess(o =>
{
deviceCtrl.VX104 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.0").OnSuccess(o =>
{
deviceCtrl.VX105 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.1").OnSuccess(o =>
{
deviceCtrl.VX106 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.2").OnSuccess(o =>
{
deviceCtrl.VX107 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.3").OnSuccess(o =>
{
deviceCtrl.VX108 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.4").OnSuccess(o =>
{
deviceCtrl.VX109 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.5").OnSuccess(o =>
{
deviceCtrl.VX110 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.6").OnSuccess(o =>
{
deviceCtrl.VX111 = o.Content;
});
siemens.Read<bool>("DB1.DBX2001.7").OnSuccess(o =>
{
deviceCtrl.VX112 = o.Content;
});
siemens.Read<bool>("DB1.DBX2002.0").OnSuccess(o =>
{
deviceCtrl.VX113 = o.Content;
});
siemens.Read<bool>("DB1.DBX2002.1").OnSuccess(o =>
{
deviceCtrl.VX114 = o.Content;
});
siemens.Read<bool>("DB1.DBX2002.2").OnSuccess(o =>
{
deviceCtrl.VX115 = o.Content;
});
PipeDetect();
Thread.Sleep(100);
}
}
public void ChartDataRead()
public void PipeDetect()
{
if (id != "")
if (deviceCtrl.VX102||deviceCtrl.VX103)
{
SaveData saveData = new SaveData()
{
Id = id,
Name = dataFeedback.Name,
Date = DateTime.Now,
M101_Speed = siemens.Read<double>("VD2006").Content,
M102_Speed = siemens.Read<double>("VD2010").Content,
M103_Speed = siemens.Read<double>("VD2014").Content,
OpenValve = siemens.Read<double>("VD2018").Content,
TempWok = siemens.Read<double>("VD2022").Content,
TempMaterial = siemens.Read<double>("VD2026").Content,
TempVent = siemens.Read<double>("VD2030").Content,
PressureWok = siemens.Read<double>("VD2034").Content,
WeightWok = siemens.Read<double>("VD2038").Content,
};


DataView(dataFeedback.M101_Speed, new DataValue() { DateTime = saveData.Date, Value = saveData.M101_Speed });
DataView(dataFeedback.M102_Speed, new DataValue() { DateTime = saveData.Date, Value = saveData.M102_Speed });
DataView(dataFeedback.M103_Speed, new DataValue() { DateTime = saveData.Date, Value = saveData.M103_Speed });
DataView(dataFeedback.OpenValve, new DataValue() { DateTime = saveData.Date, Value = saveData.OpenValve });
DataView(dataFeedback.TempWok, new DataValue() { DateTime = saveData.Date, Value = saveData.TempWok });
DataView(dataFeedback.TempMaterial, new DataValue() { DateTime = saveData.Date, Value = saveData.TempMaterial });
DataView(dataFeedback.TempVent, new DataValue() { DateTime = saveData.Date, Value = saveData.TempVent });
DataView(dataFeedback.PressureWok, new DataValue() { DateTime = saveData.Date, Value = saveData.PressureWok });
DataView(dataFeedback.WeightWok, new DataValue() { DateTime = saveData.Date, Value = saveData.WeightWok });
DeviceMotionViewModel.PipeLine.PipeH_1.Fill = true;
DeviceMotionViewModel.PipeLine.PipeH_1.Direction = 1;
}
else
{
DeviceMotionViewModel.PipeLine.PipeH_1.Fill = false;
DeviceMotionViewModel.PipeLine.PipeH_1.Direction = 0;
}
if (deviceCtrl.VX107||deviceCtrl.VX110)
{
DeviceMotionViewModel.PipeLine.PipeH_2.Fill = true;
DeviceMotionViewModel.PipeLine.PipeH_2.Direction = 1;
}
else
{
DateTime date = DateTime.Now;
Random random = new Random();
DeviceMotionViewModel.PipeLine.PipeH_2.Fill = false;
DeviceMotionViewModel.PipeLine.PipeH_2.Direction = 0;
}
if (deviceCtrl.VX108||deviceCtrl.VX109)
{
DeviceMotionViewModel.PipeLine.PipeH_3.Fill = true;
DeviceMotionViewModel.PipeLine.PipeH_3.Direction = 1;
}
else
{
DeviceMotionViewModel.PipeLine.PipeH_3.Fill = false;
DeviceMotionViewModel.PipeLine.PipeH_3.Direction = 0;
}
}
public void ChartDataRead()
{
if (siemens!=null)
{
SaveData saveData = new SaveData()
{
Id = id,
Name = dataFeedback.Name,
Date = DateTime.Now,
M101_Speed = random.Next(0, 2000),
M102_Speed = random.Next(0, 2000),
M103_Speed = random.Next(0, 2000),
OpenValve = random.Next(0, 5),
TempWok = random.Next(-10, 150),
TempMaterial = random.Next(-10, 150),
TempVent = random.Next(-10, 150),
PressureWok = random.NextDouble(),
WeightWok = random.Next(0, 50),
M101_Speed = siemens.Read<double>("DB1.DBD2006").Content,
M102_Speed = siemens.Read<double>("DB1.DBD2010").Content,
M103_Speed = siemens.Read<double>("DB1.DBD2014").Content,
OpenValve = siemens.Read<double>("DB1.DBD2018").Content,
TempWok = siemens.Read<double>("DB1.DBD2022").Content,
TempMaterial = siemens.Read<double>("DB1.DBD2026").Content,
TempVent = siemens.Read<double>("DB1.DBD2030").Content,
PressureWok = siemens.Read<double>("DB1.DBD2034").Content,
WeightWok = siemens.Read<double>("DB1.DBD2038").Content,
};
Sqlite.GetInstance.saveDatas.Add(saveData);
DataView(dataFeedback.M101_Speed, new DataValue() { DateTime = date, Value = saveData.M101_Speed });
DataView(dataFeedback.M102_Speed, new DataValue() { DateTime = date, Value = saveData.M102_Speed });
DataView(dataFeedback.M103_Speed, new DataValue() { DateTime = date, Value = saveData.M103_Speed });
DataView(dataFeedback.TempWok, new DataValue() { DateTime = date, Value = saveData.TempWok });
DataView(dataFeedback.TempMaterial, new DataValue() { DateTime = date, Value = saveData.TempMaterial });
DataView(dataFeedback.TempVent, new DataValue() { DateTime = date, Value = saveData.TempVent });
DataView(dataFeedback.OpenValve, new DataValue() { DateTime = date, Value = saveData.OpenValve });
DataView(dataFeedback.PressureWok, new DataValue() { DateTime = date, Value = saveData.PressureWok });
DataView(dataFeedback.WeightWok, new DataValue() { DateTime = date, Value = saveData.WeightWok });
if (id != "")
{
DataView(dataFeedback.M101_Speed, new DataValue() { DateTime = saveData.Date, Value = saveData.M101_Speed });
DataView(dataFeedback.M102_Speed, new DataValue() { DateTime = saveData.Date, Value = saveData.M102_Speed });
DataView(dataFeedback.M103_Speed, new DataValue() { DateTime = saveData.Date, Value = saveData.M103_Speed });
DataView(dataFeedback.OpenValve, new DataValue() { DateTime = saveData.Date, Value = saveData.OpenValve });
DataView(dataFeedback.TempWok, new DataValue() { DateTime = saveData.Date, Value = saveData.TempWok });
DataView(dataFeedback.TempMaterial, new DataValue() { DateTime = saveData.Date, Value = saveData.TempMaterial });
DataView(dataFeedback.TempVent, new DataValue() { DateTime = saveData.Date, Value = saveData.TempVent });
DataView(dataFeedback.PressureWok, new DataValue() { DateTime = saveData.Date, Value = saveData.PressureWok });
DataView(dataFeedback.WeightWok, new DataValue() { DateTime = saveData.Date, Value = saveData.WeightWok });
}
else
{
//DateTime date = DateTime.Now;
//Random random = new Random();
//SaveData saveData = new SaveData()
//{
// Id = id,
// Name = dataFeedback.Name,
// Date = DateTime.Now,
// M101_Speed = random.Next(0, 2000),
// M102_Speed = random.Next(0, 2000),
// M103_Speed = random.Next(0, 2000),
// OpenValve = random.Next(0, 5),
// TempWok = random.Next(-10, 150),
// TempMaterial = random.Next(-10, 150),
// TempVent = random.Next(-10, 150),
// PressureWok = random.NextDouble(),
// WeightWok = random.Next(0, 50),
//};
//Sqlite.GetInstance.saveDatas.Add(saveData);
//DataView(dataFeedback.M101_Speed, new DataValue() { DateTime = date, Value = saveData.M101_Speed });
//DataView(dataFeedback.M102_Speed, new DataValue() { DateTime = date, Value = saveData.M102_Speed });
//DataView(dataFeedback.M103_Speed, new DataValue() { DateTime = date, Value = saveData.M103_Speed });
//DataView(dataFeedback.TempWok, new DataValue() { DateTime = date, Value = saveData.TempWok });
//DataView(dataFeedback.TempMaterial, new DataValue() { DateTime = date, Value = saveData.TempMaterial });
//DataView(dataFeedback.TempVent, new DataValue() { DateTime = date, Value = saveData.TempVent });
//DataView(dataFeedback.OpenValve, new DataValue() { DateTime = date, Value = saveData.OpenValve });
//DataView(dataFeedback.PressureWok, new DataValue() { DateTime = date, Value = saveData.PressureWok });
//DataView(dataFeedback.WeightWok, new DataValue() { DateTime = date, Value = saveData.WeightWok });



}
}
Thread.Sleep(1000);
}
public void DataView<T>(ChartValues<T> values, T value)
@@ -157,73 +303,76 @@ namespace BPASmartClient.Academy.Model
}
public void Heartbeat()
{
if (!heart)
{
siemens.Write<bool>("V1003.7", true);
}
else
if (IsConnected)
{
IsConnected = false;
GetInstance.Connect();
}

if (deviceCtrl.M101)
{
deviceCtrl.M101 = false;
}
else
if (!heart&&siemens!=null)
{
deviceCtrl.M101 = true;
siemens.Write<bool>("DB1.DBX1003.7", true).OnFailure(o =>
{
IsConnected = false;
}).OnSuccess(o =>
{
IsConnected=true;
});
}

if (deviceCtrl.VX100)
{
deviceCtrl.VX100 = false;
}
else
{
deviceCtrl.VX100 = true;
}
//if (deviceCtrl.M101)
//{
// deviceCtrl.M101 = false;
//}
//else
//{
// deviceCtrl.M101 = true;
//}

if (deviceCtrl.M102)
{
deviceCtrl.M102 = false;
}
else
{
deviceCtrl.M102 = true;
}
//if (deviceCtrl.VX100)
//{
// deviceCtrl.VX100 = false;
//}
//else
//{
// deviceCtrl.VX100 = true;
//}

if (deviceCtrl.VX101)
{
deviceCtrl.VX101 = false;
}
else
{
deviceCtrl.VX101 = true;
}
//if (deviceCtrl.M102)
//{
// deviceCtrl.M102 = false;
//}
//else
//{
// deviceCtrl.M102 = true;
//}

if (deviceCtrl.VX102)
{
deviceCtrl.VX102 = false;
}
else
{
deviceCtrl.VX102 = true;
}
//if (deviceCtrl.VX101)
//{
// deviceCtrl.VX101 = false;
//}
//else
//{
// deviceCtrl.VX101 = true;
//}

if (deviceCtrl.VX103)
{
deviceCtrl.VX103 = false;
deviceCtrl.VX104 = false;
deviceCtrl.VX105 = false;
}
else
{
deviceCtrl.VX103 = true;
deviceCtrl.VX104 = true;
deviceCtrl.VX105 = true;
}

//if (deviceCtrl.VX102)
//{
// deviceCtrl.VX102= false;
// deviceCtrl.VX104 = false;
// deviceCtrl.VX105 = false;
// deviceCtrl.VX106 = false;
// deviceCtrl.VX109 = false;
//}
//else
//{
// deviceCtrl.VX102 = true;
// deviceCtrl.VX104 = true;
// deviceCtrl.VX105 = true;
// deviceCtrl.VX106 = true;
// deviceCtrl.VX109 = true;
//}
//PipeDetect();
Thread.Sleep(3000);
}



+ 262
- 82
BPASmartClient.Academy/View/DeviceMotionView.xaml Visa fil

@@ -143,8 +143,9 @@
<bpa:PipeLineTR
Width="30"
Margin="0,-1,-15,0"
Direction="{Binding DeviceStatus.VX100, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX100, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX100, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="15"
Speed="10" />
</StackPanel>
<TextBlock
@@ -185,28 +186,54 @@
Canvas.Top="350"
Foreground="{Binding DeviceStatus.VX105, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="阀门6" />
<TextBlock
Canvas.Left="630"
Canvas.Top="30"
Foreground="{Binding DeviceStatus.VX106, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="阀门7" />
<TextBlock
Canvas.Left="410"
Canvas.Top="240"
Foreground="{Binding DeviceStatus.VX107, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="阀门8" />
<TextBlock
Canvas.Left="30"
Canvas.Top="250"
Foreground="{Binding DeviceStatus.VX108, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="阀门9" />
<TextBlock
Canvas.Left="50"
Canvas.Top="310"
Foreground="{Binding DeviceStatus.VX109, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="阀门10" />
<TextBlock
Canvas.Left="380"
Canvas.Top="305"
Foreground="{Binding DeviceStatus.VX110, Converter={StaticResource deviceConvert}, ConverterParameter=4}"
Text="阀门11" />
<bpa:PipeLineH
Canvas.Left="229"
Canvas.Top="208"
Width="198"
Height="8"
Direction="{Binding DeviceStatus.M101, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Fill="{Binding DeviceStatus.M101, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
Direction="{Binding PipeLine.PipeH_1.Direction}"
Fill="{Binding PipeLine.PipeH_1.Fill, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
Speed="10" />
<bpa:PipeLineTL
Canvas.Left="427"
Canvas.Top="200"
Width="16"
Margin="0,0,0,-8"
Direction="{Binding DeviceStatus.VX102, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX102, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX102, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="25"
Speed="10" />
<bpa:PipeLineV
Canvas.Left="435"
Canvas.Top="177"
Width="8"
Height="23"
Direction="{Binding DeviceStatus.VX102, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX102, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX102, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
Speed="10" />

@@ -278,6 +305,7 @@
Margin="0,0,0,-8"
Direction="{Binding DeviceStatus.VX102, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Fill="{Binding DeviceStatus.VX102, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="25"
Speed="10" />
<bpa:PipeLineH
Width="50"
@@ -332,8 +360,9 @@
<bpa:PipeLineTL
Width="16"
Margin="0,0,0,8"
Direction="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="25"
Speed="10" />
</StackPanel>

@@ -342,7 +371,7 @@
Canvas.Top="170"
Width="8"
Height="30"
Direction="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
Speed="10" />

@@ -350,15 +379,16 @@
Canvas.Left="638"
Canvas.Top="154"
Width="16"
Direction="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="25"
Speed="10" />
<bpa:PipeLineH
Canvas.Left="607"
Canvas.Top="154"
Width="31"
Height="8"
Direction="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX103, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
Speed="10" />

@@ -382,16 +412,16 @@
Canvas.Left="321"
Canvas.Top="229"
Width="30"
Direction="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="13"
LineWidth="15"
Speed="10" />
<bpa:PipeLineV
Canvas.Left="336"
Canvas.Top="180"
Width="15"
Height="50"
Direction="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
Speed="10" />
<bpa:PipeLineV
@@ -399,7 +429,7 @@
Canvas.Top="40"
Width="15"
Height="110"
Direction="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Direction="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
Speed="10" />
<bpa:PipeLineBR
@@ -408,6 +438,7 @@
Width="30"
Direction="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Fill="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="15"
Speed="10" />
<bpa:PipeLineH
Canvas.Left="366"
@@ -446,6 +477,7 @@
Width="30"
Direction="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Fill="{Binding DeviceStatus.VX101, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="15"
Speed="10" />
<bpa:Condenser
Width="65"
@@ -518,26 +550,30 @@
Width="95"
Height="12"
Margin="265,278,402,154"
Direction="1"
LineWidth="2" />
Direction="{Binding PipeLine.PipeH_2.Direction}"
Fill="{Binding PipeLine.PipeH_2.Fill, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="4" />
<bpa:PipeLineTL
Width="24"
Height="24"
Margin="360,266,402,154"
Direction="-1"
LineWidth="7"
Direction="{Binding DeviceStatus.VX107, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX107, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="18"
Speed="10" />
<bpa:PipeLineV
Width="12"
Height="40"
Margin="372,226,402,154"
Direction="1"
LineWidth="2" />
Direction="{Binding DeviceStatus.VX107, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX107, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="4" />
<bpa:HandValve
x:Name="VX107"
Width="35"
Height="35"
Margin="365,232,402,154"
OpenEnable="{Binding DeviceStatus.VX107}"
RenderTransformOrigin="0.5,0.5">
<bpa:HandValve.RenderTransform>
<TransformGroup>
@@ -550,15 +586,17 @@
</bpa:HandValve>
<bpa:PipeLineV
Width="12"
Height="40"
Margin="345,290,402,154"
Direction="1"
LineWidth="2" />
Height="50"
Margin="348,287,402,154"
Direction="{Binding DeviceStatus.VX110, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Fill="{Binding DeviceStatus.VX110, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="4" />
<bpa:HandValve
x:Name="VX110"
Width="35"
Height="35"
Margin="338,296,402,154"
Margin="341,296,402,154"
OpenEnable="{Binding DeviceStatus.VX110}"
RenderTransformOrigin="0.5,0.5">
<bpa:HandValve.RenderTransform>
<TransformGroup>
@@ -575,27 +613,42 @@
Width="95"
Height="12"
Margin="105,278,402,154"
LineWidth="2" />
Direction="{Binding PipeLine.PipeH_3.Direction}"
Fill="{Binding PipeLine.PipeH_3.Fill, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="4" />
<bpa:PipeLineTR
Width="24"
Height="24"
Margin="81,266,402,154"
Direction="{Binding DeviceStatus.VX108, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX108, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="18"
Speed="10" />
<bpa:PipeLineTR
Width="24"
Height="24"
Margin="81,266,402,154"
LineWidth="7"
Direction="{Binding DeviceStatus.VX108, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX108, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="18"
Speed="10" />
<bpa:PipeLineV
Width="12"
Height="30"
Margin="81,236,402,154"
LineWidth="2" />
Height="40"
Margin="81,226,402,154"
Direction="{Binding DeviceStatus.VX108, Converter={StaticResource deviceConvert}, ConverterParameter=1}"
Fill="{Binding DeviceStatus.VX108, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="4" />
<bpa:HandValve
x:Name="VX108"
Width="35"
Height="35"
Margin="65,236,402,154"
Margin="65,240,402,154"
OpenEnable="{Binding DeviceStatus.VX109}"
RenderTransformOrigin="0.5,0.5">
<bpa:HandValve.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.926" ScaleY="1.08" />
<ScaleTransform ScaleX="-0.926" ScaleY="1.08" />
<SkewTransform />
<RotateTransform Angle="270" />
<TranslateTransform />
@@ -604,18 +657,21 @@
</bpa:HandValve>
<bpa:PipeLineV
Width="12"
Height="40"
Height="50"
Margin="105,290,402,154"
LineWidth="2" />
Direction="{Binding DeviceStatus.VX109, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX109, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="4" />
<bpa:HandValve
x:Name="VX109"
Width="35"
Height="35"
Margin="89,290,402,154"
Margin="89,297,402,154"
OpenEnable="{Binding DeviceStatus.VX109}"
RenderTransformOrigin="0.5,0.5">
<bpa:HandValve.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.926" ScaleY="1.08" />
<ScaleTransform ScaleX="-0.926" ScaleY="1.08" />
<SkewTransform />
<RotateTransform Angle="270" />
<TranslateTransform />
@@ -627,12 +683,15 @@
Width="65"
Height="8"
Margin="607,68,402,154"
Direction="{Binding DeviceStatus.VX106, Converter={StaticResource deviceConvert}, ConverterParameter=5}"
Fill="{Binding DeviceStatus.VX106, Converter={StaticResource deviceConvert}, ConverterParameter=2}"
LineWidth="2" />
<bpa:HandValve
x:Name="VX106"
Width="30"
Height="20"
Margin="617,58,402,154"
OpenEnable="{Binding DeviceStatus.VX106}"
RenderTransformOrigin="0.5,0.5" />


@@ -668,7 +727,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
<RowDefinition />
<RowDefinition Height="200"/>
</Grid.RowDefinitions>
<StackPanel
Margin="0,20,20,0"
@@ -697,21 +756,20 @@
Content="系统启动"
FontSize="20"
Style="{StaticResource Beveledcheck}" />
<StackPanel
<TextBlock
Grid.Row="1"
VerticalAlignment="Center"
Orientation="Vertical">
<TextBlock
Margin="20,10"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="20"
Foreground="White"
Text="开关控制:" />
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" >
</ScrollViewer>
<WrapPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
Margin="20,10"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontSize="20"
Foreground="White"
Text="开关控制:" />
<ScrollViewer
Grid.Row="1"
Margin="0,50,0,0"
IsManipulationEnabled="True"
PanningMode="VerticalOnly">
<WrapPanel Width="600">
<StackPanel
Margin="5,2"
HorizontalAlignment="Left"
@@ -849,6 +907,7 @@
Height="40"
BorderThickness="0"
Content="阀门3:关"
Click="Close_Click"
FontSize="16"
Foreground="White"
GroupName="5"
@@ -943,9 +1002,153 @@
Style="{StaticResource radiobutton}"
Tag="8" />
</StackPanel>
<StackPanel
Margin="10,20"
HorizontalAlignment="Left"
Orientation="Vertical">
<RadioButton
Width="120"
Height="40"
Margin="0,0,0,10"
BorderThickness="0"
Click="Open_Click"
Content="阀门7:开"
FontSize="16"
Foreground="White"
GroupName="9"
Style="{StaticResource radiobutton}"
Tag="9" />
<RadioButton
Width="120"
Height="40"
BorderThickness="0"
Click="Close_Click"
Content="阀门7:关"
FontSize="16"
Foreground="White"
GroupName="9"
IsChecked="True"
Style="{StaticResource radiobutton}"
Tag="9" />
</StackPanel>
<StackPanel
Margin="10,20"
HorizontalAlignment="Left"
Orientation="Vertical">
<RadioButton
Width="120"
Height="40"
Margin="0,0,0,10"
BorderThickness="0"
Click="Open_Click"
Content="阀门8:开"
FontSize="16"
Foreground="White"
GroupName="10"
Style="{StaticResource radiobutton}"
Tag="10" />
<RadioButton
Width="120"
Height="40"
BorderThickness="0"
Click="Close_Click"
Content="阀门8:关"
FontSize="16"
Foreground="White"
GroupName="10"
IsChecked="True"
Style="{StaticResource radiobutton}"
Tag="10" />
</StackPanel>
<StackPanel
Margin="10,20"
HorizontalAlignment="Left"
Orientation="Vertical">
<RadioButton
Width="120"
Height="40"
Margin="0,0,0,10"
BorderThickness="0"
Click="Open_Click"
Content="阀门9:开"
FontSize="16"
Foreground="White"
GroupName="11"
Style="{StaticResource radiobutton}"
Tag="11" />
<RadioButton
Width="120"
Height="40"
BorderThickness="0"
Click="Close_Click"
Content="阀门9:关"
FontSize="16"
Foreground="White"
GroupName="11"
IsChecked="True"
Style="{StaticResource radiobutton}"
Tag="11" />
</StackPanel>
<StackPanel
Margin="10,20"
HorizontalAlignment="Left"
Orientation="Vertical">
<RadioButton
Width="120"
Height="40"
Margin="0,0,0,10"
BorderThickness="0"
Click="Open_Click"
Content="阀门10:开"
FontSize="16"
Foreground="White"
GroupName="12"
Style="{StaticResource radiobutton}"
Tag="12" />
<RadioButton
Width="120"
Height="40"
BorderThickness="0"
Click="Close_Click"
Content="阀门10:关"
FontSize="16"
Foreground="White"
GroupName="12"
IsChecked="True"
Style="{StaticResource radiobutton}"
Tag="12" />
</StackPanel>
<StackPanel
Margin="10,20"
HorizontalAlignment="Left"
Orientation="Vertical">
<RadioButton
Width="120"
Height="40"
Margin="0,0,0,10"
BorderThickness="0"
Click="Open_Click"
Content="阀门11:开"
FontSize="16"
Foreground="White"
GroupName="13"
Style="{StaticResource radiobutton}"
Tag="13" />
<RadioButton
Width="120"
Height="40"
BorderThickness="0"
Click="Close_Click"
Content="阀门11:关"
FontSize="16"
Foreground="White"
GroupName="13"
IsChecked="True"
Style="{StaticResource radiobutton}"
Tag="13" />
</StackPanel>
</WrapPanel>

</StackPanel>
</ScrollViewer>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
@@ -968,24 +1171,24 @@
<RadioButton
Height="40"
Click="auto_click"
Content="自动升温"
Content="配料罐升温"
GroupName="heat"
IsChecked="True"
Style="{StaticResource RectangleRadioButtonStyle}" />
<RadioButton
Height="40"
Click="auto_click"
Content="手动升温"
Content="反应釜升温"
GroupName="heat"
Style="{StaticResource RectangleRadioButtonStyle}" />
</StackPanel>
<Border
Grid.Row="2"
Margin="30,0,30,20"
Margin="30,0,30,10"
BorderBrush="#ff2AB2E7"
BorderThickness="2">
<UniformGrid Rows="3">
<StackPanel Orientation="Horizontal">
<UniformGrid Rows="2">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock
Width="120"
Margin="40,0"
@@ -995,6 +1198,7 @@
Foreground="White"
Text="设置温度:" />
<TextBox
x:Name="temp"
Width="120"
HorizontalAlignment="Center"
VerticalAlignment="Center"
@@ -1007,34 +1211,10 @@
Foreground="White"
Text="℃" />
</StackPanel>
<StackPanel
x:Name="blf_view"
Margin="0,10"
Orientation="Horizontal">
<TextBlock
Width="120"
Margin="40,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="设置比例阀开度:" />
<TextBox
Width="120"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="12" />
<TextBlock
Margin="20,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="度" />
</StackPanel>
<Button
Width="120"
Height="30"
Click="TempSet_CLick"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Content="确认"


+ 45
- 11
BPASmartClient.Academy/View/DeviceMotionView.xaml.cs Visa fil

@@ -34,7 +34,7 @@ namespace BPASmartClient.Academy.View
}
private void Start_Click(object sender, RoutedEventArgs e)
{
if (recipeName.Text!="")
if (recipeName.Text!=""&& Simens_PLC.GetInstance.IsConnected)
{
switch (start_check.Content.ToString())
{
@@ -45,6 +45,8 @@ namespace BPASmartClient.Academy.View
Simens_PLC.GetInstance.id = dataFeedback.Id;
Simens_PLC.GetInstance.dataFeedback = dataFeedback;
Sqlite.GetInstance.saveDatas.Clear();
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1002.0", true);
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1002.1", true);
start_check.Content = "系统停止";
break;
case "系统停止":
@@ -63,17 +65,17 @@ namespace BPASmartClient.Academy.View
}
}
private string tempName = "配料罐升温";
private void auto_click(object sender, RoutedEventArgs e)
{
RadioButton radioButton = (RadioButton)sender;
switch (radioButton.Content.ToString())
{
case "自动升温":
blf_view.Visibility = Visibility.Collapsed;
case "反应釜升温":
tempName = "反应釜升温";
break;
case "手动升温":
blf_view.Visibility = Visibility.Visible;
case "配料罐升温":
tempName = "配料罐升温";
break;
default:
break;
@@ -84,27 +86,28 @@ namespace BPASmartClient.Academy.View
{
RadioButton radioButton = sender as RadioButton;
int bit = Convert.ToInt32(radioButton.Tag.ToString());
if (bit<8)
if (bit < 8)
{
Simens_PLC.GetInstance.siemens.Write<bool>($"V2000.{bit}", true);
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1000.{bit}", true);
}
else
{
Simens_PLC.GetInstance.siemens.Write<bool>($"V2001.{bit-8}", true);
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1001.{bit - 8}", true);
}
}

private void Close_Click(object sender, RoutedEventArgs e)
{

RadioButton radioButton = sender as RadioButton;
int bit = Convert.ToInt32(radioButton.Tag.ToString());
if (bit < 8)
{
Simens_PLC.GetInstance.siemens.Write<bool>($"V2000.{bit}", false);
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1000.{bit}", false);
}
else
{
Simens_PLC.GetInstance.siemens.Write<bool>($"V2001.{bit - 8}", false);
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1001.{bit - 8}", false);
}
}
public PlotModel plotModel { get; set; } = new PlotModel();
@@ -250,6 +253,37 @@ namespace BPASmartClient.Academy.View
chartView.Model = null;
}

private void TempSet_CLick(object sender, RoutedEventArgs e)
{
Simens_PLC.GetInstance.siemens.Read<int>("DB1.DBD2006").OnSuccess(o =>
{

});
int tempValue;
if (temp.Text!=null&&temp.Text.ToString()!="")
{
tempValue = Convert.ToInt32(temp.Text.ToString());
}
else
{
tempValue = 0;
}
switch (tempName)
{
case "反应釜升温":
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1001.7", true);
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1020", tempValue);
break;
case "配料罐升温":
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1001.6", true);
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1016", tempValue);
break;
default:
break;
}
}

//private void xxx_MouseMove(object sender, MouseEventArgs e)
//{
// CartesianChart liveCharts = sender as CartesianChart;


+ 5
- 0
BPASmartClient.Academy/ViewModel/DeviceMotionViewModel.cs Visa fil

@@ -6,6 +6,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;
using System.Security.Cryptography.X509Certificates;

namespace BPASmartClient.Academy.ViewModel
{
@@ -23,7 +26,9 @@ namespace BPASmartClient.Academy.ViewModel
AxisStep = TimeSpan.FromSeconds(2).Ticks;
AxisUnit = TimeSpan.TicksPerSecond;
ThreadManage.GetInstance.StartLong(() => { SetAxisLimits(DateTime.Now); }, "时间显示");
}
public static PipeLineMode PipeLine { get; set; } = new PipeLineMode();
private DataFeedback dataFeedback = Simens_PLC.GetInstance.dataFeedback;
public DataFeedback DataFeedback { get { return dataFeedback; } set { dataFeedback = value;OnPropertyChanged(); } }
public Func<double, string> DateTimeFormatter { get; set; }


+ 28
- 0
BPASmartClient.CustomResource/UserControls/MessageShow/NoticeDemoViewModel.cs Visa fil

@@ -84,5 +84,33 @@ namespace BPASmartClient.CustomResource.UserControls.MessageShow
});
}
#endregion
public static void OpenMsg(EnumPromptType type, System.Windows.Window window, string title, string content,byte viewcount,int viewtime)
{
string text = string.Empty;
if (content != null)
{
if (content.Length < 40)
{
int count = 40 - content.Length;
for (int i = 0; i < count * 2; i++)
{
content += " ";
}

}
text = content;
}
if (NotifiactionShow == null) NotifiactionShow = new Notifiaction();
NotifiactionShow.MAX_NOTIFICATIONS = viewcount;
NotifiactionShow.AddNotifiaction(new NotifiactionModel()
{
Title = title,//"这是Error通知标题",
Content = text,//"这条通知不会自动关闭,需要点击关闭按钮",
ContentToolTip = content,
NotifiactionType = type,
time = viewtime,
window = window
});
}
}
}

+ 1
- 1
BPASmartClient.CustomResource/UserControls/MessageShow/Notifiaction.xaml.cs Visa fil

@@ -23,7 +23,7 @@ namespace BPASmartClient.CustomResource.UserControls
/// </summary>
public partial class Notifiaction :Window
{
private const byte MAX_NOTIFICATIONS = 10;
public byte MAX_NOTIFICATIONS = 10;
private readonly ObservableCollection<NotifiactionModel> buffer = new ObservableCollection<NotifiactionModel>();
private ObservableCollection<NotifiactionModel> NotifiactionList = new ObservableCollection<NotifiactionModel>();
private const double topOffset = 40;


Laddar…
Avbryt
Spara