improve:按钮显示
This commit is contained in:
@@ -12,14 +12,7 @@
|
||||
Title="Ink Canvas 画板 - 计时器" Height="700" Width="1100">
|
||||
<Border Background="#F0F3F9" CornerRadius="10" BorderThickness="1" BorderBrush="#0066BF" Margin="60">
|
||||
<Grid>
|
||||
<TextBlock x:Name="TbCurrentTime" MouseDown="BtnMinimal_OnMouseUp" Visibility="Collapsed" FontSize="56" FontWeight="Black" HorizontalAlignment="Center" VerticalAlignment="Center" Text="00:00:00">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock" BasedOn="{x:Null}">
|
||||
<Setter Property="TextWrapping" Value="NoWrap" />
|
||||
<Setter Property="TextTrimming" Value="None" />
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="TbCurrentTime" MouseDown="BtnMinimal_OnMouseUp" Visibility="Collapsed" FontSize="56" FontWeight="Black" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
<Border MouseMove="WindowDragMove" Visibility="{Binding ElementName=TbCurrentTime, Path=Visibility}" Width="64" Height="15" CornerRadius="8" Background="Gray" Margin="0,0,0,5" HorizontalAlignment="Center" VerticalAlignment="Bottom" />
|
||||
<Viewbox x:Name="BigViewController" Margin="20,20,20,20">
|
||||
<Grid Height="180" Width="200">
|
||||
@@ -31,11 +24,23 @@
|
||||
Margin="0,0,0,0" Visibility="Collapsed"
|
||||
Foreground="#5B5D5F"
|
||||
Text="00" FontSize="26"/>
|
||||
<TextBlock Name="TextControlHour" Text="{Binding ElementName=TextBlockHour, Path=Text}"
|
||||
FontFamily="{Binding ElementName=TextBlockHour, Path=FontFamily}"
|
||||
Foreground="{Binding ElementName=TextBlockHour, Path=Foreground}"
|
||||
FontSize="{Binding ElementName=TextBlockHour, Path=FontSize}"
|
||||
FontWeight="SemiBold" HorizontalAlignment="Center"/>
|
||||
<ItemsControl Name="TextControlHour" ItemsSource="{Binding ElementName=TextBlockHour, Path=Text}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="14">
|
||||
<TextBlock Text="{Binding}" HorizontalAlignment="Center" FontWeight="SemiBold"
|
||||
Foreground="{Binding ElementName=TextBlockHour, Path=Foreground}"
|
||||
FontFamily="{Binding ElementName=TextBlockHour, Path=FontFamily}"
|
||||
FontSize="{Binding ElementName=TextBlockHour, Path=FontSize}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Grid Name="GridAdjustHour" Visibility="Visible" Margin="-29,-30,0,-30" Width="29">
|
||||
<ui:SimpleStackPanel Spacing="2">
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_1">
|
||||
@@ -66,11 +71,23 @@
|
||||
Margin="0,0,0,0" Visibility="Collapsed"
|
||||
Foreground="{Binding ElementName=TextBlockHour, Path=Foreground}"
|
||||
Text="01" FontSize="26"/>
|
||||
<TextBlock Name="TextControlMinute" Text="{Binding ElementName=TextBlockMinute, Path=Text}"
|
||||
FontFamily="{Binding ElementName=TextBlockMinute, Path=FontFamily}"
|
||||
Foreground="{Binding ElementName=TextBlockMinute, Path=Foreground}"
|
||||
FontSize="{Binding ElementName=TextBlockMinute, Path=FontSize}"
|
||||
FontWeight="SemiBold" HorizontalAlignment="Center"/>
|
||||
<ItemsControl Name="TextControlMinute" ItemsSource="{Binding ElementName=TextBlockMinute, Path=Text}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="14">
|
||||
<TextBlock Text="{Binding}" HorizontalAlignment="Center" FontWeight="SemiBold"
|
||||
Foreground="{Binding ElementName=TextBlockMinute, Path=Foreground}"
|
||||
FontFamily="{Binding ElementName=TextBlockMinute, Path=FontFamily}"
|
||||
FontSize="{Binding ElementName=TextBlockMinute, Path=FontSize}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Grid Visibility="{Binding ElementName=GridAdjustHour, Path=Visibility}" Margin="-29,-30,0,-30" Width="29">
|
||||
<ui:SimpleStackPanel Spacing="2">
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_5">
|
||||
@@ -113,11 +130,23 @@
|
||||
Margin="0,0,0,0" Visibility="Collapsed"
|
||||
Foreground="{Binding ElementName=TextBlockHour, Path=Foreground}"
|
||||
Text="00" FontSize="26"/>
|
||||
<TextBlock Name="TextControlSecond" Text="{Binding ElementName=TextBlockSecond, Path=Text}"
|
||||
FontFamily="{Binding ElementName=TextBlockSecond, Path=FontFamily}"
|
||||
Foreground="{Binding ElementName=TextBlockSecond, Path=Foreground}"
|
||||
FontSize="{Binding ElementName=TextBlockSecond, Path=FontSize}"
|
||||
FontWeight="SemiBold" HorizontalAlignment="Center"/>
|
||||
<ItemsControl Name="TextControlSecond" ItemsSource="{Binding ElementName=TextBlockSecond, Path=Text}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Width="14">
|
||||
<TextBlock Text="{Binding}" HorizontalAlignment="Center" FontWeight="SemiBold"
|
||||
Foreground="{Binding ElementName=TextBlockSecond, Path=Foreground}"
|
||||
FontFamily="{Binding ElementName=TextBlockSecond, Path=FontFamily}"
|
||||
FontSize="{Binding ElementName=TextBlockSecond, Path=FontSize}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Grid Margin="-96.8,0,0,0" Width="96.8" Background="Transparent" MouseUp="Grid_MouseUp"/>
|
||||
<Grid Visibility="{Binding ElementName=GridAdjustHour, Path=Visibility}" Margin="-29,-30,0,-30" Width="29">
|
||||
<ui:SimpleStackPanel Spacing="2">
|
||||
@@ -150,12 +179,12 @@
|
||||
<Grid>
|
||||
<Border x:Name="BtnStart" MouseUp="BtnStart_MouseUp" Background="#0066BF" Height="20" Width="20" CornerRadius="100">
|
||||
<Viewbox Margin="5">
|
||||
<ui:FontIcon Name="FontIconStart" Glyph="" Foreground="White"/>
|
||||
<ui:SymbolIcon Name="SymbolIconStart" Symbol="Play" Foreground="White"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnStartCover" Visibility="Collapsed" Background="#BFBFBF" Height="20" Width="20" CornerRadius="100">
|
||||
<Viewbox Margin="5">
|
||||
<ui:FontIcon Glyph="{Binding ElementName=FontIconStart, Path=Glyph}" Foreground="White"/>
|
||||
<ui:SymbolIcon Symbol="{Binding ElementName=SymbolIconStart, Path=Symbol}" Foreground="White"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -165,12 +194,12 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.15" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:FontIcon Glyph="" Foreground="Black"/>
|
||||
<ui:SymbolIcon Symbol="Refresh" Foreground="Black"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnResetCover" Background="#F3F5F9" Height="20" Width="20" CornerRadius="100">
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:FontIcon Glyph="" Foreground="#9D9D9E"/>
|
||||
<ui:SymbolIcon Symbol="Refresh" Foreground="#9D9D9E"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -186,7 +215,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<TextBlock Name="FontIconMinimal" Text="" Foreground="Black" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
<ui:SymbolIcon Name="SymbolIconMinimal" Symbol="HideBcc" Foreground="Black"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnFullscreen" MouseUp="BtnFullscreen_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
@@ -196,7 +225,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<TextBlock Name="FontIconFullscreen" Text="" Foreground="Black" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
<ui:SymbolIcon Name="SymbolIconFullscreen" Symbol="FullScreen" Foreground="Black"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnClose" MouseUp="BtnClose_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
@@ -206,7 +235,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<TextBlock Text="" Foreground="White" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
<ui:SymbolIcon Symbol="Clear" Foreground="White"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Media;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using Application = System.Windows.Application;
|
||||
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
@@ -56,7 +51,7 @@ namespace Ink_Canvas
|
||||
TextBlockSecond.Text = "00";
|
||||
timer.Stop();
|
||||
isTimerRunning = false;
|
||||
FontIconStart.Glyph = "";
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Play;
|
||||
BtnStartCover.Visibility = Visibility.Visible;
|
||||
TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F"));
|
||||
BorderStopTime.Visibility = Visibility.Collapsed;
|
||||
@@ -75,23 +70,23 @@ namespace Ink_Canvas
|
||||
|
||||
SoundPlayer player = new SoundPlayer();
|
||||
|
||||
int hour;
|
||||
int hour = 0;
|
||||
int minute = 1;
|
||||
int second;
|
||||
int second = 0;
|
||||
int totalSeconds = 60;
|
||||
|
||||
DateTime startTime = DateTime.Now;
|
||||
DateTime pauseTime = DateTime.Now;
|
||||
|
||||
bool isTimerRunning;
|
||||
bool isPaused;
|
||||
bool isTimerRunning = false;
|
||||
bool isPaused = false;
|
||||
|
||||
Timer timer = new Timer();
|
||||
|
||||
private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (isTimerRunning) return;
|
||||
if (ProcessBarTime.Visibility == Visibility.Visible && !isTimerRunning)
|
||||
if (ProcessBarTime.Visibility == Visibility.Visible && isTimerRunning == false)
|
||||
{
|
||||
ProcessBarTime.Visibility = Visibility.Collapsed;
|
||||
GridAdjustHour.Visibility = Visibility.Visible;
|
||||
@@ -207,12 +202,12 @@ namespace Ink_Canvas
|
||||
if (WindowState == WindowState.Normal)
|
||||
{
|
||||
WindowState = WindowState.Maximized;
|
||||
FontIconFullscreen.Text = "";
|
||||
SymbolIconFullscreen.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.BackToWindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowState = WindowState.Normal;
|
||||
FontIconFullscreen.Text = "";
|
||||
SymbolIconFullscreen.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.FullScreen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,6 +222,7 @@ namespace Ink_Canvas
|
||||
BtnStartCover.Visibility = Visibility.Collapsed;
|
||||
BorderStopTime.Visibility = Visibility.Collapsed;
|
||||
TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F"));
|
||||
return;
|
||||
}
|
||||
else if (isTimerRunning && isPaused)
|
||||
{
|
||||
@@ -237,7 +233,7 @@ namespace Ink_Canvas
|
||||
BtnStartCover.Visibility = Visibility.Collapsed;
|
||||
BorderStopTime.Visibility = Visibility.Collapsed;
|
||||
TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F"));
|
||||
FontIconStart.Glyph = "";
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Play;
|
||||
isTimerRunning = false;
|
||||
timer.Stop();
|
||||
isPaused = false;
|
||||
@@ -287,7 +283,7 @@ namespace Ink_Canvas
|
||||
startTime += DateTime.Now - pauseTime;
|
||||
ProcessBarTime.IsPaused = false;
|
||||
TextBlockHour.Foreground = Brushes.Black;
|
||||
FontIconStart.Glyph = "";
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Pause;
|
||||
isPaused = false;
|
||||
timer.Start();
|
||||
UpdateStopTime();
|
||||
@@ -299,7 +295,7 @@ namespace Ink_Canvas
|
||||
pauseTime = DateTime.Now;
|
||||
ProcessBarTime.IsPaused = true;
|
||||
TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F"));
|
||||
FontIconStart.Glyph = "";
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Play;
|
||||
BorderStopTime.Visibility = Visibility.Collapsed;
|
||||
isPaused = true;
|
||||
timer.Stop();
|
||||
@@ -311,7 +307,7 @@ namespace Ink_Canvas
|
||||
totalSeconds = ((hour * 60) + minute) * 60 + second;
|
||||
ProcessBarTime.IsPaused = false;
|
||||
TextBlockHour.Foreground = Brushes.Black;
|
||||
FontIconStart.Glyph = "";
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Pause;
|
||||
BtnResetCover.Visibility = Visibility.Collapsed;
|
||||
|
||||
if (totalSeconds <= 10)
|
||||
@@ -339,7 +335,7 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, CancelEventArgs e)
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
isTimerRunning = false;
|
||||
}
|
||||
@@ -349,7 +345,7 @@ namespace Ink_Canvas
|
||||
Close();
|
||||
}
|
||||
|
||||
private bool _isInCompact;
|
||||
private bool _isInCompact = false;
|
||||
|
||||
private void BtnMinimal_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
@@ -363,13 +359,12 @@ namespace Ink_Canvas
|
||||
// Set to center
|
||||
double dpiScaleX = 1, dpiScaleY = 1;
|
||||
PresentationSource source = PresentationSource.FromVisual(this);
|
||||
if (source != null)
|
||||
{
|
||||
if (source != null) {
|
||||
dpiScaleX = source.CompositionTarget.TransformToDevice.M11;
|
||||
dpiScaleY = source.CompositionTarget.TransformToDevice.M22;
|
||||
}
|
||||
IntPtr windowHandle = new WindowInteropHelper(this).Handle;
|
||||
Screen screen = Screen.FromHandle(windowHandle);
|
||||
System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.FromHandle(windowHandle);
|
||||
double screenWidth = screen.Bounds.Width / dpiScaleX, screenHeight = screen.Bounds.Height / dpiScaleY;
|
||||
Left = (screenWidth / 2) - (Width / 2);
|
||||
Top = (screenHeight / 2) - (Height / 2);
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
</Viewbox>
|
||||
</ui:SimpleStackPanel>
|
||||
</ScrollViewer>
|
||||
<Viewbox Margin="20,20,20,20" HorizontalAlignment="Right">
|
||||
<Viewbox Visibility="{Binding ElementName=BigViewController, Path=Visibility}" Margin="20,20,20,20" HorizontalAlignment="Right">
|
||||
<ui:SimpleStackPanel Height="180" Orientation="Horizontal">
|
||||
<Border x:Name="BtnFullscreen" MouseUp="BtnFullscreen_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
Margin="5"
|
||||
@@ -80,7 +80,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<TextBlock Name="FontIconFullscreen" Text="" Foreground="Black" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
<ui:SymbolIcon Name="SymbolIconFullscreen" Symbol="FullScreen" Foreground="Black"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnClose" MouseUp="BtnClose_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
@@ -90,7 +90,7 @@
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<TextBlock Text="" Foreground="White" FontFamily="Segoe MDL2 Assets" FontSize="12" />
|
||||
<ui:SymbolIcon Symbol="Clear" Foreground="White"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
@@ -25,22 +25,17 @@ namespace Ink_Canvas
|
||||
if (e.LeftButton == MouseButtonState.Pressed) DragMove();
|
||||
}
|
||||
|
||||
private void BtnFullscreen_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (WindowState == WindowState.Normal)
|
||||
{
|
||||
private void BtnFullscreen_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (WindowState == WindowState.Normal) {
|
||||
WindowState = WindowState.Maximized;
|
||||
FontIconFullscreen.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
SymbolIconFullscreen.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.BackToWindow;
|
||||
} else {
|
||||
WindowState = WindowState.Normal;
|
||||
FontIconFullscreen.Text = "";
|
||||
SymbolIconFullscreen.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.FullScreen;
|
||||
}
|
||||
}
|
||||
|
||||
private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e)
|
||||
{
|
||||
private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e) {
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user