Commit 850d97c6 authored by 潘栩锋's avatar 潘栩锋 🚴

比较完善的 MultiLayout

parent 58cc4b86
<NavigationWindow x:Class="MultiLayout.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"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Loaded="MainWindow_Loaded"
ShowsNavigationUI="False">
</NavigationWindow>
using MultiLayout;
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 Unity;
using UnityConfigurationTree;
using LoadingProgress = MultiLayout.LoadingProgress;
namespace MultiLayout
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : NavigationWindow
{
IUnityContainer container;
LoadingProgress lp;
FlyLayoutManager manager;
public MainWindow()
{
InitializeComponent();
//---------------------------------------------------------
//转到进度条页面
lp = new LoadingProgress();
PgLoading p = new PgLoading();
p.DataContext = lp;
NavigationService.Navigate(p);
}
private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
await Task.Delay(10);
//---------------------------------------------------------
//加载 unity
container = new UnityContainer();
Application.Current.Properties["container"] = container;
container.RegisterInstance(lp);
UnityConfExt.Load(container);
container.RegisterInstance<Window>(this);
//---------------------------------------------------------
//加载主界面布局
FlyLayout layout = new FlyLayout();
layout.Load();
//初始化
manager = new FlyLayoutManager();
container.RegisterInstance(manager);
manager.Init(
layout, container, lp);
FlyLayoutManager.NavigationService = NavigationService;
//---------------------------------------------------------
//ui 加载前初始化
await manager.OnPreInit();
//加载模块构造主界面,如果是多设备界面, FlyLayoutManager.NavigationService 会被修改为 page内部的 NavigationService
var page = await manager.LoadModule();
NavigationService.Navigate(page);
page.Loaded += (s, e1) =>
NavigationService.RemoveBackEntry();
//---------------------------------------------------------
//初始化
await manager.OnInit();
//启动Poll系统
//FObjBase.PollModule.Current.Start();
}
}
}
...@@ -58,6 +58,12 @@ ...@@ -58,6 +58,12 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CustomMenu\MainEditMenu.cs" /> <Compile Include="CustomMenu\MainEditMenu.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
<Compile Include="PgLoading.xaml.cs">
<DependentUpon>PgLoading.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\IMenu.cs" /> <Compile Include="UiModule\IMenu.cs" />
<Compile Include="UiModule\IOnInit.cs" /> <Compile Include="UiModule\IOnInit.cs" />
<Compile Include="UiModule\IUiModule2.cs" /> <Compile Include="UiModule\IUiModule2.cs" />
...@@ -209,6 +215,14 @@ ...@@ -209,6 +215,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PgLoading.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PgMenu.xaml"> <Page Include="PgMenu.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
...@@ -313,6 +327,10 @@ ...@@ -313,6 +327,10 @@
<Project>{119c3adc-f8e1-4f72-b89b-006236ff8586}</Project> <Project>{119c3adc-f8e1-4f72-b89b-006236ff8586}</Project>
<Name>FLY.ControlLibrary</Name> <Name>FLY.ControlLibrary</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\UnityConfigurationTree\UnityConfigurationTree.csproj">
<Project>{3340b6f4-74b5-4a0e-8912-951222642e77}</Project>
<Name>UnityConfigurationTree</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Images\buildingblock.jpg" /> <Resource Include="Images\buildingblock.jpg" />
......
<Page x:Class="FLY.Thick.Base.UI.PgLoading" <Page x:Class="MultiLayout.PgLoading"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/> <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/> <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Page.Resources> </Page.Resources>
......
...@@ -13,9 +13,8 @@ using System.Windows.Navigation; ...@@ -13,9 +13,8 @@ using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Threading; using System.Windows.Threading;
using System.ComponentModel; using System.ComponentModel;
using Misc;
using System.Threading; using System.Threading;
namespace FLY.Thick.Base.UI namespace MultiLayout
{ {
/// <summary> /// <summary>
/// Page1.xaml 的交互逻辑 /// Page1.xaml 的交互逻辑
...@@ -29,12 +28,12 @@ namespace FLY.Thick.Base.UI ...@@ -29,12 +28,12 @@ namespace FLY.Thick.Base.UI
} }
public class LoadingProgress : INotifyPropertyChanged //public class LoadingProgress : INotifyPropertyChanged
{ //{
public int Progress { get; set; } // public int Progress { get; set; }
public int MaxValue { get; set; } = 100; // public int MaxValue { get; set; } = 100;
public event PropertyChangedEventHandler PropertyChanged; // public event PropertyChangedEventHandler PropertyChanged;
} //}
} }
...@@ -19,4 +19,7 @@ ...@@ -19,4 +19,7 @@
<conv:Equals2BoolConverter x:Key="e2bconv"/> <conv:Equals2BoolConverter x:Key="e2bconv"/>
<conv:BoolReverseConverter x:Key="brconv"/> <conv:BoolReverseConverter x:Key="brconv"/>
<conv:RatioConverter x:Key="ratioconv" />
<conv:RatioConverter_TimeSpan x:Key="ratioconv_ts" />
</ResourceDictionary> </ResourceDictionary>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
namespace FLY.ControlLibrary.Converter
{
/// <summary>
/// 3个输入,
/// [0]比例分子;
/// [1]比例分母;
/// [2]控件最大长度
/// </summary>
public class RatioConverter: IMultiValueConverter
{
#region IMultiValueConverter 成员
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (values.Length == 3 && (values[0] is int) && (values[1] is int) && (values[2] is double))//必须要检查,不然 界面生成器 会错误,提示转换异常
{
double ratio ;
int value = (int)values[0];
if (value == 99999998)
value = 0;
int max = (int)values[1];
double ActualWidth = (double)values[2];
if(max <=0)
ratio = 0;
else
ratio = (double)value / max;
if (ratio < 0)
ratio = 0;
else if (ratio > 1)
ratio = 1;
return ActualWidth * ratio;
}
else
{
return 100;
}
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
#endregion
}
public class RatioConverter_TimeSpan : IMultiValueConverter
{
#region IMultiValueConverter 成员
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (values.Length == 3 && (values[0] is TimeSpan) && (values[1] is TimeSpan) && (values[2] is double))//必须要检查,不然 界面生成器 会错误,提示转换异常
{
double ratio;
TimeSpan v = (TimeSpan)values[0];
TimeSpan max = (TimeSpan)values[1];
double ActualWidth = (double)values[2];
if (max.TotalSeconds <= 0)
ratio = 0;
else
ratio = v.TotalSeconds / max.TotalSeconds;
if (ratio < 0)
ratio = 0;
else if (ratio > 1)
ratio = 1;
return ActualWidth * ratio;
}
else
{
return 100;
}
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
#endregion
}
}
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="COMMON.cs" /> <Compile Include="COMMON.cs" />
<Compile Include="Converter\RatioConverter.cs" />
<Compile Include="GraphRange_coslight.cs" /> <Compile Include="GraphRange_coslight.cs" />
<Compile Include="GraphScan3.cs" /> <Compile Include="GraphScan3.cs" />
<Compile Include="GraphScan4.xaml.cs"> <Compile Include="GraphScan4.xaml.cs">
......
...@@ -14,12 +14,15 @@ ...@@ -14,12 +14,15 @@
<Style TargetType="Button" x:Key="ButtonStyle_icon" BasedOn="{StaticResource ButtonStyle_empty}"> <Style TargetType="Button" x:Key="ButtonStyle_icon" BasedOn="{StaticResource ButtonStyle_empty}">
<Style.Resources> <Style.Resources>
<Style TargetType="TextBlock" > <Style TargetType="TextBlock" >
<Setter Property="FontSize" Value="15"/> <Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="Black"/> <Setter Property="Foreground" Value="Black"/>
<Setter Property="HorizontalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="FontFamily" Value="YouYuan"/>
<Setter Property="Margin" Value="3"/>
</Style> </Style>
<Style TargetType="iconPacks:PackIconMaterial" > <Style TargetType="iconPacks:PackIconMaterial" >
<Setter Property="Width" Value="40"/> <Setter Property="Width" Value="36"/>
<Setter Property="Height" Value="auto"/> <Setter Property="Height" Value="auto"/>
<Setter Property="HorizontalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center"/>
</Style> </Style>
......
...@@ -20,6 +20,11 @@ namespace FObjBase ...@@ -20,6 +20,11 @@ namespace FObjBase
/// 连接器 /// 连接器
/// </summary> /// </summary>
protected IFConn mConn; protected IFConn mConn;
/// <summary>
/// 连接名称
/// </summary>
public string ConnName;
/// <summary> /// <summary>
/// 连接成功 /// 连接成功
/// </summary> /// </summary>
...@@ -41,6 +46,7 @@ namespace FObjBase ...@@ -41,6 +46,7 @@ namespace FObjBase
/// <param name="connName"></param> /// <param name="connName"></param>
public FObjServiceClient(UInt32 serviceId, string connName) : this(serviceId) public FObjServiceClient(UInt32 serviceId, string connName) : this(serviceId)
{ {
ConnName = connName;
FObjServiceClientManager.Instance.Connect_to_Another_OBJSys(connName, this); FObjServiceClientManager.Instance.Connect_to_Another_OBJSys(connName, this);
} }
...@@ -64,6 +70,9 @@ namespace FObjBase ...@@ -64,6 +70,9 @@ namespace FObjBase
/// </summary> /// </summary>
public override void Dispose() public override void Dispose()
{ {
if (!string.IsNullOrEmpty(ConnName))
FObjServiceClientManager.Instance.ObjClientDisponse(this);
CurrObjSys.ObjRemove( CurrObjSys.ObjRemove(
this, mConn); this, mConn);
} }
......
...@@ -64,7 +64,20 @@ namespace FObjBase ...@@ -64,7 +64,20 @@ namespace FObjBase
} }
} }
} }
/// <summary>
/// 客户端注销时通知
/// </summary>
/// <param name="fObjClient"></param>
public void ObjClientDisponse(FObjServiceClient fObjClient)
{
if (string.IsNullOrEmpty(fObjClient.ConnName))
return;
var connaddr = ConnAddrs.Find(c => c.ConnName == fObjClient.ConnName);
connaddr.ClientIds.RemoveAll(id => fObjClient.GetIDs().Contains(id));
}
/// <summary> /// <summary>
/// 重连 /// 重连
/// </summary> /// </summary>
......
...@@ -77,6 +77,9 @@ namespace Misc ...@@ -77,6 +77,9 @@ namespace Misc
// 将主机名或 IP 地址解析为 IPEndPoint 实例。 // 将主机名或 IP 地址解析为 IPEndPoint 实例。
public static IPEndPoint ToIPEndPoint(string hostNameOrAddress) public static IPEndPoint ToIPEndPoint(string hostNameOrAddress)
{ {
if (string.IsNullOrEmpty(hostNameOrAddress))
return null;
string[] s = hostNameOrAddress.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); string[] s = hostNameOrAddress.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
if (s.Length == 1) if (s.Length == 1)
{ {
......
...@@ -14,7 +14,7 @@ using System.Threading.Tasks; ...@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace FLY.OBJComponents.Client namespace FLY.OBJComponents.Client
{ {
public class BufferServiceClient<T> : FObj, IBuffer<T> public class BufferServiceClient<T> : FObjServiceClient, IBuffer<T>
{ {
#region property #region property
public int NewestID { get; private set; } = -1; public int NewestID { get; private set; } = -1;
...@@ -27,23 +27,19 @@ namespace FLY.OBJComponents.Client ...@@ -27,23 +27,19 @@ namespace FLY.OBJComponents.Client
public event NotifyBufferChangedEventHandler<T> BufferChanged; public event NotifyBufferChangedEventHandler<T> BufferChanged;
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
IFConn mConn; public BufferServiceClient(UInt32 serviceId) : base(serviceId) { }
UInt32 mServerID;
/// <summary>
///
/// </summary>
/// <param name="serviceId"></param>
/// <param name="connName"></param>
public BufferServiceClient(UInt32 serviceId, string connName) : base(serviceId, connName) { }
public BufferServiceClient(UInt32 serverid)
{
mServerID = serverid;
}
public override void Dispose()
{
CurrObjSys.ObjRemove(
this, mConn);
}
public override void ConnectNotify(IFConn from) public override void ConnectNotify(IFConn from)
{ {
mConn = from; base.ConnectNotify(from);
if (from.IsConnected) if (from.IsConnected)
{ {
//获取所有数据,设置推送 //获取所有数据,设置推送
......
...@@ -15,19 +15,9 @@ namespace FLY.OBJComponents.Client ...@@ -15,19 +15,9 @@ namespace FLY.OBJComponents.Client
{ {
public event JsonDistValueChangedEventHandler ValueChanged; public event JsonDistValueChangedEventHandler ValueChanged;
public JsonDistServiceClient(UInt32 serviceId) : base(serviceId) public JsonDistServiceClient(UInt32 serviceId) : base(serviceId) { }
{
Init(serviceId); public JsonDistServiceClient(UInt32 serviceId, string connName) : base(serviceId, connName) { }
}
public JsonDistServiceClient(UInt32 serviceId, string connName) : this(serviceId)
{
FObjServiceClientManager.Instance.Connect_to_Another_OBJSys(connName, this);
}
void Init(UInt32 serviceId)
{
}
public void GetValue(string key, AsyncCBHandler asyncCB, object asyncContext) public void GetValue(string key, AsyncCBHandler asyncCB, object asyncContext)
......
...@@ -14,12 +14,18 @@ namespace FLY.Thick.Base.UI.Converter ...@@ -14,12 +14,18 @@ namespace FLY.Thick.Base.UI.Converter
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{ {
IPEndPoint ep = (IPEndPoint)value; IPEndPoint ep = (IPEndPoint)value;
return ep.ToString(); if (ep == null)
{
return "";
}
else
return ep.ToString();
} }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{ {
string s = (string)value; string s = (string)value;
return Misc.StringConverter.ToIPEndPoint(s); return Misc.StringConverter.ToIPEndPoint(s);
} }
......
...@@ -60,10 +60,6 @@ namespace FLY.Thick.Base.UI ...@@ -60,10 +60,6 @@ namespace FLY.Thick.Base.UI
private int reason_list_index = -1; private int reason_list_index = -1;
public CtMicroGageVm() public CtMicroGageVm()
{
InitCmd();
}
void InitCmd()
{ {
StopCmd = new RelayCommand(() => StopCmd = new RelayCommand(() =>
{ {
...@@ -82,6 +78,7 @@ namespace FLY.Thick.Base.UI ...@@ -82,6 +78,7 @@ namespace FLY.Thick.Base.UI
mTDGageService.StartP2(STARTP2_MODE.BACKW); mTDGageService.StartP2(STARTP2_MODE.BACKW);
}); });
} }
public void Init( public void Init(
DynArea dynArea, DynArea dynArea,
IInitParamService initParam, IInitParamService initParam,
......
...@@ -157,6 +157,9 @@ ...@@ -157,6 +157,9 @@
<Compile Include="PgCurveModify.xaml.cs"> <Compile Include="PgCurveModify.xaml.cs">
<DependentUpon>PgCurveModify.xaml</DependentUpon> <DependentUpon>PgCurveModify.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="PgError\PgErrorTable2.xaml.cs">
<DependentUpon>PgErrorTable2.xaml</DependentUpon>
</Compile>
<Compile Include="PgFlyAd.xaml.cs"> <Compile Include="PgFlyAd.xaml.cs">
<DependentUpon>PgFlyAd.xaml</DependentUpon> <DependentUpon>PgFlyAd.xaml</DependentUpon>
</Compile> </Compile>
...@@ -166,9 +169,6 @@ ...@@ -166,9 +169,6 @@
<Compile Include="PgInitparam.xaml.cs"> <Compile Include="PgInitparam.xaml.cs">
<DependentUpon>PgInitparam.xaml</DependentUpon> <DependentUpon>PgInitparam.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="PgLoading.xaml.cs">
<DependentUpon>PgLoading.xaml</DependentUpon>
</Compile>
<Compile Include="PgReject.xaml.cs"> <Compile Include="PgReject.xaml.cs">
<DependentUpon>PgReject.xaml</DependentUpon> <DependentUpon>PgReject.xaml</DependentUpon>
</Compile> </Compile>
...@@ -229,6 +229,12 @@ ...@@ -229,6 +229,12 @@
<Compile Include="UiModule\MenuMotion.xaml.cs"> <Compile Include="UiModule\MenuMotion.xaml.cs">
<DependentUpon>MenuMotion.xaml</DependentUpon> <DependentUpon>MenuMotion.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UiModule\MenuProfile.xaml.cs">
<DependentUpon>MenuProfile.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\MenuSetting.xaml.cs">
<DependentUpon>MenuSetting.xaml</DependentUpon>
</Compile>
<Compile Include="WdAbHelper.xaml.cs"> <Compile Include="WdAbHelper.xaml.cs">
<DependentUpon>WdAbHelper.xaml</DependentUpon> <DependentUpon>WdAbHelper.xaml</DependentUpon>
</Compile> </Compile>
...@@ -301,6 +307,10 @@ ...@@ -301,6 +307,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="PgError\PgErrorTable2.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PgFlyAd.xaml"> <Page Include="PgFlyAd.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
...@@ -313,10 +323,6 @@ ...@@ -313,10 +323,6 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="PgLoading.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PgReject.xaml"> <Page Include="PgReject.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
...@@ -393,6 +399,14 @@ ...@@ -393,6 +399,14 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="UiModule\MenuProfile.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\MenuSetting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdAbHelper.xaml"> <Page Include="WdAbHelper.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
......
...@@ -16,7 +16,7 @@ namespace FLY.Thick.Base.UI ...@@ -16,7 +16,7 @@ namespace FLY.Thick.Base.UI
public const string ErrCodesOfTip = "ErrCodesOfTip"; public const string ErrCodesOfTip = "ErrCodesOfTip";
public const string LCUS1_PortName = "LCUS1_PortName"; public const string LCUS1_PortName = "LCUS1_PortName";
public const string EnableLCUS1 = "EnableLCUS1"; public const string EnableLCUS1 = "EnableLCUS1";
public const string WindowSize = "WindowSize";
} }
} }
using FLY.OBJComponents.Client; using FLY.OBJComponents.Client;
using FLY.OBJComponents.Common; using FLY.OBJComponents.Common;
using Misc;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -14,6 +15,7 @@ using System.Windows.Media; ...@@ -14,6 +15,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using Unity;
namespace FLY.Thick.Base.UI namespace FLY.Thick.Base.UI
{ {
...@@ -22,9 +24,9 @@ namespace FLY.Thick.Base.UI ...@@ -22,9 +24,9 @@ namespace FLY.Thick.Base.UI
/// </summary> /// </summary>
public partial class PgErrorAllTable : Page public partial class PgErrorAllTable : Page
{ {
FLY.OBJComponents.IService.IWarningService mWarningService; FLY.OBJComponents.IService.IWarningService warningService;
BufferWindow<FlyData_WarningHistory> mWindow; BufferWindow<FlyData_WarningHistory> mWindow;
ParamDictionary paramDictionary;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
...@@ -37,19 +39,31 @@ namespace FLY.Thick.Base.UI ...@@ -37,19 +39,31 @@ namespace FLY.Thick.Base.UI
/// ///
/// </summary> /// </summary>
/// <param name="warningService"></param> /// <param name="warningService"></param>
/// <param name="paramDictionary"></param>
[InjectionMethod]
public void Init( public void Init(
FLY.OBJComponents.IService.IWarningService warningService) FLY.OBJComponents.IService.IWarningService warningService,
ParamDictionary paramDictionary)
{ {
mWarningService = warningService; this.warningService = warningService;
Common.BindingWindowSize((windowSize) => this.paramDictionary = paramDictionary;
//窗口显示数据条数
int windowSize = this.paramDictionary.GetValue<int>(ParamDistItemKeys.WindowSize, 30);
mWindow = new BufferWindow<FlyData_WarningHistory>(this.warningService.NewestList, windowSize);
mWindow.PropertyChanged += (s, e) =>
{ {
mWindow = new BufferWindow<FlyData_WarningHistory>(mWarningService.NewestList, windowSize); if (e.PropertyName == "Size")
return mWindow; {
}); this.paramDictionary.SetValue(ParamDistItemKeys.WindowSize, mWindow.Size);
this.paramDictionary.Save();
}
};
grid_window.DataContext = mWindow; grid_window.DataContext = mWindow;
} }
private void button_back_Click(object sender, RoutedEventArgs e) private void button_back_Click(object sender, RoutedEventArgs e)
{ {
NavigationService.GoBack(); NavigationService.GoBack();
...@@ -59,7 +73,7 @@ namespace FLY.Thick.Base.UI ...@@ -59,7 +73,7 @@ namespace FLY.Thick.Base.UI
{ {
if (FLY.ControlLibrary.MyMessageBox.Show("确定是否清空全部历史数据?") == true) if (FLY.ControlLibrary.MyMessageBox.Show("确定是否清空全部历史数据?") == true)
{ {
mWarningService.NewestList.Reset(); warningService.NewestList.Reset();
FLY.ControlLibrary.Window_Tip.Show("成功", "清除完毕!", TimeSpan.FromSeconds(2)); FLY.ControlLibrary.Window_Tip.Show("成功", "清除完毕!", TimeSpan.FromSeconds(2));
} }
} }
......
...@@ -53,8 +53,6 @@ namespace FLY.Thick.Base.UI ...@@ -53,8 +53,6 @@ namespace FLY.Thick.Base.UI
NavigationService.GoBack(); NavigationService.GoBack();
} }
private void button_reset_click(object sender, RoutedEventArgs e) private void button_reset_click(object sender, RoutedEventArgs e)
{ {
warningService.Reset(); warningService.Reset();
...@@ -63,9 +61,9 @@ namespace FLY.Thick.Base.UI ...@@ -63,9 +61,9 @@ namespace FLY.Thick.Base.UI
private void button_iotip_click(object sender, RoutedEventArgs e) private void button_iotip_click(object sender, RoutedEventArgs e)
{ {
Window w; Window w;
if (container.IsRegistered<Window>("wdIoTip")) if (container.IsRegistered<Window>("wdIOTip"))
{ {
w = container.Resolve<Window>("wdIoTip"); w = container.Resolve<Window>("wdIOTip");
} }
else else
{ {
...@@ -91,13 +89,9 @@ namespace FLY.Thick.Base.UI ...@@ -91,13 +89,9 @@ namespace FLY.Thick.Base.UI
private void button_database_click(object sender, RoutedEventArgs e) private void button_database_click(object sender, RoutedEventArgs e)
{ {
NavigationService ns = NavigationService; PgErrorAllTable p = container.Resolve<PgErrorAllTable>(
if (ns != null) new Unity.Resolution.ParameterOverride("warningService", warningService));
{ NavigationService.Navigate(p);
PgErrorAllTable p = new PgErrorAllTable();
p.Init(warningService);
ns.Navigate(p);
}
} }
} }
} }
<Page x:Class="FLY.Thick.Base.UI.PgErrorTable2"
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:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
mc:Ignorable="d"
d:DesignHeight="768" d:DesignWidth="1024"
Background="White"
Title="Page_WarningSystem">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="Control" x:Key="iconPackStyle">
<Setter Property="Width" Value="25"/>
<Setter Property="Height" Value="auto"/>
<Setter Property="MaxHeight" Value="25"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
<Style TargetType="Ellipse" x:Key="backPackStyle">
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Fill" Value="{StaticResource Color_theme_static}"/>
</Style>
<Style TargetType="TextBlock" x:Key="titlePackStyle">
<Setter Property="Margin" Value="2"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="White"/>
</Style>
<Style TargetType="Button" x:Key="buttonStyle" BasedOn="{StaticResource ButtonStyle_empty}">
<Setter Property="Margin" Value="20,0"/>
<Setter Property="Foreground" Value="White"/>
</Style>
</ResourceDictionary>
</Page.Resources>
<Grid Name="root_grid" >
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="496*" />
</Grid.RowDefinitions>
<Grid Background="{StaticResource Background_Title}">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" >
<Button Style="{StaticResource ButtonStyle_back2}" Click="button_back_Click" />
<TextBlock Style="{StaticResource TextBlockStyle_Title}" Text="报警"/>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="60,0,0,0">
<Button Style="{StaticResource buttonStyle}" Click="button_database_click" >
<StackPanel>
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Ellipse Style="{StaticResource backPackStyle}" />
<iconPacks:PackIconMaterial Kind="DatabaseSearch" Style="{StaticResource iconPackStyle}"/>
</Grid>
<TextBlock Text="查询" Style="{StaticResource titlePackStyle}"/>
</StackPanel>
</Button>
<Button Style="{StaticResource buttonStyle}" Click="button_reset_click">
<StackPanel>
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Ellipse Style="{StaticResource backPackStyle}" Fill="#FFEE3232" />
<iconPacks:PackIconMaterial Kind="RestartAlert" Style="{StaticResource iconPackStyle}" />
</Grid>
<TextBlock Text="复位" Style="{StaticResource titlePackStyle}"/>
</StackPanel>
</Button>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" >
<Button Style="{StaticResource buttonStyle}" Click="button_silence_click" Foreground="#FFEE3232">
<StackPanel >
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Ellipse Style="{StaticResource backPackStyle}" Fill="White"/>
<iconPacks:PackIconMaterial Kind="VolumeMute" Style="{StaticResource iconPackStyle}" />
</Grid>
<TextBlock Text="消音" Style="{StaticResource titlePackStyle}"/>
</StackPanel>
</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Style="{StaticResource BorderStyle_paramSection}" >
<TextBlock Text="当前报警&#x0a;列表" />
</Border>
<DataGrid Grid.Column="1" x:Name="gridFlows" AutoGenerateColumns="False" IsReadOnly="True" >
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="FontSize" Value="20"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Time,StringFormat={}{0:MM/dd HH:mm}}" IsReadOnly="True">
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="时间" />
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding ErrCode}" IsReadOnly="True">
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="编码" />
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn x:Name="column_cp" Binding="{Binding Description}" >
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="报警描述" />
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<StackPanel Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10,-30,30,10" Orientation="Horizontal">
</StackPanel>
</Grid>
</Grid>
</Page>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 System.Net;
using FLY.Thick.Base.Client;
using Unity;
namespace FLY.Thick.Base.UI
{
/// <summary>
/// Page_ErrorTable.xaml 的交互逻辑
/// </summary>
public partial class PgErrorTable2 : Page
{
FLY.OBJComponents.IService.IWarningService warningService;
WarningReasonWindow warningReasonWindow;
IUnityContainer container;
/// <summary>
///
/// </summary>
public PgErrorTable2()
{
InitializeComponent();
}
[InjectionMethod]
public void Init(
IUnityContainer container,
FLY.OBJComponents.IService.IWarningService warningService,
WarningReasonWindow warningReasonWindow
)
{
this.container = container;
this.warningService = warningService;
this.warningReasonWindow = warningReasonWindow;
gridFlows.ItemsSource = this.warningReasonWindow.Record;
}
private void button_back_Click(object sender, RoutedEventArgs e)
{
NavigationService.GoBack();
}
private void button_reset_click(object sender, RoutedEventArgs e)
{
warningService.Reset();
}
private void button_silence_click(object sender, RoutedEventArgs e)
{
warningService.Silence();
}
private void button_database_click(object sender, RoutedEventArgs e)
{
PgErrorAllTable p = container.Resolve<PgErrorAllTable>(
new Unity.Resolution.ParameterOverride("warningService", warningService));
NavigationService.Navigate(p);
}
}
}
...@@ -20,6 +20,7 @@ using System.Windows.Threading; ...@@ -20,6 +20,7 @@ using System.Windows.Threading;
using FLY.Thick.Base.UI; using FLY.Thick.Base.UI;
using Unity; using Unity;
using Unity.Resolution; using Unity.Resolution;
using MultiLayout;
namespace FLY.Thick.Base.UI.UiModule namespace FLY.Thick.Base.UI.UiModule
{ {
...@@ -52,17 +53,7 @@ namespace FLY.Thick.Base.UI.UiModule ...@@ -52,17 +53,7 @@ namespace FLY.Thick.Base.UI.UiModule
protected virtual void Border_IO_Click(object sender, RoutedEventArgs e) protected virtual void Border_IO_Click(object sender, RoutedEventArgs e)
{ {
var p = container.Resolve<PgErrorTable>(); var p = container.Resolve<PgErrorTable>();
FlyLayoutManager.NavigationService.Navigate(p);
//PgErrorTable p = new PgErrorTable();
//var warningService = container.Resolve<FLY.OBJComponents.IService.IWarningService>();
//var warningReasonWindow = container.Resolve<WarningReasonWindow>();
//var wdIoTip = typeof(WdIOTip);
//p.Init(container, warningService, warningReasonWindow);//, wdIoTip);
//container.BuildUp< PgErrorTable >(p,
// new Unity.Resolution.ParameterOverride(typeof(Type), "wdIoTip", typeof(WdIOTip)));
(Application.Current.Properties["NavigationService"] as NavigationService).Navigate(p);
} }
} }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FLY.Thick.Normal.UI.Client.UiModule"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
mc:Ignorable="d" > mc:Ignorable="d" >
<UserControl.Resources> <UserControl.Resources>
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FLY.Thick.Normal.UI.Client.UiModule"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
mc:Ignorable="d" > mc:Ignorable="d" >
<UserControl.Resources> <UserControl.Resources>
......
using FLY.Thick.Normal.IService; 
using MultiLayout; using MultiLayout;
using MultiLayout.UiModule; using MultiLayout.UiModule;
using System; using System;
......
...@@ -556,11 +556,7 @@ namespace FLY.Thick.BulkDataModule ...@@ -556,11 +556,7 @@ namespace FLY.Thick.BulkDataModule
} }
} }
#region INotifyPropertyChanged 成员
public event PropertyChangedEventHandler PropertyChanged;
#endregion
} }
......
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