Commit a6d8d098 authored by 潘栩锋's avatar 潘栩锋 🚴

multiLayout 添加 顶部报警提示栏

parent 9604a028
...@@ -62,6 +62,14 @@ namespace MultiLayout ...@@ -62,6 +62,14 @@ namespace MultiLayout
return null; return null;
} }
} }
public bool IsErrMsgVisable => !string.IsNullOrEmpty(ErrMsg);
/// <summary>
/// 错误信息
/// </summary>
public string ErrMsg { get; set; }
public Action ErrMsgClick;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
......
<NavigationWindow x:Class="MultiLayout.MainWindow" <Window x:Class="MultiLayout.MainWindow"
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:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MultiLayout"
mc:Ignorable="d" mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Loaded="MainWindow_Loaded" Title="MainWindow" Height="450" Width="800" Loaded="MainWindow_Loaded">
ShowsNavigationUI="False"> <Window.Resources>
<ResourceDictionary>
</NavigationWindow> <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>
<local:UcMultiGageVmUt x:Key="viewModel" GageTag="机尾" IsErrMsgVisable ="True"/>
</ResourceDictionary>
</Window.Resources>
<Grid d:DataContext="{StaticResource viewModel}">
<Frame Name="frame" NavigationUIVisibility="Hidden"/>
<Button Style="{StaticResource Styles.Button.Empty}" Visibility="{Binding IsErrMsgVisable,Converter={StaticResource visbilityconv}}" Click="btnErrMsgClick">
<Border Background="Red" CornerRadius="0, 0 10 10" HorizontalAlignment="Center" VerticalAlignment="Top" >
<StackPanel Orientation="Horizontal">
<Grid Width="15"/>
<Path Margin="5" Fill="White" Stretch="Uniform" Width="20" Height="20" SnapsToDevicePixels="True" Data="{StaticResource Geometry_alert-circle-outline}" >
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding IsErrMsgVisable}" 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 Text="{Binding ErrMsg}" FontWeight="Bold" FontFamily="YouYuan" FontSize="20"
Padding="10" TextAlignment="Left" MaxWidth="600"
Foreground="White" />
<Grid Width="10"/>
</StackPanel>
</Border>
</Button>
</Grid>
</Window>
...@@ -23,12 +23,12 @@ namespace MultiLayout ...@@ -23,12 +23,12 @@ namespace MultiLayout
/// <summary> /// <summary>
/// MainWindow.xaml 的交互逻辑 /// MainWindow.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class MainWindow : NavigationWindow public partial class MainWindow : Window
{ {
IUnityContainer container; IUnityContainer container;
LoadingProgress lp; LoadingProgress lp;
FlyLayoutManager manager; FlyLayoutManager manager;
NavigationService NavigationService => frame.NavigationService;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
...@@ -42,6 +42,7 @@ namespace MultiLayout ...@@ -42,6 +42,7 @@ namespace MultiLayout
lp = new LoadingProgress(); lp = new LoadingProgress();
PgLoading p = new PgLoading(); PgLoading p = new PgLoading();
p.DataContext = lp; p.DataContext = lp;
NavigationService.Navigate(p); NavigationService.Navigate(p);
await Task.Delay(1000); await Task.Delay(1000);
...@@ -64,7 +65,9 @@ namespace MultiLayout ...@@ -64,7 +65,9 @@ namespace MultiLayout
container.RegisterInstance(manager); container.RegisterInstance(manager);
manager.Init( manager.Init(
layout, container, lp); layout, container, lp);
this.DataContext = manager;
//以后的页面切换器
FlyLayoutManager.NavigationService = NavigationService; FlyLayoutManager.NavigationService = NavigationService;
//--------------------------------------------------------- //---------------------------------------------------------
...@@ -76,7 +79,7 @@ namespace MultiLayout ...@@ -76,7 +79,7 @@ namespace MultiLayout
NavigationService.Navigate(page); NavigationService.Navigate(page);
page.Loaded += (s, e1) => page.Loaded += (s, e1) =>
NavigationService.RemoveBackEntry(); frame.NavigationService.RemoveBackEntry();
//--------------------------------------------------------- //---------------------------------------------------------
//初始化 //初始化
...@@ -86,5 +89,10 @@ namespace MultiLayout ...@@ -86,5 +89,10 @@ namespace MultiLayout
//启动Poll系统 //启动Poll系统
//FObjBase.PollModule.Current.Start(); //FObjBase.PollModule.Current.Start();
} }
private void btnErrMsgClick(object sender, RoutedEventArgs e)
{
manager.ErrMsgClick?.Invoke();
}
} }
} }
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
<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.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/> <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<local:UcMultiGageVmUt x:Key="ViewModelUt" GageTag="机尾"/> <local:UcMultiGageVmUt x:Key="viewModel" GageTag="机尾" IsErrMsgVisable ="True"/>
</ResourceDictionary> </ResourceDictionary>
</UserControl.Resources> </UserControl.Resources>
<Grid d:DataContext="{StaticResource ViewModelUt}"> <Grid d:DataContext="{StaticResource viewModel}">
<Frame Name="frame" NavigationUIVisibility="Hidden"/> <Frame Name="frame" NavigationUIVisibility="Hidden"/>
<Border Background="#FF2C3C5A" CornerRadius="0 0 10 10" HorizontalAlignment="Center" VerticalAlignment="Top" <Border Background="#FF2C3C5A" CornerRadius="0 0 10 10" HorizontalAlignment="Center" VerticalAlignment="Top"
Visibility="{Binding IsGageTagVisible,Converter={StaticResource visbilityconv}}"> Visibility="{Binding IsGageTagVisible,Converter={StaticResource visbilityconv}}">
...@@ -23,5 +23,6 @@ ...@@ -23,5 +23,6 @@
Padding="50,10" Padding="50,10"
Foreground="White" /> Foreground="White" />
</Border> </Border>
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -22,7 +22,7 @@ namespace MultiLayout ...@@ -22,7 +22,7 @@ namespace MultiLayout
public partial class UcMultiGage : UserControl public partial class UcMultiGage : UserControl
{ {
public PgMultiGage pgMultiGage; public PgMultiGage pgMultiGage;
FlyLayoutManager manager;
public UcMultiGage() public UcMultiGage()
{ {
InitializeComponent(); InitializeComponent();
...@@ -30,6 +30,7 @@ namespace MultiLayout ...@@ -30,6 +30,7 @@ namespace MultiLayout
} }
public void Init(FlyLayoutManager manager) public void Init(FlyLayoutManager manager)
{ {
this.manager = manager;
this.DataContext = manager; this.DataContext = manager;
NavigationService.Navigate(pgMultiGage); NavigationService.Navigate(pgMultiGage);
......
...@@ -12,6 +12,8 @@ namespace MultiLayout ...@@ -12,6 +12,8 @@ namespace MultiLayout
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
public string GageTag { get; set; } = "机头"; public string GageTag { get; set; } = "机头";
public bool IsGageTagVisible { get; set; } = true; public bool IsGageTagVisible { get; set; } = true;
public bool IsErrMsgVisable { get; set; }
public string ErrMsg { get; set; } = "非常报警,包包11111111112312313131313123131312231311231312312313131";
} }
} }
...@@ -43,11 +43,14 @@ ...@@ -43,11 +43,14 @@
</StackPanel> </StackPanel>
</Viewbox> </Viewbox>
</Grid> </Grid>
<TabControl Grid.Column="1" Name="tabControl_graph" Template="{StaticResource GraphTab}"> <TabControl Grid.Column="1" Name="tabControl_graph" Template="{StaticResource GraphTab}">
<TabItem Header="TEST"/> <TabItem Header="TEST"/>
<TabItem Header="TEST2"/> <TabItem Header="TEST2"/>
<TabItem Header="TEST3"/> <TabItem Header="TEST3"/>
</TabControl> </TabControl>
</Grid> </Grid>
</Grid> </Grid>
<Grid > <Grid >
......
...@@ -38,5 +38,10 @@ namespace MultiLayout ...@@ -38,5 +38,10 @@ namespace MultiLayout
p.Init(manager); p.Init(manager);
FlyLayoutManager.NavigationService.Navigate(p); FlyLayoutManager.NavigationService.Navigate(p);
} }
private void btnErrMsgClick(object sender, RoutedEventArgs e)
{
manager.ErrMsgClick?.Invoke();
}
} }
} }
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