add clock
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
<UserControl x:Class="SafeBagDE70.ClockUC"
|
||||||
|
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:SafeBagDE70"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Border Background="Transparent" CornerRadius="10" Padding="10">
|
||||||
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
<TextBlock x:Name="txtTime"
|
||||||
|
FontSize="40"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Foreground="Red"
|
||||||
|
HorizontalAlignment="Center" />
|
||||||
|
<TextBlock x:Name="txtDate"
|
||||||
|
FontSize="35"
|
||||||
|
Foreground="Red"
|
||||||
|
FontWeight="Bold"
|
||||||
|
HorizontalAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
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.Threading;
|
||||||
|
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 SafeBagDE70
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ClockUC.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ClockUC : UserControl
|
||||||
|
{
|
||||||
|
private DispatcherTimer _timer;
|
||||||
|
public ClockUC()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_timer = new DispatcherTimer()
|
||||||
|
{
|
||||||
|
Interval = TimeSpan.FromSeconds(1)
|
||||||
|
};
|
||||||
|
_timer.Tick += Timer_Tick;
|
||||||
|
_timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Timer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
txtTime.Text = DateTime.Now.ToString("HH:mm:ss");
|
||||||
|
txtDate.Text = DateTime.Now.ToString("dd/MM/yyyy");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-1
@@ -10,7 +10,12 @@
|
|||||||
ShowInTaskbar="False"
|
ShowInTaskbar="False"
|
||||||
ShowNonClientArea="False"
|
ShowNonClientArea="False"
|
||||||
IsFullScreen="True">
|
IsFullScreen="True">
|
||||||
<Grid x:Name="gridMain">
|
<Grid >
|
||||||
|
<Grid x:Name="gridMain"/>
|
||||||
|
|
||||||
|
<local:ClockUC HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
Margin="0,130,80,0" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</hc:Window>
|
</hc:Window>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user