Commit 892d8466 by liulongfei

1. GPIO支持

2. 对象池支持
3. 时间控件
parent 00094f06
......@@ -180,6 +180,7 @@ namespace VIZ.Framework.Common
window.box.Message = message;
window.box.Buttons = buttons;
window.Owner = ownerWindow;
window.Topmost = true;
window.ShowDialog();
......@@ -207,6 +208,7 @@ namespace VIZ.Framework.Common
window.box.Message = message;
window.box.Buttons = buttons;
window.Owner = Application.Current?.MainWindow;
window.Topmost = true;
window.ShowDialog();
......
......@@ -12,6 +12,7 @@
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/LabelValue/LabelValue.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/HotkeyBox/HotkeyBox.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/GPIOPinTestControl/GPIOPinTestControl.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/ShowMessageControl/ShowMessageControl.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
......@@ -158,6 +158,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Widgets\ShowMessageControl\ShowMessageControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Widgets\VideoTimeBar\VideoTimeBar.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -268,6 +272,9 @@
<Compile Include="Widgets\NavigationControl\NavigationItemControl.cs" />
<Compile Include="Widgets\NoneWindow\NoneWindow.cs" />
<Compile Include="Widgets\NumberBox\NumberBox.cs" />
<Compile Include="Widgets\ShowMessageControl\ShowMessage.cs" />
<Compile Include="Widgets\ShowMessageControl\ShowMessageControl.cs" />
<Compile Include="Widgets\TimeDisplayControl\TimeDisplayControl.cs" />
<Compile Include="Widgets\VideoTimeBar\EventArgs\VideoTimeBarValueChangedEventArgs.cs" />
<Compile Include="Widgets\VideoTimeBar\VideoTimeBar.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
......
......@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.Framework.Common
{
......@@ -25,5 +26,23 @@ namespace VIZ.Framework.Common
DefaultStyleKeyProperty.OverrideMetadata(typeof(GPIOPinTestControl), new FrameworkPropertyMetadata(typeof(GPIOPinTestControl)));
}
#region GPIOModel -- GPIO模型
/// <summary>
/// GPIO模型
/// </summary>
public GPIOModel GPIOModel
{
get { return (GPIOModel)GetValue(GPIOModelProperty); }
set { SetValue(GPIOModelProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for GPIOModel. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty GPIOModelProperty =
DependencyProperty.Register("GPIOModel", typeof(GPIOModel), typeof(GPIOPinTestControl), new PropertyMetadata(null));
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Framework.Common
{
/// <summary>
/// 显示消息
/// </summary>
public class ShowMessage
{
/// <summary>
/// 消息键
/// </summary>
public string MessageKey { get; set; }
/// <summary>
/// 消息
/// </summary>
public string Message { get; set; }
}
}
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;
using VIZ.Framework.Core;
using VIZ.Framework.Domain;
namespace VIZ.Framework.Common
{
/// <summary>
/// 显示消息控件
/// </summary>
public class ShowMessageControl : Control
{
static ShowMessageControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ShowMessageControl), new FrameworkPropertyMetadata(typeof(ShowMessageControl)));
}
public ShowMessageControl()
{
this.Loaded += ShowMessageControl_Loaded;
}
#region Message -- 消息
/// <summary>
/// 消息
/// </summary>
public string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for Message. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty MessageProperty =
DependencyProperty.Register("Message", typeof(string), typeof(ShowMessageControl), new PropertyMetadata(null));
#endregion
#region IsShow -- 是否显示
/// <summary>
/// 是否显示
/// </summary>
public bool IsShow
{
get { return (bool)GetValue(IsShowProperty); }
set { SetValue(IsShowProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for IsShow. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty IsShowProperty =
DependencyProperty.Register("IsShow", typeof(bool), typeof(ShowMessageControl), new PropertyMetadata(false));
#endregion
#region MessageKey -- 消息键
/// <summary>
/// 消息键
/// </summary>
public string MessageKey
{
get { return (string)GetValue(MessageKeyProperty); }
set { SetValue(MessageKeyProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for MessageKey. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty MessageKeyProperty =
DependencyProperty.Register("MessageKey", typeof(string), typeof(ShowMessageControl), new PropertyMetadata(null));
#endregion
#region MessageShowDuration -- 消息显示持续时间
/// <summary>
/// 消息显示持续时间
/// </summary>
public TimeSpan MessageShowDuration
{
get { return (TimeSpan)GetValue(MessageShowDurationProperty); }
set { SetValue(MessageShowDurationProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for MessageShowDuration. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty MessageShowDurationProperty =
DependencyProperty.Register("MessageShowDuration", typeof(TimeSpan), typeof(ShowMessageControl), new PropertyMetadata(TimeSpan.FromSeconds(2)));
#endregion
/// <summary>
/// 是否已经完成加载
/// </summary>
private bool isAlreadyLoaded;
/// <summary>
/// 加载完成
/// </summary>
private void ShowMessageControl_Loaded(object sender, RoutedEventArgs e)
{
if (this.isAlreadyLoaded || ApplicationDomain.MessageManager == null)
return;
ApplicationDomain.MessageManager.Register<ShowMessage>(this, this.ExecuteMessage);
this.isAlreadyLoaded = true;
}
/// <summary>
/// 执行消息
/// </summary>
/// <param name="msg">消息</param>
private void ExecuteMessage(ShowMessage msg)
{
if (this.MessageKey != msg.MessageKey)
return;
WPFHelper.BeginInvoke(() =>
{
this.Message = msg.Message;
this.IsShow = true;
ApplicationDomain.DelayManager.Wait($"ShowMessageControl__{this.MessageKey}", this.MessageShowDuration, () =>
{
WPFHelper.BeginInvoke(() =>
{
this.IsShow = false;
});
});
});
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:local="clr-namespace:VIZ.Framework.Common">
<core:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter" TrueVisibility="Visible" FalseVisibility="Collapsed"></core:Bool2VisibilityConverter>
<Style TargetType="local:ShowMessageControl">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:ShowMessageControl">
<Border Background="{TemplateBinding Background}"
Visibility="{Binding Path=IsShow,RelativeSource={RelativeSource AncestorLevel=1,Mode=FindAncestor,AncestorType=local:ShowMessageControl},Converter={StaticResource Bool2VisibilityConverter}}">
<TextBlock Text="{Binding Path=Message,RelativeSource={RelativeSource AncestorLevel=1,Mode=FindAncestor,AncestorType=local:ShowMessageControl}}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
using log4net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using VIZ.Framework.Core;
using VIZ.Framework.Domain;
namespace VIZ.Framework.Common
{
/// <summary>
/// 时间控件
/// </summary>
public class TimeDisplayControl : TextBlock, IDisposable
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(TimeDisplayControl));
/// <summary>
/// 时间控件
/// </summary>
public TimeDisplayControl()
{
ApplicationDomain.ObjectPoolManager.Add($"TimeDisplayControl__{Guid.NewGuid()}", this);
this.Loaded += TimeDisplayControl_Loaded;
}
#region TimeStringFormat -- 时间字符串格式
/// <summary>
/// 时间字符串格式
/// </summary>
public string TimeStringFormat
{
get { return (string)GetValue(TimeStringFormatProperty); }
set { SetValue(TimeStringFormatProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for TimeStringFormat. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty TimeStringFormatProperty =
DependencyProperty.Register("TimeStringFormat", typeof(string), typeof(TimeDisplayControl), new PropertyMetadata("yyyy-MM-dd HH:mm:ss"));
#endregion
/// <summary>
/// 更新任务信息
/// </summary>
private TaskInfo updateTaskInfo;
/// <summary>
/// 更新任务
/// </summary>
private Task updateTask;
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
if (this.updateTaskInfo == null)
return;
this.updateTaskInfo.IsCancel = true;
this.updateTaskInfo = null;
this.updateTask = null;
}
/// <summary>
/// 控件完成加载
/// </summary>
private void TimeDisplayControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
if (this.updateTask != null)
return;
this.updateTaskInfo = new TaskInfo();
this.updateTask = Task.Run(this.update);
}
/// <summary>
/// 更新
/// </summary>
[DebuggerNonUserCode]
private void update()
{
TaskInfo info = this.updateTaskInfo;
if (info == null)
return;
while (!info.IsCancel)
{
WPFHelper.BeginInvoke(() =>
{
this.Text = DateTime.Now.ToString(this.TimeStringFormat);
});
Task.Delay(1000).Wait();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
namespace VIZ.Framework.Core
{
/// <summary>
/// 颜色转化为
/// </summary>
public class Color2SolidColorBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is Color))
return null;
Color color = (Color)value;
return new SolidColorBrush(color);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
......@@ -35,5 +35,44 @@ namespace VIZ.Framework.Core
return attribute.Description;
}
/// <summary>
/// 获取枚举的枚举模型
/// </summary>
/// <typeparam name="TEnum">枚举类型</typeparam>
/// <returns>枚举模型列表</returns>
public static List<EnumModel> GetEnumModels<TEnum>()
{
Type type = typeof(TEnum);
if (!type.IsEnum)
throw new Exception($"type: {type.Name} is not enum.");
List<EnumModel> models = new List<EnumModel>();
Array names = Enum.GetNames(type);
foreach (object name in names)
{
if (name == null)
continue;
FieldInfo field = type.GetField(name.ToString());
if (field == null)
continue;
DescriptionAttribute attribute = field.GetCustomAttribute<DescriptionAttribute>(false);
if (attribute == null)
continue;
EnumModel model = new EnumModel();
model.Key = name.ToString();
model.Description = attribute.Description;
models.Add(model);
}
return models;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Framework.Core
{
/// <summary>
/// 枚举模型
/// </summary>
public class EnumModel : ModelBase
{
#region Key -- 枚举值
private object key;
/// <summary>
/// 枚举值
/// </summary>
public object Key
{
get { return key; }
set { key = value; this.RaisePropertyChanged(nameof(Key)); }
}
#endregion
#region Description -- 描述
private string description;
/// <summary>
/// 描述
/// </summary>
public string Description
{
get { return description; }
set { description = value; this.RaisePropertyChanged(nameof(Description)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -106,6 +107,7 @@ namespace VIZ.Framework.Core
/// <summary>
/// 执行
/// </summary>
[DebuggerNonUserCode]
private void Execute()
{
LoopThreadInfo info = this.threadInfo;
......
using Microsoft.VisualBasic.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Framework.Core
{
/// <summary>
/// 对象池管理器
/// </summary>
public interface IObjectPoolManager
{
/// <summary>
/// 添加对象
/// </summary>
/// <param name="key">键</param>
/// <param name="obj">对象</param>
/// <returns>是否成功添加</returns>
bool Add(string key, object obj);
/// <summary>
/// 销毁
/// </summary>
/// <param name="key">键</param>
/// <returns>是否成功销毁</returns>
bool Dispose(string key);
/// <summary>
/// 销毁所有的对象
/// </summary>
void DisposeAll();
}
}
using log4net;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Framework.Core
{
/// <summary>
/// 对象池管理器
/// </summary>
public class ObjectPoolManager : IObjectPoolManager
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(ObjectPoolManager));
/// <summary>
/// 对象池列表
/// </summary>
private readonly ConcurrentDictionary<string, WeakReference> pool = new ConcurrentDictionary<string, WeakReference>();
/// <summary>
/// 添加对象
/// </summary>
/// <param name="key">键</param>
/// <param name="obj">对象</param>
/// <returns>是否成功添加</returns>
public bool Add(string key, object obj)
{
if (pool.ContainsKey(key))
return false;
WeakReference reference = new WeakReference(obj, false);
return pool.TryAdd(key, reference);
}
/// <summary>
/// 销毁
/// </summary>
/// <param name="key">键</param>
/// <returns>是否成功销毁</returns>
public bool Dispose(string key)
{
try
{
if (!pool.ContainsKey(key))
return false;
if (!pool.TryRemove(key, out WeakReference reference))
return false;
object obj = reference.Target;
if (obj == null)
return true;
IDisposable disposable = obj as IDisposable;
if (disposable == null)
return true;
disposable.Dispose();
return true;
}
catch (Exception ex)
{
log.Error(ex);
return false;
}
}
/// <summary>
/// 销毁所有的对象
/// </summary>
public void DisposeAll()
{
List<WeakReference> list = pool.Values.ToList();
pool.Clear();
foreach (var item in list)
{
try
{
if (item == null || item.Target == null)
continue;
IDisposable disposable = item.Target as IDisposable;
if (disposable == null)
continue;
disposable.Dispose();
}
catch (Exception ex)
{
log.Error(ex);
}
}
}
}
}
......@@ -18,7 +18,7 @@ namespace VIZ.Framework.Core
/// <param name="PinMask">需要设置为输入模式的引脚,每个bit位代表一个引脚,对应bit位为1时改引脚对设置有效,最低位为P0</param>
/// <param name="PuPd">PuPd 0-浮空输入,无上拉或者下拉,1-上拉输入,2-下拉输入</param>
/// <returns>函数执行状态,小于0函数执行出错<see cref="GPIOResult"/></returns>
[DllImport("USB2XXX.dll")]
[DllImport("LUCERO.dll")]
public static extern Int32 GPIO_SetInput(Int32 DevHandle, UInt32 PinMask, Byte PuPd);
/// <summary>
......@@ -28,7 +28,7 @@ namespace VIZ.Framework.Core
/// <param name="PinMask">需要设置为输出模式的引脚,每个bit位代表一个引脚,对应bit位为1时改引脚对设置有效,最低位对应P0</param>
/// <param name="PuPd">PuPd 0-推挽输出,无上拉或者下拉,1-上拉输出,2-下拉输出</param>
/// <returns>函数执行状态,小于0函数执行出错<see cref="GPIOResult"/></returns>
[DllImport("USB2XXX.dll")]
[DllImport("LUCERO.dll")]
public static extern Int32 GPIO_SetOutput(Int32 DevHandle, UInt32 PinMask, Byte PuPd);
/// <summary>
......@@ -38,7 +38,7 @@ namespace VIZ.Framework.Core
/// <param name="PinMask">需要设置为开漏模式的引脚,每个bit位代表一个引脚,对应bit位为1时改引脚对设置有效,最低位对应P0</param>
/// <param name="PuPd"> PuPd 0-内部无上拉或者下拉,1-使能上拉,2-使能下拉</param>
/// <returns>函数执行状态,小于0函数执行出错<see cref="GPIOResult"/></returns>
[DllImport("USB2XXX.dll")]
[DllImport("LUCERO.dll")]
public static extern Int32 GPIO_SetOpenDrain(Int32 DevHandle, UInt32 PinMask, Byte PuPd);
/// <summary>
......@@ -48,7 +48,7 @@ namespace VIZ.Framework.Core
/// <param name="PinMask">需要输出状态的引脚,每个bit位代表一个引脚,对应bit位为1时改引脚对设置有效,最低位对应P0</param>
/// <param name="PinValue">对应引脚的状态,每个bit位代表一个引脚,对应bit位为1输出高电平,为0输出低电平,最低位对应P0</param>
/// <returns>函数执行状态,小于0函数执行出错<see cref="GPIOResult"/></returns>
[DllImport("USB2XXX.dll")]
[DllImport("LUCERO.dll")]
public static extern Int32 GPIO_Write(Int32 DevHandle, UInt32 PinMask, UInt32 PinValue);
/// <summary>
......@@ -58,7 +58,7 @@ namespace VIZ.Framework.Core
/// <param name="PinMask">需要获取状态的引脚,每个bit位代表一个引脚,对应bit位为1时改引脚对设置有效,最低位对应P0</param>
/// <param name="pPinValue">对应引脚的状态,每个bit位代表一个引脚,对应bit位为1引脚为高电平,为0引脚为低电平,最低位对应P0</param>
/// <returns>函数执行状态,小于0函数执行出错<see cref="GPIOResult"/></returns>
[DllImport("USB2XXX.dll")]
[DllImport("LUCERO.dll")]
public static extern Int32 GPIO_Read(Int32 DevHandle, UInt32 PinMask, ref UInt32 pPinValue);
}
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@ namespace VIZ.Framework.Core
/// <param name="pDevHandle">设备句柄</param>
/// <remarks>pDevHandle数组长度一般为20</remarks>
/// <returns>函数执行状态,小于0函数执行出错</returns>
[DllImport("USB2XXX.dll")]
[DllImport("LUCERO.dll")]
public static extern Int32 USB_ScanDevice(Int32[] pDevHandle);
/// <summary>
......@@ -26,7 +26,7 @@ namespace VIZ.Framework.Core
/// </summary>
/// <param name="DevHandle">设备句柄</param>
/// <returns>设备状态,是否可用</returns>
[DllImport("USB2XXX.dll")]
[DllImport("LUCERO.dll")]
public static extern bool USB_OpenDevice(Int32 DevHandle);
/// <summary>
......@@ -34,7 +34,7 @@ namespace VIZ.Framework.Core
/// </summary>
/// <param name="DevHandle">设备句柄</param>
/// <returns>是否成功关闭</returns>
[DllImport("USB2XXX.dll")]
[DllImport("LUCERO.dll")]
public static extern bool USB_CloseDevice(Int32 DevHandle);
/// <summary>
......@@ -44,7 +44,7 @@ namespace VIZ.Framework.Core
/// <param name="pDevInfo">设备信息</param>
/// <param name="pFunctionStr">功能字符串</param>
/// <returns>是否成功获取</returns>
[DllImport("USB2XXX.dll")]
[DllImport("LUCERO.dll")]
public static extern bool DEV_GetDeviceInfo(Int32 DevHandle, ref USBDeviceStruct pDevInfo, StringBuilder pFunctionStr);
}
}
......@@ -14,82 +14,82 @@ namespace VIZ.Framework.Core
/// <summary>
/// PIN 0
/// </summary>
public const uint PIN_0 = 0b0000000010000000;
public const uint PIN_0 = 0b0000000000000001;
/// <summary>
/// PIN 1
/// </summary>
public const uint PIN_1 = 0b0000000001000000;
public const uint PIN_1 = 0b0000000000000010;
/// <summary>
/// PIN 2
/// </summary>
public const uint PIN_2 = 0b0000000000100000;
public const uint PIN_2 = 0b0000000000000100;
/// <summary>
/// PIN 3
/// </summary>
public const uint PIN_3 = 0b0000000000010000;
public const uint PIN_3 = 0b0000000000001000;
/// <summary>
/// PIN 4
/// </summary>
public const uint PIN_4 = 0b0000000000001000;
public const uint PIN_4 = 0b0000000000010000;
/// <summary>
/// PIN 5
/// </summary>
public const uint PIN_5 = 0b0000000000000100;
public const uint PIN_5 = 0b0000000000100000;
/// <summary>
/// PIN 6
/// </summary>
public const uint PIN_6 = 0b0000000000000010;
public const uint PIN_6 = 0b0000000001000000;
/// <summary>
/// PIN 7
/// </summary>
public const uint PIN_7 = 0b0000000000000001;
public const uint PIN_7 = 0b0000000010000000;
/// <summary>
/// PIN 8
/// </summary>
public const uint PIN_8 = 0b1000000000000000;
public const uint PIN_8 = 0b0000000100000000;
/// <summary>
/// PIN 9
/// </summary>
public const uint PIN_9 = 0b0100000000000000;
public const uint PIN_9 = 0b0000001000000000;
/// <summary>
/// PIN 10
/// </summary>
public const uint PIN_10 = 0b0010000000000000;
public const uint PIN_10 = 0b0000010000000000;
/// <summary>
/// PIN 11
/// </summary>
public const uint PIN_11 = 0b0001000000000000;
public const uint PIN_11 = 0b0000100000000000;
/// <summary>
/// PIN 12
/// </summary>
public const uint PIN_12 = 0b0000100000000000;
public const uint PIN_12 = 0b0001000000000000;
/// <summary>
/// PIN 13
/// </summary>
public const uint PIN_13 = 0b0000010000000000;
public const uint PIN_13 = 0b0010000000000000;
/// <summary>
/// PIN 14
/// </summary>
public const uint PIN_14 = 0b0000001000000000;
public const uint PIN_14 = 0b0100000000000000;
/// <summary>
/// PIN 15
/// </summary>
public const uint PIN_15 = 0b0000000100000000;
public const uint PIN_15 = 0b1000000000000000;
/// <summary>
/// PIN 0 ~ 7
......@@ -105,5 +105,10 @@ namespace VIZ.Framework.Core
/// PIN 0 ~ 15
/// </summary>`
public const uint PIN_0_TO_15 = 0b1111111111111111;
/// <summary>
/// PIN 的默认值
/// </summary>
public const uint PIN_DEFAULT_VALUE = 0b1111111111111111;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Framework.Core
{
/// <summary>
/// GPIO模型引脚值改变事件参数
/// </summary>
public class GPIOModelPinValueChangedEventArgs : EventArgs
{
/// <summary>
/// GPIO模型
/// </summary>
public GPIOModel GPIOModel { get; set; }
/// <summary>
/// 引脚值
/// </summary>
public uint PinValue { get; set; }
}
}
......@@ -50,5 +50,65 @@ namespace VIZ.Framework.Core
/// 模型集合
/// </summary>
public static List<GPIOModel> Models { get; private set; } = new List<GPIOModel>();
/// <summary>
/// 获取引脚模型集合
/// </summary>
/// <returns>引脚模型集合</returns>
public static List<GPIOPinModel> GetPinModels()
{
List<GPIOPinModel> models = new List<GPIOPinModel>();
models.Add(new GPIOPinModel { Index = 0, PinMask = GPIOPin.PIN_0 });
models.Add(new GPIOPinModel { Index = 1, PinMask = GPIOPin.PIN_1 });
models.Add(new GPIOPinModel { Index = 2, PinMask = GPIOPin.PIN_2 });
models.Add(new GPIOPinModel { Index = 3, PinMask = GPIOPin.PIN_3 });
models.Add(new GPIOPinModel { Index = 4, PinMask = GPIOPin.PIN_4 });
models.Add(new GPIOPinModel { Index = 5, PinMask = GPIOPin.PIN_5 });
models.Add(new GPIOPinModel { Index = 6, PinMask = GPIOPin.PIN_6 });
models.Add(new GPIOPinModel { Index = 7, PinMask = GPIOPin.PIN_7 });
models.Add(new GPIOPinModel { Index = 8, PinMask = GPIOPin.PIN_8 });
models.Add(new GPIOPinModel { Index = 9, PinMask = GPIOPin.PIN_9 });
models.Add(new GPIOPinModel { Index = 10, PinMask = GPIOPin.PIN_10 });
models.Add(new GPIOPinModel { Index = 11, PinMask = GPIOPin.PIN_11 });
models.Add(new GPIOPinModel { Index = 12, PinMask = GPIOPin.PIN_12 });
models.Add(new GPIOPinModel { Index = 13, PinMask = GPIOPin.PIN_13 });
models.Add(new GPIOPinModel { Index = 14, PinMask = GPIOPin.PIN_14 });
models.Add(new GPIOPinModel { Index = 15, PinMask = GPIOPin.PIN_15 });
return models;
}
/// <summary>
/// 获取引脚掩码
/// </summary>
/// <param name="index">引脚位序</param>
/// <returns>引脚掩码</returns>
public static uint GetPinMask(int? index)
{
if (index == null)
return GPIOPin.PIN_DEFAULT_VALUE;
switch (index.Value)
{
case 0: return GPIOPin.PIN_0;
case 1: return GPIOPin.PIN_1;
case 2: return GPIOPin.PIN_2;
case 3: return GPIOPin.PIN_3;
case 4: return GPIOPin.PIN_4;
case 5: return GPIOPin.PIN_5;
case 6: return GPIOPin.PIN_6;
case 7: return GPIOPin.PIN_7;
case 8: return GPIOPin.PIN_8;
case 9: return GPIOPin.PIN_9;
case 10: return GPIOPin.PIN_10;
case 11: return GPIOPin.PIN_11;
case 12: return GPIOPin.PIN_12;
case 13: return GPIOPin.PIN_13;
case 14: return GPIOPin.PIN_14;
case 15: return GPIOPin.PIN_15;
default: return GPIOPin.PIN_DEFAULT_VALUE;
}
}
}
}
......@@ -10,7 +10,7 @@ namespace VIZ.Framework.Core
/// <summary>
/// USB设备模型
/// </summary>
public class GPIOModel : ModelBase, IDisposable
public class GPIOModel : ModelBase
{
/// <summary>
/// 日志
......@@ -308,6 +308,11 @@ namespace VIZ.Framework.Core
#endregion
/// <summary>
/// 引脚值改变时触发
/// </summary>
public event EventHandler<GPIOModelPinValueChangedEventArgs> PinValueChanged;
/// <summary>
/// 状态读取线程
/// </summary>
private Task readTask;
......@@ -338,9 +343,6 @@ namespace VIZ.Framework.Core
if (this.DeviceInfo == null)
return false;
if (!this.DeviceInfo.Close())
return false;
if (!this.DeviceInfo.Open())
return false;
......@@ -374,15 +376,8 @@ namespace VIZ.Framework.Core
}
this.readTaskInfo = null;
this.readTask = null;
this.deviceInfo.Close();
}
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
this.Close();
this.deviceInfo?.Close();
this.DeviceState = false;
}
/// <summary>
......@@ -411,8 +406,11 @@ namespace VIZ.Framework.Core
}
// 每轮尝试5次读取
uint pinValue = 0;
this.DeviceInfo.Read(PIN_MASK, out pinValue);
uint pinValue;
if (!this.DeviceInfo.Read(PIN_MASK, out pinValue))
{
pinValue = GPIOPin.PIN_DEFAULT_VALUE;
}
this.updatePinValue(pinValue);
Task.Delay(READ_PIN_VALUE_DELAY).Wait();
......@@ -432,25 +430,26 @@ namespace VIZ.Framework.Core
{
bool[] state = new bool[16];
state[0] = (GPIOPin.PIN_0 & pinValue) == 1;
state[1] = (GPIOPin.PIN_1 & pinValue) == 1;
state[2] = (GPIOPin.PIN_2 & pinValue) == 1;
state[3] = (GPIOPin.PIN_3 & pinValue) == 1;
state[4] = (GPIOPin.PIN_4 & pinValue) == 1;
state[5] = (GPIOPin.PIN_5 & pinValue) == 1;
state[6] = (GPIOPin.PIN_6 & pinValue) == 1;
state[7] = (GPIOPin.PIN_7 & pinValue) == 1;
state[8] = (GPIOPin.PIN_8 & pinValue) == 1;
state[9] = (GPIOPin.PIN_9 & pinValue) == 1;
state[10] = (GPIOPin.PIN_10 & pinValue) == 1;
state[11] = (GPIOPin.PIN_11 & pinValue) == 1;
state[12] = (GPIOPin.PIN_12 & pinValue) == 1;
state[13] = (GPIOPin.PIN_13 & pinValue) == 1;
state[14] = (GPIOPin.PIN_14 & pinValue) == 1;
state[15] = (GPIOPin.PIN_15 & pinValue) == 1;
state[0] = (GPIOPin.PIN_0 & pinValue) == 0;
state[1] = (GPIOPin.PIN_1 & pinValue) == 0;
state[2] = (GPIOPin.PIN_2 & pinValue) == 0;
state[3] = (GPIOPin.PIN_3 & pinValue) == 0;
state[4] = (GPIOPin.PIN_4 & pinValue) == 0;
state[5] = (GPIOPin.PIN_5 & pinValue) == 0;
state[6] = (GPIOPin.PIN_6 & pinValue) == 0;
state[7] = (GPIOPin.PIN_7 & pinValue) == 0;
state[8] = (GPIOPin.PIN_8 & pinValue) == 0;
state[9] = (GPIOPin.PIN_9 & pinValue) == 0;
state[10] = (GPIOPin.PIN_10 & pinValue) == 0;
state[11] = (GPIOPin.PIN_11 & pinValue) == 0;
state[12] = (GPIOPin.PIN_12 & pinValue) == 0;
state[13] = (GPIOPin.PIN_13 & pinValue) == 0;
state[14] = (GPIOPin.PIN_14 & pinValue) == 0;
state[15] = (GPIOPin.PIN_15 & pinValue) == 0;
WPFHelper.BeginInvoke(() =>
{
// 修改引脚值
this.PIN_0 = state[0];
this.PIN_1 = state[1];
this.PIN_2 = state[2];
......@@ -467,6 +466,16 @@ namespace VIZ.Framework.Core
this.PIN_13 = state[13];
this.PIN_14 = state[14];
this.PIN_15 = state[15];
// 触发引脚值改变事件
if (this.PinValueChanged == null)
return;
GPIOModelPinValueChangedEventArgs args = new GPIOModelPinValueChangedEventArgs();
args.GPIOModel = this;
args.PinValue = pinValue;
this.PinValueChanged.Invoke(this, args);
});
}
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Framework.Core
{
/// <summary>
/// GPIO引脚模型
/// </summary>
public class GPIOPinModel : ModelBase
{
#region Index -- 引脚位序
private int? index;
/// <summary>
/// 引脚位序
/// </summary>
public int? Index
{
get { return index; }
set { index = value; this.RaisePropertyChanged(nameof(Index)); }
}
#endregion
#region PinMask -- 引脚掩码
private uint pinMask;
/// <summary>
/// 引脚掩码
/// </summary>
public uint PinMask
{
get { return pinMask; }
set { pinMask = value; this.RaisePropertyChanged(nameof(PinMask)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Framework.Core
{
/// <summary>
/// GPIO属性模型
/// </summary>
public class GPIOPropertyModel : ModelBase
{
#region PinValue -- 引脚值
private bool pinValue;
/// <summary>
/// 引脚值
/// </summary>
public bool PinValue
{
get { return pinValue; }
private set { pinValue = value; this.RaisePropertyChanged(nameof(PinValue)); }
}
#endregion
#region PinMask -- 引脚掩码
private uint pinMask;
/// <summary>
/// 引脚掩码
/// <see cref="GPIOPin"/>
/// </summary>
public uint PinMask
{
get { return pinMask; }
set { pinMask = value; this.RaisePropertyChanged(nameof(PinMask)); }
}
#endregion
#region GPIOModel -- GPIO模型
private GPIOModel gpioModel;
/// <summary>
/// GPIO模型
/// </summary>
public GPIOModel GPIOModel
{
get { return gpioModel; }
set
{
if (gpioModel != null)
{
gpioModel.PinValueChanged -= GpioModel_PinValueChanged;
}
gpioModel = value;
this.RaisePropertyChanged(nameof(GPIOModel));
if (gpioModel != null)
{
gpioModel.PinValueChanged -= GpioModel_PinValueChanged;
gpioModel.PinValueChanged += GpioModel_PinValueChanged;
}
}
}
/// <summary>
/// 引脚值发生改变时触发
/// </summary>
private void GpioModel_PinValueChanged(object sender, GPIOModelPinValueChangedEventArgs e)
{
this.PinValue = (this.PinMask & e.PinValue) == 0;
}
#endregion
}
}
......@@ -179,7 +179,7 @@ namespace VIZ.Framework.Core
/// <returns>是否成功关闭</returns>
public bool Close()
{
if (this.Handle <= 0)
if (this.Handle <= 0 || this.State == false)
return false;
if (!USBDevice.USB_CloseDevice(this.Handle))
......
......@@ -90,16 +90,20 @@
<Compile Include="Core\Converter\Bool2BoolConverter.cs" />
<Compile Include="Core\Converter\ByteSizeConverter.cs" />
<Compile Include="Core\Converter\Bool2SolidColorBrushConverter.cs" />
<Compile Include="Core\Converter\Color2SolidColorBrushConverter.cs" />
<Compile Include="Core\Converter\StringAppendConverter.cs" />
<Compile Include="Core\Debug\DebugDomain.cs" />
<Compile Include="Core\Debug\DebugMessage.cs" />
<Compile Include="Core\Enum\EnumHelper.cs" />
<Compile Include="Core\Enum\EnumModel.cs" />
<Compile Include="Core\Helper\ByteHelper.cs" />
<Compile Include="Core\Helper\CmdHelper.cs" />
<Compile Include="Core\Helper\KeepSymbolHelper.cs" />
<Compile Include="Core\Helper\ProcessHelper.cs" />
<Compile Include="Core\Helper\FPSHelper.cs" />
<Compile Include="Core\Net\NetHelperMacInfo.cs" />
<Compile Include="Core\Object\IObjectPoolManager.cs" />
<Compile Include="Core\Object\ObjectPoolManager.cs" />
<Compile Include="Core\Safe\ApplicationMacCheckAttribute.cs" />
<Compile Include="Core\Safe\ApplicationTimeCheckAttribute.cs" />
<Compile Include="Core\Image\ImageHelperExpand.cs" />
......@@ -127,7 +131,10 @@
<Compile Include="Expand\GPIO\Enum\GPIOPin.cs" />
<Compile Include="Expand\GPIO\Enum\GPIOPuPd.cs" />
<Compile Include="Expand\GPIO\Enum\GPIOResult.cs" />
<Compile Include="Expand\GPIO\Event\GPIOModelPinValueChangedEventArgs.cs" />
<Compile Include="Expand\GPIO\GPIOManager.cs" />
<Compile Include="Expand\GPIO\GPIOPinModel.cs" />
<Compile Include="Expand\GPIO\GPIOPropertyModel.cs" />
<Compile Include="Expand\GPIO\USBDeviceInfo.cs" />
<Compile Include="Expand\GPIO\GPIOModel.cs" />
<Compile Include="Expand\Monitor\IMonitorManager.cs" />
......
......@@ -21,6 +21,11 @@ namespace VIZ.Framework.Domain
public static IniStorage IniStorage { get; private set; } = new IniStorage(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config", "config.ini"));
/// <summary>
/// 对象池管理器
/// </summary>
public static IObjectPoolManager ObjectPoolManager { get; private set; } = new ObjectPoolManager();
/// <summary>
/// 消息管理器
/// </summary>
public static IMessageManager MessageManager { get; private set; } = new MessageManager();
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Framework.Domain
{
/// <summary>
/// 摇杆方向
/// </summary>
public enum RockerDirection
{
/// <summary>
/// 正向
/// </summary>
[Description("正向")]
Forward = 1,
/// <summary>
/// 反向
/// </summary>
[Description("反向")]
backward = 2
}
}
......@@ -60,6 +60,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationDomain.cs" />
<Compile Include="Enum\RockerDirection.cs" />
<Compile Include="Model\Monitor\System\SystemMonitorGpuModel.cs" />
<Compile Include="Model\Monitor\System\SystemMonitorModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
......
......@@ -67,7 +67,10 @@ namespace VIZ.Framework.Module
// Step 6. 初始化循环
appSetups.Add(new AppSetup_Loop());
// Step 7. 初始化辅助类
// Step 7. 初始化对象池
appSetups.Add(new AppSetup_ObjectPool());
// Step 8. 初始化辅助类
appSetups.Add(new AppSetup_Helper());
}
......
using log4net;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Management;
using VIZ.Framework.Core;
using VIZ.Framework.Connection;
using VIZ.Framework.Module;
using System.Reflection;
using VIZ.Framework.Domain;
namespace VIZ.Framework.Module
{
/// <summary>
/// 应用程序启动 -- 对象池
/// </summary>
public class AppSetup_ObjectPool : AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_ObjectPool));
/// <summary>
/// 描述
/// </summary>
public override string Detail { get; } = "应用程序启动 -- 对象池";
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context)
{
return true;
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context)
{
ApplicationDomain.ObjectPoolManager?.DisposeAll();
}
}
}
......@@ -110,6 +110,7 @@
<Compile Include="Setup\IAppSetup.cs" />
<Compile Include="Setup\Message\AppShutDownMessage.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_DebugWindow.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_ObjectPool.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_ApplicationSafe.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_Helper.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_CatchUnhandledException.cs" />
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
<Application x:Class="VIZ.Framework.TimeSliceTool.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:VIZ.Framework.TimeSliceTool"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Domain;
using VIZ.Framework.Module;
namespace VIZ.Framework.TimeSliceTool
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
public App()
{
// 初始化UDP
AppSetup.AppendSetup(new AppSetup_InitUDP());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Domain;
namespace VIZ.Framework.TimeSliceTool
{
/// <summary>
/// 应用程序域扩展
/// </summary>
public class ApplicationDomainEx : ApplicationDomain
{
/// <summary>
/// 本机IP地址
/// </summary>
public static string LocalIP { get; set; }
/// <summary>
/// 本机端口
/// </summary>
public static int LocalPort { get; set; }
}
}
<Window x:Class="VIZ.Framework.TimeSliceTool.MainWindow"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VIZ.Framework.TimeSliceTool"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="时间切片UDP工具" Height="450" Width="800">
<Grid>
<local:MainView Margin="10"></local:MainView>
</Grid>
</Window>
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;
using VIZ.Framework.Module;
namespace VIZ.Framework.TimeSliceTool
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.Closed += MainWindow_Closed;
}
/// <summary>
/// 窗口关闭
/// </summary>
private void MainWindow_Closed(object sender, EventArgs e)
{
AppSetup.ShutDown();
}
}
}
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("VIZ.Framework.TimeSliceTool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VIZ.Framework.TimeSliceTool")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace VIZ.Framework.TimeSliceTool.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VIZ.Framework.TimeSliceTool.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace VIZ.Framework.TimeSliceTool.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Module;
using log4net;
using VIZ.Framework.Connection;
namespace VIZ.Framework.TimeSliceTool
{
/// <summary>
/// 应用程序启动 -- 初始化UDP
/// </summary>
public class AppSetup_InitUDP : AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_InitUDP));
/// <summary>
/// 描述
/// </summary>
public override string Detail { get; } = "应用程序启动 -- 初始化UDP";
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context)
{
UdpConnection conn = new UdpConnection();
// -----------------------------------------------------------------
// 客户端
string clientIP = ApplicationDomainEx.IniStorage.GetValue<UdpConfig, string>(p => p.UDP_BINDING_IP);
int clientPort = ApplicationDomainEx.IniStorage.GetValue<UdpConfig, int>(p => p.UDP_BINDING_PORT);
conn.Binding(clientIP, clientPort);
ConnectionManager.UdpConnection = conn;
conn.Start();
return true;
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context)
{
ConnectionManager.UdpConnection?.Dispose();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Storage;
namespace VIZ.Framework.TimeSliceTool
{
/// <summary>
/// UDP配置
/// </summary>
public class UdpConfig : IniConfigBase
{
/// <summary>
/// UDP本机绑定IP
/// </summary>
[Ini(Section = "UDP", DefaultValue = "127.0.0.1", Type = typeof(string))]
public string UDP_BINDING_IP { get; set; }
/// <summary>
/// UDP本机绑定端口
/// </summary>
[Ini(Section = "UDP", DefaultValue = "8300", Type = typeof(int))]
public string UDP_BINDING_PORT { get; set; }
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>VIZ.Framework.TimeSliceTool</RootNamespace>
<AssemblyName>VIZ.Framework.TimeSliceTool</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="View\MainView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Domain\ApplicationDomainEx.cs" />
<Compile Include="Setup\AppSetup_InitUDP.cs" />
<Compile Include="Storage\Ini\UdpConfig.cs" />
<Compile Include="ViewModel\MainViewModel.cs" />
<Compile Include="View\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="config\config.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VIZ.Framework.Common.Resource\VIZ.Framework.Common.Resource.csproj">
<Project>{76ef480a-e486-41b7-b7a5-2a849fc8d5bf}</Project>
<Name>VIZ.Framework.Common.Resource</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Framework.Common\VIZ.Framework.Common.csproj">
<Project>{92834c05-703e-4f05-9224-f36220939d8f}</Project>
<Name>VIZ.Framework.Common</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Framework.Connection\VIZ.Framework.Connection.csproj">
<Project>{e07528dd-9dee-47c2-b79d-235ecfa6b003}</Project>
<Name>VIZ.Framework.Connection</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Framework.Core\VIZ.Framework.Core.csproj">
<Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project>
<Name>VIZ.Framework.Core</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Framework.Domain\VIZ.Framework.Domain.csproj">
<Project>{28661e82-c86a-4611-a028-c34f6ac85c97}</Project>
<Name>VIZ.Framework.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Framework.Module\VIZ.Framework.Module.csproj">
<Project>{47cf6fb0-e37d-4ef1-afc7-03db2bca8892}</Project>
<Name>VIZ.Framework.Module</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Framework.Storage\VIZ.Framework.Storage.csproj">
<Project>{06b80c09-343d-4bb2-aeb1-61cfbfbf5cad}</Project>
<Name>VIZ.Framework.Storage</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<UserControl x:Class="VIZ.Framework.TimeSliceTool.MainView"
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:VIZ.Framework.TimeSliceTool"
d:DataContext="{d:DesignInstance Type=local:MainViewModel}"
mc:Ignorable="d" Background="White"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 路径选择 -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="160"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="选择路径:" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBox Grid.Column="1" Height="30" VerticalAlignment="Center" VerticalContentAlignment="Center"
Margin="10,0,10,0" TextWrapping="NoWrap" AcceptsReturn="False" Padding="3,0,3,0"
Text="{Binding Path=DirPath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Grid.Column="2" Width="120" Height="30" Content="选择路径"
Command="{Binding Path=SelectDirPathCommand}"></Button>
</Grid>
<!-- UDP -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="160"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="发送目标IP:" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBox Grid.Column="1" Height="30" VerticalAlignment="Center" VerticalContentAlignment="Center"
Margin="10,0,10,0" TextWrapping="NoWrap" AcceptsReturn="False" Padding="3,0,3,0"
Text="{Binding Path=DirPath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
<TextBlock Text="发送目标端口:" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="2"></TextBlock>
<TextBox Grid.Column="3" Height="30" VerticalAlignment="Center" VerticalContentAlignment="Center"
Margin="10,0,10,0" TextWrapping="NoWrap" AcceptsReturn="False" Padding="3,0,3,0"
Text="{Binding Path=DirPath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Width="120" Height="30" Content="发送" Grid.Column="4"
Command="{Binding Path=SelectDirPathCommand}"></Button>
</Grid>
<!-- Json数据 -->
<TextBox Grid.Row="2"
Margin="18" TextWrapping="Wrap" AcceptsReturn="True" Padding="3"
Text="{Binding Path=JsonString,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
</Grid>
</UserControl>
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;
using VIZ.Framework.Core;
namespace VIZ.Framework.TimeSliceTool
{
/// <summary>
/// MainView.xaml 的交互逻辑
/// </summary>
public partial class MainView : UserControl
{
public MainView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new MainViewModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.Framework.TimeSliceTool
{
/// <summary>
/// 主视图模型
/// </summary>
public class MainViewModel : ViewModelBase
{
public MainViewModel()
{
this.SelectDirPathCommand = new VCommand(this.SelectDirPath);
}
// ------------------------------------------------------------------------
// Property
// ------------------------------------------------------------------------
#region DirPath -- 文件夹路径
private string dirPath;
/// <summary>
/// 文件夹路径
/// </summary>
public string DirPath
{
get { return dirPath; }
set { dirPath = value; this.RaisePropertyChanged(nameof(DirPath)); }
}
#endregion
#region JsonString -- Json字符串
private string jsonString;
/// <summary>
/// Json字符串
/// </summary>
public string JsonString
{
get { return jsonString; }
set { jsonString = value; this.RaisePropertyChanged(nameof(JsonString)); }
}
#endregion
// ------------------------------------------------------------------------
// Command
// ------------------------------------------------------------------------
#region SelectDirPathCommand -- 选择文件夹路径命令
/// <summary>
/// 选择文件夹路径命令
/// </summary>
public VCommand SelectDirPathCommand { get; set; }
/// <summary>
/// 选择文件夹路径
/// </summary>
private void SelectDirPath()
{
System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;
this.DirPath = dialog.SelectedPath;
}
#endregion
#region SendCommand -- 发送命令
#endregion
}
}
; ============================================================
; === Application ===
; ============================================================
[Application]
;是否是调试模式
APPLICATION_IS_DEBUG=true
; ============================================================
; === UDP ===
; ============================================================
[UDP]
;UDP本机绑定IP
UDP_BINDING_IP=127.0.0.1
;UDP本机绑定端口
UDP_BINDING_PORT=8300
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.14" targetFramework="net48" />
</packages>
\ No newline at end of file
......@@ -8,6 +8,15 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Background="#ff252b3d">
<fcommon:GPIOPinTestControl Margin="40" Width="700" Height="140"></fcommon:GPIOPinTestControl>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="100"></RowDefinition>
</Grid.RowDefinitions>
<fcommon:GPIOPinTestControl x:Name="tally" Margin="40" Width="700" Height="140"></fcommon:GPIOPinTestControl>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Grid.Row="1" Width="120" Height="40" Content="开启GPIO" Click="Button_Click_Open" Margin="10"></Button>
<Button Grid.Row="1" Width="120" Height="40" Content="关闭GPIO" Click="Button_Click_Close" Margin="10"></Button>
</StackPanel>
</Grid>
</UserControl>
......@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.Framework.WpfTest
{
......@@ -23,6 +24,21 @@ namespace VIZ.Framework.WpfTest
public TallyTest()
{
InitializeComponent();
List<USBDeviceInfo> list = GPIOManager.ScanDevice();
GPIOModel model = new GPIOModel(list[0]);
this.tally.GPIOModel = model;
}
private void Button_Click_Open(object sender, RoutedEventArgs e)
{
this.tally.GPIOModel.Open();
}
private void Button_Click_Close(object sender, RoutedEventArgs e)
{
this.tally.GPIOModel?.Close();
}
}
}
......@@ -54,6 +54,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.Framework.MacTool", "VI
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VIZ.Framework.Core.Navigation3D", "VIZ.Framework.Core.Navigation3D\VIZ.Framework.Core.Navigation3D.vcxproj", "{D1AA6399-2000-42BA-A577-D50BC5FCA393}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.Framework.TimeSliceTool", "VIZ.Framework.TimeSliceTool\VIZ.Framework.TimeSliceTool.csproj", "{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -220,6 +222,18 @@ Global
{D1AA6399-2000-42BA-A577-D50BC5FCA393}.Release|x64.Build.0 = Release|x64
{D1AA6399-2000-42BA-A577-D50BC5FCA393}.Release|x86.ActiveCfg = Release|Win32
{D1AA6399-2000-42BA-A577-D50BC5FCA393}.Release|x86.Build.0 = Release|Win32
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Debug|x64.ActiveCfg = Debug|x64
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Debug|x64.Build.0 = Debug|x64
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Debug|x86.ActiveCfg = Debug|Any CPU
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Debug|x86.Build.0 = Debug|Any CPU
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Release|Any CPU.Build.0 = Release|Any CPU
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Release|x64.ActiveCfg = Release|Any CPU
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Release|x64.Build.0 = Release|Any CPU
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Release|x86.ActiveCfg = Release|Any CPU
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -238,6 +252,7 @@ Global
{70D6EBC7-0C32-4A52-BFD2-6D20219FC608} = {4E1CA052-91A6-401D-9F07-4973231A33FB}
{6B864E7B-164B-4B1E-B7D6-1563D824F567} = {4E1CA052-91A6-401D-9F07-4973231A33FB}
{D1AA6399-2000-42BA-A577-D50BC5FCA393} = {2F6173AD-2376-4F42-B852-10E3DBD394EE}
{CB5A6164-8937-49B0-9E01-29D96D4CE0EA} = {4E1CA052-91A6-401D-9F07-4973231A33FB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4C56D4BA-4B41-4AB8-836F-9997506EA9AC}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment