@@ -0,0 +1,14 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" /> | |||
<ProjectReference Include="..\BPASmartClinet.DataBusName\BPASmartClinet.DataBusName.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,236 @@ | |||
| |||
using BPASmartClient.Bus.DataBus; | |||
using BPASmartClient.Helper; | |||
using BPASmartClinet.DataBusName; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
/* *********************************************** | |||
* subject 数据总线,总线入口,后续按类型分发 | |||
* author 张原川 | |||
* date 2019/6/3 9:49:03 | |||
* ***********************************************/ | |||
namespace LandStation.Bus.DataBus | |||
{ | |||
public class DataBus : Singleton<DataBus>, IDisposable | |||
{ | |||
//原始数据总线 | |||
private IDataBus<byte> _dataBus_rawdata; | |||
//MAVLINK消息总线 | |||
private IDataBus<object> _dataBus_mavMessage; | |||
//参数总线 | |||
private IDataBus<object> _dataBus_parameter; | |||
//调试消息总线 | |||
private IDataBus<string> _dataBus_message; | |||
/// <summary> | |||
/// 数据总线初始化 | |||
/// </summary> | |||
public void Initialize() | |||
{ | |||
_dataBus_rawdata = new DataBus_Byte(); | |||
_dataBus_mavMessage = new DataBus_Currency<object>(); | |||
_dataBus_parameter = new DataBus_Currency<object>(); | |||
_dataBus_message = new DataBus_Currency<string>(); | |||
} | |||
/// <summary> | |||
/// 总线开启 | |||
/// </summary> | |||
public void Start() | |||
{ | |||
Executer.GetInstance().Start(_dataBus_rawdata.StartBus, ActionKey.DataBus_Rawdata); | |||
Executer.GetInstance().Start(_dataBus_mavMessage.StartBus, ActionKey.DataBus_MAVLinkMessage); | |||
Executer.GetInstance().Start(_dataBus_message.StartBus, ActionKey.DataBus_MessageData); | |||
Executer.GetInstance().Start(_dataBus_parameter.StartBus, ActionKey.DataBus_ParameterData); | |||
//Executer.GetInstance().Start(delegate () | |||
//{ | |||
// while (true) | |||
// { | |||
// //Console.WriteLine("原始数据========>批量数据订阅数:{0},单数据订阅数:{1}", _dataBus_rawdata.MultSubscriberCount, _dataBus_rawdata.SingleSubscriberCount); | |||
// //Console.WriteLine("MAVLink数据=====>批量数据订阅数:{0},单数据订阅数:{1}", _dataBus_mavMessage.MultSubscriberCount, _dataBus_mavMessage.SingleSubscriberCount); | |||
// //Console.WriteLine("状态数据========>批量数据订阅数:{0},单数据订阅数:{1}", _dataBus_status.MultSubscriberCount, _dataBus_status.SingleSubscriberCount); | |||
// //Console.WriteLine("参数数据========>批量数据订阅数:{0},单数据订阅数:{1}", _dataBus_parameter.MultSubscriberCount, _dataBus_parameter.SingleSubscriberCount); | |||
// //Console.WriteLine("消息数据========>批量数据订阅数:{0},单数据订阅数:{1}", _dataBus_message.MultSubscriberCount, _dataBus_message.SingleSubscriberCount); | |||
// //Console.WriteLine("==============================================================================================="); | |||
// Console.WriteLine("原始数据========>{0}", _dataBus_rawdata.DataCount); | |||
// Console.WriteLine("MAVLink数据=====>{0}", _dataBus_mavMessage.DataCount); | |||
// Console.WriteLine("状态数据========>{0}", _dataBus_status.DataCount); | |||
// Console.WriteLine("参数数据========>{0}", _dataBus_parameter.DataCount); | |||
// Console.WriteLine("消息数据========>{0}", _dataBus_message.DataCount); | |||
// Console.WriteLine("==============================================================================================="); | |||
// Thread.Sleep(50); | |||
// } | |||
//}, ActionKey.DataBus_Monitor, "数据总线监控"); | |||
} | |||
/// <summary> | |||
/// 根据数据类型放入数据到对应总线 | |||
/// </summary> | |||
/// <typeparam name="TData">数据实际类型</typeparam> | |||
/// <param name="data">数据</param> | |||
/// <param name="simpleData">数据业务类型</param> | |||
public void Put<TData>(object data, SimpleDataType simpleData) | |||
{ | |||
switch (simpleData) | |||
{ | |||
case SimpleDataType.RAW_DATA: | |||
if (data is byte) | |||
_dataBus_rawdata.Put((byte)data); | |||
if (data is byte[]) | |||
_dataBus_rawdata.Put((byte[])data); | |||
break; | |||
case SimpleDataType.MAV_MESSAGE_DATA: | |||
_dataBus_mavMessage.Put((object)data); | |||
break; | |||
case SimpleDataType.PARAMETER: | |||
_dataBus_parameter.Put((object)data); | |||
break; | |||
case SimpleDataType.MESSAGE_DATA: | |||
_dataBus_message.Put((string)data); | |||
break; | |||
} | |||
} | |||
/// <summary> | |||
/// 订阅数据 | |||
/// </summary> | |||
/// <typeparam name="TData">数据实际类型</typeparam> | |||
/// <param name="action">接收数据推送回调</param> | |||
/// <param name="dataType">数据业务类型</param> | |||
public void Subscribe<TData>(Action<TData> action, SimpleDataType dataType) | |||
{ | |||
switch (dataType) | |||
{ | |||
case SimpleDataType.RAW_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_rawdata).Subscribe(action); | |||
break; | |||
case SimpleDataType.MAV_MESSAGE_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_mavMessage).Subscribe(action); | |||
break; | |||
case SimpleDataType.PARAMETER: | |||
((ISimpleDataBus<TData>)_dataBus_parameter).Subscribe(action); | |||
break; | |||
case SimpleDataType.MESSAGE_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_message).Subscribe(action); | |||
break; | |||
} | |||
} | |||
/// <summary> | |||
/// 订阅数据 | |||
/// </summary> | |||
/// <typeparam name="TData">数据实际类型</typeparam> | |||
/// <param name="action">接收数据推送回调</param> | |||
/// <param name="dataType">数据业务类型</param> | |||
public void UnSubscribe<TData>(Action<TData> action, SimpleDataType dataType) | |||
{ | |||
switch (dataType) | |||
{ | |||
case SimpleDataType.RAW_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_rawdata).UnSubcribe(action); | |||
break; | |||
case SimpleDataType.MAV_MESSAGE_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_mavMessage).UnSubcribe(action); | |||
break; | |||
case SimpleDataType.PARAMETER: | |||
((ISimpleDataBus<TData>)_dataBus_parameter).UnSubcribe(action); | |||
break; | |||
case SimpleDataType.MESSAGE_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_message).UnSubcribe(action); | |||
break; | |||
} | |||
} | |||
/// <summary> | |||
/// 订阅数据 | |||
/// </summary> | |||
/// <typeparam name="TData">数据实际类型</typeparam> | |||
/// <param name="action">接收数据推送回调</param> | |||
/// <param name="dataType">数据业务类型</param> | |||
public void Subscribe<TData>(Action<TData[]> action, SimpleDataType dataType) | |||
{ | |||
switch (dataType) | |||
{ | |||
case SimpleDataType.RAW_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_rawdata).Subscribe(action); | |||
break; | |||
case SimpleDataType.MAV_MESSAGE_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_mavMessage).Subscribe(action); | |||
break; | |||
case SimpleDataType.PARAMETER: | |||
((ISimpleDataBus<TData>)_dataBus_parameter).Subscribe(action); | |||
break; | |||
case SimpleDataType.MESSAGE_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_message).Subscribe(action); | |||
break; | |||
} | |||
} | |||
/// <summary> | |||
/// 订阅数据 | |||
/// </summary> | |||
/// <typeparam name="TData">数据实际类型</typeparam> | |||
/// <param name="action">接收数据推送回调</param> | |||
/// <param name="dataType">数据业务类型</param> | |||
public void UnSubscribe<TData>(Action<TData[]> action, SimpleDataType dataType) | |||
{ | |||
switch (dataType) | |||
{ | |||
case SimpleDataType.RAW_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_rawdata).UnSubcribe(action); | |||
break; | |||
case SimpleDataType.MAV_MESSAGE_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_mavMessage).UnSubcribe(action); | |||
break; | |||
case SimpleDataType.PARAMETER: | |||
((ISimpleDataBus<TData>)_dataBus_parameter).UnSubcribe(action); | |||
break; | |||
case SimpleDataType.MESSAGE_DATA: | |||
((ISimpleDataBus<TData>)_dataBus_message).UnSubcribe(action); | |||
break; | |||
} | |||
} | |||
/// <summary> | |||
/// 获取一个数据 | |||
/// </summary> | |||
/// <typeparam name="TData">数据实际类型</typeparam> | |||
/// <param name="dataType">数据业务类型</param> | |||
/// <returns>一个数据</returns> | |||
public byte GetRawdata() | |||
{ | |||
return ((IGivenDataBus<byte>)_dataBus_rawdata).Get(); | |||
} | |||
/// <summary> | |||
/// 获取多个数据 | |||
/// </summary> | |||
/// <typeparam name="TData">数据实际类型</typeparam> | |||
/// <param name="dataType">数据业务类型</param> | |||
/// <param name="length">获取数据长度</param> | |||
/// <returns>一个数据</returns> | |||
public byte[] GetRawdata(int length) | |||
{ | |||
return ((IGivenDataBus<byte>)_dataBus_rawdata).Get(length); | |||
} | |||
/// <summary> | |||
/// 释放数据总线 | |||
/// </summary> | |||
public void Dispose() | |||
{ | |||
_dataBus_rawdata.StopBus(); | |||
_dataBus_mavMessage.StopBus(); | |||
_dataBus_message.StopBus(); | |||
_dataBus_parameter.StopBus(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,98 @@ | |||
| |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
/* *********************************************** | |||
* subject Byte类型数据总线,在订阅推送模式基础上 | |||
* 增加主动获取 | |||
* author 张原川 | |||
* date 2019/6/3 14:44:36 | |||
* ***********************************************/ | |||
namespace BPASmartClient.Bus.DataBus | |||
{ | |||
public class DataBus_Byte : DataBus_Currency<byte>, IGivenDataBus<byte> | |||
{ | |||
//接收数据缓冲(用以Get) | |||
//protected CircularBuffer<byte> _givenDataPool = new CircularBuffer<byte>(1 * 1024 * 1024); | |||
protected ConcurrentQueue<byte> _givenDataPool = new ConcurrentQueue<byte>(); | |||
public new int DataCount { get { return _givenDataPool.Count; } } | |||
/// <summary> | |||
/// 重写Put方法,加入givenDataPool | |||
/// </summary> | |||
public new void Put(byte data) | |||
{ | |||
if (!_running) | |||
return; | |||
if (_multDataHandlers.Count > 0 || _singleDataHandlers.Count > 0) | |||
_dataPool.Enqueue(data); | |||
_givenDataPool.Enqueue(data); | |||
} | |||
/// <summary> | |||
/// 重写Put方法,加入givenDataPool | |||
/// </summary> | |||
public new void Put(byte[] data) | |||
{ | |||
if (!_running) | |||
return; | |||
if (_multDataHandlers.Count > 0 || _singleDataHandlers.Count > 0) | |||
foreach (var item in data) | |||
_dataPool.Enqueue(item); | |||
foreach (var item in data) | |||
_givenDataPool.Enqueue(item); | |||
} | |||
/// <summary> | |||
/// 数据取出 | |||
/// </summary> | |||
public byte Get() | |||
{ | |||
agin: | |||
if (_givenDataPool.Count <= 0) | |||
{ | |||
Thread.Sleep(5); | |||
goto agin; | |||
} | |||
byte res; | |||
while (!_givenDataPool.TryDequeue(out res)) ; | |||
return res; | |||
} | |||
/// <summary> | |||
/// 数据取出 | |||
/// </summary> | |||
public byte[] Get(int count) | |||
{ | |||
agin: | |||
if (_givenDataPool.Count < count) | |||
{ | |||
Thread.Sleep(5); | |||
goto agin; | |||
} | |||
//Console.WriteLine(_givenDataPool.Size + "===========" + _dataPool.Size); | |||
//for (int i = 0; i < count; i++) { | |||
// _givenDataPool.TryDequeue | |||
//} | |||
int i = 0; | |||
byte[] result = new byte[count]; | |||
while (i < count) | |||
{ | |||
if (_givenDataPool.TryDequeue(out result[i])) | |||
{ | |||
i++; | |||
} | |||
} | |||
return result;// _givenDataPool.Get(count); | |||
} | |||
} | |||
} |
@@ -0,0 +1,190 @@ | |||
| |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
/* *********************************************** | |||
* subject 通用数据总线,采取订阅推送模式 | |||
* author 张原川 | |||
* date 2019/6/3 15:03:10 | |||
* ***********************************************/ | |||
namespace BPASmartClient.Bus.DataBus | |||
{ | |||
public class DataBus_Currency<TData> : ISimpleDataBus<TData> | |||
{ | |||
//接收数据缓冲 | |||
//protected CircularBuffer<TData> _dataPool = new CircularBuffer<TData>(1 * 1024 * 1024); | |||
protected ConcurrentQueue<TData> _dataPool = new ConcurrentQueue<TData>(); | |||
//订阅数据回调集合 | |||
protected List<Action<TData[]>> _multDataHandlers = new List<Action<TData[]>>(); | |||
protected List<Action<TData>> _singleDataHandlers = new List<Action<TData>>(); | |||
//订阅与推送数据信号量 | |||
protected AutoResetEvent _are = new AutoResetEvent(false); | |||
//运行标识 | |||
protected bool _running = false; | |||
public int MultSubscriberCount { get { return _multDataHandlers.Count; } } | |||
public int SingleSubscriberCount { get { return _singleDataHandlers.Count; } } | |||
public int DataCount { get { return _dataPool.Count; } } | |||
/// <summary> | |||
/// 终止事件总线 | |||
/// </summary> | |||
public void Dispose() | |||
{ | |||
StopBus(); | |||
} | |||
/// <summary> | |||
/// 数据存入 | |||
/// </summary> | |||
public void Put(TData data) | |||
{ | |||
if (!_running) | |||
return; | |||
if (_multDataHandlers.Count > 0 || _singleDataHandlers.Count > 0) | |||
_dataPool.Enqueue(data); | |||
} | |||
/// <summary> | |||
/// 数据存入 | |||
/// </summary> | |||
public void Put(TData[] data) | |||
{ | |||
if (!_running) | |||
return; | |||
if (_multDataHandlers.Count > 0 || _singleDataHandlers.Count > 0) | |||
foreach (var item in data) | |||
_dataPool.Enqueue(item); | |||
} | |||
/// <summary> | |||
/// 开启总线 | |||
/// </summary> | |||
public void StartBus() | |||
{ | |||
_running = true; | |||
List<TData> items = new List<TData>(); | |||
_are.Set(); | |||
while (_running) | |||
{ | |||
int count = _dataPool.Count; | |||
items.Clear(); | |||
if (_singleDataHandlers.Count > 0) | |||
{ | |||
_are.WaitOne(TimeSpan.FromMilliseconds(10)); | |||
for (int i = 0; i < count; i++) | |||
{ | |||
TData data = default(TData); | |||
while (!_dataPool.TryDequeue(out data)) ; | |||
uint msgId = Convert.ToUInt32(data.GetType().GetProperty("msgid").GetValue(data)); | |||
if (msgId == 316) | |||
{ | |||
} | |||
//var item = _dataPool.Get(); | |||
//Parallel.ForEach(_singleDataHandlers, p => p.Invoke(items[items.Count - 1])); | |||
for (int j = 0; j < _singleDataHandlers.Count; j++) | |||
{ | |||
_singleDataHandlers[j].Invoke(data); | |||
} | |||
items.Add(data); | |||
} | |||
} | |||
if (_multDataHandlers.Count > 0) | |||
{ | |||
if (items.Count <= 0) | |||
{ | |||
TData data = default(TData); | |||
for (int i = 0; i < count; i++) | |||
{ | |||
while (!_dataPool.TryDequeue(out data)) ; | |||
items.Add(data); | |||
} | |||
//items.AddRange(_dataPool.Get(count)); | |||
} | |||
_are.WaitOne(TimeSpan.FromMilliseconds(10)); | |||
//Parallel.For(0, _multDataHandlers.Count, (i) => | |||
//{ | |||
// _multDataHandlers[i].Invoke(items.ToArray()); | |||
//}); | |||
for (int i = _multDataHandlers.Count - 1; i >= 0; i--) | |||
{ | |||
_multDataHandlers[i].Invoke(items.ToArray()); | |||
} | |||
} | |||
Thread.Sleep(10); | |||
_are.Set(); | |||
} | |||
} | |||
public void StopBus() | |||
{ | |||
_running = false; | |||
} | |||
/// <summary> | |||
/// 数据订阅 | |||
/// </summary> | |||
/// <param name="action">接收数据回调</param> | |||
public void Subscribe(Action<TData> action) | |||
{ | |||
if (_singleDataHandlers.Contains(action)) | |||
return; | |||
_are.Reset(); | |||
_singleDataHandlers.Add(action); | |||
_are.Set(); | |||
} | |||
/// <summary> | |||
/// 数据订阅 | |||
/// </summary> | |||
/// <param name="action">接收数据回调</param> | |||
public void Subscribe(Action<TData[]> action) | |||
{ | |||
if (_multDataHandlers.Contains(action)) | |||
return; | |||
_are.Reset(); | |||
_multDataHandlers.Add(action); | |||
_are.Set(); | |||
} | |||
/// <summary> | |||
/// 取消数据订阅 | |||
/// </summary> | |||
/// <param name="action">接收数据回调</param> | |||
public void UnSubcribe(Action<TData> action) | |||
{ | |||
if (!_singleDataHandlers.Contains(action)) | |||
return; | |||
_are.Reset(); | |||
_singleDataHandlers.Remove(action); | |||
_are.Set(); | |||
} | |||
/// <summary> | |||
/// 取消数据订阅 | |||
/// </summary> | |||
/// <param name="action">接收数据回调</param> | |||
public void UnSubcribe(Action<TData[]> action) | |||
{ | |||
if (!_multDataHandlers.Contains(action)) | |||
return; | |||
_are.Reset(); | |||
_multDataHandlers.Remove(action); | |||
_are.Set(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,149 @@ | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Bus.DataBus | |||
{ | |||
/// <summary> | |||
/// 线程集中处理委托 | |||
/// </summary> | |||
/// <param name="action"></param> | |||
public delegate void ActionKeyHandle(string action); | |||
public delegate void ThreadExceptionHandle(string action, Exception ex); | |||
public delegate void ThreadExitHandle(string action); | |||
/// <summary> | |||
/// 执行器 | |||
/// </summary> | |||
public class Executer : Singleton<Executer> | |||
{ | |||
private System.Timers.Timer _timer4Monitor = new System.Timers.Timer(1000); | |||
private ConcurrentDictionary<string, Thread> _actions = new ConcurrentDictionary<string, Thread>(); | |||
private object _async = new object(); | |||
public event ThreadExceptionHandle OnThreadException; | |||
public event ThreadExitHandle ThreadExit; | |||
/// <summary> | |||
/// 构造器 | |||
/// </summary> | |||
public Executer() | |||
{ | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public void Dispose() | |||
{ | |||
_timer4Monitor.Stop(); | |||
foreach (var th in _actions) | |||
{ | |||
try { th.Value.Abort(); } | |||
catch (ThreadAbortException) { } | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <returns></returns> | |||
public List<Thread> GetActionInfos() | |||
{ | |||
Monitor.TryEnter(_async, 200); | |||
var actionInfos = _actions.Values.ToList(); | |||
Monitor.Exit(_async); | |||
return actionInfos; | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="key"></param> | |||
public void Abort(string key) | |||
{ | |||
Monitor.TryEnter(_async, 200); | |||
if (_actions.ContainsKey(key)) | |||
{ | |||
try { _actions[key].Abort(); } | |||
catch (ThreadAbortException) { } | |||
} | |||
Monitor.Exit(_async); | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="key"></param> | |||
/// <returns></returns> | |||
public bool ContainsKey(string key) | |||
{ | |||
Monitor.TryEnter(_async, 200); | |||
var item = _actions[key]; | |||
Monitor.Exit(_async); | |||
if (null != item) | |||
{ | |||
return true; | |||
} | |||
return false; | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="action"></param> | |||
/// <param name="name"></param> | |||
/// <param name="isBackground"></param> | |||
/// <param name="priority"></param> | |||
public void Start(Action action, string name, bool isBackground = false, ThreadPriority priority = ThreadPriority.Normal) | |||
{ | |||
Thread thread = new Thread(() => | |||
{ | |||
try | |||
{ | |||
action(); | |||
ThreadExit?.Invoke(name); | |||
} | |||
catch (Exception ex) | |||
{ | |||
OnThreadException?.Invoke(name, ex); | |||
} | |||
}); | |||
thread.IsBackground = isBackground; | |||
thread.Priority = priority; | |||
thread.Name = name; | |||
thread.Start(); | |||
Monitor.TryEnter(_async, 50); | |||
if (_actions.ContainsKey(name)) | |||
{ | |||
try { _actions[name].Abort(); } | |||
catch (ThreadAbortException) { } | |||
} | |||
_actions[name] = thread; | |||
Monitor.Exit(_async); | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="action"></param> | |||
/// <param name="timeout"></param> | |||
/// <returns></returns> | |||
public bool StartWhiteReturn(Func<bool> action, int timeout = 3) | |||
{ | |||
DateTime beginTime = DateTime.Now; | |||
bool doResult = false; | |||
while (DateTime.Now.Subtract(beginTime).TotalSeconds <= 3 && !doResult) | |||
{ | |||
doResult = action(); | |||
} | |||
return doResult; | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public event ActionKeyHandle ActionAbort; | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public event ActionKeyHandle ActionStarted; | |||
} | |||
} |
@@ -0,0 +1,54 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
/* *********************************************** | |||
* subject 数据总线接口 | |||
* author 张原川 | |||
* date 2019/6/3 11:33:57 | |||
* ***********************************************/ | |||
namespace BPASmartClient.Bus.DataBus | |||
{ | |||
/// <summary> | |||
/// 数据总线接口 | |||
/// </summary> | |||
public interface IDataBus<TData> | |||
{ | |||
/// <summary> | |||
/// 多数据订阅数量 | |||
/// </summary> | |||
int MultSubscriberCount { get; } | |||
/// <summary> | |||
/// 单数据订阅数量 | |||
/// </summary> | |||
int SingleSubscriberCount { get; } | |||
/// <summary> | |||
/// 数据量 | |||
/// </summary> | |||
int DataCount { get; } | |||
/// <summary> | |||
/// 开启总线 | |||
/// </summary> | |||
void StartBus(); | |||
/// <summary> | |||
/// 关闭总线 | |||
/// </summary> | |||
void StopBus(); | |||
/// <summary> | |||
/// 数据放入总线 | |||
/// </summary> | |||
/// <param name="data">数据</param> | |||
void Put(TData data); | |||
/// <summary> | |||
/// 数据放入总线 | |||
/// </summary> | |||
/// <param name="data">数据</param> | |||
void Put(TData[] data); | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
/* *********************************************** | |||
* subject 数据总线接口,定义主动取得数据 | |||
* author 张原川 | |||
* date 2019/6/3 11:25:11 | |||
* ***********************************************/ | |||
namespace BPASmartClient.Bus.DataBus | |||
{ | |||
public interface IGivenDataBus<TData>: IDataBus<TData> | |||
{ | |||
/// <summary> | |||
/// 数据取出 | |||
/// </summary> | |||
/// <returns></returns> | |||
TData Get(); | |||
/// <summary> | |||
/// 数据取出 | |||
/// </summary> | |||
/// <returns></returns> | |||
TData[] Get(int count); | |||
} | |||
} |
@@ -0,0 +1,33 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
/* *********************************************** | |||
* subject 数据总线接口,定义原始数据、MAVLINK消息、状态数据、消息数据标准 | |||
* author 张原川 | |||
* date 2019/6/3 9:50:01 | |||
* ***********************************************/ | |||
namespace BPASmartClient.Bus.DataBus | |||
{ | |||
interface ISimpleDataBus<TData>: IDataBus<TData>,IDisposable | |||
{ | |||
/// <summary> | |||
/// 订阅总线数据 | |||
/// </summary> | |||
/// <param name="action">数据类型</param> | |||
void Subscribe(Action<TData> action); | |||
void Subscribe(Action<TData[]> action); | |||
/// <summary> | |||
/// 取消订阅数据 | |||
/// </summary> | |||
/// <param name="action">数据类型</param> | |||
void UnSubcribe(Action<TData> action); | |||
void UnSubcribe(Action<TData[]> action); | |||
} | |||
} |
@@ -0,0 +1,32 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Bus.DataBus | |||
{ | |||
public enum SimpleDataType | |||
{ | |||
/// <summary> | |||
/// 原始数据总线 | |||
/// </summary> | |||
RAW_DATA, | |||
/// <summary> | |||
/// MAVLINK消息总线 | |||
/// </summary> | |||
MAV_MESSAGE_DATA, | |||
/// <summary> | |||
/// 全局状态数据总线 | |||
/// </summary> | |||
STATUS_DATA, | |||
/// <summary> | |||
/// 参数总线 | |||
/// </summary> | |||
PARAMETER, | |||
/// <summary> | |||
/// 调试消息总线 | |||
/// </summary> | |||
MESSAGE_DATA | |||
} | |||
} |
@@ -0,0 +1,108 @@ | |||
| |||
using BPASmartClient.Bus.EventBus; | |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
/* *********************************************** | |||
* subject 事件总线,总线入口,后续按类型分发 | |||
* author 张原川 | |||
* date 2019/6/3 15:49:03 | |||
* ***********************************************/ | |||
namespace LandStation.Bus | |||
{ | |||
public class EventBus : Singleton<EventBus> | |||
{ | |||
//事件处理委托 | |||
public delegate void EventCallBackHandle(params object[] args); | |||
//事件处理委托 | |||
public delegate void EventHandle(IEvent @event, EventCallBackHandle callBack = null); | |||
//事件订阅者集合 | |||
private ConcurrentDictionary<Type, List<EventHandle>> _eventHandls = new ConcurrentDictionary<Type, List<EventHandle>>(); | |||
/// <summary> | |||
/// 事件订阅 | |||
/// </summary> | |||
public void Subscribe<TEvent>(EventHandle handle) | |||
{ | |||
if (!_eventHandls.ContainsKey(typeof(TEvent))) | |||
_eventHandls.TryAdd(typeof(TEvent), new List<EventHandle>()); | |||
lock (_eventHandls) | |||
_eventHandls[typeof(TEvent)].Add(handle); | |||
} | |||
/// <summary> | |||
/// 事件退订 | |||
/// </summary> | |||
public void UnSubscribe<TEvent>(EventHandle handle) | |||
{ | |||
if (_eventHandls.ContainsKey(typeof(TEvent))) | |||
{ | |||
if (_eventHandls[typeof(TEvent)].Contains(handle)) | |||
{ | |||
lock (_eventHandls) | |||
_eventHandls[typeof(TEvent)].Remove(handle); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 事件发布,不带返回 | |||
/// </summary> | |||
public void Publish<TEvent>(TEvent @event) where TEvent : IEvent | |||
{ | |||
if (_eventHandls.ContainsKey(typeof(TEvent))) | |||
{ | |||
for (int i = _eventHandls[typeof(TEvent)].Count - 1; i >= 0; i--) | |||
_eventHandls[typeof(TEvent)][i](@event); | |||
//_eventHandls[typeof(TEvent)].ForEach(p => | |||
//{ | |||
// p(@event); | |||
//}); | |||
} | |||
} | |||
/// <summary> | |||
/// 事件发布,带返回 | |||
/// </summary> | |||
public void Publish<TEvent>(TEvent @event, EventCallBackHandle eventCallBack) where TEvent : IEvent | |||
{ | |||
List<object> result = new List<object>(); | |||
if (_eventHandls.ContainsKey(typeof(TEvent))) | |||
{ | |||
//_eventHandls[typeof(TEvent)].ForEach(p => | |||
//{ | |||
// p(@event, delegate (object[] args) | |||
// { | |||
// result.AddRange(args); | |||
// }); | |||
//}); | |||
for (int i = _eventHandls[typeof(TEvent)].Count - 1; i >= 0; i--) | |||
{ | |||
_eventHandls[typeof(TEvent)][i](@event, delegate (object[] args) | |||
{ | |||
result.AddRange(args); | |||
}); | |||
} | |||
} | |||
eventCallBack.Invoke(result.ToArray()); | |||
} | |||
/// <summary> | |||
/// 事件总线释放 | |||
/// </summary> | |||
public void Dispose() | |||
{ | |||
_eventHandls.Clear(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Bus.EventBus | |||
{ | |||
/// <summary> | |||
/// 事件接口 | |||
/// </summary> | |||
public interface IEvent | |||
{ | |||
int DeviceId { get; set; } | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
/* ============================================================================== | |||
* 功能描述: | |||
* 创 建 者:张原川 | |||
* 创建日期:2016/10/10 16:50:12 | |||
* ==============================================================================*/ | |||
using BPASmartClient.Bus.EventBus; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
namespace LandStation.Bus | |||
{ | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public static class IEventExtends | |||
{ | |||
#region Methods - Public | |||
public static void Publish<TEvent>(this TEvent message) where TEvent : class, IEvent | |||
{ | |||
EventBus.GetInstance().Publish<TEvent>(message); | |||
} | |||
public static void Publish<TEvent>(this TEvent message, EventBus.EventCallBackHandle eventCallBack) where TEvent : class, IEvent | |||
{ | |||
EventBus.GetInstance().Publish<TEvent>(message, eventCallBack); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Folder Include="Hepler\" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Reference Include="Antlr3.Runtime"> | |||
<HintPath>DLL\Antlr3.Runtime.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Unvell.ReoScript"> | |||
<HintPath>DLL\Unvell.ReoScript.dll</HintPath> | |||
</Reference> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,89 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using Unvell.ReoScript; | |||
namespace BPASmartClient.Compiler | |||
{ | |||
public class Config | |||
{ | |||
#region 单例模式 | |||
public static Config Instance = null; | |||
public static Config GetInstance() | |||
{ | |||
if (Instance == null) | |||
{ | |||
Instance = new Config(); | |||
} | |||
return Instance; | |||
} | |||
#endregion | |||
public static ScriptRunningMachine srm { get; } = new ScriptRunningMachine(); | |||
public Config() | |||
{ | |||
srm.WorkMode |= | |||
// Enable DirectAccess | |||
MachineWorkMode.AllowDirectAccess | |||
// Ignore exceptions in CLR calling (by default) | |||
| MachineWorkMode.IgnoreCLRExceptions | |||
// Enable CLR Event Binding | |||
| MachineWorkMode.AllowCLREventBind; | |||
RegisterFunction(); | |||
} | |||
/// <summary> | |||
/// 运行脚本 | |||
/// </summary> | |||
/// <param name="script"></param> | |||
public void RunJsScipt(string script) | |||
{ | |||
try | |||
{ | |||
srm.Run(script); | |||
} | |||
catch (Exception e) | |||
{ | |||
//MessageBox.Show(e.Message, "脚本错误"); | |||
} | |||
} | |||
/// <summary> | |||
/// 注册对象到js | |||
/// </summary> | |||
public void SetVariable(string name, object obj) | |||
{ | |||
srm.SetGlobalVariable(name, obj); | |||
} | |||
/// <summary> | |||
/// 注册方法到Js | |||
/// </summary> | |||
private static void RegisterFunction() | |||
{ | |||
srm["ShowMessage"] = new NativeFunctionObject("ShowMessage", (ctx, owner, args) => | |||
{ | |||
StringBuilder sb = new StringBuilder(); | |||
foreach (var item in args) | |||
{ | |||
sb.Append(item.ToString()); | |||
} | |||
//MessageBox.Show($"{sb}", "提示"); | |||
return null; | |||
}); | |||
srm["SetICDValue"] = new NativeFunctionObject("SetICDValue", (ctx, owner, args) => | |||
{ | |||
//MessageBox.Show($"发送ICD数据", "提示"); | |||
return null; | |||
}); | |||
} | |||
} | |||
} |
@@ -87,6 +87,7 @@ | |||
<None Remove="Image\上箭头.png" /> | |||
<None Remove="Image\不规则矩形.png" /> | |||
<None Remove="Image\个人信息.png" /> | |||
<None Remove="Image\中间.png" /> | |||
<None Remove="Image\临时模板.png" /> | |||
<None Remove="Image\产品制作.png" /> | |||
<None Remove="Image\光柱.png" /> | |||
@@ -113,6 +114,8 @@ | |||
<None Remove="Image\圆角矩形 30 拷贝.png" /> | |||
<None Remove="Image\圆角矩形 4.png" /> | |||
<None Remove="Image\圆角矩形.png" /> | |||
<None Remove="Image\外边框1.png" /> | |||
<None Remove="Image\容器边框2.png" /> | |||
<None Remove="Image\工艺流程.jpg" /> | |||
<None Remove="Image\工艺流程.png" /> | |||
<None Remove="Image\底部背景.png" /> | |||
@@ -122,6 +125,10 @@ | |||
<None Remove="Image\按钮\停用.png" /> | |||
<None Remove="Image\按钮\添加.png" /> | |||
<None Remove="Image\弹窗.png" /> | |||
<None Remove="Image\按钮\组 7.png" /> | |||
<None Remove="Image\按钮\组 8.png" /> | |||
<None Remove="Image\按钮背景蓝色.png" /> | |||
<None Remove="Image\按钮背景黄.png" /> | |||
<None Remove="Image\搜索按钮.png" /> | |||
<None Remove="Image\搜索框.png" /> | |||
<None Remove="Image\文字.png" /> | |||
@@ -131,6 +138,7 @@ | |||
<None Remove="Image\智慧城市科技风登录页面边框.png" /> | |||
<None Remove="Image\有告警.png" /> | |||
<None Remove="Image\权限背景.png" /> | |||
<None Remove="Image\标签.png" /> | |||
<None Remove="Image\标题背景.png" /> | |||
<None Remove="Image\浅色背景.jpeg" /> | |||
<None Remove="Image\环形切图\内圈\未选中.png" /> | |||
@@ -141,9 +149,12 @@ | |||
<None Remove="Image\界面2.png" /> | |||
<None Remove="Image\登录界面背景.jpg" /> | |||
<None Remove="Image\登录界面背景1.jpg" /> | |||
<None Remove="Image\直线.png" /> | |||
<None Remove="Image\矩形.png" /> | |||
<None Remove="Image\矩形1.png" /> | |||
<None Remove="Image\矩形2.png" /> | |||
<None Remove="Image\矩形样式.png" /> | |||
<None Remove="Image\矩形边框.png" /> | |||
<None Remove="Image\窗体样式\datagrid\data_标题栏背景.png" /> | |||
<None Remove="Image\窗体样式\datagrid\data_行背景.png" /> | |||
<None Remove="Image\窗体样式\From\内部背景.png" /> | |||
@@ -186,12 +197,14 @@ | |||
<None Remove="Image\背景2.png" /> | |||
<None Remove="Image\背景3.jpg" /> | |||
<None Remove="Image\背景图片.png" /> | |||
<None Remove="Image\背景框.png" /> | |||
<None Remove="Image\背景矢量\内部.png" /> | |||
<None Remove="Image\背景矢量\右上.png" /> | |||
<None Remove="Image\背景矢量\右下.png" /> | |||
<None Remove="Image\背景矢量\左上.png" /> | |||
<None Remove="Image\背景矢量\左下.png" /> | |||
<None Remove="Image\背景矢量\矢量智能对象.png" /> | |||
<None Remove="Image\背景边框4.png" /> | |||
<None Remove="Image\营销额.png" /> | |||
<None Remove="Image\蓝色背景.png" /> | |||
<None Remove="Image\蓝边框.png" /> | |||
@@ -207,9 +220,17 @@ | |||
<None Remove="Image\表格标题背景2.png" /> | |||
<None Remove="Image\调味品.jpeg" /> | |||
<None Remove="Image\边框效果2.png" /> | |||
<None Remove="Image\边框线.png" /> | |||
<None Remove="Image\边角.png" /> | |||
<None Remove="Image\退出.png" /> | |||
<None Remove="Image\退出按钮.png" /> | |||
<None Remove="Image\透明背景.png" /> | |||
<None Remove="Image\配方背景\圆角矩形.png" /> | |||
<None Remove="Image\配方背景\竖背景框.png" /> | |||
<None Remove="Image\配方背景\组 5.png" /> | |||
<None Remove="Image\配方背景\蓝色背景.png" /> | |||
<None Remove="Image\配方背景\蓝色背景2.png" /> | |||
<None Remove="Image\配方背景\黄色背景.png" /> | |||
<None Remove="Image\阴影边框.png" /> | |||
<None Remove="Image\顶部.png" /> | |||
<None Remove="Image\顶部切图\Button_No.png" /> | |||
@@ -276,6 +297,7 @@ | |||
<Resource Include="Image\textBox.png" /> | |||
<Resource Include="Image\WindowImages.png" /> | |||
<Resource Include="Image\上箭头.png" /> | |||
<Resource Include="Image\中间.png" /> | |||
<Resource Include="Image\临时模板.png" /> | |||
<Resource Include="Image\产品制作.png" /> | |||
<Resource Include="Image\光柱.png" /> | |||
@@ -286,6 +308,8 @@ | |||
<Resource Include="Image\告警\无告警.png" /> | |||
<Resource Include="Image\告警\无告警1.png" /> | |||
<Resource Include="Image\告警\轻微告警.png" /> | |||
<Resource Include="Image\外边框1.png" /> | |||
<Resource Include="Image\容器边框2.png" /> | |||
<Resource Include="Image\工艺流程.jpg" /> | |||
<Resource Include="Image\工艺流程.png" /> | |||
<Resource Include="Image\弹窗2.png" /> | |||
@@ -294,9 +318,14 @@ | |||
<Resource Include="Image\按钮\停用.png" /> | |||
<Resource Include="Image\按钮\添加.png" /> | |||
<Resource Include="Image\弹窗.png" /> | |||
<Resource Include="Image\按钮\组 7.png" /> | |||
<Resource Include="Image\按钮\组 8.png" /> | |||
<Resource Include="Image\按钮背景蓝色.png" /> | |||
<Resource Include="Image\按钮背景黄.png" /> | |||
<Resource Include="Image\智慧城市科技风登录页面.png" /> | |||
<Resource Include="Image\智慧城市科技风登录页面边框.png" /> | |||
<Resource Include="Image\权限背景.png" /> | |||
<Resource Include="Image\标签.png" /> | |||
<Resource Include="Image\浅色背景.jpeg" /> | |||
<Resource Include="Image\界面2.png"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
@@ -304,6 +333,9 @@ | |||
<Resource Include="Image\圆角矩形 30 拷贝.png" /> | |||
<Resource Include="Image\登录界面背景.jpg" /> | |||
<Resource Include="Image\登录界面背景1.jpg" /> | |||
<Resource Include="Image\直线.png" /> | |||
<Resource Include="Image\矩形2.png" /> | |||
<Resource Include="Image\矩形边框.png" /> | |||
<Resource Include="Image\系统名称.png" /> | |||
<Resource Include="Image\红色圆角矩形背景.png" /> | |||
<Resource Include="Image\纹理背景.jpeg" /> | |||
@@ -312,9 +344,12 @@ | |||
<Resource Include="Image\组合边框1.png" /> | |||
<Resource Include="Image\背景2.png" /> | |||
<Resource Include="Image\背景3.jpg" /> | |||
<Resource Include="Image\背景框.png" /> | |||
<Resource Include="Image\背景边框4.png" /> | |||
<Resource Include="Image\蓝色背景.png" /> | |||
<Resource Include="Image\蓝边框.png" /> | |||
<Resource Include="Image\调味品.jpeg" /> | |||
<Resource Include="Image\边框线.png" /> | |||
<Resource Include="Image\边角.png" /> | |||
</ItemGroup> | |||
@@ -322,6 +357,13 @@ | |||
<Resource Include="Image\HBL.png" /> | |||
<Resource Include="Image\告警\Wifi_NO.ico" /> | |||
<Resource Include="Image\告警\Wifi_OK.ico" /> | |||
<Resource Include="Image\透明背景.png" /> | |||
<Resource Include="Image\配方背景\圆角矩形.png" /> | |||
<Resource Include="Image\配方背景\竖背景框.png" /> | |||
<Resource Include="Image\配方背景\组 5.png" /> | |||
<Resource Include="Image\配方背景\蓝色背景.png" /> | |||
<Resource Include="Image\配方背景\蓝色背景2.png" /> | |||
<Resource Include="Image\配方背景\黄色背景.png" /> | |||
<Resource Include="Image\阴影边框.png" /> | |||
<Resource Include="Image\顶部切图\Button_No.png" /> | |||
<Resource Include="Image\顶部切图\Button_Select.png" /> | |||
@@ -12,6 +12,7 @@ using System.Windows; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class AlarmHelper<AlarmT> where AlarmT : class, new() | |||
{ | |||
public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>(); | |||
@@ -41,7 +42,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), $"{typeof(AlarmT)},报警通用模块监听"); | |||
}), $"{typeof(AlarmT).Name},报警通用模块监听"); | |||
} | |||
@@ -82,7 +83,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
Value = value.ToString(), | |||
Time = DateTime.Now.ToString("HH:mm:ss"), | |||
}; | |||
var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm); | |||
Sqlite<Alarm>.GetInstance.Save(); | |||
@@ -10,9 +10,9 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public AlarmInfo() | |||
{ | |||
} | |||
#region 180项目报警信息 | |||
/// <summary> | |||
/// 1 号滚筒线故障 | |||
/// </summary> | |||
@@ -53,7 +53,84 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
/// </summary> | |||
[Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.严重报警)] | |||
public ushort FryPotFiveRollerTrouble { get; set; } | |||
#region 滚筒是否运行状态监测 | |||
/// <summary> | |||
/// 1号滚筒线滚筒未运行 | |||
/// </summary> | |||
[Alarm("【1】号滚筒线未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort LineOneRollerRunning { get; set; } | |||
/// <summary> | |||
/// 2号滚筒线滚筒未运行 | |||
/// </summary> | |||
[Alarm("【2】号滚筒线未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort LineTwoRollerRunning { get; set; } | |||
/// <summary> | |||
/// 3号滚筒线滚筒未运行 | |||
/// </summary> | |||
[Alarm("【3】号滚筒线未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort LineThreeRollerRunning { get; set; } | |||
/// <summary> | |||
/// 1号炒锅进料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【1】号炒锅进料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotOneRollerRunning { get; set; } | |||
/// <summary> | |||
/// 2号炒锅进料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【2】号炒锅进料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotTwoRollerRunning { get; set; } | |||
/// <summary> | |||
/// 3号炒锅进料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【3】号炒锅进料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotThreeRollerRunning { get; set; } | |||
/// <summary> | |||
/// 4号炒锅进料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【4】号炒锅进料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotFourRollerRunning { get; set; } | |||
/// <summary> | |||
/// 5号炒锅进料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【5】号炒锅进料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotFiveRollerRunning { get; set; } | |||
/// <summary> | |||
/// 1号炒锅空桶出料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【1】号炒锅空桶出料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotOneEmptyRollerRunning { get; set; } | |||
/// <summary> | |||
/// 2号炒锅空桶出料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【2】号炒锅空桶出料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotTwoEmptyRollerRunning { get; set; } | |||
/// <summary> | |||
/// 3号炒锅空桶出料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【3】号炒锅空桶出料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotThreeEmptyRollerRunning { get; set; } | |||
/// <summary> | |||
/// 4号炒锅空桶出料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【4】号炒锅空桶出料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotFourEmptyRollerRunning { get; set; } | |||
/// <summary> | |||
/// 5号炒锅空桶出料滚筒未运行 | |||
/// </summary> | |||
[Alarm("【5】号炒锅空桶出料滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort FryPotFiveEmptyRollerRunning { get; set; } | |||
/// <summary> | |||
/// 洗桶工位进桶滚筒未运行 | |||
/// </summary> | |||
[Alarm("洗桶工位进桶滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort CleanEnterRollerRunning { get; set; } | |||
/// <summary> | |||
/// 洗桶工位出桶滚筒未运行 | |||
/// </summary> | |||
[Alarm("洗桶工位出桶滚筒未运行", AlarmTriggerType.Falling, AlarmLevel.一般报警)] | |||
public ushort CleanOutputRollerRunning { get; set; } | |||
#endregion | |||
#endregion | |||
} | |||
} |
@@ -38,7 +38,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
private void AddData() | |||
{ | |||
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.管理员, UserName = "admin", Password = "admin" }); | |||
Global.userManager.userInfos.Add(new UserInfo() {Id = Guid.NewGuid().ToString(), permission = Permission.管理员, UserName = "admin", Password = "admin" }); | |||
SaveUser(); | |||
} | |||
@@ -22,10 +22,10 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
private Permission _perimission; | |||
public string UserName { get { return _userName; } set { _userName = value; OnPropertyChanged(); } } | |||
private string _userName = "admin"; | |||
private string _userName ; | |||
public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } } | |||
private string _password = "admin"; | |||
private string _password; | |||
public string CardId { get; set; } = string.Empty; | |||
@@ -256,7 +256,7 @@ | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="日期" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
@@ -264,11 +264,13 @@ | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="时间" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
@@ -277,6 +279,7 @@ | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="操作权限" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
@@ -285,6 +288,7 @@ | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="用户名" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
@@ -340,7 +344,7 @@ | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
HorizontalAlignment="Center" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding UserName}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
@@ -317,11 +317,84 @@ | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<Style x:Key="FocusVisual"> | |||
<Setter Property="Control.Template"> | |||
<Setter.Value> | |||
<ControlTemplate> | |||
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<SolidColorBrush x:Key="Button.Static.Background1" Color="#FFDDDDDD"/> | |||
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/> | |||
<SolidColorBrush x:Key="Button.MouseOver.Background1" Color="#FF2AB2E7"/> | |||
<SolidColorBrush x:Key="Button.MouseOver.Border1" Color="#FF3C7FB1"/> | |||
<SolidColorBrush x:Key="Button.Pressed.Background1" Color="#FFC4E5F6"/> | |||
<SolidColorBrush x:Key="Button.Pressed.Border1" Color="#FF2C628B"/> | |||
<SolidColorBrush x:Key="Button.Disabled.Background1" Color="#FFF4F4F4"/> | |||
<SolidColorBrush x:Key="Button.Disabled.Border1" Color="#FFADB2B5"/> | |||
<SolidColorBrush x:Key="Button.Disabled.Foreground1" Color="#FF838383"/> | |||
<Style x:Key="ButtonStyle1" TargetType="{x:Type Button}"> | |||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/> | |||
<Setter Property="Background" Value="{StaticResource Button.Static.Background1}"/> | |||
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> | |||
<Setter Property="BorderThickness" Value="1"/> | |||
<Setter Property="HorizontalContentAlignment" Value="Center"/> | |||
<Setter Property="VerticalContentAlignment" Value="Center"/> | |||
<Setter Property="Padding" Value="1"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true"> | |||
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsDefaulted" Value="true"> | |||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background1}"/> | |||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border1}"/> | |||
</Trigger> | |||
<Trigger Property="IsPressed" Value="true"> | |||
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background1}"/> | |||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border1}"/> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background1}"/> | |||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border1}"/> | |||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground1}"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<ScrollViewer VerticalScrollBarVisibility="Hidden"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<StackPanel x:Name="btn" Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<!--<Button HorizontalAlignment="Right" Width="100" Height="30" Content="保存数据" BorderThickness="1" BorderBrush="Cyan" Background="Transparent" Foreground="Aqua" FontSize="16" Command="{Binding SaveDataCommand}" Margin="0,0,10,0"></Button>--> | |||
<Button Style="{DynamicResource ButtonStyle1}" Width="105" Height="30" Background="Transparent" Foreground="Aqua" Command="{Binding AddUserInfoCommand}" Margin="0,0,10,0"> | |||
<Button.Content> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<TextBlock x:Name="t1" Width="auto" Height="auto" FontFamily="../../Fonts/font/#iconfont" Text="" VerticalAlignment="Center" FontSize="18" Margin="0,0,6,0"/> | |||
<TextBlock x:Name="t2" Width="auto" Height="auto" Text="添加账号" FontSize="17" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Button.Content> | |||
</Button> | |||
</StackPanel> | |||
<ScrollViewer VerticalScrollBarVisibility="Hidden" Grid.Row="1"> | |||
<DataGrid ItemsSource="{Binding usersInfo}" GridLinesVisibility="All" Background="Transparent" | |||
AutoGenerateColumns="False" | |||
CanUserAddRows="False" | |||
IsReadOnly="False" Style="{StaticResource dataGrid }" | |||
ColumnHeaderStyle="{StaticResource columsHeader}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
@@ -418,7 +491,7 @@ | |||
<Button Command="{Binding DataContext.SaveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" | |||
CommandParameter="{Binding UserName}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Foreground="Cyan" Content="Save" Margin="5,0"></Button> | |||
<!--<Button Command="{Binding DataContext.UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Update" Grid.Column="1" Margin="5,0"></Button>--> | |||
<Button Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding Id}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Delete" Grid.Column="1" Foreground="Cyan" Margin="5,0"></Button> | |||
<Button Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding Id}" Template="{DynamicResource ButtonTemplate1}" Style="{StaticResource btnStyle}" Content="Delete" Grid.Column="1" Foreground="Cyan" Margin="5,0" ></Button> | |||
</Grid> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
@@ -25,6 +25,7 @@ namespace BPASmartClient.CustomResource.Pages.View | |||
public UserManageView() | |||
{ | |||
InitializeComponent(); | |||
//this.DataContext = UserManageViewModel.GetInstance; | |||
} | |||
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | |||
@@ -32,15 +33,22 @@ namespace BPASmartClient.CustomResource.Pages.View | |||
ComboBox cbo = sender as ComboBox; | |||
var id = cbo.Tag; | |||
var per = cbo.SelectedItem; | |||
if (id == null) | |||
if (id != null) | |||
{ | |||
var a = UserManageViewModel.GetInstance.usersInfo.FirstOrDefault(p => p.Id == id); | |||
var a = UserManageViewModel.usersInfo.FirstOrDefault(p => p.Id == id.ToString()); | |||
if (a != null && per != null) | |||
{ | |||
a.permission = (Permission)Enum.Parse(typeof(Permission), per.ToString()); | |||
} | |||
} | |||
//else | |||
//{ | |||
// if (UserManageViewModel.usersInfo.Last().permission.ToString() == null) | |||
// UserManageViewModel.usersInfo.Last().permission = (Permission)Enum.Parse(typeof(Permission), per.ToString()); | |||
//} | |||
} | |||
} | |||
} |
@@ -374,13 +374,15 @@ | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<ComboBox ItemsSource="{Binding DeviceName}" SelectedValue="滚筒输送线" Style="{StaticResource ComboBoxStyle1}" | |||
VerticalContentAlignment="Center" SelectionChanged="ComboBox_SelectionChanged" FontSize="20" Foreground="#FF2AB2E7" Width="130" Height="40" Margin="0,0,10,0"></ComboBox> | |||
VerticalContentAlignment="Center" | |||
SelectionChanged="ComboBox_SelectionChanged" FontSize="20" Foreground="#FF2AB2E7" Width="130" Height="40" Margin="0,0,10,0"></ComboBox> | |||
<Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="1" Command="{Binding SaveDataCommand}"></Button> | |||
</StackPanel> | |||
<!--变量配置--> | |||
<DataGrid Name="GT" Grid.Row="1" ItemsSource="{Binding Variables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False" | |||
AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}" | |||
LoadingRow="DataGrid_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
LoadingRow="DataGrid_LoadingRow" | |||
CanUserDeleteRows="True" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
@@ -130,7 +130,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
private DateTime _mEndDateTime = DateTime.Now; | |||
public ObservableCollection<Alarm> AlarmInfos { get; set; } | |||
public ObservableCollection<Alarm> AlarmInfos { get; set; } | |||
public ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>(); | |||
} | |||
@@ -17,14 +17,18 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
internal class UserManageViewModel:ObservableObject | |||
{ | |||
private static UserManageViewModel _instance; | |||
public static UserManageViewModel GetInstance => _instance ??= new UserManageViewModel(); | |||
public ObservableCollection<UserInfo> usersInfo { get; set; } = new ObservableCollection<UserInfo>(); | |||
//private static UserManageViewModel _instance; | |||
//public static UserManageViewModel GetInstance => _instance ??= new UserManageViewModel(); | |||
public static ObservableCollection<UserInfo> usersInfo { get; set; } = new ObservableCollection<UserInfo>(); | |||
//public List<Permission> Authorities { get; set; } = new List<Permission>() { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }; | |||
public List<string> Authorities { get; set; } = new List<string>(); | |||
public RelayCommand<string> SaveCommand { get; set; } | |||
public RelayCommand<string> DeleteCommand { get; set; } | |||
public RelayCommand AddUserInfoCommand { get; set; } | |||
public RelayCommand SaveDataCommand { get; set; } | |||
public UserManageViewModel() | |||
{ | |||
var userManager = JsonConvert.DeserializeObject<UserManager>(File.ReadAllText("up.hbl").AESDecrypt()); | |||
@@ -52,7 +56,10 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
MessageBox.Show("保存成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information); | |||
} | |||
} | |||
else | |||
{ | |||
MessageBox.Show("用户名为空或输入后未回车确认", "提示", MessageBoxButton.OK, MessageBoxImage.Information); | |||
} | |||
}); | |||
DeleteCommand = new RelayCommand<string>((str) => | |||
@@ -73,6 +80,27 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
MessageBox.Show("未找到对应记录", "提示", MessageBoxButton.OK, MessageBoxImage.Information); | |||
} | |||
} | |||
else | |||
{ | |||
usersInfo.Remove(usersInfo.Last()); | |||
Global.userManager.userInfos = usersInfo; | |||
File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt()); | |||
} | |||
}); | |||
AddUserInfoCommand = new RelayCommand( ()=> | |||
{ | |||
usersInfo.Add(new UserInfo() { Id=IdProcess()}); | |||
}); | |||
SaveDataCommand = new RelayCommand(() => | |||
{ | |||
Global.userManager.userInfos = usersInfo; | |||
File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt()); | |||
MessageBox.Show("保存成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information); | |||
}); | |||
} | |||
@@ -13,14 +13,75 @@ | |||
<SolidColorBrush x:Key="scb" Color="#FFB1B1B9" /> | |||
<SolidColorBrush x:Key="scbs" Color="#FF6d6666" /> | |||
<SineEase x:Key="SineEaseOut" EasingMode="EaseOut" /> | |||
<Storyboard x:Key="AnimateRound" RepeatBehavior="Forever"> | |||
<DoubleAnimation | |||
EasingFunction="{StaticResource SineEaseOut}" | |||
Storyboard.TargetName="Scale" | |||
Storyboard.TargetProperty="ScaleX" | |||
To="2" | |||
Duration="0:0:01" /> | |||
<DoubleAnimation | |||
EasingFunction="{StaticResource SineEaseOut}" | |||
Storyboard.TargetName="Scale" | |||
Storyboard.TargetProperty="ScaleY" | |||
To="2" | |||
Duration="0:0:01" /> | |||
<DoubleAnimation | |||
EasingFunction="{StaticResource SineEaseOut}" | |||
Storyboard.TargetProperty="Opacity" | |||
To="0" | |||
Duration="0:0:01" /> | |||
</Storyboard> | |||
<Style x:Key="toggleButtonStyle" TargetType="ToggleButton"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ToggleButton"> | |||
<Grid> | |||
<Ellipse | |||
Name="el" | |||
Width="{TemplateBinding Width}" | |||
Height="{TemplateBinding Height}" | |||
Fill="Red" | |||
RenderTransformOrigin="0.5,0.5"> | |||
<Ellipse.OpacityMask> | |||
<RadialGradientBrush> | |||
<GradientStop Offset="0" Color="Transparent" /> | |||
<GradientStop Offset="1" Color="Black" /> | |||
</RadialGradientBrush> | |||
</Ellipse.OpacityMask> | |||
<Ellipse.RenderTransform> | |||
<ScaleTransform x:Name="Scale" /> | |||
</Ellipse.RenderTransform> | |||
<!--<Ellipse.Triggers> | |||
<EventTrigger RoutedEvent="Loaded"> | |||
<BeginStoryboard Storyboard="{StaticResource AnimateRound}" /> | |||
</EventTrigger> | |||
</Ellipse.Triggers>--> | |||
</Ellipse> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="el" Property="Fill" Value="Green" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="el" Property="Fill" Value="red" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Name="cav"> | |||
<Viewbox Width="auto" Height="auto"> | |||
<Canvas | |||
Name="cv" | |||
Width="{Binding ElementName=cav, Path=ActualWidth}" | |||
Height="{Binding ElementName=cav, Path=ActualHeight}"> | |||
Width="389" | |||
Height="100"> | |||
<Path | |||
Data="M2 30 L2 70" | |||
Stroke="{StaticResource scb}" | |||
@@ -229,18 +290,37 @@ | |||
Stroke="{StaticResource scbs}" | |||
StrokeThickness="4" /> | |||
<Ellipse | |||
<ToggleButton | |||
Name="LeftTog" | |||
Width="30" | |||
Height="30" | |||
Margin="120,35,0,0" | |||
HorizontalAlignment="Left" | |||
Fill="Red" /> | |||
<Ellipse | |||
IsEnabled="False" | |||
Style="{StaticResource toggleButtonStyle}" /> | |||
<ToggleButton | |||
Name="RightTog" | |||
Width="30" | |||
Height="30" | |||
Margin="325,35,0,0" | |||
HorizontalAlignment="Left" | |||
IsEnabled="False" | |||
Style="{StaticResource toggleButtonStyle}" /> | |||
<!--<Ellipse | |||
Width="30" | |||
Height="30" | |||
Margin="120,35,0,0" | |||
HorizontalAlignment="Left" | |||
Fill="Red" />--> | |||
<!--<Ellipse | |||
Width="30" | |||
Height="30" | |||
Margin="325,35,0,0" | |||
HorizontalAlignment="Left" | |||
Fill="Red" /> | |||
Fill="Red" />--> | |||
</Canvas> | |||
</Viewbox> | |||
@@ -26,6 +26,38 @@ namespace BPASmartClient.CustomResource.UserControls | |||
} | |||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
(d as Cylinder)?.Refresh(); | |||
} | |||
private void Refresh() | |||
{ | |||
this.LeftTog.IsChecked = LeftTogIsChecked; | |||
this.RightTog.IsChecked = RightTogIsChecked; | |||
} | |||
public bool LeftTogIsChecked | |||
{ | |||
get { return (bool)GetValue(LeftTogIsCheckedProperty); } | |||
set { SetValue(LeftTogIsCheckedProperty, value); } | |||
} | |||
public static readonly DependencyProperty LeftTogIsCheckedProperty = | |||
DependencyProperty.Register("LeftTogIsChecked", typeof(bool), typeof(Cylinder), | |||
new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||
public bool RightTogIsChecked | |||
{ | |||
get { return (bool)GetValue(RightTogIsCheckedProperty); } | |||
set { SetValue(RightTogIsCheckedProperty, value); } | |||
} | |||
public static readonly DependencyProperty RightTogIsCheckedProperty = | |||
DependencyProperty.Register("RightTogIsChecked", typeof(bool), typeof(Cylinder), | |||
new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||
} | |||
} |
@@ -0,0 +1,96 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.CustomResource.UserControls.ImageBorder" | |||
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:local="clr-namespace:BPASmartClient.CustomResource.UserControls" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="borderColor" Color="#552AB2E7" /> | |||
</UserControl.Resources> | |||
<Grid Name="gr"> | |||
<Viewbox Width="auto" Height="auto"> | |||
<Canvas Width="{Binding ElementName=gr, Path=ActualWidth}" Height="{Binding ElementName=gr, Path=ActualHeight}"> | |||
<Canvas.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/矩形2.png" Stretch="Fill" /> | |||
</Canvas.Background> | |||
<Grid> | |||
<Border | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
BorderBrush="{StaticResource borderColor}" | |||
BorderThickness="0.5" /> | |||
<Border | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Bottom" | |||
BorderBrush="{StaticResource borderColor}" | |||
BorderThickness="0.5" /> | |||
<Border | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
BorderBrush="{StaticResource borderColor}" | |||
BorderThickness="0.5" /> | |||
<Border | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Right" | |||
BorderBrush="{StaticResource borderColor}" | |||
BorderThickness="0.5" /> | |||
<!--<Image | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | |||
Stretch="Fill" /> | |||
<Image | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Bottom" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" /> | |||
<Image | |||
Width="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
RenderTransformOrigin="0,0.1" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png"> | |||
<Image.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform /> | |||
<SkewTransform /> | |||
<RotateTransform Angle="90" /> | |||
<TranslateTransform /> | |||
</TransformGroup> | |||
</Image.RenderTransform> | |||
</Image> | |||
<Image | |||
Width="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Bottom" | |||
RenderTransformOrigin="1,0" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png"> | |||
<Image.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform /> | |||
<SkewTransform /> | |||
<RotateTransform Angle="90" /> | |||
<TranslateTransform /> | |||
</TransformGroup> | |||
</Image.RenderTransform> | |||
</Image>--> | |||
<Path Name="leftTop" Stroke="Aqua" /> | |||
<Path Name="rightTop" Stroke="Aqua" /> | |||
<Path Name="leftBottom" Stroke="Aqua" /> | |||
<Path Name="rightBottom" Stroke="Aqua" /> | |||
</Grid> | |||
</Canvas> | |||
</Viewbox> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,67 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
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; | |||
namespace BPASmartClient.CustomResource.UserControls | |||
{ | |||
/// <summary> | |||
/// ImageBorder.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ImageBorder : UserControl | |||
{ | |||
public ImageBorder() | |||
{ | |||
InitializeComponent(); | |||
this.SizeChanged += ImageBorder_SizeChanged; | |||
} | |||
private void ImageBorder_SizeChanged(object sender, SizeChangedEventArgs e) | |||
{ | |||
double min = Math.Min(this.Width, this.Height); | |||
PathGeometry geometry = new PathGeometry(); | |||
PathFigure pathFigure = new PathFigure(); | |||
pathFigure.StartPoint = new Point(15, 0); | |||
pathFigure.Segments.Add(new LineSegment(new Point(0, 0), true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(0, 15), true)); | |||
geometry.Figures.Add(pathFigure); | |||
this.leftTop.Data = geometry; | |||
geometry = new PathGeometry(); | |||
pathFigure = new PathFigure(); | |||
pathFigure.StartPoint = new Point(this.Width - 15, 0); | |||
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 0), true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 15), true)); | |||
geometry.Figures.Add(pathFigure); | |||
this.rightTop.Data = geometry; | |||
geometry = new PathGeometry(); | |||
pathFigure = new PathFigure(); | |||
pathFigure.StartPoint = new Point(0, this.Height - 15); | |||
pathFigure.Segments.Add(new LineSegment(new Point(0, this.Height), true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(15, this.Height), true)); | |||
geometry.Figures.Add(pathFigure); | |||
this.leftBottom.Data = geometry; | |||
geometry = new PathGeometry(); | |||
pathFigure = new PathFigure(); | |||
pathFigure.StartPoint = new Point(this.Width - 15, this.Height); | |||
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height), true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height - 15), true)); | |||
geometry.Figures.Add(pathFigure); | |||
this.rightBottom.Data = geometry; | |||
} | |||
} | |||
} |
@@ -0,0 +1,9 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
</Project> |
@@ -0,0 +1,34 @@ | |||
using System.Collections.Concurrent; | |||
namespace BPASmartClient.DATABUS | |||
{ | |||
/// <summary> | |||
/// 数据总线 | |||
/// </summary> | |||
public class Class_DataBus | |||
{ | |||
#region 单例模式 | |||
public static Class_DataBus dataBus = null; | |||
public static Class_DataBus GetInstance() | |||
{ | |||
if (dataBus == null) | |||
{ | |||
dataBus = new Class_DataBus(); | |||
} | |||
return dataBus; | |||
} | |||
#endregion | |||
#region 基础配置 | |||
#endregion | |||
#region 实时数据->大数据量 | |||
/// <summary> | |||
/// 设备数据 | |||
/// </summary> | |||
public ConcurrentDictionary<string, object> Dic_DeviceData = new ConcurrentDictionary<string, object>(); //原始目标链表 | |||
#endregion | |||
} | |||
} |
@@ -90,7 +90,76 @@ | |||
</StackPanel> | |||
<!--#endregion--> | |||
<ScrollViewer Grid.Row="2"> | |||
<!--#region 表格标题栏设置--> | |||
<!--<Grid Grid.Row="1" Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="序号" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="配方名称" /> | |||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="编码" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="结束时间" /> | |||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Grid Grid.Column="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="制作状态" /> | |||
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="0,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="6" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="完成时间" /> | |||
</Grid>--> | |||
<!--#endregion--> | |||
<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Disabled"> | |||
<ListView | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
@@ -0,0 +1,9 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
</Project> |
@@ -0,0 +1,29 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MessageName | |||
{ | |||
/// <summary> | |||
/// 数据订阅主题管理中心 | |||
/// </summary> | |||
public class DataName | |||
{ | |||
#region XX数据 | |||
/// <summary> | |||
/// xxx消息 | |||
/// </summary> | |||
[Category("测试"), Description("消息备注"), Browsable(true)] | |||
public static string xxx = "xxx"; | |||
/// <summary> | |||
/// xxx消息 | |||
/// </summary> | |||
[Category("测试"), Description("消息备注1"), Browsable(true)] | |||
public static string 测试 = "测试"; | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,51 @@ | |||
using System.ComponentModel; | |||
namespace BPASmartClient.MessageName | |||
{ | |||
/// <summary> | |||
/// 消息名称管理中心 | |||
/// 特性:Category,消息分组 | |||
/// Description,消息备注 | |||
/// Browsable,是否使用 | |||
/// 消息发送案例: | |||
/// Class_InnerMessageBus.GetInstance().PostMessage(this, MessageName.xxx, "12321"); | |||
/// 接收数据案例: | |||
/// Class_InnerMessageBus.GetInstance().ListenMessage(this, MessageName.xxx, "xxnameHandler"); | |||
/// public void xxnameHandler(object sender, InnerMessageEventArgs e) { } | |||
/// </summary> | |||
public class MessageName | |||
{ | |||
#region XX消息 | |||
/// <summary> | |||
/// xxx消息 | |||
/// </summary> | |||
[Category("消息分组"),Description("消息备注"),Browsable(true)] | |||
public static string xxx = "xxx"; | |||
#endregion | |||
#region 滚动线消息事件管理中心 | |||
/// <summary> | |||
/// 滚动线控制滚动消息 | |||
/// </summary> | |||
[Category("滚动线"), Description("滚动线控制滚动"), Browsable(true)] | |||
public static string ConveyorBeltIsRun = "ConveyorBeltIsRun"; | |||
/// <summary> | |||
/// 滚动线控制左转 | |||
/// </summary> | |||
[Category("滚动线"), Description("滚动线控制左转"), Browsable(true)] | |||
public static string ConveyorBeltLeft = "ConveyorBeltLeft"; | |||
/// <summary> | |||
/// 滚动线控制右转 | |||
/// </summary> | |||
[Category("滚动线"), Description("滚动线控制右转"), Browsable(true)] | |||
public static string ConveyorBeltRight = "ConveyorBeltRight"; | |||
/// <summary> | |||
/// 滚动线控制停止 | |||
/// </summary> | |||
[Category("滚动线"), Description("滚动线控制停止"), Browsable(true)] | |||
public static string ConveyorBeltStop = "ConveyorBeltStop"; | |||
#endregion | |||
} | |||
} |
@@ -250,79 +250,7 @@ namespace BPASmartClient.Modbus | |||
return default(object); | |||
} | |||
#region 180项目调用 | |||
public int GetAddress(string address, string target) | |||
{ | |||
if (address == null) return -1; | |||
if (address.Length > 0) | |||
{ | |||
if (address.ToUpper().Contains("D") && address.Length == 5) | |||
{ | |||
try | |||
{ | |||
string head = "4" + (Convert.ToInt32(address.Substring(1, 1)) - 1).ToString(); | |||
string tail = address.Substring(2, 3); | |||
address = head + tail; | |||
return Convert.ToInt32(address); | |||
} | |||
catch (Exception) | |||
{ | |||
//打印日志 | |||
} | |||
} | |||
} | |||
return -1; | |||
} | |||
public object Read(string address, ushort len, string target, byte slaveAddress = 1) | |||
{ | |||
if (address == null || tcpClient == null) return default(object); | |||
ushort startAddress = (ushort)GetAddress(address, target); | |||
CommandType commandType = CommandType.HoldingRegisters; | |||
try | |||
{ | |||
if (address.ToUpper().Contains("D")) | |||
{ | |||
commandType = CommandType.HoldingRegisters; | |||
return master.ReadHoldingRegisters(slaveAddress, startAddress, len); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx($"读取地址:【{address}:= {startAddress}】,读取类型:【{commandType.ToString()}】出错,{ex.ToString()}"); | |||
ExceptionHandling(ex); | |||
} | |||
return default(object); | |||
} | |||
public void Write<T>(string address, T value, string target, byte slaveAddress = 1) | |||
{ | |||
if (address == null || tcpClient == null) return; | |||
ushort startAddress = (ushort)GetAddress(address, target); | |||
CommandType commandType = CommandType.Coils; | |||
try | |||
{ | |||
if (address.ToUpper().Contains("D")) | |||
{ | |||
commandType = CommandType.HoldingRegisters; | |||
if (value is ushort ushortValue) | |||
{ | |||
master.WriteSingleRegister(slaveAddress, startAddress, ushortValue); | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx($"写入地址:【{address}:= {startAddress}】,写入类型:【{commandType.ToString()}】出错,{ex.ToString()}"); | |||
ExceptionHandling(ex); | |||
} | |||
} | |||
#endregion | |||
public void Write<T>(string address, T value, byte slaveAddress = 1) | |||
@@ -80,7 +80,7 @@ namespace BPASmartClient.MorkF | |||
/// </summary> | |||
public bool MaterialArriveComplete { get; set; } | |||
/// <summary> | |||
/// 机器人空闲状态 | |||
/// 机器人空闲状态 1:忙碌 0:空闲 | |||
/// </summary> | |||
public bool RoobotIdle { get; set; } | |||
/// <summary> | |||
@@ -291,6 +291,14 @@ namespace BPASmartClient.MorkF | |||
/// 辅流程所执行的锅位置 | |||
/// </summary> | |||
public int MinorProcessPotLoc { get; set; } | |||
#region 单口锅逻辑变量 | |||
/// <summary> | |||
/// 订单唯一ID | |||
/// </summary> | |||
public string CurrentOrderId { get; set; } | |||
#endregion | |||
} | |||
} | |||
@@ -0,0 +1,197 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
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.Animation; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.SCADAControl | |||
{ | |||
/// <summary> | |||
/// 新测试仪表盘 | |||
/// </summary> | |||
public class ArcGauge : Control, IExecutable | |||
{ | |||
public ArcGauge() | |||
{ | |||
Width = 300; | |||
Height = 300; | |||
SetCurrentValue(ValueProperty, 0d); | |||
SetCurrentValue(MinValueProperty, 0d); | |||
SetCurrentValue(MaxValueProperty, 100d); | |||
} | |||
private void InitTick() | |||
{ | |||
// 画大刻度 | |||
for (int i = 0; i < 11; i++) | |||
{ | |||
Line line = new Line(); | |||
line.X1 = 0; | |||
line.Y1 = 0; | |||
line.X2 = 0; | |||
line.Y2 = 12; | |||
line.Stroke = Brushes.White; | |||
line.StrokeThickness = 2; | |||
line.HorizontalAlignment = HorizontalAlignment.Center; | |||
line.RenderTransformOrigin = new Point(0.5, 0.5); | |||
line.RenderTransform = new RotateTransform() { Angle = -140 + i * 28 }; | |||
bdGrid.Children.Add(line); | |||
DrawText(); | |||
} | |||
// 画小刻度 | |||
for (int i = 0; i < 10; i++) | |||
{ | |||
var start = -140 + 28 * i + 2.8; | |||
for (int j = 0; j < 9; j++) | |||
{ | |||
Line line = new Line(); | |||
line.X1 = 0; | |||
line.Y1 = 0; | |||
line.X2 = 0; | |||
line.Y2 = 6; | |||
line.Stroke = Brushes.White; | |||
line.StrokeThickness = 1; | |||
line.HorizontalAlignment = HorizontalAlignment.Center; | |||
line.RenderTransformOrigin = new Point(0.5, 0.5); | |||
line.RenderTransform = new RotateTransform() { Angle = start + j * 2.8 }; | |||
bdGrid.Children.Add(line); | |||
} | |||
} | |||
} | |||
List<TextBlock> textLabels = new List<TextBlock>(); | |||
private void DrawText() | |||
{ | |||
foreach (var item in textLabels) | |||
{ | |||
bdGrid.Children.Remove(item); | |||
} | |||
textLabels.Clear(); | |||
var per = MaxValue / 10; | |||
for (int i = 0; i < 11; i++) | |||
{ | |||
TextBlock textBlock = new TextBlock(); | |||
textBlock.Text = $"{MinValue + (per * i)}"; | |||
textBlock.HorizontalAlignment = HorizontalAlignment.Center; | |||
textBlock.RenderTransformOrigin = new Point(0.5, 0.5); | |||
textBlock.RenderTransform = new RotateTransform() { Angle = -140 + i * 28 }; | |||
textBlock.Margin = new Thickness(12); | |||
textBlock.Foreground = Brushes.White; | |||
bdGrid.Children.Add(textBlock); | |||
textLabels.Add(textBlock); | |||
} | |||
} | |||
static ArcGauge() | |||
{ | |||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ArcGauge), new FrameworkPropertyMetadata(typeof(ArcGauge))); | |||
} | |||
RotateTransform rotateTransform; | |||
Grid bdGrid; | |||
public override void OnApplyTemplate() | |||
{ | |||
base.OnApplyTemplate(); | |||
rotateTransform = GetTemplateChild("PointRotate") as RotateTransform; | |||
bdGrid = GetTemplateChild("bdGrid") as Grid; | |||
Refresh(); | |||
InitTick(); | |||
} | |||
private bool isExecuteState; | |||
public bool IsExecuteState | |||
{ | |||
get { return isExecuteState; } | |||
set | |||
{ | |||
isExecuteState = value; | |||
if (IsExecuteState) | |||
{ | |||
Register(); | |||
} | |||
} | |||
} | |||
[Category("值设定")] | |||
public double Value | |||
{ | |||
get { return (double)GetValue(ValueProperty); } | |||
set { SetValue(ValueProperty, value); } | |||
} | |||
public static readonly DependencyProperty ValueProperty = | |||
DependencyProperty.Register("Value", typeof(double), typeof(ArcGauge), new PropertyMetadata(0d, OnValueChanged)); | |||
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as ArcGauge)?.Refresh(); | |||
[Category("值设定")] | |||
public double MinValue | |||
{ | |||
get { return (double)GetValue(MinValueProperty); } | |||
set { SetValue(MinValueProperty, value); } | |||
} | |||
public static readonly DependencyProperty MinValueProperty = | |||
DependencyProperty.Register("MinValue", typeof(double), typeof(ArcGauge), new PropertyMetadata(0d, OnValueChanged)); | |||
[Category("值设定")] | |||
public double MaxValue | |||
{ | |||
get { return (double)GetValue(MaxValueProperty); } | |||
set { SetValue(MaxValueProperty, value); } | |||
} | |||
public string ControlType => "控件"; | |||
public static readonly DependencyProperty MaxValueProperty = | |||
DependencyProperty.Register("MaxValue", typeof(double), typeof(ArcGauge), new PropertyMetadata(0d, OnValueChanged)); | |||
private void Refresh() | |||
{ | |||
if (rotateTransform == null) | |||
return; | |||
DrawText(); | |||
DoubleAnimation da = new DoubleAnimation(); | |||
da.Duration = new Duration(TimeSpan.FromMilliseconds(350)); | |||
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; | |||
if (Value > MaxValue) | |||
{ | |||
rotateTransform.Angle = 140; | |||
da.To = 140; | |||
} | |||
else if (Value < MinValue) | |||
{ | |||
rotateTransform.Angle = -140; | |||
da.To = -140; | |||
} | |||
else | |||
{ | |||
var range = MaxValue - MinValue; | |||
var process = Value / range; | |||
var tAngle = process * 280 - 140; | |||
rotateTransform.Angle = tAngle; | |||
da.To = tAngle; | |||
} | |||
rotateTransform.BeginAnimation(RotateTransform.AngleProperty, da); | |||
} | |||
public void Register() | |||
{ | |||
Refresh(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
using System.Windows; | |||
[assembly: ThemeInfo( | |||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | |||
//(used if a resource is not found in the page, | |||
// or application resource dictionaries) | |||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | |||
//(used if a resource is not found in the page, | |||
// app, or any theme specific resource dictionaries) | |||
)] |
@@ -0,0 +1,30 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0-windows</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="Images\光柱.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Compiler\BPASmartClient.Compiler.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Reference Include="Antlr3.Runtime"> | |||
<HintPath>DLL\Antlr3.Runtime.dll</HintPath> | |||
</Reference> | |||
<Reference Include="Unvell.ReoScript"> | |||
<HintPath>DLL\Unvell.ReoScript.dll</HintPath> | |||
</Reference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Images\光柱.png" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
namespace BPASmartClient.SCADAControl.Converters | |||
{ | |||
public class HalfNumberConverter : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (double.TryParse(value.ToString(), out double val)) | |||
{ | |||
return val / 2; | |||
} | |||
return 0; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
return null; | |||
} | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.SCADAControl | |||
{ | |||
public interface IExecutable | |||
{ | |||
/// <summary> | |||
/// 是否执行 | |||
/// </summary> | |||
bool IsExecuteState { get; set; } | |||
/// <summary> | |||
/// 运行程序 注册事件 | |||
/// </summary> | |||
void Register(); | |||
/// <summary> | |||
/// 控件类型 | |||
/// </summary> | |||
string ControlType { get; } | |||
} | |||
} |
@@ -0,0 +1,30 @@ | |||
<UserControl x:Class="BPASmartClient.SCADAControl.NewConveyorBelt" | |||
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:BPASmartClient.SCADAControl" | |||
mc:Ignorable="d" | |||
x:Name="gr" | |||
Margin="0,0,0,0" | |||
d:DesignHeight="400" d:DesignWidth="1200"> | |||
<Grid > | |||
<Viewbox Width="auto" Height="auto"> | |||
<Canvas Width="{Binding ElementName=gr, Path=ActualWidth}" Height="{Binding ElementName=gr, Path=ActualHeight}"> | |||
<Path | |||
Tag="mp" | |||
Margin="0" | |||
Stroke="{Binding StrokeFillBrush, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" | |||
StrokeDashArray="{Binding StrokeDashArray, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" | |||
StrokeThickness="{Binding ConveyorBeltWidth, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" /> | |||
<Path | |||
Tag="cb" | |||
Fill="Transparent" | |||
Stroke="{Binding StrokeBrush, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" | |||
StrokeThickness="{Binding StrokeThickness, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" /> | |||
</Canvas> | |||
</Viewbox> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,277 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
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.Animation; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.SCADAControl | |||
{ | |||
/// <summary> | |||
/// NewConveyorBelt.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class NewConveyorBelt : UserControl, IExecutable | |||
{ | |||
Path Path_mp = null; | |||
Path Path_cb = null; | |||
Storyboard storyboard = new Storyboard(); | |||
Storyboard storyboard1 = new Storyboard(); | |||
public NewConveyorBelt() | |||
{ | |||
InitializeComponent(); | |||
Width = 1200; | |||
Height = 400; | |||
this.SizeChanged += ConveyorBelt_SizeChanged; | |||
ConveyorBeltWidth = 70; | |||
Direction = 0; | |||
StrokeBrush = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#00BEFA")); | |||
StrokeDashArray = new DoubleCollection { 1.5, 1.5 }; | |||
StrokeFillBrush = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#00BEFA")); | |||
StrokeThickness = 2; | |||
} | |||
public string ControlType => "滚动线"; | |||
private bool isExecuteState; | |||
public bool IsExecuteState | |||
{ | |||
get { return isExecuteState; } | |||
set | |||
{ | |||
isExecuteState = value; | |||
if (IsExecuteState) | |||
{ | |||
IsEnabled = true; | |||
Register(); | |||
Style = null; | |||
} | |||
} | |||
} | |||
public void Register() | |||
{ | |||
} | |||
public void VisualStateManagerData() | |||
{ | |||
storyboard.RepeatBehavior = RepeatBehavior.Forever; | |||
DoubleAnimation dbAscending = new DoubleAnimation | |||
{ | |||
From = 0, | |||
To = 100, | |||
Duration = new Duration(new TimeSpan(0, 0, 20)), | |||
}; | |||
storyboard.Children.Add(dbAscending); | |||
Storyboard.SetTarget(dbAscending, Path_mp); | |||
Storyboard.SetTargetProperty(dbAscending, new PropertyPath("StrokeDashOffset")); | |||
storyboard1.RepeatBehavior = RepeatBehavior.Forever; | |||
DoubleAnimation dbAscending1 = new DoubleAnimation | |||
{ | |||
From = 0, | |||
To = -100, | |||
Duration = new Duration(new TimeSpan(0, 0, 20)), | |||
}; | |||
storyboard1.Children.Add(dbAscending1); | |||
Storyboard.SetTarget(dbAscending1, Path_mp); | |||
Storyboard.SetTargetProperty(dbAscending1, new PropertyPath("StrokeDashOffset")); | |||
Refursh(); | |||
} | |||
private void ConveyorBelt_SizeChanged(object sender, SizeChangedEventArgs e) | |||
{ | |||
//查找 | |||
if (!(Path_cb != null && Path_mp != null)) | |||
{ | |||
foreach (Path tb in FindVisualChildren<Path>(this)) | |||
{ | |||
// do something with tb here | |||
if (tb.Tag != null) | |||
{ | |||
if (tb.Tag.ToString() == "cb") | |||
{ | |||
Path_cb = tb; | |||
} | |||
else if (tb.Tag.ToString() == "mp") | |||
{ | |||
Path_mp = tb; | |||
} | |||
} | |||
} | |||
VisualStateManagerData(); | |||
} | |||
//传送带外边框绘制 | |||
PathGeometry geometry = new PathGeometry(); | |||
PathFigure pathFigure = new PathFigure(); | |||
pathFigure.StartPoint = new Point(this.Height / 2, 0); | |||
pathFigure.Segments.Add(new ArcSegment(new Point(this.Height / 2, this.Height), new Size(this.Height / 2, this.Height / 2), 0, false, SweepDirection.Counterclockwise, true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height), true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth), true)); | |||
double innerCircle = (this.Height - (ConveyorBeltWidth * 2)) / 2;//内圆半径 | |||
pathFigure.Segments.Add(new LineSegment(new Point(ConveyorBeltWidth + innerCircle, this.Height - ConveyorBeltWidth), true)); | |||
pathFigure.Segments.Add(new ArcSegment(new Point(ConveyorBeltWidth + innerCircle, ConveyorBeltWidth), new Size(innerCircle, innerCircle), 0, false, SweepDirection.Clockwise, true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, ConveyorBeltWidth), true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 0), true)); | |||
pathFigure.Segments.Add(new LineSegment(new Point(this.Height / 2, 0), true)); | |||
geometry.Figures.Add(pathFigure); | |||
Path_cb.Data = geometry; | |||
//传送带内部皮带绘制 | |||
PathGeometry geometry1 = new PathGeometry(); | |||
PathFigure pathFigure1 = new PathFigure(); | |||
pathFigure1.StartPoint = new Point(this.Width, ConveyorBeltWidth / 2); | |||
double innerCircle1 = (this.Height - ConveyorBeltWidth) / 2;//内圆半径 | |||
pathFigure1.Segments.Add(new LineSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, ConveyorBeltWidth / 2), true)); | |||
pathFigure1.Segments.Add(new ArcSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, this.Height - ConveyorBeltWidth / 2), new Size(innerCircle1, innerCircle1), 0, false, SweepDirection.Counterclockwise, true)); | |||
pathFigure1.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth / 2), true)); | |||
geometry1.Figures.Add(pathFigure1); | |||
Path_mp.Data = geometry1; | |||
} | |||
/// <summary> | |||
/// 搜索指定名称的子元素 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="obj"></param> | |||
/// <param name="name"></param> | |||
/// <returns></returns> | |||
public static T FindChild<T>(DependencyObject obj, string name) where T : FrameworkElement | |||
{ | |||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) | |||
{ | |||
DependencyObject child = VisualTreeHelper.GetChild(obj, i); | |||
if (child != null && child is T && (child as T).Name.Equals(name)) | |||
return (T)child; | |||
else | |||
{ | |||
T childOfChild = FindChild<T>(child, name); | |||
if (childOfChild != null) | |||
return childOfChild; | |||
} | |||
} | |||
return null; | |||
} | |||
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject | |||
{ | |||
if (depObj != null) | |||
{ | |||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++) | |||
{ | |||
DependencyObject child = VisualTreeHelper.GetChild(depObj, i); | |||
if (child != null && child is T) | |||
{ | |||
yield return (T)child; | |||
} | |||
foreach (T childOfChild in FindVisualChildren<T>(child)) | |||
{ | |||
yield return childOfChild; | |||
} | |||
} | |||
} | |||
} | |||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
(d as NewConveyorBelt)?.Refursh(); | |||
} | |||
private void Refursh() | |||
{ | |||
if (Direction == 1) | |||
{ | |||
storyboard.Begin(); | |||
storyboard1.Stop(); | |||
// VisualStateManager.GoToState(this, "Left", false); | |||
} | |||
else if (Direction == 2) | |||
{ | |||
storyboard.Stop(); | |||
storyboard1.Begin(); | |||
//VisualStateManager.GoToState(this, "Right", false); | |||
} | |||
else | |||
{ | |||
storyboard.Stop(); | |||
storyboard1.Stop(); | |||
//VisualStateManager.GoToState(this, "Stop", false); | |||
} | |||
} | |||
public DoubleCollection StrokeDashArray | |||
{ | |||
get { return (DoubleCollection)GetValue(StrokeDashArrayProperty); } | |||
set { SetValue(StrokeDashArrayProperty, value); } | |||
} | |||
public static readonly DependencyProperty StrokeDashArrayProperty = | |||
DependencyProperty.Register("StrokeDashArray", typeof(DoubleCollection), typeof(NewConveyorBelt), | |||
new PropertyMetadata(default, new PropertyChangedCallback(OnPropertyChanged))); | |||
public double ConveyorBeltWidth | |||
{ | |||
get { return (double)GetValue(ConveyorBeltWidthProperty); } | |||
set { SetValue(ConveyorBeltWidthProperty, value); } | |||
} | |||
public static readonly DependencyProperty ConveyorBeltWidthProperty = | |||
DependencyProperty.Register("ConveyorBeltWidth", typeof(double), typeof(NewConveyorBelt), | |||
new PropertyMetadata(50.0, new PropertyChangedCallback(OnPropertyChanged))); | |||
public Brush StrokeFillBrush | |||
{ | |||
get { return (Brush)GetValue(StrokeFillBrushProperty); } | |||
set { SetValue(StrokeFillBrushProperty, value); } | |||
} | |||
public static readonly DependencyProperty StrokeFillBrushProperty = | |||
DependencyProperty.Register("StrokeFillBrush", typeof(Brush), typeof(NewConveyorBelt), | |||
new PropertyMetadata(Brushes.LightBlue, new PropertyChangedCallback(OnPropertyChanged))); | |||
public Brush StrokeBrush | |||
{ | |||
get { return (Brush)GetValue(StrokeBrushProperty); } | |||
set { SetValue(StrokeBrushProperty, value); } | |||
} | |||
public static readonly DependencyProperty StrokeBrushProperty = | |||
DependencyProperty.Register("StrokeBrush", typeof(Brush), typeof(NewConveyorBelt), | |||
new PropertyMetadata(Brushes.LightBlue, new PropertyChangedCallback(OnPropertyChanged))); | |||
public double StrokeThickness | |||
{ | |||
get { return (double)GetValue(StrokeThicknessProperty); } | |||
set { SetValue(StrokeThicknessProperty, value); } | |||
} | |||
public static readonly DependencyProperty StrokeThicknessProperty = | |||
DependencyProperty.Register("StrokeThickness", typeof(double), typeof(NewConveyorBelt), | |||
new PropertyMetadata(1.0, new PropertyChangedCallback(OnPropertyChanged))); | |||
[Category("值设定")] | |||
public int Direction | |||
{ | |||
get { return (int)GetValue(DirectionProperty); } | |||
set { SetValue(DirectionProperty, value); } | |||
} | |||
public static readonly DependencyProperty DirectionProperty = | |||
DependencyProperty.Register("Direction", typeof(int), typeof(NewConveyorBelt), | |||
new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged))); | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
<UserControl x:Class="BPASmartClient.SCADAControl.Silos" | |||
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:BPASmartClient.SCADAControl" | |||
mc:Ignorable="d" | |||
d:DesignHeight="270" d:DesignWidth="180" > | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Bottom" | |||
Margin="0 0 0 35" | |||
FontSize="25" | |||
Foreground="#FFCCD61F" | |||
Text="{Binding Title,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="0,25,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="0,70,0,0" | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.SCADAControl;component/Images/光柱.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,96 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
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; | |||
namespace BPASmartClient.SCADAControl | |||
{ | |||
/// <summary> | |||
/// Silos.xaml 的交互逻辑 | |||
/// 物料仓 | |||
/// </summary> | |||
public partial class Silos : UserControl, IExecutable | |||
{ | |||
public Silos() | |||
{ | |||
InitializeComponent(); | |||
this.DataContext = this; | |||
Width = 180; | |||
Height = 270; | |||
Value = 25.23; | |||
Title = "香料"; | |||
Text = "1 号仓"; | |||
} | |||
public string ControlType => "物料仓"; | |||
private bool isExecuteState; | |||
public bool IsExecuteState | |||
{ | |||
get { return isExecuteState; } | |||
set | |||
{ | |||
isExecuteState = value; | |||
if (IsExecuteState) | |||
{ | |||
IsEnabled = true; | |||
Register(); | |||
Style = null; | |||
} | |||
} | |||
} | |||
#region 属性 | |||
[Category("值设定")] | |||
public double Value | |||
{ | |||
get { return (double)GetValue(ValueProperty); } | |||
set { SetValue(ValueProperty, value); } | |||
} | |||
public static readonly DependencyProperty ValueProperty = | |||
DependencyProperty.Register("Value", typeof(double), typeof(Silos), new PropertyMetadata(0d, OnValueChanged)); | |||
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as Silos)?.Refresh(); | |||
[Category("值设定")] | |||
public string Text | |||
{ | |||
get { return (string)GetValue(TextProperty); } | |||
set { SetValue(TextProperty, value); } | |||
} | |||
public static readonly DependencyProperty TextProperty = | |||
DependencyProperty.Register("Text", typeof(string), typeof(Silos), new PropertyMetadata(string.Empty)); | |||
[Category("值设定")] | |||
public string Title | |||
{ | |||
get { return (string)GetValue(TitleProperty); } | |||
set { SetValue(TitleProperty, value); } | |||
} | |||
public static readonly DependencyProperty TitleProperty = | |||
DependencyProperty.Register("Title", typeof(string), typeof(Silos), new PropertyMetadata(string.Empty)); | |||
#endregion | |||
#region 函数 | |||
public void Refresh() | |||
{ | |||
} | |||
#endregion | |||
public void Register() | |||
{ | |||
} | |||
} | |||
} |
@@ -0,0 +1,144 @@ | |||
using BPASmartClient.Compiler; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Controls.Primitives; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Animation; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.SCADAControl | |||
{ | |||
[TemplatePart(Name = ELLIPSE, Type = typeof(FrameworkElement))] | |||
[TemplatePart(Name = TranslateX, Type = typeof(TranslateTransform))] | |||
public class SwitchButton : ToggleButton, IExecutable | |||
{ | |||
public SwitchButton() | |||
{ | |||
SetCurrentValue(WidthProperty, 120d); | |||
SetCurrentValue(HeightProperty, 40d); | |||
} | |||
public const string ELLIPSE = "ELLIPSE"; | |||
public const string TranslateX = "TranslateX"; | |||
static SwitchButton() | |||
{ | |||
DefaultStyleKeyProperty.OverrideMetadata(typeof(SwitchButton), new FrameworkPropertyMetadata(typeof(SwitchButton))); | |||
} | |||
/// <summary> | |||
/// 不勾选时执行代码 | |||
/// </summary> | |||
[Category("事件")] | |||
public string UnCheckedExec | |||
{ | |||
get { return (string)GetValue(UnCheckedExecProperty); } | |||
set { SetValue(UnCheckedExecProperty, value); } | |||
} | |||
public static readonly DependencyProperty UnCheckedExecProperty = | |||
DependencyProperty.Register("UnCheckedExec", typeof(string), typeof(SwitchButton), new PropertyMetadata(string.Empty)); | |||
/// <summary> | |||
/// 勾选时执行代码 | |||
/// </summary> | |||
[Category("事件")] | |||
public string CheckedExec | |||
{ | |||
get { return (string)GetValue(CheckedExecProperty); } | |||
set { SetValue(CheckedExecProperty, value); } | |||
} | |||
public static readonly DependencyProperty CheckedExecProperty = | |||
DependencyProperty.Register("CheckedExec", typeof(string), typeof(SwitchButton), new PropertyMetadata(string.Empty)); | |||
protected override void OnRender(DrawingContext drawingContext) | |||
{ | |||
base.OnRender(drawingContext); | |||
ellipse.Width = Height - 8; | |||
ellipse.Height = Height - 8; | |||
Refresh(); | |||
} | |||
TranslateTransform transX; | |||
Ellipse ellipse; | |||
public override void OnApplyTemplate() | |||
{ | |||
base.OnApplyTemplate(); | |||
ellipse = GetTemplateChild(ELLIPSE) as Ellipse; | |||
transX = GetTemplateChild(TranslateX) as TranslateTransform; | |||
} | |||
protected override void OnChecked(RoutedEventArgs e) | |||
{ | |||
base.OnChecked(e); | |||
Refresh(); | |||
} | |||
protected override void OnUnchecked(RoutedEventArgs e) | |||
{ | |||
base.OnUnchecked(e); | |||
Refresh(); | |||
} | |||
void Refresh() | |||
{ | |||
if (ellipse == null) | |||
{ | |||
return; | |||
} | |||
DoubleAnimation da = new DoubleAnimation(); | |||
da.Duration = new Duration(TimeSpan.FromMilliseconds(250)); | |||
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; | |||
if (IsChecked == true) | |||
{ | |||
da.To = ActualWidth - ellipse.ActualWidth - 5; | |||
ellipse.SetCurrentValue(Ellipse.FillProperty, Background); | |||
} | |||
else | |||
{ | |||
da.To = 3; | |||
ellipse.SetCurrentValue(Ellipse.FillProperty, Brushes.Gray); | |||
} | |||
transX.BeginAnimation(TranslateTransform.XProperty, da); | |||
} | |||
private bool isExecuteState; | |||
public bool IsExecuteState | |||
{ | |||
get { return isExecuteState; } | |||
set | |||
{ | |||
isExecuteState = value; | |||
if (IsExecuteState) | |||
{ | |||
Register(); | |||
} | |||
} | |||
} | |||
public void Register() | |||
{ | |||
Checked += TheCheckBox_Checked; | |||
Unchecked += TheCheckBox_Unchecked; | |||
} | |||
private void TheCheckBox_Unchecked(object sender, RoutedEventArgs e) | |||
{ | |||
Config.GetInstance().RunJsScipt(UnCheckedExec); | |||
} | |||
private void TheCheckBox_Checked(object sender, RoutedEventArgs e) | |||
{ | |||
Config.GetInstance().RunJsScipt(CheckedExec); | |||
} | |||
public string ControlType => "控件"; | |||
} | |||
} |
@@ -0,0 +1,135 @@ | |||
<ResourceDictionary | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:BPASmartClient.SCADAControl" | |||
xmlns:ctrl="clr-namespace:BPASmartClient.SCADAControl" | |||
xmlns:con="clr-namespace:BPASmartClient.SCADAControl.Converters"> | |||
<!--<Style TargetType="{x:Type local:CustomControl1}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type local:CustomControl1}"> | |||
<Border Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}"> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style>--> | |||
<Style TargetType="{x:Type ctrl:ArcGauge}"> | |||
<Setter Property="Background" Value="#646464"/> | |||
<Setter Property="Foreground" Value="Black"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ctrl:ArcGauge}"> | |||
<Border Margin="10"> | |||
<Grid Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"> | |||
<Ellipse Fill="#FF3B3B3B"/> | |||
<Grid RenderTransformOrigin="0.5,0.5" Margin="2"> | |||
<Grid.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform Angle="{Binding Path=Angle,ElementName=PointRotate}"/> | |||
</TransformGroup> | |||
</Grid.RenderTransform> | |||
<Ellipse Width="16" Height="14" Fill="Orange" VerticalAlignment="Top" > | |||
<Ellipse.Effect> | |||
<BlurEffect Radius="12"/> | |||
</Ellipse.Effect> | |||
</Ellipse> | |||
</Grid> | |||
<Grid x:Name="bdGrid" Margin="12" UseLayoutRounding="True" ClipToBounds="True"> | |||
<Ellipse> | |||
<Ellipse.Fill> | |||
<RadialGradientBrush> | |||
<GradientStop Color="#4D000000"/> | |||
</RadialGradientBrush> | |||
</Ellipse.Fill> | |||
</Ellipse> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition Height="2*"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Ellipse Stroke="#464646" StrokeThickness="1" Grid.Column="1" Grid.Row="1"/> | |||
<Ellipse Stroke="#959595" Margin="4" StrokeThickness="6" Grid.Column="1" Grid.Row="1"/> | |||
<Ellipse Stroke="#464646" Margin="14" StrokeThickness="1" Grid.Column="1" Grid.Row="1"/> | |||
</Grid> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Path Data="M5,0 5,0 10,120 0,120z" Fill="#0FA9CE" Stretch="Uniform" Margin="0 30 0 0" RenderTransformOrigin="0.5,1" HorizontalAlignment="Center"> | |||
<Path.RenderTransform> | |||
<TransformGroup> | |||
<RotateTransform x:Name="PointRotate"/> | |||
</TransformGroup> | |||
</Path.RenderTransform> | |||
</Path> | |||
</Grid> | |||
<Ellipse Width="28" Height="28" Fill="Black"> | |||
<Ellipse.Effect> | |||
<DropShadowEffect Color="#0FA9CE" ShadowDepth="0" Direction="0" BlurRadius="16"/> | |||
</Ellipse.Effect> | |||
</Ellipse> | |||
<Border VerticalAlignment="Bottom" BorderBrush="#10ABD1" BorderThickness="2" Margin="0 0 0 12" Background="Black" Padding="4 2" HorizontalAlignment="Center"> | |||
<TextBlock Text="{Binding Value,RelativeSource={RelativeSource Mode=TemplatedParent},StringFormat={}{0:f1}}" FontSize="16" Width="46" TextAlignment="Center" Foreground="White"/> | |||
</Border> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<LinearGradientBrush x:Key="NormalBackground" StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStopCollection> | |||
<GradientStop Color="White" /> | |||
<GradientStop Color="#D0D0D0" Offset="0.5"/> | |||
<GradientStop Color="#E3E3E3" Offset="1"/> | |||
</GradientStopCollection> | |||
</LinearGradientBrush> | |||
<SolidColorBrush x:Key="AccentBrush" Color="#2B79E2"/> | |||
<SolidColorBrush x:Key="ControlBorderBrush" Color="LightGray"/> | |||
<SolidColorBrush x:Key="ControlBackground" Color="White"/> | |||
<SolidColorBrush x:Key="ControlForeground" Color="Black"/> | |||
<con:HalfNumberConverter x:Key="HalfNumber"/> | |||
<Style TargetType="{x:Type ctrl:SwitchButton}"> | |||
<Setter Property="Background" Value="#00F4D5"/> | |||
<Setter Property="BorderBrush" Value="LightGray"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ctrl:SwitchButton"> | |||
<Border CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=ActualHeight,Converter={StaticResource HalfNumber}}" | |||
BorderThickness="1" Background="{StaticResource ControlBackground}" BorderBrush="{TemplateBinding BorderBrush}"> | |||
<Grid> | |||
<Ellipse x:Name="ELLIPSE" HorizontalAlignment="Left" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" | |||
Fill="Gray" Stroke="{StaticResource ControlBorderBrush}" StrokeThickness="1"> | |||
<Ellipse.RenderTransform> | |||
<TransformGroup> | |||
<TranslateTransform x:Name="TranslateX" X="2"/> | |||
</TransformGroup> | |||
</Ellipse.RenderTransform> | |||
</Ellipse> | |||
</Grid> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</ResourceDictionary> |
@@ -27,7 +27,7 @@ | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Border Style="{DynamicResource border主窗体背景}"> | |||
<Border Style="{DynamicResource border主窗体背景}"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60" /> | |||
@@ -40,7 +40,8 @@ | |||
<ColumnDefinition Width="300" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Border x:Name="br" | |||
<Border | |||
x:Name="br" | |||
Grid.ColumnSpan="2" | |||
Height="52" | |||
VerticalAlignment="Top" | |||
@@ -103,6 +103,25 @@ namespace BPASmartClient.DosingSystem | |||
}); | |||
#endregion | |||
#region 手动控制 | |||
ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>(); | |||
ManualControl.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "手动控制", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.DosingSystem", | |||
ToggleWindowPath = "View.ManualControlView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
MainMenuName = "手动控制", | |||
Alias = "Parameter Set", | |||
subMenumodels = ManualControl, | |||
}); | |||
#endregion | |||
#region 消息日志 | |||
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>(); | |||
InfoLog.Add(new SubMenumodel() | |||
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class ConveyorServer | |||
{ | |||
public ConveyorServer() | |||
{ | |||
} | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class CylinderStatusModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 气缸原点信号 | |||
/// </summary> | |||
public bool HomeStatus { get { return _mHomeStatus; } set { _mHomeStatus = value; OnPropertyChanged(); } } | |||
private bool _mHomeStatus; | |||
/// <summary> | |||
/// 气缸到位信号 | |||
/// </summary> | |||
public bool InPlace { get { return _mInPlace; } set { _mInPlace = value; OnPropertyChanged(); } } | |||
private bool _mInPlace; | |||
} | |||
} |
@@ -66,7 +66,6 @@ namespace BPASmartClient.DosingSystem.Model | |||
public void Init() | |||
{ | |||
devices.Add(new Devices() { DeviceName = "测试", IpAddress = "192.168.0.1" }); | |||
IpAddressLines(); | |||
DeviceDataInit(); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
@@ -60,7 +60,7 @@ | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="4" /> | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
@@ -68,7 +68,9 @@ | |||
<DataTemplate> | |||
<Border | |||
Name="ShadowElement" | |||
Width="200" | |||
Height="150" | |||
Margin="10" | |||
VerticalAlignment="Top" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
@@ -125,8 +127,8 @@ | |||
Grid.Row="2" | |||
Width="130" | |||
Height="30" | |||
VerticalAlignment="Top" | |||
Margin="0,0,0,0" | |||
VerticalAlignment="Top" | |||
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding IpAddress}" | |||
Content="修改原料名称" | |||
@@ -17,7 +17,8 @@ | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="bordColor" Color="#33ffffff" /> | |||
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />--> | |||
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}"> | |||
@@ -0,0 +1,379 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.DosingSystem.View.ManualControlView" | |||
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:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.Resources> | |||
<Style x:Key="radioButtonStyle" TargetType="RadioButton"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Opacity="0.8"> | |||
<ContentControl | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="{TemplateBinding FontSize}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
<Image | |||
Name="image" | |||
Source="/BPASmartClient.CustomResource;component/Image/边框线.png" | |||
Stretch="Fill" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/边框线.png" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/透明背景.png" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="gr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
<vm:ManualControlViewModel /> | |||
</UserControl.DataContext> | |||
<Grid Margin="8"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 升降气缸--> | |||
<Grid | |||
Name="cy" | |||
Grid.Row="0" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=cy, Path=ActualWidth}" | |||
Height="{Binding ElementName=cy, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="升降气缸控制" /> | |||
<ListView | |||
Grid.Row="1" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding cylinderModels}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 阻挡气缸--> | |||
<Grid | |||
Name="zd" | |||
Grid.Row="1" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=zd, Path=ActualWidth}" | |||
Height="{Binding ElementName=zd, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="阻挡气缸控制" /> | |||
<ListView | |||
Grid.Row="1" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding BlockCylinders}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 托盘气缸--> | |||
<Grid | |||
Name="tp" | |||
Grid.Row="2" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<pry:ImageBorder | |||
Grid.RowSpan="2" | |||
Width="{Binding ElementName=tp, Path=ActualWidth}" | |||
Height="{Binding ElementName=tp, Path=ActualHeight}" /> | |||
<Image | |||
Margin="2,3,0,0" | |||
HorizontalAlignment="Left" | |||
Source="/BPASmartClient.CustomResource;component/Image/标签.png" /> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
Text="托盘气缸控制" /> | |||
<ListView | |||
Grid.Row="2" | |||
Margin="10" | |||
Background="Transparent" | |||
BorderBrush="#00BEFA" | |||
BorderThickness="0" | |||
ItemsSource="{Binding PalletCylinders}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Width="200" | |||
Height="100" | |||
Margin="0,0,0,15" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.5*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
Text="{Binding Name}" /> | |||
<pry:Cylinder | |||
Grid.Row="1" | |||
Grid.ColumnSpan="3" | |||
Width="200" | |||
Height="50" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
LeftTogIsChecked="{Binding LeftTog}" | |||
RightTogIsChecked="{Binding RightTog}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="1" | |||
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="伸出" | |||
Foreground="Aqua" | |||
IsChecked="True" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
<RadioButton | |||
Grid.Row="2" | |||
Grid.Column="2" | |||
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Name}" | |||
Content="缩回" | |||
Foreground="Aqua" | |||
IsChecked="False" | |||
Style="{StaticResource radioButtonStyle}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
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; | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// ManualControlView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ManualControlView : UserControl | |||
{ | |||
public ManualControlView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -24,7 +24,6 @@ | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="20" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<!--<Setter Property="Foreground" Value="{StaticResource FontColor}" />--> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
@@ -37,6 +36,8 @@ | |||
<Setter Property="BorderThickness" Value="0" /> | |||
</Style> | |||
<Style x:Key="ListViewStyle" TargetType="ListView" /> | |||
</UserControl.Resources> | |||
<UserControl.DataContext> | |||
@@ -90,253 +91,199 @@ | |||
</StackPanel> | |||
<!--#endregion--> | |||
<ScrollViewer Grid.Row="2"> | |||
<ListView | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
<ListBox | |||
Grid.Row="2" | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding Recipes}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition Height="128" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="5" | |||
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="LightSkyBlue"> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
Text="配方信息:" /> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.25*" /> | |||
<RowDefinition Height="0.2*" /> | |||
</Grid.RowDefinitions> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="2,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#dd000000" | |||
Text="{Binding RecipeName}" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="2" | |||
Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
EnterBackground="Red" | |||
FontStyle="Normal" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="编辑" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding RawMaterialName}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text=":" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#aa2AB2E7" | |||
Text="g" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</Border> | |||
</DataTemplate> | |||
</ListView.ItemTemplate> | |||
</ListView> | |||
</ScrollViewer> | |||
<!--<UniformGrid | |||
Grid.Row="2" | |||
Height="200" | |||
VerticalAlignment="Top" | |||
Columns="10"> | |||
<Border | |||
Margin="10" | |||
Background="LightSkyBlue" | |||
BorderThickness="1"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="0.25*" /> | |||
<RowDefinition Height="0.2*" /> | |||
</Grid.RowDefinitions> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="2,0,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="#dd000000" | |||
Text="配方名称" /> | |||
<Grid Name="gr" Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Content="删除" | |||
EnterBackground="Red" | |||
FontStyle="Normal" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Content="编辑" | |||
EnterBackground="#FF2AB2E7" | |||
Foreground="#dd000000" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</ScrollViewer> | |||
<!--<Grid | |||
Grid.Row="3" | |||
Height="2" | |||
VerticalAlignment="Bottom"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/直线.png" Stretch="Fill" /> | |||
</Grid.Background> | |||
</Grid>--> | |||
<Image | |||
Grid.Row="3" | |||
Width="{Binding ElementName=tt, Path=ActualWidth}" | |||
Height="2" | |||
VerticalAlignment="Bottom" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" | |||
Stretch="Fill" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="4" | |||
Height="30" | |||
Margin="0,0,0,10" | |||
VerticalAlignment="Bottom" | |||
Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<!--<Image | |||
Height="2" | |||
Grid.ColumnSpan="2" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
VerticalAlignment="Top" | |||
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />--> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="4,4,3,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
FontStyle="Normal" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Grid.Column="1" | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#112AB2E7" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="编辑" | |||
EnterBackground="#222AB2E7" | |||
Foreground="#FF2AB2E7" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</Grid> | |||
<!--</StackPanel>--> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</UniformGrid>--> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
<!--#region 表格数据显示--> | |||
<!--<ScrollViewer | |||
Grid.Row="2" | |||
Visibility="Collapsed" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding Recipes}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton Background="Transparent" GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Foreground="#ff00ccff" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="{Binding SerialNum}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
Foreground="#ff00ccff" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="{Binding RecipeName}" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Foreground="#ff00ccff" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="{Binding RecipCode}" /> | |||
--> | |||
<!--<Grid Grid.Column="3"> | |||
<Button | |||
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="编辑" | |||
Style="{StaticResource buttonStyle}" /> | |||
</Grid>--> | |||
<!-- | |||
<Grid Grid.Column="5"> | |||
<Button | |||
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="详情" | |||
Style="{StaticResource buttonStyle}" /> | |||
</Grid> | |||
<Grid Grid.Column="6"> | |||
<Button | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipCode}" | |||
Content="删除" | |||
Style="{StaticResource buttonStyle}" /> | |||
</Grid> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="gr" Property="Background" Value="#3300ccff" /> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#3300ccff" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer>--> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -28,25 +28,28 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
ErrorInfo = "设备名称不能为空"; | |||
return; | |||
} | |||
int index = Array.FindIndex(DeviceListViewModel.devices.ToArray(), p => p.IpAddress == IpAddress); | |||
if (index >= 0 && index < DeviceListViewModel.devices.Count) | |||
int index = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.IpAddress == IpAddress); | |||
if (index >= 0 && index < DeviceInquire.GetInstance.devices.Count) | |||
{ | |||
if (DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == DeviceName) != null) | |||
if (DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == DeviceName) != null) | |||
ErrorInfo = "设备名称已存在"; | |||
else | |||
{ | |||
var res = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceListViewModel.devices.ElementAt(index).DeviceName); | |||
res.RawMaterialName = DeviceName; | |||
DeviceListViewModel.devices.ElementAt(index).DeviceName = DeviceName; | |||
DeviceInquire.GetInstance.GetDevice(IpAddress).SetDeviceName(DeviceName);//设置PLC名称 | |||
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++) | |||
var res = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(index).DeviceName); | |||
if (res != null) | |||
{ | |||
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
res.RawMaterialName = DeviceName; | |||
DeviceInquire.GetInstance.devices.ElementAt(index).DeviceName = DeviceName; | |||
DeviceInquire.GetInstance.GetDevice(IpAddress).SetDeviceName(DeviceName);//设置PLC名称 | |||
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName; | |||
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++) | |||
{ | |||
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName; | |||
} | |||
} | |||
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); | |||
} | |||
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); | |||
} | |||
} | |||
@@ -0,0 +1,91 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class ManualControlViewModel : ObservableObject | |||
{ | |||
public ManualControlViewModel() | |||
{ | |||
for (int i = 0; i < 15; i++) | |||
{ | |||
cylinderModels.Add(new CylinderModel() | |||
{ | |||
Name = $"升降气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
BlockCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"阻挡气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
for (int i = 0; i < 4; i++) | |||
{ | |||
PalletCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"托盘气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
Open = new RelayCommand<object>((o) => | |||
{ | |||
}); | |||
Close = new RelayCommand<object>((o) => | |||
{ | |||
}); | |||
} | |||
/// <summary> | |||
/// 升降气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>(); | |||
/// <summary> | |||
/// 阻挡气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
/// <summary> | |||
/// 托盘气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
public RelayCommand<object> Open { get; set; } | |||
public RelayCommand<object> Close { get; set; } | |||
} | |||
public class CylinderModel : ObservableObject | |||
{ | |||
public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } } | |||
private bool _mLeftTog; | |||
public bool RightTog { get { return _mRightTog; } set { _mRightTog = value; OnPropertyChanged(); } } | |||
private bool _mRightTog; | |||
public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } } | |||
private string _mName; | |||
} | |||
} |
@@ -59,14 +59,14 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
if (RecipeName == String.Empty) { ErrorInfo = "配方名称未填写"; return; } | |||
for (int i = 0; i < RawMaterials.Count; i++) | |||
{ | |||
var res = DeviceListViewModel.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName); | |||
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == RawMaterials.ElementAt(i).RawMaterialName); | |||
if (res != null) | |||
{ | |||
RawMaterials.ElementAt(i).DeviceIp = res.IpAddress;//根据设备名称和原料名称的唯一匹配关系,给原料配置IP | |||
RawMaterials.ElementAt(i).RawMaterialSource = 1; | |||
} | |||
var su = Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == RawMaterials.ElementAt(i).RawMaterialName); | |||
if(su != null) | |||
if (su != null) | |||
{ | |||
RawMaterials.ElementAt(i).RawMaterialSource = su.RawMaterialSource; | |||
} | |||
@@ -179,7 +179,7 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
public RelayCommand SaveCommand { get; set; } | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel> (); | |||
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
public ObservableCollection<string> RawMaterialNames { get; set; } = new ObservableCollection<string>(); | |||
@@ -38,6 +38,7 @@ namespace FryPot_DosingSystem | |||
if (res != null && res == true) | |||
{ | |||
mv.Show(); | |||
MessageLog.GetInstance.ShowUserLog("用户登录"); | |||
DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取 | |||
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序 | |||
HubHelper.GetInstance.Connect("192.168.1.40", 8089); | |||
@@ -105,7 +106,7 @@ namespace FryPot_DosingSystem | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "操作日志", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员,Permission.观察员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.UserLogView" | |||
}); | |||
@@ -113,7 +114,7 @@ namespace FryPot_DosingSystem | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "运行日志", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.观察员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.RunLogView" | |||
}); | |||
@@ -121,14 +122,14 @@ namespace FryPot_DosingSystem | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "报警记录", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.观察员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.AlarmView" | |||
}); | |||
InfoLog.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "炒锅状态记录", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 }, | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.观察员 }, | |||
AssemblyName = "FryPot_DosingSystem", | |||
ToggleWindowPath = "View.SqliteDataView" | |||
}); | |||
@@ -138,7 +139,7 @@ namespace FryPot_DosingSystem | |||
MainMenuIcon = "", | |||
MainMenuName = "消息日志", | |||
Alias = "Message Log", | |||
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 }, | |||
subMenumodels = InfoLog, | |||
}); | |||
#endregion | |||
@@ -155,7 +156,7 @@ namespace FryPot_DosingSystem | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "PLC变量配置", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.VariableConfigView" | |||
}); | |||
@@ -180,7 +181,7 @@ namespace FryPot_DosingSystem | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "AGV视图", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员, Permission.观察员 }, | |||
AssemblyName = "FryPot_DosingSystem", | |||
ToggleWindowPath = "View.AgvView" | |||
}); | |||
@@ -200,7 +201,7 @@ namespace FryPot_DosingSystem | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "用户登录", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.SubPagLoginView" | |||
}); | |||
@@ -208,7 +209,7 @@ namespace FryPot_DosingSystem | |||
UserManager.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "密码修改", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.CustomResource", | |||
ToggleWindowPath = "Pages.View.PasswordChangeView" | |||
}); | |||
@@ -231,7 +232,7 @@ namespace FryPot_DosingSystem | |||
MainMenuIcon = "", | |||
MainMenuName = "用户管理", | |||
Alias = "User Management", | |||
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
subMenumodels = UserManager, | |||
}); | |||
#endregion | |||
@@ -1372,9 +1372,11 @@ namespace FryPot_DosingSystem.Control | |||
globalVar.rollerLineOne.OutMaterialingSingle = data[3]; | |||
globalVar.rollerLineTwo.OutMaterialingSingle = data[4]; | |||
globalVar.rollerLineThree.OutMaterialingSingle = data[5]; | |||
//globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6]; | |||
//globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7]; | |||
//globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8]; | |||
AlarmHelper<AlarmInfo>.Alarm.LineOneRollerRunning = data[3]; | |||
AlarmHelper<AlarmInfo>.Alarm.LineTwoRollerRunning = data[4]; | |||
AlarmHelper<AlarmInfo>.Alarm.LineThreeRollerRunning = data[5]; | |||
AlarmHelper<AlarmInfo>.Alarm.LOneRollerTrouble = data[6]; | |||
AlarmHelper<AlarmInfo>.Alarm.LTwoRollerTrouble = data[7]; | |||
AlarmHelper<AlarmInfo>.Alarm.LThreeRollerTrouble = data[8]; | |||
@@ -1387,6 +1389,13 @@ namespace FryPot_DosingSystem.Control | |||
globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2]; | |||
globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3]; | |||
globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotOneRollerRunning= data[0]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotTwoRollerRunning = data[1]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotThreeRollerRunning = data[2]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotFourRollerRunning = data[3]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotFiveRollerRunning = data[4]; | |||
})); | |||
GetAddressData("D2045", new Action<ushort[]>((data) => | |||
{ | |||
@@ -1411,6 +1420,12 @@ namespace FryPot_DosingSystem.Control | |||
globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2]; | |||
globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3]; | |||
globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotOneEmptyRollerRunning = data[0]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotTwoEmptyRollerRunning = data[1]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotThreeEmptyRollerRunning = data[2]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotFourEmptyRollerRunning = data[3]; | |||
AlarmHelper<AlarmInfo>.Alarm.FryPotFiveEmptyRollerRunning = data[4]; | |||
})); | |||
GetAddressData("D2070", new Action<ushort[]>((data) => | |||
{ | |||
@@ -1433,7 +1448,7 @@ namespace FryPot_DosingSystem.Control | |||
})); | |||
GetAddressData("D2075", new Action<ushort[]>(data => | |||
{ | |||
AlarmHelper<AlarmInfo>.Alarm.CleanEnterRollerRunning = data[0]; | |||
globalVar.CleadBarrelEnterSingle = data[0]; | |||
})); | |||
GetAddressData("2076", new Action<ushort[]>(data => | |||
@@ -1443,7 +1458,7 @@ namespace FryPot_DosingSystem.Control | |||
})); | |||
GetAddressData("D2077", new Action<ushort[]>(data => | |||
{ | |||
AlarmHelper<AlarmInfo>.Alarm.CleanOutputRollerRunning = data[0]; | |||
globalVar.CleadBarrelExitSingle = data[0]; | |||
})); | |||
//炒锅1状态数据 | |||
@@ -1516,6 +1531,7 @@ namespace FryPot_DosingSystem.Control | |||
FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity; | |||
FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity; | |||
} | |||
//炒锅状态实时显示 | |||
FryPotStatusDisplay(); | |||
RollerLineStatusDisplay(); | |||
@@ -2056,7 +2072,10 @@ namespace FryPot_DosingSystem.Control | |||
WritePlcData("D1066", 1);//AGV空桶出桶就位信号下发PlC | |||
MessageLog.GetInstance.ShowRunLog("AGV到达清洗台空桶上料位置"); | |||
// MessageLog.GetInstance.ShowRunLog("清洗台空桶装载完成"); | |||
if (globalVar.CleadBarrelExitSingle == 0) | |||
{ | |||
MessageLog.GetInstance.ShowRunLog("警告:清洗台出桶滚筒未运行!!"); | |||
} | |||
} | |||
} | |||
@@ -2158,10 +2177,12 @@ namespace FryPot_DosingSystem.Control | |||
{ | |||
globalVar.rollerLineOne.agvArriveCleanUnLoad = false; | |||
MessageLog.GetInstance.ShowRunLog("空桶从线体1到达清洗位置,准备卸桶"); | |||
//plc交互 | |||
WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC | |||
// MessageLog.GetInstance.ShowRunLog("卸桶完成"); | |||
if (globalVar.CleadBarrelEnterSingle == 0) | |||
{ | |||
MessageLog.GetInstance.ShowRunLog("警告:清洗台进桶滚筒未运行!!"); | |||
} | |||
} | |||
if (globalVar.rollerLineTwo.agvArriveCleanUnLoad) | |||
{ | |||
@@ -2170,7 +2191,10 @@ namespace FryPot_DosingSystem.Control | |||
//plc交互 | |||
WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC | |||
// MessageLog.GetInstance.ShowRunLog("卸桶完成"); | |||
if (globalVar.CleadBarrelEnterSingle == 0) | |||
{ | |||
MessageLog.GetInstance.ShowRunLog("警告:清洗台进桶滚筒未运行!!"); | |||
} | |||
} | |||
if (globalVar.rollerLineThree.agvArriveCleanUnLoad) | |||
{ | |||
@@ -2179,8 +2203,12 @@ namespace FryPot_DosingSystem.Control | |||
//plc交互 | |||
WritePlcData("D1065", 1);//AGV空桶洗桶就位信号下发PLC | |||
// MessageLog.GetInstance.ShowRunLog("卸桶完成"); | |||
if (globalVar.CleadBarrelEnterSingle == 0) | |||
{ | |||
MessageLog.GetInstance.ShowRunLog("警告:清洗台进桶滚筒未运行!!"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
@@ -2313,7 +2341,7 @@ namespace FryPot_DosingSystem.Control | |||
//Sqlite<PotFiveStatus>.GetInstance.Save();//保存数据 | |||
} | |||
globalVar.LTwoCurrentRecipeName = string.Empty; | |||
Task.Run(() => { Thread.Sleep(2000); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; }); | |||
Task.Run(() => { Thread.Sleep(1500); fryTwoRecipe = string.Empty; fryFiveRecipe = string.Empty; }); | |||
} | |||
} | |||
@@ -2377,9 +2405,6 @@ namespace FryPot_DosingSystem.Control | |||
globalVar.rollerLineTwo.RecipeComMidSingle = 0; | |||
} | |||
} | |||
} | |||
/// <summary> | |||
@@ -3053,82 +3078,8 @@ namespace FryPot_DosingSystem.Control | |||
} | |||
///// <summary> | |||
///// 2号线体对应空桶清洗 | |||
///// </summary> | |||
//public void LTwoEmptyRollerToLineFour() | |||
//{ | |||
// if (globalVar.LTwoEmptyRollerUnLoadcCom)//agv在4号线体下料完成 | |||
// { | |||
// globalVar.AllowAgvToLineTwoLoadRoller = true; | |||
// globalVar.LTwoLoadRoller = false; | |||
// globalVar.LTwoAgvToFryPot = false; | |||
// globalVar.LTwoPotInputMaterialArrive = false; | |||
// globalVar.LTwoPotOutputRollerArrive = false; | |||
// globalVar.LTwoAgvArrivePot = false; | |||
// } | |||
//} | |||
///// <summary> | |||
///// 3号线体对应空桶清洗 | |||
///// </summary> | |||
//public void LThreeEmptyRollerToLinFour() | |||
//{ | |||
// if (globalVar.LThreeEmptyRollerUnLoadcCom)//agv在4号线体下料完成 | |||
// { | |||
// globalVar.AllowAgvToLineThreeLoadRoller = true; | |||
// globalVar.LThreeLoadRoller = false; | |||
// globalVar.LThreeAgvToFryPot = false; | |||
// globalVar.LThreePotInputMaterialArrive = false; | |||
// globalVar.LThreePotOutputRollerArrive = false; | |||
// globalVar.LThreeAgvArrivePot = false; | |||
// } | |||
//} | |||
/// <summary> | |||
/// 炒锅滚筒进料运行到位处理 | |||
/// </summary> | |||
//public void FryPotInputMaterialRollerOperate(ConcurrentQueue<MaterialInfo> queue) | |||
//{ | |||
// switch (queue.ElementAt(0).materialType.MaterialLoc / 100) | |||
// { | |||
// case 1: | |||
// while (globalVar.fryPotOne.InputMaterialArrivedSingle == 0) | |||
// { | |||
// Thread.Sleep(5); if (globalVar.ExitMainTask) | |||
// return; | |||
// } | |||
// MessageLog.GetInstance.ShowRunLog($"炒锅【1】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; | |||
// case 2: | |||
// while (globalVar.fryPotTwo.InputMaterialArrivedSingle == 0) | |||
// { | |||
// Thread.Sleep(5); if (globalVar.ExitMainTask) | |||
// return; | |||
// } | |||
// MessageLog.GetInstance.ShowRunLog($"炒锅【2】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; | |||
// case 3: | |||
// while (globalVar.fryPotThree.InputMaterialArrivedSingle == 0) | |||
// { | |||
// Thread.Sleep(5); if (globalVar.ExitMainTask) | |||
// return; | |||
// } | |||
// MessageLog.GetInstance.ShowRunLog($"炒锅【3】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; | |||
// case 4: | |||
// while (globalVar.fryPotFour.InputMaterialArrivedSingle == 0) | |||
// { | |||
// Thread.Sleep(5); if (globalVar.ExitMainTask) | |||
// return; | |||
// } | |||
// MessageLog.GetInstance.ShowRunLog($"炒锅【4】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; | |||
// case 5: | |||
// while (globalVar.fryPotFive.InputMaterialArrivedSingle == 0) | |||
// { | |||
// Thread.Sleep(5); if (globalVar.ExitMainTask) | |||
// return; | |||
// } | |||
// MessageLog.GetInstance.ShowRunLog($"炒锅【5】原料:{OutputMaterialQuene.ElementAt(0).materialType.MaterialName}已到进料位置,准备倒料"); break; | |||
// } | |||
//} | |||
/// <summary> | |||
/// 炒锅1,4滚筒进料运行到位处理 | |||
/// </summary> | |||
@@ -197,7 +197,7 @@ namespace FryPot_DosingSystem.Control | |||
public bool agvArriveLineOneLoadCom { get; set; } //agv线体1空桶上料完成 | |||
public bool agvArriveLineTwoLoadCom { get; set; } //agv线体2空桶上料完成 | |||
public bool agvArriveLineThreeLoadCom { get; set; }//agv线体3空桶上料完成 | |||
//空桶清洗流程锁 | |||
#endregion | |||
} | |||
/// <summary> | |||
@@ -263,10 +263,12 @@ namespace FryPot_DosingSystem.Control | |||
public ushort EmptyRollerNum { get; set; } | |||
/// <summary> | |||
/// 上一个桶是否是空桶 | |||
/// 上一个桶是否是空桶,空桶上料结束后,配方料桶AGV才能去1号线装桶 | |||
/// </summary> | |||
public bool IsEpmtyBefore { get; set; } //空桶上料结束后,配方料桶AGV才能去1号线装桶 | |||
/// <summary> | |||
/// 配方料桶上料结束后,线体空桶AGV才能1号线装桶 | |||
/// </summary> | |||
public bool CanRun { get; set; } = true; //配方料桶上料结束后,线体空桶AGV才能1号线装桶 | |||
/// <summary> | |||
/// 线体1上所有空桶的编号集合 | |||
@@ -280,6 +282,8 @@ namespace FryPot_DosingSystem.Control | |||
/// AGV从线体1到达清洗台 | |||
/// </summary> | |||
public bool agvArriveCleanUnLoad { get; set; } | |||
} | |||
/// <summary> | |||
/// 滚筒线2相关变量 | |||
@@ -3,8 +3,8 @@ | |||
<head> | |||
<meta charset="utf-8"/> | |||
<title>iconfont Demo</title> | |||
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i2/O1CN01ZyAlrn1MwaMhqz36G_!!6000000001499-73-tps-64-64.ico" type="image/x-icon"/> | |||
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01EYTRnJ297D6vehehJ_!!6000000008020-55-tps-64-64.svg"/> | |||
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" type="image/x-icon"/> | |||
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg"/> | |||
<link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css"> | |||
<link rel="stylesheet" href="demo.css"> | |||
<link rel="stylesheet" href="iconfont.css"> | |||
@@ -88,6 +88,12 @@ | |||
<div class="code-name">&#xe695;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">加号</div> | |||
<div class="code-name">&#xe602;</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont"></span> | |||
<div class="name">密码</div> | |||
@@ -166,7 +172,7 @@ | |||
<pre><code class="language-css" | |||
>@font-face { | |||
font-family: 'iconfont'; | |||
src: url('iconfont.ttf?t=1659942239310') format('truetype'); | |||
src: url('iconfont.ttf?t=1660817438136') format('truetype'); | |||
} | |||
</code></pre> | |||
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3> | |||
@@ -246,6 +252,15 @@ | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-jiahao"></span> | |||
<div class="name"> | |||
加号 | |||
</div> | |||
<div class="code-name">.icon-jiahao | |||
</div> | |||
</li> | |||
<li class="dib"> | |||
<span class="icon iconfont icon-mima"></span> | |||
<div class="name"> | |||
@@ -411,6 +426,14 @@ | |||
<div class="code-name">#icon-window-max_line</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-jiahao"></use> | |||
</svg> | |||
<div class="name">加号</div> | |||
<div class="code-name">#icon-jiahao</div> | |||
</li> | |||
<li class="dib"> | |||
<svg class="icon svg-icon" aria-hidden="true"> | |||
<use xlink:href="#icon-mima"></use> | |||
@@ -50,9 +50,8 @@ | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Content="配方一键下发" Width="110" Height="30" Margin="0,0,10,0" Cursor="Hand" Command="{Binding AllRecipeSetDownCommand}"></Button> | |||
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" > | |||
<ScrollViewer Name="sv" Grid.Row="1" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel" VerticalScrollBarVisibility="Hidden" > | |||
<ListView | |||
Margin="5" | |||
VerticalAlignment="Top" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
@@ -60,16 +59,17 @@ | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListView.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<UniformGrid | |||
<!--<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="8" /> | |||
Columns="8" />--> | |||
<WrapPanel/> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
<ListView.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5" Background="LightSkyBlue"> | |||
<Border Margin="3.5" Width="230" Height="280" Background="LightSkyBlue"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
@@ -91,13 +91,12 @@ | |||
Name="gr" | |||
Grid.Row="2" | |||
Height="30" | |||
Margin="0,0,0,-9" | |||
Background="#00BEFA"> | |||
<pry:IcoButton | |||
Width="{Binding ElementName=gr, Path=ActualWidth}" | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RecipeSetDownCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}" | |||
CommandParameter="{Binding RecipeId}" | |||
@@ -24,5 +24,13 @@ namespace FryPot_DosingSystem.View | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e) | |||
{ | |||
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta); | |||
eventArg.RoutedEvent = UIElement.MouseWheelEvent; | |||
eventArg.Source = sender; | |||
sv.RaiseEvent(eventArg); | |||
} | |||
} | |||
} |
@@ -8,9 +8,9 @@ | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800" | |||
xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"> | |||
<UserControl.DataContext> | |||
<!--<UserControl.DataContext> | |||
<vm:UserManageViewModel/> | |||
</UserControl.DataContext> | |||
</UserControl.DataContext>--> | |||
<UserControl.Resources> | |||
<Style x:Key="dgCell" TargetType="TextBlock"> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
@@ -29,6 +29,7 @@ namespace FryPot_DosingSystem.View | |||
public UserManageView() | |||
{ | |||
InitializeComponent(); | |||
this.DataContext = UserManageViewModel.GetInstance; | |||
} | |||
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) | |||
@@ -38,13 +39,17 @@ namespace FryPot_DosingSystem.View | |||
var per = cbo.SelectedItem; | |||
if (id != null) | |||
{ | |||
var a = UserManageViewModel.GetInstance.usersInfo.FirstOrDefault(p => p.Id == id); | |||
var a = UserManageViewModel.GetInstance.usersInfo.FirstOrDefault(p => p.Id == id.ToString()); | |||
if (a != null && per != null) | |||
{ | |||
a.permission = (Permission)Enum.Parse(typeof(Permission), per.ToString()); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
UserManageViewModel.GetInstance.usersInfo.Last().permission = (Permission)Enum.Parse(typeof(Permission), per.ToString()); | |||
} | |||
} | |||
} | |||
@@ -132,7 +132,23 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.JXJFoodBigSt | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.JXJFoodSmallStation", "BPASmartClient.JXJFoodSmallStation\BPASmartClient.JXJFoodSmallStation.csproj", "{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFDemo", "WPFDemo\WPFDemo.csproj", "{A456D582-D910-4CA2-8620-6D8F63344B47}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WPFDemo", "WPFDemo\WPFDemo.csproj", "{A456D582-D910-4CA2-8620-6D8F63344B47}" | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0.SCADA", "0.SCADA", "{7B0175AD-BB74-4A98-B9A7-1E289032485E}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MessageName", "BPASmartClient.MessageName\BPASmartClient.MessageName.csproj", "{0D769B3B-0332-4DB9-A657-B739EDB28567}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DATABUS", "BPASmartClient.DATABUS\BPASmartClient.DATABUS.csproj", "{7C1AF86E-867C-427E-90DB-6473D88F51EB}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.SCADAControl", "BPASmartClient.SCADAControl\BPASmartClient.SCADAControl.csproj", "{6A3FC66D-0B89-45E8-B39B-9D81538002D1}" | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1.数据中心", "1.数据中心", "{7BED8969-7EA7-409C-8BBC-D2777ECDA2F1}" | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.消息名称管理", "2.消息名称管理", "{28BE5235-2399-4EBA-B1F0-88E0F32AC869}" | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.组态控件集", "3.组态控件集", "{5300552F-560D-474A-8D96-0A2747D08F64}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Compiler", "BPASmartClient.Compiler\BPASmartClient.Compiler.csproj", "{B6213013-2A0E-41DD-BA9F-775D53C19374}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
@@ -1288,6 +1304,86 @@ Global | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x64.Build.0 = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.ActiveCfg = Release|Any CPU | |||
{A456D582-D910-4CA2-8620-6D8F63344B47}.Release|x86.Build.0 = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|x64.Build.0 = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Debug|x86.Build.0 = Debug|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|ARM.Build.0 = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|ARM64.Build.0 = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|x64.ActiveCfg = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|x64.Build.0 = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|x86.ActiveCfg = Release|Any CPU | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567}.Release|x86.Build.0 = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|x64.Build.0 = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Debug|x86.Build.0 = Debug|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|ARM.Build.0 = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|ARM64.Build.0 = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|x64.ActiveCfg = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|x64.Build.0 = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|x86.ActiveCfg = Release|Any CPU | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB}.Release|x86.Build.0 = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|x64.Build.0 = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Debug|x86.Build.0 = Debug|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|ARM.Build.0 = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|ARM64.Build.0 = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|x64.ActiveCfg = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|x64.Build.0 = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|x86.ActiveCfg = Release|Any CPU | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1}.Release|x86.Build.0 = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|x64.Build.0 = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Debug|x86.Build.0 = Debug|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|ARM.Build.0 = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|ARM64.Build.0 = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|x64.ActiveCfg = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|x64.Build.0 = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|x86.ActiveCfg = Release|Any CPU | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374}.Release|x86.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -1350,6 +1446,13 @@ Global | |||
{FA695D7E-6F12-4483-A16D-8494609FAE68} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{D609C4CF-FA5C-4D39-B12F-07A60FFE5E40} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{A456D582-D910-4CA2-8620-6D8F63344B47} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{0D769B3B-0332-4DB9-A657-B739EDB28567} = {28BE5235-2399-4EBA-B1F0-88E0F32AC869} | |||
{7C1AF86E-867C-427E-90DB-6473D88F51EB} = {7BED8969-7EA7-409C-8BBC-D2777ECDA2F1} | |||
{6A3FC66D-0B89-45E8-B39B-9D81538002D1} = {5300552F-560D-474A-8D96-0A2747D08F64} | |||
{7BED8969-7EA7-409C-8BBC-D2777ECDA2F1} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | |||
{28BE5235-2399-4EBA-B1F0-88E0F32AC869} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | |||
{5300552F-560D-474A-8D96-0A2747D08F64} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | |||
{B6213013-2A0E-41DD-BA9F-775D53C19374} = {5300552F-560D-474A-8D96-0A2747D08F64} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC} | |||
@@ -1,9 +1,8 @@ | |||
<Application x:Class="WPFDemo.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:WPFDemo" | |||
StartupUri="MainWindow.xaml"> | |||
<Application.Resources> | |||
</Application.Resources> | |||
<Application | |||
x:Class="WPFDemo.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:WPFDemo" | |||
StartupUri="MainWindow.xaml"> | |||
<Application.Resources /> | |||
</Application> |