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

multiLayout 添加 顶部报警提示栏

parent 9604a028
......@@ -62,6 +62,14 @@ namespace MultiLayout
return null;
}
}
public bool IsErrMsgVisable => !string.IsNullOrEmpty(ErrMsg);
/// <summary>
/// 错误信息
/// </summary>
public string ErrMsg { get; set; }
public Action ErrMsgClick;
/// <summary>
///
/// </summary>
......
<NavigationWindow x:Class="MultiLayout.MainWindow"
<Window 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"
xmlns:local="clr-namespace:MultiLayout"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Loaded="MainWindow_Loaded"
ShowsNavigationUI="False">
</NavigationWindow>
Title="MainWindow" Height="450" Width="800" Loaded="MainWindow_Loaded">
<Window.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>
<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
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : NavigationWindow
public partial class MainWindow : Window
{
IUnityContainer container;
LoadingProgress lp;
FlyLayoutManager manager;
NavigationService NavigationService => frame.NavigationService;
public MainWindow()
{
InitializeComponent();
......@@ -42,6 +42,7 @@ namespace MultiLayout
lp = new LoadingProgress();
PgLoading p = new PgLoading();
p.DataContext = lp;
NavigationService.Navigate(p);
await Task.Delay(1000);
......@@ -64,7 +65,9 @@ namespace MultiLayout
container.RegisterInstance(manager);
manager.Init(
layout, container, lp);
this.DataContext = manager;
//以后的页面切换器
FlyLayoutManager.NavigationService = NavigationService;
//---------------------------------------------------------
......@@ -76,7 +79,7 @@ namespace MultiLayout
NavigationService.Navigate(page);
page.Loaded += (s, e1) =>
NavigationService.RemoveBackEntry();
frame.NavigationService.RemoveBackEntry();
//---------------------------------------------------------
//初始化
......@@ -86,5 +89,10 @@ namespace MultiLayout
//启动Poll系统
//FObjBase.PollModule.Current.Start();
}
private void btnErrMsgClick(object sender, RoutedEventArgs e)
{
manager.ErrMsgClick?.Invoke();
}
}
}
......@@ -12,10 +12,10 @@
<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="ViewModelUt" GageTag="机尾"/>
<local:UcMultiGageVmUt x:Key="viewModel" GageTag="机尾" IsErrMsgVisable ="True"/>
</ResourceDictionary>
</UserControl.Resources>
<Grid d:DataContext="{StaticResource ViewModelUt}">
<Grid d:DataContext="{StaticResource viewModel}">
<Frame Name="frame" NavigationUIVisibility="Hidden"/>
<Border Background="#FF2C3C5A" CornerRadius="0 0 10 10" HorizontalAlignment="Center" VerticalAlignment="Top"
Visibility="{Binding IsGageTagVisible,Converter={StaticResource visbilityconv}}">
......@@ -23,5 +23,6 @@
Padding="50,10"
Foreground="White" />
</Border>
</Grid>
</UserControl>
......@@ -22,7 +22,7 @@ namespace MultiLayout
public partial class UcMultiGage : UserControl
{
public PgMultiGage pgMultiGage;
FlyLayoutManager manager;
public UcMultiGage()
{
InitializeComponent();
......@@ -30,6 +30,7 @@ namespace MultiLayout
}
public void Init(FlyLayoutManager manager)
{
this.manager = manager;
this.DataContext = manager;
NavigationService.Navigate(pgMultiGage);
......
......@@ -12,6 +12,8 @@ namespace MultiLayout
public event PropertyChangedEventHandler PropertyChanged;
public string GageTag { get; set; } = "机头";
public bool IsGageTagVisible { get; set; } = true;
public bool IsErrMsgVisable { get; set; }
public string ErrMsg { get; set; } = "非常报警,包包11111111112312313131313123131312231311231312312313131";
}
}
......@@ -43,11 +43,14 @@
</StackPanel>
</Viewbox>
</Grid>
<TabControl Grid.Column="1" Name="tabControl_graph" Template="{StaticResource GraphTab}">
<TabItem Header="TEST"/>
<TabItem Header="TEST2"/>
<TabItem Header="TEST3"/>
</TabControl>
</Grid>
</Grid>
<Grid >
......
......@@ -38,5 +38,10 @@ namespace MultiLayout
p.Init(manager);
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