浏览代码

11

样式分支
fyf 2 年前
父节点
当前提交
b4b8ecfa8e
共有 3 个文件被更改,包括 90 次插入14 次删除
  1. +32
    -0
      BPASmartClient.CustomResource/UserControls/DateTimeUI.xaml
  2. +56
    -0
      BPASmartClient.CustomResource/UserControls/DateTimeUI.xaml.cs
  3. +2
    -14
      BPASmartClient/MainWindow.xaml

+ 32
- 0
BPASmartClient.CustomResource/UserControls/DateTimeUI.xaml 查看文件

@@ -0,0 +1,32 @@
<UserControl x:Class=" BPASmartClient.CustomResource.UserControls.DateTimeUI"
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:BPASmartClient.CustomResource.UserControls"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="100">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<TextBlock x:Name="time" FontSize="16">14:48:30</TextBlock>
<Image Style="{DynamicResource timeImage}" Margin="10,0,0,0"></Image>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<TextBlock x:Name="dateRL" FontSize="10">星期一</TextBlock>

<TextBlock x:Name="date" Margin="10,0,0,0" FontSize="10">2021-11-13</TextBlock>
</StackPanel>
</Grid>
</UserControl>

+ 56
- 0
BPASmartClient.CustomResource/UserControls/DateTimeUI.xaml.cs 查看文件

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
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 BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// DateTimeUI.xaml 的交互逻辑
/// </summary>
public partial class DateTimeUI : UserControl
{
public DateTimeUI()
{
InitializeComponent();
Task.Run(new Action(() =>
{
while (true)
{
this.Dispatcher.Invoke(new Action(() =>
{
time.Text = DateTime.Now.ToString("HH:mm:ss");
date.Text = DateTime.Now.ToString("yyyy-MM-dd");
if (DateTime.Now.DayOfWeek == DayOfWeek.Monday)
dateRL.Text = "星期一";
else if (DateTime.Now.DayOfWeek == DayOfWeek.Tuesday)
dateRL.Text = "星期二";
else if (DateTime.Now.DayOfWeek == DayOfWeek.Wednesday)
dateRL.Text = "星期三";
else if (DateTime.Now.DayOfWeek == DayOfWeek.Thursday)
dateRL.Text = "星期四";
else if (DateTime.Now.DayOfWeek == DayOfWeek.Friday)
dateRL.Text = "星期五";
else if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday)
dateRL.Text = "星期六";
else if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
dateRL.Text = "星期天";

}));
Thread.Sleep(500);
}
}));
}
}
}

+ 2
- 14
BPASmartClient/MainWindow.xaml 查看文件

@@ -6,6 +6,7 @@
xmlns:local="clr-namespace:BPASmartClient"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
Title="MainWindow" Width="1600"
Height="900"
AllowsTransparency="True"
@@ -92,20 +93,7 @@
<Border Style="{DynamicResource border竖线}" />
<ToggleButton VerticalAlignment="Center" ToolTip="告警消息" HorizontalAlignment="Center" Style="{DynamicResource StatusBtnStyle告警}" DataContext="{Binding GaoJingMessage}" Cursor="Hand"/>
<Border Style="{DynamicResource border竖线}" />
<Grid Margin="10,0,10,0" VerticalAlignment="Center" >
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<TextBlock x:Name="time" FontSize="16" Text="18:00:00"/>
<Image Style="{DynamicResource timeImage}" Margin="10,0,0,0"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<TextBlock x:Name="dateRL" FontSize="10" >星期一</TextBlock>
<TextBlock x:Name="date" Margin="10,0,0,0" FontSize="10" >2021-11-13</TextBlock>
</StackPanel>
</Grid>
<control:DateTimeUI Margin="10,0,10,0" VerticalAlignment="Center"></control:DateTimeUI>
<Border Style="{DynamicResource border竖线}" />
<Button x:Name="ButClose" Grid.Column="4" Margin="10,0,20,0" Style="{DynamicResource CommonBtn_返回}" VerticalAlignment="Center" ToolTip="退出程序" Cursor="Hand" Content="退出"/>
</StackPanel>


正在加载...
取消
保存