From 1f98d758f0ca4b367f198feb0f07501938462f46 Mon Sep 17 00:00:00 2001 From: micahh <micahh28@outlook.com> Date: Sat, 23 Jan 2021 23:13:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AA=97=E4=BD=93=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SoftwarePack/Close.xaml.cs | 2 +- SoftwarePack/MainWindow.xaml | 4 ++-- SoftwarePack/MainWindow.xaml.cs | 31 +++++++++++++++++++++++-------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/SoftwarePack/Close.xaml.cs b/SoftwarePack/Close.xaml.cs index 3b0d98b..37aff96 100644 --- a/SoftwarePack/Close.xaml.cs +++ b/SoftwarePack/Close.xaml.cs @@ -24,7 +24,7 @@ private void image_min_MouseUp(object sender, MouseButtonEventArgs e) private void image_close_MouseUp(object sender, MouseButtonEventArgs e) { Window win = Window.GetWindow(this); - if (MessageBoxX.Show("确认要退出吗?", "退出", Application.Current.MainWindow, MessageBoxButton.YesNo) == MessageBoxResult.Yes) + if (MessageBoxX.Show("确认要退出吗?", "退出", Application.Current.MainWindow, MessageBoxButton.OKCancel) == MessageBoxResult.OK) { Application.Current.Shutdown(-1); } diff --git a/SoftwarePack/MainWindow.xaml b/SoftwarePack/MainWindow.xaml index 3431609..2b48b6b 100644 --- a/SoftwarePack/MainWindow.xaml +++ b/SoftwarePack/MainWindow.xaml @@ -15,7 +15,7 @@ </Grid.RowDefinitions> - <Image Source="/images/bgtop.png" Stretch="Fill"/> + <Image Source="/images/bgtop.png" Stretch="Fill" MouseDown="Window_MouseDown"/> <local:Close Margin="0,10,10,0" HorizontalAlignment="Right" VerticalAlignment="Top" Height="36" Width="82" /> <Label Name="lbl_Ver" Content="" Grid.Row="2" HorizontalAlignment="Center" Foreground="Gray" MouseUp="lbl_Ver_MouseUp"/> @@ -23,7 +23,7 @@ <Grid x:Name="step1" Grid.Row="1" Visibility="Visible"> <Label Content="软件名称:" HorizontalAlignment="Left" Margin="62,45,0,0" VerticalAlignment="Top" Height="25" Width="70"/> - <TextBox HorizontalAlignment="Left" x:Name="txtSoftName" Width="250" Height="30" FontSize="18" Foreground="Black" VerticalContentAlignment="Top" Margin="132,45,0,388" + <TextBox HorizontalAlignment="Left" x:Name="txtSoftName" Width="250" Height="30" Foreground="Black" VerticalContentAlignment="Center" Margin="132,45,0,388" pu:TextBoxHelper.Watermark="请输入软件名称" pu:TextBoxHelper.FocusedBorderBrush="#00FFE2" pu:TextBoxHelper.FocusedShadowColor="#00FFE2" diff --git a/SoftwarePack/MainWindow.xaml.cs b/SoftwarePack/MainWindow.xaml.cs index 4666cae..20b91d7 100644 --- a/SoftwarePack/MainWindow.xaml.cs +++ b/SoftwarePack/MainWindow.xaml.cs @@ -1,4 +1,5 @@ using Panuon.UI.Silver; +using Panuon.UI.Silver.Core; using SevenZip; using System; using System.Diagnostics; @@ -22,9 +23,19 @@ public partial class MainWindow : Window /// </summary> private string rootDirPath = AppDomain.CurrentDomain.BaseDirectory; + /// <summary> + /// 版本信息 + /// </summary> private string verStr = "© 2021 Micahh MIT license"; + /// <summary> + /// 是否压缩完成 + /// </summary> private bool IsCompleteCompressor; + + /// <summary> + /// MainWindow + /// </summary> public MainWindow() { InitializeComponent(); @@ -68,10 +79,13 @@ private void Window_Loaded(object sender, RoutedEventArgs e) } lbl_Ver.Content = verStr; - } - + private void Window_MouseDown(object sender, MouseButtonEventArgs e) + { + // Begin dragging the window + this.DragMove(); + } /// <summary> /// 按钮动作 /// </summary> @@ -256,10 +270,11 @@ private void btnNext_Click(object sender, RoutedEventArgs e) step1.Visibility = Visibility.Hidden; step2.Visibility = Visibility.Visible; + } catch (Exception ex) { - System.Windows.MessageBox.Show($"异常错误:{ex.Message}", "错误", System.Windows.MessageBoxButton.OK, MessageBoxImage.Error); + MessageBoxX.Show($"异常错误:{ex.Message}", "错误", Application.Current.MainWindow, MessageBoxButton.OK, new MessageBoxXConfigurations() { MessageBoxIcon = MessageBoxIcon.Error }); } } @@ -283,7 +298,7 @@ private void CompressorSoftware() btnBuild.IsEnabled = true; btnLastStep.IsEnabled = true; IsCompleteCompressor = true; - lbl_Ver.Content = "准备工作已全部完成,开始打属于你的安装包吧"; + lbl_Ver.Content = "准备工作已全部完成,开始打包属于你的安装包吧"; }; } @@ -314,25 +329,25 @@ private bool InitProductInfo(out string productInfoData) productInfoData = string.Empty; if (string.IsNullOrEmpty(txtSoftName.Text)) { - MessageBox.Show("请输入应用程序名称"); + MessageBoxX.Show("请输入应用程序名称", "提示", Application.Current.MainWindow, MessageBoxButton.OK); return false; } // 版本号验证 if (!Regex.IsMatch(softVersion, @"^([1-9]\d|[1-9])(\.([1-9]\d|\d)){3}$")) { - MessageBox.Show("请输入版本号"); + MessageBoxX.Show("请输入版本号", "提示", Application.Current.MainWindow, MessageBoxButton.OK); return false; } if (string.IsNullOrEmpty(txtSoftPath.Text)) { - MessageBox.Show("请选择应用程序路径"); + MessageBoxX.Show("请选择应用程序路径", "提示", Application.Current.MainWindow, MessageBoxButton.OK); return false; } if (string.IsNullOrEmpty(txtMainSoftPath.Text)) { - MessageBox.Show("请选择应用程序主启动程序"); + MessageBoxX.Show("请选择应用程序主启动程序", "提示", Application.Current.MainWindow, MessageBoxButton.OK); return false; }