Commit 0a9653b5 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 把基于数据库的HeatingHelper 动态区的状态框 与 自动风环的状态框合并

parent 8bde3da5
......@@ -68,6 +68,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</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>
......@@ -116,6 +120,9 @@
<ItemGroup>
<Compile Include="Converter\IPEPConverter.cs" />
<Compile Include="HeatListHelper.cs" />
<Compile Include="UiModule\DynAreaAirRing2.xaml.cs">
<DependentUpon>DynAreaAirRing2.xaml</DependentUpon>
</Compile>
<Compile Include="UiModule\MenuSetting.xaml.cs">
<DependentUpon>MenuSetting.xaml</DependentUpon>
</Compile>
......@@ -179,6 +186,14 @@
<Resource Include="Images\teachers_day.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Project.FLY.ThickHeatAnalyst.Fix\FLY.HeatingHelper.UI\FLY.HeatingHelper.UI.csproj">
<Project>{276ee86a-0961-4c69-a38a-696f4d76e931}</Project>
<Name>FLY.HeatingHelper.UI</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.ThickHeatAnalyst.Fix\FLY.HeatingHelper\FLY.HeatingHelper.csproj">
<Project>{973f0eed-3181-4fb9-abd6-196a9e816b77}</Project>
<Name>FLY.HeatingHelper</Name>
</ProjectReference>
<ProjectReference Include="..\..\thick_public\MultiLayout\MultiLayout.csproj">
<Project>{5BBE76F5-CFD7-4DFA-9EE5-0C47D77D96E6}</Project>
<Name>MultiLayout</Name>
......
......@@ -66,10 +66,14 @@
</Grid>
</Button>
<Button Click="button_heatlist_Click" >
<TextBlock FontWeight="Bold" FontFamily="YouYuan" VerticalAlignment="Center">
<Run Foreground="White" FontSize="40" Text="记录"/>
<TextBlock FontWeight="Bold" VerticalAlignment="Center" Foreground="White" Background="#C00083D7" Padding="10" FontFamily="Arial" FontSize="40" >
<Run Text="记录" ></Run>
<Run FontSize="20">(初级分析器)</Run>
</TextBlock>
</Button>
<Button Click="btnHeatingHelperClick" >
<TextBlock FontWeight="Bold" VerticalAlignment="Center" Foreground="White" FontSize="40" Text="高级分析器" Background="#C00083D7" Padding="10" FontFamily="Arial"/>
</Button>
</WrapPanel>
</Grid>
</ScrollViewer>
......
using FLY.FeedbackRenZiJia.UI.Client.UiModule;
using FLY.HeatingHelper.UI.UiModule;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -58,5 +59,12 @@ namespace FLY.FeedbackRenZiJia.UI.Client
p.Owner = FLY.ControlLibrary.COMMON.GetWindow(this);
p.ShowDialog();
}
private void btnHeatingHelperClick(object sender, RoutedEventArgs e)
{
Page_HeatDetector page = new Page_HeatDetector();
container.BuildUp(page);
MultiLayout.FlyLayoutManager.NavigationService.Navigate(page);
}
}
}
......@@ -15,7 +15,7 @@
</ResourceDictionary.MergedDictionaries>
<client:StableConverter x:Key="stableconv"/>
<local:DynAreaViewModelParams x:Key="unitests_props" IsError="True" Error="报警MSG"/>
<local:DynAreaViewModelParams x:Key="unitests_props" IsError="False" Error="报警MSG"/>
</ResourceDictionary>
</UserControl.Resources>
......@@ -30,21 +30,14 @@
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical">
<StackPanel >
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" 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="Vertical" Margin="2" DataContext="{Binding DataContext,ElementName=grid_heatbuf}">
<TextBlock Text="打散度" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Left" Foreground="#FF3B3B3B" />
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" FontFamily="Microsoft Sans Serif" Foreground="{StaticResource Color_theme_activity}" Text="{Binding CurrBreakUp, StringFormat={}{0:F0}}" FontSize="24" VerticalAlignment="Center" />
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="%" FontSize="12"/>
</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" />
......
<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>
<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="Red"
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="30" 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;
GraphAirRingParams graphAirRingParams;
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
)
{
//获取设备
graphAirRingParams = GraphAirRingParams.Current;
this.container = container;
mFeedback = feedbackHeatService;
mHeatBuf = heatBufService;
this.warningReasonWindow = warningReasonWindow;
this.warningService = warningService;
view_stability.DataContext = graphAirRingParams;
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 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)
{
}
}
}
......@@ -31,8 +31,25 @@ namespace FLY.HeatingHelper.UI.UiModule
{
CurrentResetBolt = blowing.OrgBoltNo;
NewResetBolt = CurrentResetBolt;
});
IsDifferent = (CurrentResetBolt != NewResetBolt);
this.PropertyChanged += (s, e) =>
{
if ((e.PropertyName == "CurrentResetBolt") || (e.PropertyName == "NewResetBolt"))
{
IsDifferent = (CurrentResetBolt != NewResetBolt);
}
};
//CurrentResetBolt = 55;
//NewResetBolt = 30;
//IsDifferent = true;
}
public bool HasData
{
......@@ -48,6 +65,7 @@ namespace FLY.HeatingHelper.UI.UiModule
public int CurrentResetBolt { get; set; }
public bool IsDifferent { get; private set; }
public event PropertyChangedEventHandler PropertyChanged;
}
......
......@@ -189,16 +189,16 @@ namespace FLY.HeatingHelper
public bool BeginUse(bool isAsync = true)
{
if(isAsync)
{
return Monitor.TryEnter(_sync);
}
Monitor.Enter(_sync);
//if(isAsync)
//{
// return Monitor.TryEnter(_sync);
//}
//Monitor.Enter(_sync);
return true;
}
public void EndUse()
{
Monitor.Exit(_sync);
//Monitor.Exit(_sync);
}
public void CalculateAirRingShift()
......@@ -1550,6 +1550,8 @@ namespace FLY.HeatingHelper
public void StartMonitorTask()
{
taskForDB = Task.Factory.StartNew(() =>
{
try
{
while (true)
{
......@@ -1566,6 +1568,11 @@ namespace FLY.HeatingHelper
Thread.Sleep(1000 * 2);
}
}
}
catch (Exception e)
{
throw e;
}
});
}
#endregion
......
......@@ -11,6 +11,7 @@
<register type="IUiModule2" mapTo="UiModule2_MenuSetting" name="airRing_ms" />
<register type="IUiModule2" mapTo="UiModule2_DynAreaAirRing" name="airRing_da" />
<register type="IUiModule2" mapTo="UiModule2_GraphAirRing" name="airRing_g" />
<register type="IUiModule2" mapTo="UiModule2_DynAreaAirRing2" name="airRing_da2" />
</container>
</unity>
</configuration>
\ No newline at end of file
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