提交初始文件
This commit is contained in:
@@ -0,0 +1,246 @@
|
||||
<Window x:Class="Ink_Canvas.CountdownTimerWindow"
|
||||
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:Ink_Canvas"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:processbars="clr-namespace:Ink_Canvas.ProcessBars"
|
||||
ui:ThemeManager.RequestedTheme="Light" Topmost="True" Background="Transparent"
|
||||
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True"
|
||||
Loaded="Window_Loaded" Closing="Window_Closing" WindowStartupLocation="CenterScreen"
|
||||
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" />
|
||||
<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">
|
||||
<processbars:CycleProcessBar x:Name="ProcessBarTime" CurrentValue="0" Width="150" VerticalAlignment="Top"/>
|
||||
<ui:SimpleStackPanel MouseMove="WindowDragMove" Orientation="Horizontal" Height="28.5" Margin="0,0,0,25"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock Name="TextBlockHour" FontFamily="Segeo UI"
|
||||
Margin="0,0,0,0" Visibility="Collapsed"
|
||||
Foreground="#5B5D5F"
|
||||
Text="00" FontSize="26"/>
|
||||
<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">
|
||||
<TextBlock Text="+5" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click">
|
||||
<TextBlock Text="+1" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Spacing="2" VerticalAlignment="Bottom">
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_2">
|
||||
<TextBlock Text="-1" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_3">
|
||||
<TextBlock Text="-5" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</ui:SimpleStackPanel>
|
||||
</Grid>
|
||||
<TextBlock Text=":"
|
||||
FontFamily="{Binding ElementName=TextBlockHour, Path=FontFamily}"
|
||||
Margin="0,-2.5,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{Binding ElementName=TextBlockHour, Path=Foreground}"
|
||||
FontSize="{Binding ElementName=TextBlockHour, Path=FontSize}"
|
||||
FontWeight="DemiBold"/>
|
||||
<TextBlock Name="TextBlockMinute" FontFamily="{Binding ElementName=TextBlockHour, Path=FontFamily}"
|
||||
Margin="0,0,0,0" Visibility="Collapsed"
|
||||
Foreground="{Binding ElementName=TextBlockHour, Path=Foreground}"
|
||||
Text="01" FontSize="26"/>
|
||||
<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">
|
||||
<TextBlock Text="+5" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_4">
|
||||
<TextBlock Text="+1" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Spacing="2" VerticalAlignment="Bottom">
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_6">
|
||||
<TextBlock Text="-1" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_7">
|
||||
<TextBlock Text="-5" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</ui:SimpleStackPanel>
|
||||
<Border x:Name="BtnTimeSetOkay" MouseUp="Grid_MouseUp"
|
||||
Background="#0066BF"
|
||||
Height="20" Width="20"
|
||||
CornerRadius="100"
|
||||
VerticalAlignment="Bottom" Margin="0,0,0,-35">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:SymbolIcon Symbol="Save" Foreground="White"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock Text=":"
|
||||
FontFamily="{Binding ElementName=TextBlockHour, Path=FontFamily}"
|
||||
Margin="0,-2.5,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{Binding ElementName=TextBlockHour, Path=Foreground}"
|
||||
FontSize="{Binding ElementName=TextBlockHour, Path=FontSize}"
|
||||
FontWeight="DemiBold"/>
|
||||
<TextBlock Name="TextBlockSecond" FontFamily="{Binding ElementName=TextBlockHour, Path=FontFamily}"
|
||||
Margin="0,0,0,0" Visibility="Collapsed"
|
||||
Foreground="{Binding ElementName=TextBlockHour, Path=Foreground}"
|
||||
Text="00" FontSize="26"/>
|
||||
<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">
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_8">
|
||||
<TextBlock Text="+5" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_9">
|
||||
<TextBlock Text="+1" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Spacing="2" VerticalAlignment="Bottom">
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_10">
|
||||
<TextBlock Text="-1" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
<Button Height="13" Width="{Binding ElementName=GridAdjustHour, Path=ActualWidth}" Click="Button_Click_11">
|
||||
<TextBlock Text="-5" Margin="-10" FontSize="8" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Button>
|
||||
</ui:SimpleStackPanel>
|
||||
</Grid>
|
||||
</ui:SimpleStackPanel>
|
||||
<Border x:Name="BorderStopTime" Background="#E8EAF0" Margin="0,23,0,0"
|
||||
Height="18" CornerRadius="9"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<ui:SimpleStackPanel Margin="6,0" Spacing="0" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Image Margin="0,0,2,0" Source="/Resources/Icons-Fluent/ic_fluent_clock_24_regular.png" RenderOptions.BitmapScalingMode="HighQuality" Height="10" Width="10"/>
|
||||
<TextBlock Name="TextBlockStopTime" Text="12:30 PM" FontSize="9" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
<ui:SimpleStackPanel Visibility="{Binding ElementName=ProcessBarTime, Path=Visibility}" Spacing="10" Orientation="Horizontal" Height="30" HorizontalAlignment="Center" VerticalAlignment="Bottom">
|
||||
<Grid>
|
||||
<Border x:Name="BtnStart" MouseUp="BtnStart_MouseUp" Background="#0066BF" Height="20" Width="20" CornerRadius="100">
|
||||
<Viewbox Margin="5">
|
||||
<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:SymbolIcon Symbol="{Binding ElementName=SymbolIconStart, Path=Symbol}" Foreground="White"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Border x:Name="BtnReset" MouseUp="BtnReset_MouseUp" Background="#FBFBFD" Height="20" Width="20" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.15" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<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:SymbolIcon Symbol="Refresh" Foreground="#9D9D9E"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ui:SimpleStackPanel>
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
<Viewbox Visibility="{Binding ElementName=BigViewController, Path=Visibility}" Margin="20,20,20,20" HorizontalAlignment="Right">
|
||||
<ui:SimpleStackPanel Height="180" Orientation="Horizontal">
|
||||
<Border x:Name="BtnMinimal" Visibility="{Binding ElementName=BorderStopTime, Path=Visibility}" MouseUp="BtnMinimal_OnMouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
Margin="5"
|
||||
Background="#FBFBFD" Height="20" Width="20" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:SymbolIcon Name="SymbolIconMinimal" Symbol="HideBcc" Foreground="Black"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnFullscreen" MouseUp="BtnFullscreen_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
Margin="5"
|
||||
Background="#FBFBFD" Height="20" Width="20" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:SymbolIcon Name="SymbolIconFullscreen" Symbol="FullScreen" Foreground="Black"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnClose" MouseUp="BtnClose_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
Margin="5"
|
||||
Background="#E32A34" Height="20" Width="20" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:SymbolIcon Symbol="Clear" Foreground="White"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
</Viewbox>
|
||||
<MediaElement Visibility="Collapsed" HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="100"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -0,0 +1,393 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using System;
|
||||
using System.Media;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for StopwatchWindow.xaml
|
||||
/// </summary>
|
||||
public partial class CountdownTimerWindow : Window
|
||||
{
|
||||
public CountdownTimerWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
|
||||
|
||||
timer.Elapsed += Timer_Elapsed;
|
||||
timer.Interval = 50;
|
||||
}
|
||||
|
||||
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
if (!isTimerRunning || isPaused)
|
||||
{
|
||||
timer.Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
TimeSpan timeSpan = DateTime.Now - startTime;
|
||||
TimeSpan totalTimeSpan = new TimeSpan(hour, minute, second);
|
||||
TimeSpan leftTimeSpan = totalTimeSpan - timeSpan;
|
||||
if (leftTimeSpan.Milliseconds > 0) leftTimeSpan += new TimeSpan(0, 0, 1);
|
||||
double spentTimePercent = timeSpan.TotalMilliseconds / (totalSeconds * 1000.0);
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
ProcessBarTime.CurrentValue = 1 - spentTimePercent;
|
||||
TextBlockHour.Text = leftTimeSpan.Hours.ToString("00");
|
||||
TextBlockMinute.Text = leftTimeSpan.Minutes.ToString("00");
|
||||
TextBlockSecond.Text = leftTimeSpan.Seconds.ToString("00");
|
||||
TbCurrentTime.Text = leftTimeSpan.ToString(@"hh\:mm\:ss");
|
||||
if (spentTimePercent >= 1)
|
||||
{
|
||||
ProcessBarTime.CurrentValue = 0;
|
||||
TextBlockHour.Text = "00";
|
||||
TextBlockMinute.Text = "00";
|
||||
TextBlockSecond.Text = "00";
|
||||
timer.Stop();
|
||||
isTimerRunning = false;
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Play;
|
||||
BtnStartCover.Visibility = Visibility.Visible;
|
||||
TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F"));
|
||||
BorderStopTime.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
});
|
||||
if (spentTimePercent >= 1)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
//Play sound
|
||||
player.Stream = Properties.Resources.TimerDownNotice;
|
||||
player.Play();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
SoundPlayer player = new SoundPlayer();
|
||||
|
||||
int hour = 0;
|
||||
int minute = 1;
|
||||
int second = 0;
|
||||
int totalSeconds = 60;
|
||||
|
||||
DateTime startTime = DateTime.Now;
|
||||
DateTime pauseTime = DateTime.Now;
|
||||
|
||||
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 == false)
|
||||
{
|
||||
ProcessBarTime.Visibility = Visibility.Collapsed;
|
||||
GridAdjustHour.Visibility = Visibility.Visible;
|
||||
TextBlockHour.Foreground = Brushes.Black;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessBarTime.Visibility = Visibility.Visible;
|
||||
GridAdjustHour.Visibility = Visibility.Collapsed;
|
||||
TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F"));
|
||||
|
||||
if (hour == 0 && minute == 0 && second == 0)
|
||||
{
|
||||
second = 1;
|
||||
TextBlockSecond.Text = second.ToString("00");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
hour++;
|
||||
if (hour >= 100) hour = 0;
|
||||
TextBlockHour.Text = hour.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
hour += 5;
|
||||
if (hour >= 100) hour = 0;
|
||||
TextBlockHour.Text = hour.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||
{
|
||||
hour--;
|
||||
if (hour < 0) hour = 99;
|
||||
TextBlockHour.Text = hour.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_3(object sender, RoutedEventArgs e)
|
||||
{
|
||||
hour -= 5;
|
||||
if (hour < 0) hour = 99;
|
||||
TextBlockHour.Text = hour.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_4(object sender, RoutedEventArgs e)
|
||||
{
|
||||
minute++;
|
||||
if (minute >= 60) minute = 0;
|
||||
TextBlockMinute.Text = minute.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_5(object sender, RoutedEventArgs e)
|
||||
{
|
||||
minute += 5;
|
||||
if (minute >= 60) minute = 0;
|
||||
TextBlockMinute.Text = minute.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_6(object sender, RoutedEventArgs e)
|
||||
{
|
||||
minute--;
|
||||
if (minute < 0) minute = 59;
|
||||
TextBlockMinute.Text = minute.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_7(object sender, RoutedEventArgs e)
|
||||
{
|
||||
minute -= 5;
|
||||
if (minute < 0) minute = 59;
|
||||
TextBlockMinute.Text = minute.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_8(object sender, RoutedEventArgs e)
|
||||
{
|
||||
second += 5;
|
||||
if (second >= 60) second = 0;
|
||||
TextBlockSecond.Text = second.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_9(object sender, RoutedEventArgs e)
|
||||
{
|
||||
second++;
|
||||
if (second >= 60) second = 0;
|
||||
TextBlockSecond.Text = second.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_10(object sender, RoutedEventArgs e)
|
||||
{
|
||||
second--;
|
||||
if (second < 0) second = 59;
|
||||
TextBlockSecond.Text = second.ToString("00");
|
||||
}
|
||||
|
||||
private void Button_Click_11(object sender, RoutedEventArgs e)
|
||||
{
|
||||
second -= 5;
|
||||
if (second < 0) second = 59;
|
||||
TextBlockSecond.Text = second.ToString("00");
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ProcessBarTime.Visibility = Visibility.Visible;
|
||||
GridAdjustHour.Visibility = Visibility.Collapsed;
|
||||
BorderStopTime.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void BtnFullscreen_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (WindowState == WindowState.Normal)
|
||||
{
|
||||
WindowState = WindowState.Maximized;
|
||||
SymbolIconFullscreen.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.BackToWindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowState = WindowState.Normal;
|
||||
SymbolIconFullscreen.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.FullScreen;
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnReset_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!isTimerRunning)
|
||||
{
|
||||
TextBlockHour.Text = hour.ToString("00");
|
||||
TextBlockMinute.Text = minute.ToString("00");
|
||||
TextBlockSecond.Text = second.ToString("00");
|
||||
BtnResetCover.Visibility = Visibility.Visible;
|
||||
BtnStartCover.Visibility = Visibility.Collapsed;
|
||||
BorderStopTime.Visibility = Visibility.Collapsed;
|
||||
TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F"));
|
||||
return;
|
||||
}
|
||||
else if (isTimerRunning && isPaused)
|
||||
{
|
||||
TextBlockHour.Text = hour.ToString("00");
|
||||
TextBlockMinute.Text = minute.ToString("00");
|
||||
TextBlockSecond.Text = second.ToString("00");
|
||||
BtnResetCover.Visibility = Visibility.Visible;
|
||||
BtnStartCover.Visibility = Visibility.Collapsed;
|
||||
BorderStopTime.Visibility = Visibility.Collapsed;
|
||||
TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F"));
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Play;
|
||||
isTimerRunning = false;
|
||||
timer.Stop();
|
||||
isPaused = false;
|
||||
ProcessBarTime.CurrentValue = 0;
|
||||
ProcessBarTime.IsPaused = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateStopTime();
|
||||
startTime = DateTime.Now;
|
||||
Timer_Elapsed(timer, null);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateStopTime()
|
||||
{
|
||||
TimeSpan totalTimeSpan = new TimeSpan(hour, minute, second);
|
||||
TextBlockStopTime.Text = (startTime + totalTimeSpan).ToString("t");
|
||||
}
|
||||
|
||||
private Color StringToColor(string colorStr)
|
||||
{
|
||||
Byte[] argb = new Byte[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
char[] charArray = colorStr.Substring(i * 2 + 1, 2).ToCharArray();
|
||||
//string str = "11";
|
||||
Byte b1 = toByte(charArray[0]);
|
||||
Byte b2 = toByte(charArray[1]);
|
||||
argb[i] = (Byte)(b2 | (b1 << 4));
|
||||
}
|
||||
|
||||
return Color.FromArgb(argb[0], argb[1], argb[2], argb[3]); //#FFFFFFFF
|
||||
}
|
||||
|
||||
private static byte toByte(char c)
|
||||
{
|
||||
byte b = (byte)"0123456789ABCDEF".IndexOf(c);
|
||||
return b;
|
||||
}
|
||||
|
||||
private void BtnStart_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (isPaused && isTimerRunning)
|
||||
{
|
||||
//继续
|
||||
startTime += DateTime.Now - pauseTime;
|
||||
ProcessBarTime.IsPaused = false;
|
||||
TextBlockHour.Foreground = Brushes.Black;
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Pause;
|
||||
isPaused = false;
|
||||
timer.Start();
|
||||
UpdateStopTime();
|
||||
BorderStopTime.Visibility = Visibility.Visible;
|
||||
}
|
||||
else if (isTimerRunning)
|
||||
{
|
||||
//暂停
|
||||
pauseTime = DateTime.Now;
|
||||
ProcessBarTime.IsPaused = true;
|
||||
TextBlockHour.Foreground = new SolidColorBrush(StringToColor("#FF5B5D5F"));
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Play;
|
||||
BorderStopTime.Visibility = Visibility.Collapsed;
|
||||
isPaused = true;
|
||||
timer.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
//从头开始
|
||||
startTime = DateTime.Now;
|
||||
totalSeconds = ((hour * 60) + minute) * 60 + second;
|
||||
ProcessBarTime.IsPaused = false;
|
||||
TextBlockHour.Foreground = Brushes.Black;
|
||||
SymbolIconStart.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Pause;
|
||||
BtnResetCover.Visibility = Visibility.Collapsed;
|
||||
|
||||
if (totalSeconds <= 10)
|
||||
{
|
||||
timer.Interval = 20;
|
||||
}
|
||||
else if (totalSeconds <= 60)
|
||||
{
|
||||
timer.Interval = 30;
|
||||
}
|
||||
else if (totalSeconds <= 120)
|
||||
{
|
||||
timer.Interval = 50;
|
||||
}
|
||||
else
|
||||
{
|
||||
timer.Interval = 100;
|
||||
}
|
||||
|
||||
isPaused = false;
|
||||
isTimerRunning = true;
|
||||
timer.Start();
|
||||
UpdateStopTime();
|
||||
BorderStopTime.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
isTimerRunning = false;
|
||||
}
|
||||
|
||||
private void BtnClose_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private bool _isInCompact = false;
|
||||
|
||||
private void BtnMinimal_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (_isInCompact)
|
||||
{
|
||||
Width = 1100;
|
||||
Height = 700;
|
||||
BigViewController.Visibility = Visibility.Visible;
|
||||
TbCurrentTime.Visibility = Visibility.Collapsed;
|
||||
|
||||
// Set to center
|
||||
double dpiScaleX = 1, dpiScaleY = 1;
|
||||
PresentationSource source = PresentationSource.FromVisual(this);
|
||||
if (source != null) {
|
||||
dpiScaleX = source.CompositionTarget.TransformToDevice.M11;
|
||||
dpiScaleY = source.CompositionTarget.TransformToDevice.M22;
|
||||
}
|
||||
IntPtr windowHandle = new WindowInteropHelper(this).Handle;
|
||||
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);
|
||||
Left = (screenWidth / 2) - (Width / 2);
|
||||
Top = (screenHeight / 2) - (Height / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WindowState == WindowState.Maximized) WindowState = WindowState.Normal;
|
||||
Width = 400;
|
||||
Height = 250;
|
||||
BigViewController.Visibility = Visibility.Collapsed;
|
||||
TbCurrentTime.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
_isInCompact = !_isInCompact;
|
||||
}
|
||||
|
||||
private void WindowDragMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
DragMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<UserControl x:Class="Ink_Canvas.ProcessBars.CycleProcessBar"
|
||||
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:Ink_Canvas.ProcessBars"
|
||||
mc:Ignorable="d" >
|
||||
<Viewbox>
|
||||
<Grid Width="34" Height="34">
|
||||
<Path Data="M17,3A14,14,0,1,1,16.999,3z" Stroke="#EAEAEA" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5" Height="34" Width="34" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<Path Name="myCycleProcessBar" Data="M17,3 A14,14 0 0 1 16,3 " Stroke="#0066BF" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeThickness="1.5" Height="34" Width="34" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
<Label Name="lbValue" Content="50%" HorizontalAlignment="Center" Visibility="Hidden" VerticalAlignment="Center" FontSize="9" />
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,204 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas.ProcessBars
|
||||
{
|
||||
/// <summary>
|
||||
/// CycleProcessBar1.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CycleProcessBar : UserControl
|
||||
{
|
||||
public CycleProcessBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
IsPaused = false;
|
||||
}
|
||||
|
||||
public bool IsPaused
|
||||
{
|
||||
set { SetRingColor(value); }
|
||||
}
|
||||
|
||||
private void SetRingColor(bool isPaused)
|
||||
{
|
||||
if (isPaused)
|
||||
{
|
||||
myCycleProcessBar.Stroke = new SolidColorBrush(StringToColor("#FF1A71C8"));
|
||||
}
|
||||
else
|
||||
{
|
||||
myCycleProcessBar.Stroke = new SolidColorBrush(StringToColor("#FF0067C1"));
|
||||
}
|
||||
}
|
||||
|
||||
private Color StringToColor(string colorStr)
|
||||
{
|
||||
Byte[] argb = new Byte[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
char[] charArray = colorStr.Substring(i * 2 + 1, 2).ToCharArray();
|
||||
//string str = "11";
|
||||
Byte b1 = toByte(charArray[0]);
|
||||
Byte b2 = toByte(charArray[1]);
|
||||
argb[i] = (Byte)(b2 | (b1 << 4));
|
||||
}
|
||||
return Color.FromArgb(argb[0], argb[1], argb[2], argb[3]);//#FFFFFFFF
|
||||
}
|
||||
|
||||
private static byte toByte(char c)
|
||||
{
|
||||
byte b = (byte)"0123456789ABCDEF".IndexOf(c);
|
||||
return b;
|
||||
}
|
||||
|
||||
public double CurrentValue
|
||||
{
|
||||
set { SetValue(value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置百分百,输入小数,自动乘100
|
||||
/// </summary>
|
||||
/// <param name="percentValue"></param>
|
||||
private void SetValue(double percentValue)
|
||||
{
|
||||
/*****************************************
|
||||
方形矩阵边长为34,半长为17
|
||||
环形半径为14,所以距离边框3个像素
|
||||
环形描边3个像素
|
||||
******************************************/
|
||||
double angel = percentValue * 360; //角度
|
||||
|
||||
double radius = 14; //环形半径
|
||||
|
||||
//起始点
|
||||
double leftStart = 17;
|
||||
double topStart = 3;
|
||||
|
||||
//结束点
|
||||
double endLeft = 0;
|
||||
double endTop = 0;
|
||||
|
||||
if (percentValue == 0) myCycleProcessBar.Visibility = Visibility.Hidden;
|
||||
else myCycleProcessBar.Visibility = Visibility.Visible;
|
||||
|
||||
|
||||
//数字显示
|
||||
lbValue.Content = (percentValue * 100).ToString("0") + "%";
|
||||
|
||||
/***********************************************
|
||||
* 整个环形进度条使用Path来绘制,采用三角函数来计算
|
||||
* 环形根据角度来分别绘制,以90度划分,方便计算比例
|
||||
***********************************************/
|
||||
|
||||
bool isLagreCircle = false; //是否优势弧,即大于180度的弧形
|
||||
|
||||
//小于90度
|
||||
if (angel <= 90)
|
||||
{
|
||||
/*****************
|
||||
*
|
||||
* *
|
||||
* * ra
|
||||
* * * * * * * * *
|
||||
*
|
||||
*
|
||||
*
|
||||
******************/
|
||||
double ra = (90 - angel) * Math.PI / 180; //弧度
|
||||
endLeft = leftStart + Math.Cos(ra) * radius; //余弦横坐标
|
||||
endTop = topStart + radius - Math.Sin(ra) * radius; //正弦纵坐标
|
||||
}
|
||||
|
||||
else if (angel <= 180)
|
||||
{
|
||||
/*****************
|
||||
*
|
||||
*
|
||||
*
|
||||
* * * * * * * * *
|
||||
* * ra
|
||||
* *
|
||||
* *
|
||||
******************/
|
||||
|
||||
double ra = (angel - 90) * Math.PI / 180; //弧度
|
||||
endLeft = leftStart + Math.Cos(ra) * radius; //余弦横坐标
|
||||
endTop = topStart + radius + Math.Sin(ra) * radius;//正弦纵坐标
|
||||
}
|
||||
|
||||
else if (angel <= 270)
|
||||
{
|
||||
/*****************
|
||||
*
|
||||
*
|
||||
*
|
||||
* * * * * * * * *
|
||||
* *
|
||||
*ra*
|
||||
* *
|
||||
******************/
|
||||
isLagreCircle = true; //优势弧
|
||||
double ra = (angel - 180) * Math.PI / 180;
|
||||
endLeft = leftStart - Math.Sin(ra) * radius;
|
||||
endTop = topStart + radius + Math.Cos(ra) * radius;
|
||||
}
|
||||
|
||||
else if (angel < 360)
|
||||
{
|
||||
/*****************
|
||||
* *
|
||||
* *
|
||||
ra * *
|
||||
* * * * * * * * *
|
||||
*
|
||||
*
|
||||
*
|
||||
******************/
|
||||
isLagreCircle = true; //优势弧
|
||||
double ra = (angel - 270) * Math.PI / 180;
|
||||
endLeft = leftStart - Math.Cos(ra) * radius;
|
||||
endTop = topStart + radius - Math.Sin(ra) * radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
isLagreCircle = true; //优势弧
|
||||
endLeft = leftStart - 0.001; //不与起点在同一点,避免重叠绘制出非环形
|
||||
endTop = topStart;
|
||||
}
|
||||
|
||||
Point arcEndPt = new Point(endLeft, endTop); //结束点
|
||||
Size arcSize = new Size(radius, radius);
|
||||
SweepDirection direction = SweepDirection.Clockwise; //顺时针弧形
|
||||
//弧形
|
||||
ArcSegment arcsegment = new ArcSegment(arcEndPt, arcSize, 0, isLagreCircle, direction, true);
|
||||
|
||||
//形状集合
|
||||
PathSegmentCollection pathsegmentCollection = new PathSegmentCollection();
|
||||
pathsegmentCollection.Add(arcsegment);
|
||||
|
||||
//路径描述
|
||||
PathFigure pathFigure = new PathFigure();
|
||||
pathFigure.StartPoint = new Point(leftStart, topStart); //起始地址
|
||||
pathFigure.Segments = pathsegmentCollection;
|
||||
|
||||
//路径描述集合
|
||||
PathFigureCollection pathFigureCollection = new PathFigureCollection();
|
||||
pathFigureCollection.Add(pathFigure);
|
||||
|
||||
//复杂形状
|
||||
PathGeometry pathGeometry = new PathGeometry();
|
||||
pathGeometry.Figures = pathFigureCollection;
|
||||
|
||||
//Data赋值
|
||||
myCycleProcessBar.Data = pathGeometry;
|
||||
//达到100%则闭合整个
|
||||
if (angel == 360)
|
||||
{
|
||||
myCycleProcessBar.Data = Geometry.Parse(myCycleProcessBar.Data.ToString() + " z");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<Window x:Class="Ink_Canvas.HasNewUpdateWindow"
|
||||
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:Ink_Canvas"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml"
|
||||
mc:Ignorable="d"
|
||||
ui:WindowHelper.UseModernWindowStyle = "True"
|
||||
ui:WindowHelper.SystemBackdropType="Mica"
|
||||
ui:TitleBar.Height="36"
|
||||
Title="InkCanvasForClass有新版本可用" Height="475" Width="800" ResizeMode="NoResize">
|
||||
<Grid Background="#fafafa">
|
||||
<ui:SimpleStackPanel VerticalAlignment="Stretch" Spacing="0">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Background="#2563eb" Margin="0,0,0,0">
|
||||
<ui:SimpleStackPanel Orientation="Vertical" Width="685" Margin="24,18,0,12" Spacing="2">
|
||||
<TextBlock Text="InkCanvasForClass 新版本来了!" FontSize="24" FontWeight="Bold" Foreground="White" TextAlignment="Left"/>
|
||||
<TextBlock Text="希望您能喜欢我们的新版本 :-)" FontSize="20" TextAlignment="Left" Foreground="White"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<Image Source="/Resources/Icons-fluent/party.png" Width="72" Height="72"/>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
<Border BorderBrush="#3f3f46" Background="White" BorderThickness="1" CornerRadius="4" Margin="24,12,24,0">
|
||||
<ui:ScrollViewerEx Margin="0" VerticalScrollBarVisibility="Auto" Height="256" PanningMode="VerticalOnly">
|
||||
<mdxam:MarkdownScrollViewer xml:space="preserve" Foreground="Black" MarkdownStyleName="GithubLike">
|
||||
# InkCanvasForClass v5.0.2更新
|
||||
|
||||
你好,旅行者们,本次InkCanvasForClass更新带来了如下新功能供您探索:
|
||||
|
||||
1. 全新设计的UI界面,包括浮动工具栏和白板页面均经过重新设计,更加现代化的UI让您在使用的过程中更加舒适。
|
||||
2. 带来了实时修改橡皮大小和橡皮形状的菜单。您可以选择使用圆形橡皮,方形橡皮,和类似希沃白板的真实黑板擦(矩形)橡皮。
|
||||
3. 白板页面支持显示当前时间和日期
|
||||
4. 自动收纳新增对希沃轻白板、智绘教、鸿合屏幕书写等软件的支持,自动查杀新增对鸿合屏幕书写、希沃轻白板等软件的支持。
|
||||
5. 为设置界面重写了全新的UI。
|
||||
6. 重写了随机抽选模块,现在支持更丰富的抽选机制和自定义选项。
|
||||
7. 修复了部分小Bug,提升了整体的用户体验。
|
||||
8. 带来了基于FitToCurve的笔迹平滑,基于贝塞尔曲线平滑,让墨迹线条更加优美好看。
|
||||
</mdxam:MarkdownScrollViewer>
|
||||
</ui:ScrollViewerEx>
|
||||
</Border>
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="12" Margin="0,8,0,0">
|
||||
<TextBlock Text="本次更新: 4.9.1 -> 5.9.1" FontWeight="Bold" FontSize="14" TextAlignment="Center"/>
|
||||
<TextBlock Text="2024年8月4日发布更新" FontSize="14" TextAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="12">
|
||||
<Button Content="立刻更新" Foreground="White" HorizontalAlignment="Center" Margin="0,10,0,0">
|
||||
<Button.Resources>
|
||||
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundKey}" Color="#15803d"/>
|
||||
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPointerOverKey}" Color="#15803d"/>
|
||||
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPressedKey}" Color="#166534"/>
|
||||
</Button.Resources>
|
||||
</Button>
|
||||
<Button Content="下次更新" Foreground="Black" HorizontalAlignment="Center" Margin="0,10,0,0"/>
|
||||
<Button Content="跳过该版本" HorizontalAlignment="Center" Foreground="#71717a" Margin="0,10,0,0"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,66 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
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.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
/// <summary>
|
||||
/// HasNewUpdateWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
///
|
||||
|
||||
|
||||
public partial class HasNewUpdateWindow : Window
|
||||
{
|
||||
|
||||
[DllImport("dwmapi.dll")]
|
||||
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
|
||||
|
||||
private const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;
|
||||
private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;
|
||||
|
||||
private static bool UseImmersiveDarkMode(IntPtr handle, bool enabled)
|
||||
{
|
||||
if (IsWindows10OrGreater(17763))
|
||||
{
|
||||
var attribute = DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1;
|
||||
if (IsWindows10OrGreater(18985))
|
||||
{
|
||||
attribute = DWMWA_USE_IMMERSIVE_DARK_MODE;
|
||||
}
|
||||
|
||||
int useImmersiveDarkMode = enabled ? 1 : 0;
|
||||
return DwmSetWindowAttribute(handle, (int)attribute, ref useImmersiveDarkMode, sizeof(int)) == 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsWindows10OrGreater(int build = -1)
|
||||
{
|
||||
return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= build;
|
||||
}
|
||||
public HasNewUpdateWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
AnimationsHelper.ShowWithFadeIn(this, 0.25);
|
||||
Trace.WriteLine(new WindowInteropHelper(this).Handle);
|
||||
UseImmersiveDarkMode(new WindowInteropHelper(this).Handle, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<Window x:Class="Ink_Canvas.NamesInputWindow"
|
||||
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:Ink_Canvas"
|
||||
mc:Ignorable="d" FontFamily="Microsoft YaHei UI" ui:WindowHelper.UseModernWindowStyle="True"
|
||||
ui:ThemeManager.RequestedTheme="Light" WindowStartupLocation="CenterScreen"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" Topmost="True"
|
||||
Title="Ink Canvas 抽奖 - 名单导入" Height="500" Width="400"
|
||||
Loaded="Window_Loaded" Closing="Window_Closing">
|
||||
<Grid>
|
||||
<Label Content="请在下方输入名单,每行一人(建议直接粘贴表格姓名列)" Margin="10"/>
|
||||
<TextBox Name="TextBoxNames" FontFamily="Microsoft YaHei UI" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" Margin="10,40,10,50" />
|
||||
<Button Margin="10" VerticalAlignment="Bottom" HorizontalAlignment="Right"
|
||||
Content="关闭" FontFamily="Microsoft YaHei UI"
|
||||
Width="100" Click="Button_Click"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,46 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for NamesInputWindow.xaml
|
||||
/// </summary>
|
||||
public partial class NamesInputWindow : Window
|
||||
{
|
||||
public NamesInputWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
|
||||
}
|
||||
|
||||
string originText = "";
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (File.Exists(App.RootPath + "Names.txt"))
|
||||
{
|
||||
TextBoxNames.Text = File.ReadAllText(App.RootPath + "Names.txt");
|
||||
originText = TextBoxNames.Text;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (originText != TextBoxNames.Text)
|
||||
{
|
||||
var result = MessageBox.Show("是否保存?", "名单导入", MessageBoxButton.YesNo);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
File.WriteAllText(App.RootPath + "Names.txt", TextBoxNames.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<Window x:Class="Ink_Canvas.OperatingGuideWindow"
|
||||
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:Ink_Canvas"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
ui:ThemeManager.RequestedTheme="Light" Topmost="True" Background="Transparent"
|
||||
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Title="Ink Canvas Annotation 使用指南"
|
||||
Height="600" Width="500">
|
||||
<Border Background="#F0F3F9" CornerRadius="10" BorderThickness="1" BorderBrush="#0066BF" Margin="10,10,10,50">
|
||||
<Grid>
|
||||
<Border MouseMove="WindowDragMove" Visibility="Visible" Width="64" Height="15" CornerRadius="8" Background="Gray" Margin="0,0,0,5" HorizontalAlignment="Center" VerticalAlignment="Bottom" />
|
||||
<ScrollViewer Margin="0,0,0,30" VerticalScrollBarVisibility="Auto"
|
||||
PanningMode="VerticalOnly" ui:ThemeManager.RequestedTheme="Light"
|
||||
ManipulationBoundaryFeedback="SCManipulationBoundaryFeedback">
|
||||
<ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20,20,20,0" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<Image Margin="5, 0" Source="/Resources/Icons-Fluent/ic_fluent_keyboard_24_regular.png"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" Height="40" Width="40"/>
|
||||
<TextBlock FontSize="22" Text="软件快捷键" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
|
||||
<Viewbox Height="320" HorizontalAlignment="Left">
|
||||
<ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-Fluent/ic_fluent_control_button_24_regular.png"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20"/>
|
||||
<TextBlock FontSize="10" Text=" + Z —— 撤销" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-Fluent/ic_fluent_control_button_24_regular.png"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20"/>
|
||||
<TextBlock FontSize="10" Text=" + Y —— 重做" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<Image Source="/Resources/Icons-Fluent/ic_fluent_control_button_24_regular.png"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" Height="20" Width="20"/>
|
||||
<TextBlock FontSize="10" Text=" + E —— 清屏" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock FontSize="10" Text=" Alt + V —— 显示/隐藏笑脸右侧工具栏(Visibility)" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock FontSize="10" Text=" Alt + C —— 截屏(Capture)" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock FontSize="10" Text=" Alt + S —— 切换至选择模式(Select)" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock FontSize="10" Text=" Alt + D —— 切换至批注模式 / 墨迹颜色选择器(Draw)" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock FontSize="10" Text=" Alt + Q —— 退出批注模式(Quit)" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock FontSize="10" Text=" Alt + B —— 切换/退出画板模式(Board)" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock FontSize="10" Text=" Alt + E —— 切换至面积擦/墨迹擦功能(Eraser)" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock FontSize="10" Text=" Alt + L —— 切换至单次直线绘制功能(Line)" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Margin="20, 0" Height="20" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<TextBlock FontSize="10" Text="Shift + Esc —— 退出 PPT 放映" TextWrapping="Wrap" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</ui:SimpleStackPanel>
|
||||
</Viewbox>
|
||||
</ui:SimpleStackPanel>
|
||||
</ScrollViewer>
|
||||
<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"
|
||||
Background="#FBFBFD" Height="20" Width="20" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:SymbolIcon Name="SymbolIconFullscreen" Symbol="FullScreen" Foreground="Black"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Border x:Name="BtnClose" MouseUp="BtnClose_MouseUp" HorizontalAlignment="Right" VerticalAlignment="Bottom"
|
||||
Margin="5"
|
||||
Background="#E32A34" Height="20" Width="20" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="5.5">
|
||||
<ui:SymbolIcon Symbol="Clear" Foreground="White"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -0,0 +1,42 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for StopwatchWindow.xaml
|
||||
/// </summary>
|
||||
public partial class OperatingGuideWindow : Window
|
||||
{
|
||||
public OperatingGuideWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
|
||||
}
|
||||
|
||||
private void BtnClose_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void WindowDragMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed) DragMove();
|
||||
}
|
||||
|
||||
private void BtnFullscreen_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (WindowState == WindowState.Normal) {
|
||||
WindowState = WindowState.Maximized;
|
||||
SymbolIconFullscreen.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.BackToWindow;
|
||||
} else {
|
||||
WindowState = WindowState.Normal;
|
||||
SymbolIconFullscreen.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.FullScreen;
|
||||
}
|
||||
}
|
||||
|
||||
private void SCManipulationBoundaryFeedback(object sender, ManipulationBoundaryFeedbackEventArgs e) {
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<Window x:Class="Ink_Canvas.RandWindow"
|
||||
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:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:local="clr-namespace:Ink_Canvas" FontFamily="Microsoft YaHei UI"
|
||||
ui:ThemeManager.RequestedTheme="Light" Topmost="True" Background="Transparent"
|
||||
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True" Loaded="Window_Loaded"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Title="Ink Canvas 抽奖" Height="500" Width="900">
|
||||
<Border Background="#F0F3F9" CornerRadius="10" BorderThickness="1" BorderBrush="#0066BF" Margin="0" ClipToBounds="True">
|
||||
<Canvas>
|
||||
<Image Source="/Resources/hatsune-miku1.png" Width="300" Canvas.Bottom="-140" Canvas.Left="-48" Canvas.Top="304"></Image>
|
||||
<Grid Canvas.Left="0" Canvas.Right="0" Canvas.Top="0" Canvas.Bottom="0" Width="900" Height="309" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.8*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Viewbox HorizontalAlignment="Center" Margin="20,0">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="50" MinHeight="470">
|
||||
<Label Name="LabelOutput" FontSize="130" Content="" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Label Name="LabelOutput2" FontSize="130" Visibility="Collapsed" Content="" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Label Name="LabelOutput3" FontSize="130" Visibility="Collapsed" Content="" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Viewbox>
|
||||
<ui:SimpleStackPanel Spacing="8" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Opacity="1" Name="PeopleControlPane" Width="256">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border x:Name="BorderBtnMinus" MouseUp="BorderBtnMinus_MouseUp" Background="#FBFBFD" Height="70" Width="70" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.15" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="20">
|
||||
<Image Width="18" Height="18">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<DrawingGroup Opacity="1">
|
||||
<DrawingGroup.ClipGeometry>
|
||||
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,0,24,24" />
|
||||
</DrawingGroup.ClipGeometry>
|
||||
<GeometryDrawing Brush="#FF000000" Geometry="F0 M24,24z M0,0z M4,12C4,11.4477,4.44772,11,5,11L19,11C19.5523,11 20,11.4477 20,12 20,12.5523 19.5523,13 19,13L5,13C4.44772,13,4,12.5523,4,12z" />
|
||||
</DrawingGroup>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<TextBlock Name="LabelNumberCount" Text="1" FontFamily="Consolas" FontSize="55" Margin="10" Width="80" TextAlignment="Center"/>
|
||||
<Border x:Name="BorderBtnAdd" MouseUp="BorderBtnAdd_MouseUp" Background="#FBFBFD" Height="70" Width="70" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.15" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="20">
|
||||
<Image Width="18" Height="18">
|
||||
<Image.Source>
|
||||
<DrawingImage>
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<DrawingGroup Opacity="1">
|
||||
<DrawingGroup.ClipGeometry>
|
||||
<RectangleGeometry RadiusX="0" RadiusY="0" Rect="0,0,24,24" />
|
||||
</DrawingGroup.ClipGeometry>
|
||||
<GeometryDrawing Brush="#18181b" Geometry="F0 M24,24z M0,0z M13,5C13,4.44772 12.5523,4 12,4 11.4477,4 11,4.44772 11,5L11,11 5,11C4.44772,11 4,11.4477 4,12 4,12.5523 4.44772,13 5,13L11,13 11,19C11,19.5523 11.4477,20 12,20 12.5523,20 13,19.5523 13,19L13,13 19,13C19.5523,13 20,12.5523 20,12 20,11.4477 19.5523,11 19,11L13,11 13,5z" />
|
||||
</DrawingGroup>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<ui:SimpleStackPanel Visibility="Collapsed" Margin="0,8,0,0" Orientation="Horizontal" HorizontalAlignment="Center" Spacing="24">
|
||||
<CheckBox x:Name="NoHotStudents" MinWidth="0"
|
||||
Content="不抽热门人选" IsThreeState="True"
|
||||
HorizontalAlignment="Center" />
|
||||
<CheckBox x:Name="NoShengPiZi" MinWidth="0"
|
||||
Content="避开生僻字" IsThreeState="True"
|
||||
HorizontalAlignment="Center" />
|
||||
</ui:SimpleStackPanel>
|
||||
<ui:SimpleStackPanel Visibility="Collapsed" Margin="0,0,0,8" Orientation="Horizontal" HorizontalAlignment="Center" Spacing="24">
|
||||
<ComboBox Name="ComboBoxRandMode"
|
||||
MinWidth="0"
|
||||
IsEditable="False"
|
||||
SelectedIndex="0"
|
||||
IsReadOnly="True">
|
||||
<ComboBoxItem>全都抽</ComboBoxItem>
|
||||
<ComboBoxItem>只抽男</ComboBoxItem>
|
||||
<ComboBoxItem>只抽女</ComboBoxItem>
|
||||
</ComboBox>
|
||||
</ui:SimpleStackPanel>
|
||||
<Border x:Name="BorderBtnRand" MouseUp="BorderBtnRand_MouseUp" Background="#0066BF" Height="70" Width="200" CornerRadius="35">
|
||||
<ui:SimpleStackPanel Margin="3,0" Spacing="20" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Viewbox Margin="0,20">
|
||||
<ui:SymbolIcon Name="SymbolIconStart" Symbol="Contact" Foreground="White"/>
|
||||
</Viewbox>
|
||||
<TextBlock Text="开抽" Foreground="White" FontSize="32" Margin="-1,-1,4,0" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
</ui:SimpleStackPanel>
|
||||
</Grid>
|
||||
<Border UseLayoutRounding="True" Canvas.Bottom="8" Canvas.Right="8" x:Name="BorderBtnHelp" MouseUp="BorderBtnHelp_MouseUp" Background="#FBFBFD" Grid.Column="1" Margin="10,10,60,10" Height="40" VerticalAlignment="Bottom" HorizontalAlignment="Right" CornerRadius="20">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.15" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Viewbox Margin="15,12">
|
||||
<ui:SymbolIcon Symbol="People" Foreground="Black"/>
|
||||
</Viewbox>
|
||||
<TextBlock Margin="-5,12,15,12" Name="TextBlockPeopleCount" Text="点击此处以导入名单" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Border>
|
||||
<Border UseLayoutRounding="True" Canvas.Bottom="8" Canvas.Right="8" x:Name="BtnClose" MouseUp="BtnClose_MouseUp" HorizontalAlignment="Right" VerticalAlignment="{Binding ElementName=BorderBtnHelp, Path=VerticalAlignment}" Margin="10" Grid.Column="1" Background="#E32A34" Height="40" Width="40" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.1" BlurRadius="3"/>
|
||||
</Border.Effect>
|
||||
<Viewbox Margin="14">
|
||||
<ui:SymbolIcon Symbol="Clear" Foreground="White"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</Canvas>
|
||||
|
||||
</Border>
|
||||
</Window>
|
||||
@@ -0,0 +1,209 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using Microsoft.VisualBasic;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
/// <summary>
|
||||
/// Interaction logic for RandWindow.xaml
|
||||
/// </summary>
|
||||
public partial class RandWindow : Window {
|
||||
public RandWindow(Settings settings) {
|
||||
InitializeComponent();
|
||||
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
|
||||
BorderBtnHelp.Visibility = settings.RandSettings.DisplayRandWindowNamesInputBtn == false ? Visibility.Collapsed : Visibility.Visible;
|
||||
RandMaxPeopleOneTime = settings.RandSettings.RandWindowOnceMaxStudents;
|
||||
RandDoneAutoCloseWaitTime = (int)settings.RandSettings.RandWindowOnceCloseLatency*1000;
|
||||
}
|
||||
|
||||
public RandWindow(Settings settings, bool IsAutoClose) {
|
||||
InitializeComponent();
|
||||
isAutoClose = IsAutoClose;
|
||||
PeopleControlPane.Opacity = 0.4;
|
||||
PeopleControlPane.IsHitTestVisible = false;
|
||||
BorderBtnHelp.Visibility = settings.RandSettings.DisplayRandWindowNamesInputBtn == false ? Visibility.Collapsed : Visibility.Visible;
|
||||
RandMaxPeopleOneTime = settings.RandSettings.RandWindowOnceMaxStudents;
|
||||
RandDoneAutoCloseWaitTime = (int)settings.RandSettings.RandWindowOnceCloseLatency * 1000;
|
||||
|
||||
new Thread(new ThreadStart(() => {
|
||||
Thread.Sleep(100);
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
BorderBtnRand_MouseUp(BorderBtnRand, null);
|
||||
});
|
||||
})).Start();
|
||||
}
|
||||
|
||||
public static int randSeed = 0;
|
||||
public bool isAutoClose = false;
|
||||
public bool isNotRepeatName = false;
|
||||
|
||||
public int TotalCount = 1;
|
||||
public int PeopleCount = 60;
|
||||
public List<string> Names = new List<string>();
|
||||
|
||||
private void BorderBtnAdd_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (RandMaxPeopleOneTime == -1 && TotalCount >= PeopleCount) return;
|
||||
if (RandMaxPeopleOneTime != -1 && TotalCount >= RandMaxPeopleOneTime) return;
|
||||
TotalCount++;
|
||||
LabelNumberCount.Text = TotalCount.ToString();
|
||||
SymbolIconStart.Symbol = Symbol.People;
|
||||
BorderBtnAdd.Opacity = 1;
|
||||
BorderBtnMinus.Opacity = 1;
|
||||
}
|
||||
|
||||
private void BorderBtnMinus_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (TotalCount < 2) return;
|
||||
TotalCount--;
|
||||
LabelNumberCount.Text = TotalCount.ToString();
|
||||
if (TotalCount == 1) {
|
||||
SymbolIconStart.Symbol = Symbol.Contact;
|
||||
}
|
||||
}
|
||||
|
||||
public int RandWaitingTimes = 100;
|
||||
public int RandWaitingThreadSleepTime = 5;
|
||||
public int RandMaxPeopleOneTime = 10;
|
||||
public int RandDoneAutoCloseWaitTime = 2500;
|
||||
|
||||
private void BorderBtnRand_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
Random random = new Random();// randSeed + DateTime.Now.Millisecond / 10 % 10);
|
||||
string outputString = "";
|
||||
List<string> outputs = new List<string>();
|
||||
List<int> rands = new List<int>();
|
||||
|
||||
LabelOutput2.Visibility = Visibility.Collapsed;
|
||||
LabelOutput3.Visibility = Visibility.Collapsed;
|
||||
|
||||
new Thread(new ThreadStart(() => {
|
||||
for (int i = 0; i < RandWaitingTimes; i++) {
|
||||
int rand = random.Next(1, PeopleCount + 1);
|
||||
while (rands.Contains(rand)) {
|
||||
rand = random.Next(1, PeopleCount + 1);
|
||||
}
|
||||
rands.Add(rand);
|
||||
if (rands.Count >= PeopleCount) rands = new List<int>();
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
if (Names.Count != 0) {
|
||||
LabelOutput.Content = Names[rand - 1];
|
||||
} else {
|
||||
LabelOutput.Content = rand.ToString();
|
||||
}
|
||||
});
|
||||
|
||||
Thread.Sleep(RandWaitingThreadSleepTime);
|
||||
}
|
||||
|
||||
rands = new List<int>();
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
for (int i = 0; i < TotalCount; i++) {
|
||||
int rand = random.Next(1, PeopleCount + 1);
|
||||
while (rands.Contains(rand)) {
|
||||
rand = random.Next(1, PeopleCount + 1);
|
||||
}
|
||||
rands.Add(rand);
|
||||
if (rands.Count >= PeopleCount) rands = new List<int>();
|
||||
|
||||
if (Names.Count != 0) {
|
||||
outputs.Add(Names[rand - 1]);
|
||||
outputString += Names[rand - 1] + Environment.NewLine;
|
||||
} else {
|
||||
outputs.Add(rand.ToString());
|
||||
outputString += rand.ToString() + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
if (TotalCount <= 5) {
|
||||
LabelOutput.Content = outputString.ToString().Trim();
|
||||
} else if (TotalCount <= 10) {
|
||||
LabelOutput2.Visibility = Visibility.Visible;
|
||||
outputString = "";
|
||||
for (int i = 0; i < (outputs.Count + 1) / 2; i++) {
|
||||
outputString += outputs[i].ToString() + Environment.NewLine;
|
||||
}
|
||||
LabelOutput.Content = outputString.ToString().Trim();
|
||||
outputString = "";
|
||||
for (int i = (outputs.Count + 1) / 2; i < outputs.Count; i++) {
|
||||
outputString += outputs[i].ToString() + Environment.NewLine;
|
||||
}
|
||||
LabelOutput2.Content = outputString.ToString().Trim();
|
||||
} else {
|
||||
LabelOutput2.Visibility = Visibility.Visible;
|
||||
LabelOutput3.Visibility = Visibility.Visible;
|
||||
outputString = "";
|
||||
for (int i = 0; i < (outputs.Count + 1) / 3; i++) {
|
||||
outputString += outputs[i].ToString() + Environment.NewLine;
|
||||
}
|
||||
LabelOutput.Content = outputString.ToString().Trim();
|
||||
outputString = "";
|
||||
for (int i = (outputs.Count + 1) / 3; i < (outputs.Count + 1) * 2 / 3; i++) {
|
||||
outputString += outputs[i].ToString() + Environment.NewLine;
|
||||
}
|
||||
LabelOutput2.Content = outputString.ToString().Trim();
|
||||
outputString = "";
|
||||
for (int i = (outputs.Count + 1) * 2 / 3; i < outputs.Count; i++) {
|
||||
outputString += outputs[i].ToString() + Environment.NewLine;
|
||||
}
|
||||
LabelOutput3.Content = outputString.ToString().Trim();
|
||||
}
|
||||
|
||||
if (isAutoClose) {
|
||||
new Thread(new ThreadStart(() => {
|
||||
Thread.Sleep(RandDoneAutoCloseWaitTime);
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
PeopleControlPane.Opacity = 1;
|
||||
PeopleControlPane.IsHitTestVisible = true;
|
||||
Close();
|
||||
});
|
||||
})).Start();
|
||||
}
|
||||
});
|
||||
})).Start();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e) {
|
||||
Names = new List<string>();
|
||||
if (File.Exists(App.RootPath + "Names.txt")) {
|
||||
string[] fileNames = File.ReadAllLines(App.RootPath + "Names.txt");
|
||||
string[] replaces = new string[0];
|
||||
|
||||
if (File.Exists(App.RootPath + "Replace.txt")) {
|
||||
replaces = File.ReadAllLines(App.RootPath + "Replace.txt");
|
||||
}
|
||||
|
||||
//Fix emtpy lines
|
||||
foreach (string str in fileNames) {
|
||||
string s = str;
|
||||
//Make replacement
|
||||
foreach (string replace in replaces) {
|
||||
if (s == Strings.Left(replace, replace.IndexOf("-->"))) {
|
||||
s = Strings.Mid(replace, replace.IndexOf("-->") + 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (s != "") Names.Add(s);
|
||||
}
|
||||
|
||||
PeopleCount = Names.Count();
|
||||
TextBlockPeopleCount.Text = PeopleCount.ToString();
|
||||
if (PeopleCount == 0) {
|
||||
PeopleCount = 60;
|
||||
TextBlockPeopleCount.Text = "点击此处以导入名单";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BorderBtnHelp_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
new NamesInputWindow().ShowDialog();
|
||||
Window_Loaded(this, null);
|
||||
}
|
||||
|
||||
private void BtnClose_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<Window x:Class="Ink_Canvas.YesOrNoNotificationWindow"
|
||||
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:Ink_Canvas" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d" Topmost="True" WindowStartupLocation="CenterScreen" ui:WindowHelper.UseModernWindowStyle="True"
|
||||
ResizeMode="NoResize" Closed="Window_Closed" ui:ThemeManager.RequestedTheme="Light"
|
||||
Title="演示文档设置 - Ink Canvas 画板" Height="160" Width="450" FontFamily="Microsoft YaHei UI">
|
||||
<Grid>
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Viewbox HorizontalAlignment="Left" Margin="10" Height="30">
|
||||
<ui:SymbolIcon Symbol="SlideShow" Foreground="{Binding ElementName=Label, Path=Foreground}"/>
|
||||
</Viewbox>
|
||||
<TextBlock TextWrapping="Wrap" Name="Label" Margin="60,0,10,0" VerticalAlignment="Center"/>
|
||||
<ui:SimpleStackPanel Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Spacing="10">
|
||||
<Button Margin="0" Content="是" Width="100" FontFamily="Microsoft YaHei UI" Click="ButtonYes_Click" Foreground="White">
|
||||
<Button.Resources>
|
||||
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundKey}" Color="#15803d"/>
|
||||
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPointerOverKey}" Color="#15803d"/>
|
||||
<SolidColorBrush x:Key="{x:Static ui:ThemeKeys.ButtonBackgroundPressedKey}" Color="#166534"/>
|
||||
</Button.Resources>
|
||||
</Button>
|
||||
<Button Margin="0" Content="否" Width="100" FontFamily="Microsoft YaHei UI" Click="ButtonNo_Click" Foreground="#555555"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for RestoreHiddenSlidesWindow.xaml
|
||||
/// </summary>
|
||||
public partial class YesOrNoNotificationWindow : Window
|
||||
{
|
||||
private readonly Action _yesAction;
|
||||
private readonly Action _noAction;
|
||||
private readonly Action _windowClose;
|
||||
|
||||
public YesOrNoNotificationWindow(string text, Action yesAction = null, Action noAction = null, Action windowClose = null)
|
||||
{
|
||||
_yesAction = yesAction;
|
||||
_noAction = noAction;
|
||||
_windowClose = windowClose;
|
||||
InitializeComponent();
|
||||
Label.Text = text;
|
||||
}
|
||||
|
||||
private void ButtonYes_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_yesAction == null)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
_yesAction.Invoke();
|
||||
Close();
|
||||
|
||||
}
|
||||
|
||||
private void ButtonNo_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_noAction == null)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
_noAction.Invoke();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, EventArgs e) {
|
||||
_windowClose.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user