From 1a2622da58a63ec4ce8a8f779ed82c8a8d9e90f5 Mon Sep 17 00:00:00 2001 From: XY Wang Date: Thu, 9 Sep 2021 13:12:34 +0800 Subject: [PATCH] Big changes are coming --- Ink Canvas/App.xaml | 10 +- Ink Canvas/App.xaml.cs | 19 ++++ Ink Canvas/Ink Canvas.csproj | 26 +++++ Ink Canvas/MainWindow.xaml | 56 +++++++++- Ink Canvas/MainWindow.xaml.cs | 205 ++++++++++++++++++++++++++++++---- Ink Canvas/packages.config | 8 ++ 6 files changed, 294 insertions(+), 30 deletions(-) create mode 100644 Ink Canvas/packages.config diff --git a/Ink Canvas/App.xaml b/Ink Canvas/App.xaml index 7efa558..cd52da8 100644 --- a/Ink Canvas/App.xaml +++ b/Ink Canvas/App.xaml @@ -2,8 +2,14 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Ink_Canvas" - StartupUri="MainWindow.xaml"> + StartupUri="MainWindow.xaml" + xmlns:ui="http://schemas.modernwpf.com/2019"> - + + + + + + diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs index 9da23d2..9cca27f 100644 --- a/Ink Canvas/App.xaml.cs +++ b/Ink Canvas/App.xaml.cs @@ -13,5 +13,24 @@ namespace Ink_Canvas /// public partial class App : Application { + System.Threading.Mutex mutex; + + public App() + { + this.Startup += new StartupEventHandler(App_Startup); + } + + void App_Startup(object sender, StartupEventArgs e) + { + bool ret; + mutex = new System.Threading.Mutex(true, "Ink_Canvas", out ret); + + if (!ret) + { + MessageBox.Show("已有一个程序实例正在运行"); + Environment.Exit(0); + } + + } } } diff --git a/Ink Canvas/Ink Canvas.csproj b/Ink Canvas/Ink Canvas.csproj index 5131ec3..b7bfa30 100644 --- a/Ink Canvas/Ink Canvas.csproj +++ b/Ink Canvas/Ink Canvas.csproj @@ -1,5 +1,6 @@  + Debug @@ -14,6 +15,8 @@ 4 true true + + AnyCPU @@ -35,8 +38,18 @@ 4 + + ..\packages\ModernWpfUI.0.9.4\lib\net462\ModernWpf.dll + + + ..\packages\ModernWpfUI.0.9.4\lib\net462\ModernWpf.Controls.dll + + + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + @@ -87,6 +100,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs @@ -96,4 +110,16 @@ + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + \ No newline at end of file diff --git a/Ink Canvas/MainWindow.xaml b/Ink Canvas/MainWindow.xaml index 5ecb141..32716c7 100644 --- a/Ink Canvas/MainWindow.xaml +++ b/Ink Canvas/MainWindow.xaml @@ -2,16 +2,18 @@ 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" Topmost="True" - xmlns:local="clr-namespace:Ink_Canvas" AllowsTransparency="True" WindowStyle="None" ResizeMode="NoResize" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Topmost="True" KeyDown="Window_KeyDown" + xmlns:local="clr-namespace:Ink_Canvas" xmlns:ui="http://schemas.modernwpf.com/2019" AllowsTransparency="True" WindowStyle="None" ResizeMode="NoResize" mc:Ignorable="d" WindowState="Maximized" Loaded="Window_Loaded" Background="Transparent" ShowInTaskbar="False" - Title="MainWindow" Height="450" Width="800"> + Title="MainWindow" Height="600" Width="800" FontFamily="Microsoft YaHei UI"> + + @@ -19,8 +21,54 @@ + - + + +