Commit 8dd15fcf authored by 潘栩锋's avatar 潘栩锋 🚴

升级 自动风环 为 V7

parent 3d223f02
......@@ -102,10 +102,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\DynAreaAirRing2.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UiModule\MenuSetting.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -158,9 +154,6 @@
<Compile Include="UiModule\AirRingGraph\AirRingGraphVmUt.cs" />
<Compile Include="UiModule\AirRingGraph\LongPress.cs" />
<Compile Include="UiModule\AirRingGraph\UiModule2_GraphAirRing.cs" />
<Compile Include="UiModule\DynAreaAirRing2.xaml.cs">
<DependentUpon>DynAreaAirRing2.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\MenuSetting.xaml.cs">
<DependentUpon>MenuSetting.xaml</DependentUpon>
</Compile>
......
......@@ -15,16 +15,15 @@
</ResourceDictionary.MergedDictionaries>
<client:StableConverter x:Key="stableconv"/>
<local:DynAreaErrorVmUt x:Key="errorVmUt" IsError="False" Error="01234567890123456789"/>
<local:DynAreaAirRingVmUt x:Key="airRingVmUt" Msg="0123" IsONoDiff="True" BestOrgBoltNo="10" OrgBoltNo="1" CurrR="0.8" LastChangedTime="12:30"/>
</ResourceDictionary>
</UserControl.Resources>
<Grid Height="110">
<Button x:Name="grid_viewModel" Style="{StaticResource ButtonStyle_empty}" Command="{Binding OpenRecordCmd}"
<Button x:Name="grid_viewModel" Style="{StaticResource Styles.Button.Empty}" Command="{Binding OpenRecordCmd}"
d:DataContext="{StaticResource airRingVmUt}">
<Grid >
<Border Style="{StaticResource BorderStyle_module}" >
<Border Style="{StaticResource Styles.Module.Border}" >
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
......@@ -138,40 +137,6 @@
</Border>
</Grid>
</Button>
<Button x:Name="grid_error" Style="{StaticResource ButtonStyle_empty}" Command="{Binding OpenWarningCmd}"
Visibility="{Binding IsError,Converter={StaticResource visbilityconv}}"
d:DataContext="{StaticResource errorVmUt}"
>
<Border Style="{StaticResource BorderStyle_module}" Background="{StaticResource Brushes.Validation}" >
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Path Margin="5" Fill="White" Stretch="Uniform" Width="60" Height="60" SnapsToDevicePixels="True" Data="{StaticResource Geometry_alert-circle-outline}" >
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding IsError}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever" >
<DoubleAnimation BeginTime="0:0:0" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="00:00:01" />
<DoubleAnimation BeginTime="0:0:1" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:01" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
<TextBlock Grid.Column="1" Margin="5" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="22" Foreground="White" Text="{Binding Error}"/>
</Grid>
</Border>
</Button>
</Grid>
</UserControl>
......@@ -34,7 +34,6 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
/// </summary>
public partial class DynAreaAirRing : UserControl
{
DynAreaErrorVm errorVm;
DynAreaAirRingVm airRingVm;
public DynAreaAirRing()
......@@ -48,12 +47,9 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
)
{
//获取设备
errorVm = container.Resolve<DynAreaErrorVm>();
airRingVm = container.Resolve<DynAreaAirRingVm>();
grid_viewModel.DataContext = airRingVm;
grid_error.DataContext = errorVm;
}
}
public class DynAreaAirRingVm : INotifyPropertyChanged
......@@ -277,138 +273,6 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
public bool IsShowBestOrgBoltNo { get; set; }
public RelayCommand OpenRecordCmd { get; }
}
public class DynAreaErrorVmUt : INotifyPropertyChanged
{
/// <summary>
/// 有异常
/// </summary>
public bool IsError { get; set; }
/// <summary>
/// 异常消息
/// </summary>
public string Error { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
public class DynAreaErrorVm : INotifyPropertyChanged
{
#region 延时推送 MARKNO
const int MARKNO_UPDATEERROR = 1;
#endregion
/// <summary>
/// 有异常
/// </summary>
public bool IsError { get; set; }
/// <summary>
/// 异常消息
/// </summary>
public string Error { get; set; }
public RelayCommand OpenWarningCmd { get; }
public event PropertyChangedEventHandler PropertyChanged;
WarningReasonWindow warningReasonWindow;
IWarningService warningService;
IUnityContainer container;
DispatcherTimer timer_error;
private int reason_list_index = -1;
public DynAreaErrorVm()
{
OpenWarningCmd = new RelayCommand(OpenWarning);
}
[InjectionMethod]
public void Init(
IUnityContainer container,
[Dependency("airRingWarningReasonWindow")] WarningReasonWindow warningReasonWindow,
[Dependency("airRingWarningService")]IWarningService warningService)
{
this.container = container;
//创建窗口观察 报警原因列表
this.warningReasonWindow = warningReasonWindow;
this.warningService = warningService;
//报警原因轮流显示
timer_error = new DispatcherTimer();
timer_error.Interval = TimeSpan.FromSeconds(3);
timer_error.Tick += (s, e) =>
{
reason_list_index--;
if (reason_list_index < 0)
reason_list_index = this.warningReasonWindow.Record.Count();
updateError();
};
this.warningReasonWindow.Record.CollectionChanged += Record_CollectionChanged;
this.warningService.PropertyChanged += WarningService_PropertyChanged;
updateError();
}
private void WarningService_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(FObjServiceClient.IsConnected))
{
updateError();
}
}
private void Record_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
FObjBase.PollModule.Current.Poll_JustOnce(
new FObjBase.PollModule.PollHandler(delegate ()
{
reason_list_index = warningReasonWindow.Record.Count() - 1;
updateError();
}), this, MARKNO_UPDATEERROR);
}
void updateError()
{
if (warningService is FObjServiceClient)
{
var objClient = warningService as FObjServiceClient;
if (!objClient.IsConnected)
{
Error = "风环服务器连接断开";
IsError = true;
reason_list_index = -1;
timer_error.Stop();
return;
}
}
if (warningReasonWindow.Record.Count == 0)
{
IsError = false;
Error = "";
reason_list_index = -1;
timer_error.Stop();
return;
}
if (reason_list_index >= warningReasonWindow.Record.Count)
reason_list_index = warningReasonWindow.Record.Count - 1;
else if (reason_list_index < 0)
reason_list_index = 0;
Error = warningReasonWindow.Record[reason_list_index].Description;
IsError = true;
timer_error.Start();
}
private void OpenWarning()
{
PgErrorTable2 p = new PgErrorTable2();
p.Init(container, warningService, warningReasonWindow);
FlyLayoutManager.NavigationService.Navigate(p);
}
}
public class UiModule2_DynAreaAirRing : IUiModule2
......
<UserControl x:Class="FLY.FeedbackRenZiJia.UI.Client.UiModule.DynAreaAirRing2"
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:FLY.FeedbackRenZiJia.UI.Client.UiModule"
xmlns:client="clr-namespace:FLY.FeedbackRenZiJia.UI.Client"
mc:Ignorable="d"
d:DesignWidth="292">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<client:StableConverter x:Key="stableconv"/>
<local:DynAreaViewModelParams x:Key="unitests_props" IsError="False" Error="报警MSG"/>
</ResourceDictionary>
</UserControl.Resources>
<Button Style="{StaticResource ButtonStyle_empty}" Background="Transparent" Click="Button_Click">
<Grid Height="110">
<Grid x:Name="grid_heatbuf"/>
<Grid x:Name="grid_feedback"/>
<Grid x:Name="grid_error" d:DataContext="{StaticResource unitests_props}"/>
<Border Style="{StaticResource BorderStyle_module}">
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel >
<StackPanel Orientation="Horizontal">
<StackPanel Margin="2" DataContext="{Binding DataContext,ElementName=grid_heatbuf}">
<TextBlock Text="稳定性" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Left" Foreground="#FF3B3B3B" />
<TextBlock FontWeight="Bold" FontFamily="Microsoft Sans Serif" Foreground="{StaticResource Color_theme_activity}" Text="{Binding CurrR, StringFormat={}{0:F1}}" FontSize="24" VerticalAlignment="Center" />
</StackPanel>
<StackPanel Orientation="Horizontal" x:Name="spHeatThickDectector">
<StackPanel Margin="2" >
<TextBlock FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Left" Foreground="#FF3B3B3B" Text="复位区号"/>
<Grid>
<TextBlock FontWeight="Bold" FontFamily="Microsoft Sans Serif" FontSize="24" VerticalAlignment="Center" Foreground="{StaticResource Color_theme_activity}" >
<Run Text="{Binding NewResetBolt }"/>
</TextBlock>
<TextBlock FontWeight="Bold" FontFamily="Microsoft Sans Serif" FontSize="24" VerticalAlignment="Center" Background="Red" Foreground="Yellow">
<Run Text="{Binding NewResetBolt }"/>
<Run Text="!= " FontSize="18" />
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Hidden"/>
<Setter Property="Foreground" Value="{StaticResource Color_theme_activity}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsDifferent}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever" >
<DoubleAnimation BeginTime="0:0:0" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="00:00:01" />
<DoubleAnimation BeginTime="0:0:1" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:01" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</StackPanel>
<StackPanel Margin="2" VerticalAlignment="Bottom">
<TextBlock FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Left" Foreground="#FF8B8B8B" Text="当前"/>
<TextBlock FontWeight="Bold" FontFamily="Microsoft Sans Serif" Foreground="{StaticResource Color_theme_static}" Text="{Binding CurrentResetBolt }" FontSize="18" VerticalAlignment="Center" />
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="2" DataContext="{Binding DataContext,ElementName=grid_feedback}">
<TextBlock Text="加热时间" FontSize="10" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Left" Foreground="#FF3B3B3B" />
<TextBlock Text="{Binding LastChangedTime,StringFormat={}{0:HH:mm:ss}}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="White" Background="Black" Margin="5,0"/>
</StackPanel>
</StackPanel>
<Viewbox Name="view_stability" Margin="2" Grid.Column="1" Visibility="{Binding IsHideStable, Converter={StaticResource ResourceKey=visbilityconv}, ConverterParameter=HiddenWhenTrue}">
<Grid DataContext="{Binding DataContext,ElementName=grid_heatbuf}">
<TextBlock Text="{Binding Stability, Converter={StaticResource ResourceKey=stableconv}}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Left" HorizontalAlignment="Left" Foreground="{StaticResource Color_theme_static}" VerticalAlignment="Bottom" MaxWidth="120" TextWrapping="Wrap" />
</Grid>
</Viewbox>
</Grid>
</Border>
<Border Style="{StaticResource BorderStyle_module}" Background="{StaticResource Brushes.Validation}"
DataContext="{Binding DataContext,ElementName=grid_error}"
Visibility="{Binding IsError,Converter={StaticResource visbilityconv}}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Path Margin="5" Fill="White" Stretch="Uniform" Width="60" Height="60" SnapsToDevicePixels="True" Data="{StaticResource Geometry_alert-circle-outline}" >
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding IsError}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever" >
<DoubleAnimation BeginTime="0:0:0" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="00:00:01" />
<DoubleAnimation BeginTime="0:0:1" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="00:00:01" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
<TextBlock Grid.Column="1" Margin="5" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="22" Foreground="White" Text="{Binding Error}"/>
</Grid>
</Border>
</Grid>
</Button>
</UserControl>
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 System.ComponentModel;
using FLY.FeedbackRenZiJia.Client;
using FLY.OBJComponents.Client;
using FLY.OBJComponents.Common;
using System.Windows.Threading;
using MultiLayout.UiModule;
using Unity;
using FLY.Thick.Base.UI;
using FLY.FeedbackRenZiJia.IService;
using FObjBase;
using MultiLayout;
using FLY.OBJComponents.IService;
using FLY.HeatingHelper;
using FLY.HeatingHelper.UI.UiModule;
namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
{
/// <summary>
/// Page_DynArea.xaml 的交互逻辑
/// </summary>
public partial class DynAreaAirRing2 : UserControl
{
#region 延时推送 MARKNO
const int MARKNO_UPDATEERROR = 1;
#endregion
IFeedbackHeatService mFeedback;
IHeatBufService mHeatBuf;
IUnityContainer container;
WarningReasonWindow warningReasonWindow;
IWarningService warningService;
DispatcherTimer timer_error;
DynAreaViewModelParams props = new DynAreaViewModelParams();
ViewModel_HeatThickDetector htdViewModel;
public DynAreaAirRing2()
{
InitializeComponent();
}
[InjectionMethod]
public void Init(
IUnityContainer container,
[Dependency("airRingWarningReasonWindow")]WarningReasonWindow warningReasonWindow,
[Dependency("airRingWarningService")]IWarningService warningService,
IFeedbackHeatService feedbackHeatService,
IHeatBufService heatBufService,
[Dependency("forThread")]IThickHeatData dat
)
{
//获取设备
this.container = container;
mFeedback = feedbackHeatService;
mHeatBuf = heatBufService;
this.warningReasonWindow = warningReasonWindow;
this.warningService = warningService;
grid_feedback.DataContext = mFeedback;
grid_heatbuf.DataContext = mHeatBuf;
htdViewModel = new ViewModel_HeatThickDetector(container.Resolve<FLY.Thick.Blowing.IService.IBlowingService>(), dat);
dat.StartMonitorTask();
spHeatThickDectector.DataContext = htdViewModel;
//报警原因轮流显示
timer_error = new DispatcherTimer();
timer_error.Interval = TimeSpan.FromSeconds(3);
timer_error.Tick += (s, e) =>
{
reason_list_index--;
if (reason_list_index < 0)
reason_list_index = this.warningReasonWindow.Record.Count();
updateError();
};
this.warningReasonWindow.Record.CollectionChanged += Record_CollectionChanged;
grid_error.DataContext = props;
mFeedback.PropertyChanged += (s, e) =>
{
if (e.PropertyName == "IsConnected")
{
updateError();
}
};
updateError();
}
private void Record_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
FObjBase.PollModule.Current.Poll_JustOnce(
new FObjBase.PollModule.PollHandler(delegate ()
{
reason_list_index = warningReasonWindow.Record.Count() - 1;
updateError();
}), this, MARKNO_UPDATEERROR);
}
void updateError()
{
if (mFeedback is FObjServiceClient)
{
var objClient = (mFeedback as FObjServiceClient);
if (!objClient.IsConnected)
{
props.Error = "风环服务器连接断开";
props.IsError = true;
reason_list_index = -1;
timer_error.Stop();
return;
}
}
if (warningReasonWindow.Record.Count == 0)
{
props.IsError = false;
props.Error = "";
reason_list_index = -1;
timer_error.Stop();
return;
}
if (reason_list_index >= warningReasonWindow.Record.Count)
reason_list_index = warningReasonWindow.Record.Count - 1;
else if (reason_list_index < 0)
reason_list_index = 0;
props.Error = warningReasonWindow.Record[reason_list_index].Description;
props.IsError = true;
timer_error.Start();
}
private int reason_list_index = -1;
private void Button_Click(object sender, RoutedEventArgs e)
{
if (props.IsError)
{
PgErrorTable2 p = new PgErrorTable2();
//var p = container.Resolve<PgErrorTable2>(new );
p.Init(container, warningService, warningReasonWindow);
FlyLayoutManager.NavigationService.Navigate(p);
}
else {
//if (!htdViewModel.HasData) return;
//if (htdViewModel._dat.BeginUse())
{
Page_HeatDetector page = new Page_HeatDetector();
container.BuildUp(page);
FlyLayoutManager.NavigationService.Navigate(page);
}
}
}
}
public class DynAreaViewModelParams : INotifyPropertyChanged
{
/// <summary>
/// 有异常
/// </summary>
public bool IsError { get; set; }
/// <summary>
/// 异常消息
/// </summary>
public string Error { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
public class UiModule2_DynAreaAirRing2 : IUiModule2
{
/// <summary>
/// 控件标题
/// 它的值取决于culture
/// </summary>
public string Title => "风环.状态2";
public ComponentType Type => ComponentType.DynArea;
public bool IsUnique => true;
/// <summary>
/// 控件
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetComponent(int id, IUnityContainer container)
{
return container.Resolve<DynAreaAirRing2>();
}
/// <summary>
/// 控件缩略图,用于编辑界面时,大致看看
/// 创建时,需要给它唯一ID,让加载自己的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public FrameworkElement GetThumbnail()
{
return new System.Windows.Controls.Grid();
}
/// <summary>
/// 给出全部控件ID, 控件自行删除没有的参数
/// </summary>
/// <param name="IDs"></param>
public void MatchParam(int[] IDs)
{
}
}
}
......@@ -65,6 +65,12 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="PgLoading.xaml.cs">
<DependentUpon>PgLoading.xaml</DependentUpon>
</Compile>
<Compile Include="PgMain.xaml.cs">
<DependentUpon>PgMain.xaml</DependentUpon>
</Compile>
<Compile Include="WdSetup.xaml.cs">
<DependentUpon>WdSetup.xaml</DependentUpon>
</Compile>
......@@ -80,6 +86,14 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="PgLoading.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="PgMain.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdSetup.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
<Window x:Class="FLY.FeedbackRenZiJia.UI.Server.MainWindow"
<NavigationWindow x:Class="FLY.FeedbackRenZiJia.UI.Server.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ResizeMode="CanMinimize"
Title="MainWindow" Height="184" Width="268">
<Grid>
<StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="PLC连接状态" />
<TextBlock Text="{Binding IsConnectedWithPLC}" FontSize="20"/>
</StackPanel>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnSetupClick"></Button>
</StackPanel>
</Grid>
</Window>
Title="MainWindow" ResizeMode="NoResize" SizeToContent="WidthAndHeight" MinWidth="400" MinHeight="200"
ShowsNavigationUI="False"
Loaded="NavigationWindow_Loaded">
</NavigationWindow>
......@@ -21,47 +21,34 @@ namespace FLY.FeedbackRenZiJia.UI.Server
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : NavigationWindow
{
FLY.AppHelper.WindowNotifyIconHelper notifyiconhelper;
TDGage mGage;
OBJProxy mOBJProxy;
TDGage gage;
OBJProxy oBJProxy;
public MainWindow()
{
InitializeComponent();
mGage = new TDGage("Gage1");
mOBJProxy = new OBJProxy(0, mGage);
PgLoading p = new PgLoading();
this.Navigate(p);
this.Title = (new Misc.Ver() { SrcType = typeof(MainWindow) }).ToString();
notifyiconhelper = new AppHelper.WindowNotifyIconHelper(this, this.Title);
this.Hide();
FObjBase.PollModule.Current.Start();
this.DataContext = mGage.mfeedback;
notifyiconhelper = new AppHelper.WindowNotifyIconHelper(this, this.Title);
}
private void button2_Click(object sender, RoutedEventArgs e)
private async void NavigationWindow_Loaded(object sender, RoutedEventArgs _e)
{
Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
var ret = fileDialog.ShowDialog();
if (ret == true)
{
string path = fileDialog.FileName;
//mGage.mfeedback.mHeatBuf.LoadData(path);
}
}
gage = new TDGage("Gage1");
await gage.Init();
oBJProxy = new OBJProxy(0, gage);
FObjBase.PollModule.Current.Start();
this.Hide();
PgMain p = new PgMain();
p.Init(gage);
this.Navigate(p);
this.NavigationService.RemoveBackEntry();
private void btnSetupClick(object sender, RoutedEventArgs e)
{
WdSetup w = new WdSetup();
w.Owner = this;
w.Init(mGage.mfeedback);
w.ShowDialog();
}
}
}
<Page x:Class="FLY.FeedbackRenZiJia.UI.Server.PgLoading"
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"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="PgLoading" >
<Grid>
<TextBlock x:Name="message" VerticalAlignment="Center" HorizontalAlignment="Center" Text="初始化中......" FontSize="24"/>
</Grid>
</Page>
\ No newline at end of file
using System;
using System.Windows.Controls;
using System.Windows.Threading;
namespace FLY.FeedbackRenZiJia.UI.Server
{
/// <summary>
/// PgLoading.xaml 的交互逻辑
/// </summary>
public partial class PgLoading : Page
{
DispatcherTimer timer;
public PgLoading()
{
InitializeComponent();
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += Timer_Tick;
timer.Start();
Timer_Tick(null, null);
}
int cnt = 0;
private void Timer_Tick(object sender, EventArgs e)
{
string str = "";
for (int i = 0; i < cnt; i++)
{
str += ".";
}
message.Text = "初始化中" + str;
cnt++;
if (cnt > 6)
cnt = 0;
}
}
}
<Page x:Class="FLY.FeedbackRenZiJia.UI.Server.PgMain"
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:FLY.FeedbackRenZiJia.UI.Server"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="PgMain">
<Grid>
<StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="PLC连接状态" />
<TextBlock Text="{Binding IsConnectedWithPLC}" FontSize="20"/>
</StackPanel>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnSetupClick"></Button>
</StackPanel>
</Grid>
</Page>
using FLY.FeedbackRenZiJia.Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace FLY.FeedbackRenZiJia.UI.Server
{
/// <summary>
/// PgMain.xaml 的交互逻辑
/// </summary>
public partial class PgMain : Page
{
TDGage gage;
public PgMain()
{
InitializeComponent();
}
public void Init(TDGage gage)
{
this.gage = gage;
this.DataContext = gage.mfeedback;
}
private void btnSetupClick(object sender, RoutedEventArgs e)
{
WdSetup w = new WdSetup();
w.Owner = App.Current.MainWindow;
w.Init(gage.mfeedback);
w.ShowDialog();
}
}
}
......@@ -7,12 +7,12 @@ using System.Windows;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("FLY.FeedbackRenZiJia.UI.Server")]
[assembly: AssemblyTitle("自动风环")]
[assembly: AssemblyDescription("自动风环.服务器")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("佛山枫莱尔自动化技术有限公司")]
[assembly: AssemblyProduct("自动风环")]
[assembly: AssemblyCopyright("Copyright © 2021 FLYAutomation")]
[assembly: AssemblyCopyright("Copyright © 2022 FLYAutomation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......@@ -51,7 +51,7 @@ using System.Windows;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.36.0")]
[assembly: AssemblyFileVersion("6.36.0")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
[assembly: Guid("32104657-86E9-4380-9113-606589E6D812")]
......@@ -11,9 +11,7 @@ namespace FLY.FeedbackRenZiJia.OBJ_INTERFACE
public const UInt32 HEATBUF_ID = 31002;
public const UInt32 HEATCELL_ID = 31003;
public const UInt32 BULKDB_ID = 31004;
/// <summary>
/// 3个
/// </summary>
public const UInt32 WARNING_OBJ_ID = 20000;
}
}
......@@ -15,14 +15,16 @@ namespace FLY.FeedbackRenZiJia.Server.OBJProxy
{
TDGage mGage = gage;
var mFeedbackOBJProxy = new FObjBase.Reflect.Reflect_Proxy( objsys_idx, OBJ_INTERFACE_ID.FEEDBACK_ID, typeof(IFeedbackHeatService), mGage.mfeedback);
var mFeedbackOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.FEEDBACK_ID, typeof(IFeedbackHeatService), mGage.mfeedback);
var mBufOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.HEATBUF_ID, typeof(IHeatBufService), mGage.mfeedback.mHeatBuf);
var mCellOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.HEATCELL_ID, typeof(IHeatCellService), mGage.mfeedback.mHeatCell);
var bulkDbOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.BULKDB_ID, typeof(IBulkDbService), mGage.mHistoryDb);
var mWarnSystemOBJProxy = new FLY.OBJComponents.Server.OBJProxy.WarningSystem_OBJProxy(objsys_idx, OBJ_INTERFACE_ID.WARNING_OBJ_ID, mGage.mWarning);
var warnSystemOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.WARNING_OBJ_ID,
typeof(OBJComponents.IService.IWarningSystem2Service), mGage.mWarning);
mFeedbackOBJProxy.CurrObjSys.Start_Conn_Server(
new IPEndPoint(IPAddress.Any, gage.mSysParam.OBJ_Port),mFeedbackOBJProxy.ID);
new IPEndPoint(IPAddress.Any, gage.mSysParam.OBJ_Port), mFeedbackOBJProxy.ID);
}
}
}
......@@ -155,7 +155,7 @@ namespace FLY.FeedbackRenZiJia.Server
/// <summary>
/// 报警系统
/// </summary>
WarningSystem mWarning;
FLY.OBJComponents.Server.WarningSystem2 mWarning;
/// <summary>
/// 加热记录文件夹
/// </summary>
......@@ -499,7 +499,7 @@ namespace FLY.FeedbackRenZiJia.Server
FLY.Thick.Blowing.IService.IBlowingService blowingService,
FLY.Thick.Blowing.IService.IBlowingDetectService bDetect,
FLY.Thick.Blowing.IService.IBulkDbService bulkDbService,
FLY.OBJComponents.Server.WarningSystem warning,
FLY.OBJComponents.Server.WarningSystem2 warning,
HistoryDb historyDb
)
{
......
......@@ -8,6 +8,8 @@ using System.Net;
using FObjBase;
using Misc;
using FLY.FeedbackRenZiJia.Server.Model;
using FLY.OBJComponents.Server;
using System.Threading.Tasks;
namespace FLY.FeedbackRenZiJia.Server
{
......@@ -30,7 +32,7 @@ namespace FLY.FeedbackRenZiJia.Server
/// <summary>
/// 报警系统
/// </summary>
public FLY.OBJComponents.Server.WarningSystem mWarning;
public FLY.OBJComponents.Server.WarningSystem2 mWarning;
public HistoryDb mHistoryDb;
......@@ -52,64 +54,61 @@ namespace FLY.FeedbackRenZiJia.Server
System.Environment.CurrentDirectory = mParamDirectory;
Init1();
mSysParam = new SysParam();
mfeedback = new FeedbackHeat();
mDbModel = new DbModel();
mHistoryDb = new HistoryDb();
mWarning = new WarningSystem2();
}
#region Init登陆服务器初始化----------------------------------------------------
/// <summary>
/// 第1步, 加载本地数据
/// </summary>
public void Init1()
public async Task Init()
{
mSysParam = new SysParam();
//---------------------------------------------------------------------------------------------------------------
//数据库
await Task.Factory.StartNew(() =>
{
//初始数据库(加载 MaxId)
mDbModel.Init();
//删除不需要的备份数据
mDbModel.KeepBackupSize(12);
//备份上一个月之前的数据到 yyyy-MM 文件夹
mDbModel.BackupBbInSize(12);
//当前的数据库只保存上个月与这个月的数据
mDbModel.KeepDBSize(1);
});
mHistoryDb.Init(mDbModel);
#region 与服务器同步的数据
FObjServiceClientManager.Instance.ConnAddrs.Add(new ConnAddr() { ConnName = "blowing", Addr = mSysParam.BlowingAddr });
mRenZiJia = new FLY.Thick.Blowing.Client.BlowingServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.RENZIJIA_ID, "blowing");
mBDetect = new FLY.Thick.Blowing.Client.BlowingDetectServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.BDETECT_ID, "blowing");
bulkDbServiceClient = new FLY.Thick.Blowing.Client.BulkDbServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.BULKDB_ID, "blowing");
#endregion
#region 提取保存的数据
//---------------------------------------------------------------------------------------------------------------
//数据库
mDbModel = new DbModel();
mDbModel.Init();
mDbModel.KeepDBSize(mSysParam.DBKeepMonth);
mHistoryDb = new HistoryDb();
mHistoryDb.Init(mDbModel);
//PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD, () =>
//{
// //避免1个月都不关程序,每天检查一次
// mHistoryDb.KeepDBSize(mSysParam.DBKeepMonth);
//}, TimeSpan.FromDays(1));
//---------------------------------------------------------------------------------------------------------------
//Warning_Create
mWarning = new FLY.OBJComponents.Server.WarningSystem();
mWarning.Init(mHistoryDb.ErrorBuffer);
Misc.BindingOperations.SetBinding(mWarning, "IsRinging", () =>
{
//报警不动作
if (mWarning.IsRinging)
{
}
else
{
mWarning.Init(mHistoryDb.ErrorBuffer);
}
});
string connName = "blowing";
#region 与服务器同步的数据
FObjServiceClientManager.Instance.ConnAddrs.Add(new ConnAddr() { ConnName = connName, Addr = mSysParam.BlowingAddr });
mRenZiJia = new FLY.Thick.Blowing.Client.BlowingServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.RENZIJIA_ID, connName);
mfeedback = new FeedbackHeat();
mBDetect = new FLY.Thick.Blowing.Client.BlowingDetectServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.BDETECT_ID, connName);
bulkDbServiceClient = new FLY.Thick.Blowing.Client.BulkDbServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.BULKDB_ID, connName);
#endregion
mfeedback.Init(
mRenZiJia,
......@@ -118,7 +117,7 @@ namespace FLY.FeedbackRenZiJia.Server
mWarning,
mHistoryDb
);
#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