返回提交历史

XFEstudio/MyFirstRespo

完善一部分弹窗

fd152f5
X
XFEstudio <mail@xfegzs.com>
提交于

代码差异

26 个文件 +382 -53
Modified XFEToolBox/Profiles/CrossVersionProfiles/DownloadProfile.cs +10 -0
@@ -11,6 +11,16 @@ public partial class DownloadProfile
11 11 [ProfileProperty]
12 12 private bool useNormalDownloader = false;
13 13 /// <summary>
14 /// 下载完成后是否自动运行下载文件
15 /// </summary>
16 [ProfileProperty]
17 private bool autoRunWhenComplete = true;
18 /// <summary>
19 /// 下载完成后是否打开目录
20 /// </summary>
21 [ProfileProperty]
22 private bool openFolderWhenComplete = true;
23 /// <summary>
14 24 /// 下载的目标文件夹
15 25 /// </summary>
16 26 [ProfileProperty]
Added XFEToolBox/Resources/Image/back.png +0 -0
二进制文件已变更,无法进行逐行预览。
Added XFEToolBox/Utilities/NavigationCenter.cs +62 -0
@@ -0,0 +1,62 @@
1 using System.Windows.Controls;
2 using XFEToolBox.Views.Windows;
3
4 namespace XFEToolBox.Utilities;
5
6 /// <summary>
7 /// 导航中心
8 /// </summary>
9 public static class NavigationCenter
10 {
11 /// <summary>
12 /// 导航堆栈
13 /// </summary>
14 public static List<Page> NavigationStack { get; set; } = [];
15 private static bool canGoBack;
16 /// <summary>
17 /// 是否可以返回
18 /// </summary>
19 public static bool CanGoBack
20 {
21 get { return canGoBack; }
22 set
23 {
24 if (MainWindow.Current is null)
25 return;
26 canGoBack = value;
27 MainWindow.Current.backTabBorder.Visibility = canGoBack ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
28 }
29 }
30 private static bool CheckCanGoBack() => NavigationStack.Count > 0 ? CanGoBack = true : CanGoBack = false;
31 /// <summary>
32 /// 返回上一个导航堆栈
33 /// </summary>
34 /// <param name="removeStack">是否从导航堆栈中移除</param>
35 /// <returns>是否成功</returns>
36 public static bool GoBack(bool removeStack = true)
37 {
38 if (MainWindow.Current is null)
39 return false;
40 MainWindow.Current.contentFrame.Content = NavigationStack[^2];
41 if (removeStack && NavigationStack.Count > 0)
42 NavigationStack.RemoveAt(NavigationStack.Count - 1);
43 CheckCanGoBack();
44 return true;
45 }
46 /// <summary>
47 /// 导航至目标堆栈
48 /// </summary>
49 /// <param name="page">目标导航页面</param>
50 /// <param name="addIntoStack">是否添加至导航堆栈中</param>
51 /// <returns>是否成功</returns>
52 public static bool Navigate(this Page page, bool addIntoStack = true)
53 {
54 if (MainWindow.Current is null)
55 return false;
56 MainWindow.Current.contentFrame.Content = NavigationStack[^1];
57 if (addIntoStack)
58 NavigationStack.Add(page);
59 CheckCanGoBack();
60 return true;
61 }
62 }
Added XFEToolBox/Utilities/PopupHelper.cs +50 -0
@@ -0,0 +1,50 @@
1 using System.Windows;
2 using System.Windows.Controls;
3 using System.Windows.Controls.Primitives;
4 using System.Windows.Media;
5 using XFEToolBox.Views.Pages.Popups;
6 using XFEToolBox.Views.Windows;
7
8 namespace XFEToolBox.Utilities;
9
10 public static class PopupHelper
11 {
12 public static NormalDialogPopupPage CreateNormalDialogPage(object content, PopupWindow popupWindow)
13 {
14 var dialogPage = new NormalDialogPopupPage(popupWindow);
15 dialogPage.ViewModel.Content = content;
16 return dialogPage;
17 }
18
19 public static MessageBoxResult? ShowNormalDialog(string text, Color textColor)
20 {
21 var popupWindow = new PopupWindow();
22 var dialogPage = CreateNormalDialogPage(new ScrollViewer()
23 {
24 Content = new TextBlock
25 {
26 Text = text,
27 Foreground = new SolidColorBrush(textColor),
28 Margin = new Thickness(20, 20, 20, 0)
29 },
30 HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden,
31 VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
32 Resources = new ResourceDictionary
33 {
34 {
35 "scroll",
36 new Style
37 {
38 TargetType = typeof(ScrollBar),
39 BasedOn = (Style)Application.Current.FindResource("ConsoleScrollBar")
40 }
41 }
42 }
43 }, popupWindow);
44 popupWindow.ViewModel.Content = dialogPage;
45 popupWindow.ShowDialog();
46 return popupWindow.Result;
47 }
48
49 public static MessageBoxResult? ShowNormalDialog(string text) => ShowNormalDialog(text, Colors.Black);
50 }
Renamed XFEToolBox/ViewModel/Pages/ConsolePageViewModel.cs +1 -1
@@ -10,7 +10,7 @@ using XFEToolBox.Profiles.CrossVersionProfiles;
10 10 using XFEToolBox.Utilities;
11 11 using XFEToolBox.Views.Pages;
12 12
13 namespace XFEToolBox.ViewModel;
13 namespace XFEToolBox.ViewModel.Pages;
14 14
15 15 public partial class ConsolePageViewModel(ConsolePage viewPage) : ObservableObject
16 16 {
Added XFEToolBox/ViewModel/Pages/DownloadPageViewModel.cs +9 -0
@@ -0,0 +1,9 @@
1 using CommunityToolkit.Mvvm.ComponentModel;
2 using XFEToolBox.Views.Pages;
3
4 namespace XFEToolBox.ViewModel.Pages;
5
6 public class DownloadPageViewModel(DownloadPage viewPage) : ObservableObject
7 {
8 public DownloadPage ViewPage { get; set; } = viewPage;
9 }
Renamed XFEToolBox/ViewModel/Pages/MainPageViewModel.cs +1 -1
@@ -1,6 +1,6 @@
1 1 using CommunityToolkit.Mvvm.ComponentModel;
2 2
3 namespace XFEToolBox.ViewModel;
3 namespace XFEToolBox.ViewModel.Pages;
4 4
5 5 public partial class MainPageViewModel : ObservableObject
6 6 {
Added XFEToolBox/ViewModel/Pages/Popups/NormalDialogPopupPageViewModel.cs +31 -0
@@ -0,0 +1,31 @@
1 using CommunityToolkit.Mvvm.ComponentModel;
2 using CommunityToolkit.Mvvm.Input;
3 using System.Windows;
4 using XFEExtension.NetCore.TaskExtension;
5 using XFEToolBox.Views.Pages.Popups;
6
7 namespace XFEToolBox.ViewModel.Pages.Popups;
8
9 public partial class NormalDialogPopupPageViewModel(NormalDialogPopupPage viewPage) : ObservableObject
10 {
11 [ObservableProperty]
12 string confirmText = "确认";
13 [ObservableProperty]
14 string cancelText = "取消";
15 [ObservableProperty]
16 object? content;
17 public NormalDialogPopupPage ViewPage { get; set; } = viewPage;
18 [RelayCommand]
19 void Confirm()
20 {
21 ViewPage.PopupWindow.Result = MessageBoxResult.OK;
22 ViewPage.PopupWindow.Close();
23 }
24
25 [RelayCommand]
26 void Cancel()
27 {
28 ViewPage.PopupWindow.Result = MessageBoxResult.Cancel;
29 ViewPage.PopupWindow.Close();
30 }
31 }
Renamed XFEToolBox/ViewModel/Pages/SettingPageViewModel.cs +2 -2
@@ -13,7 +13,7 @@ using XFEToolBox.Utilities;
13 13 using XFEToolBox.Views.Controls;
14 14 using XFEToolBox.Views.Pages;
15 15
16 namespace XFEToolBox.ViewModel;
16 namespace XFEToolBox.ViewModel.Pages;
17 17
18 18 public partial class SettingPageViewModel(SettingPage viewPage) : ObservableObject
19 19 {
@@ -216,7 +216,7 @@ public partial class SettingPageViewModel(SettingPage viewPage) : ObservableObje
216 216 void TabClicked(TabUnderLineButton value)
217 217 {
218 218 if (value.Tag is string tabTag && ViewPage.FindName($"{tabTag}SettingBlock") is TextBlock textBlock)
219 ViewPage.scrollViewer.ScrollToVerticalOffset(ViewPage.scrollViewer.VerticalOffset + textBlock.TranslatePoint(new(), ViewPage.scrollViewer).Y);
219 ViewPage.scrollViewer.ScrollToVerticalOffset(ViewPage.scrollViewer.VerticalOffset + textBlock.TranslatePoint(new(), ViewPage.scrollViewer).Y - 20);
220 220 }
221 221 #endregion
222 222 }
Renamed XFEToolBox/ViewModel/Windows/MainWindowViewModel.cs +1 -1
@@ -8,7 +8,7 @@ using XFEToolBox.Profiles.CrossVersionProfiles;
8 8 using XFEToolBox.Views.Pages;
9 9 using XFEToolBox.Views.Windows;
10 10
11 namespace XFEToolBox.ViewModel;
11 namespace XFEToolBox.ViewModel.Windows;
12 12
13 13 public partial class MainWindowViewModel : ObservableObject
14 14 {
Added XFEToolBox/ViewModel/Windows/PopupWindowViewModel.cs +26 -0
@@ -0,0 +1,26 @@
1 using CommunityToolkit.Mvvm.ComponentModel;
2 using System.Windows;
3 using System.Windows.Media;
4 using XFEToolBox.Views.Windows;
5
6 namespace XFEToolBox.ViewModel.Windows;
7
8 public partial class PopupWindowViewModel(PopupWindow viewPage) : ObservableObject
9 {
10 [ObservableProperty]
11 object? content;
12 [ObservableProperty]
13 Brush popupBackground = new SolidColorBrush(Color.FromRgb(152, 152, 231));
14 [ObservableProperty]
15 Brush popupBorder = new SolidColorBrush(Color.FromRgb(80, 80, 183));
16 [ObservableProperty]
17 Brush popupContentBackground = new SolidColorBrush(Colors.White);
18 [ObservableProperty]
19 Thickness popupThickness = new(2);
20 [ObservableProperty]
21 Visibility closeButtonVisibility = Visibility.Visible;
22 [ObservableProperty]
23 Visibility moveButtonVisibility = Visibility.Visible;
24
25 public PopupWindow ViewPage { get; set; } = viewPage;
26 }
Modified XFEToolBox/Views/Pages/ConsolePage.xaml +1 -1
@@ -4,7 +4,7 @@
4 4 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5 5 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6 6 xmlns:local="clr-namespace:XFEToolBox.Views.Pages"
7 xmlns:viewmodel="clr-namespace:XFEToolBox.ViewModel"
7 xmlns:viewmodel="clr-namespace:XFEToolBox.ViewModel.Pages"
8 8 mc:Ignorable="d"
9 9 d:DesignHeight="450" d:DesignWidth="800"
10 10 Title="ConsolePage" d:DataContext="{d:DesignInstance Type=viewmodel:ConsolePageViewModel}">
Modified XFEToolBox/Views/Pages/ConsolePage.xaml.cs +2 -3
@@ -1,5 +1,5 @@
1 1 using System.Windows.Controls;
2 using XFEToolBox.ViewModel;
2 using XFEToolBox.ViewModel.Pages;
3 3
4 4 namespace XFEToolBox.Views.Pages;
5 5
@@ -12,9 +12,8 @@ public partial class ConsolePage : Page
12 12 public ConsolePageViewModel ViewModel { get; set; }
13 13 public ConsolePage()
14 14 {
15 ViewModel = new ConsolePageViewModel(this);
16 DataContext = ViewModel;
17 15 Current = this;
16 DataContext = ViewModel = new(this);
18 17 InitializeComponent();
19 18 }
20 19
Added XFEToolBox/Views/Pages/DownloadInfoPage.xaml +14 -0
@@ -0,0 +1,14 @@
1 <Page x:Class="XFEToolBox.Views.Pages.DownloadInfoPage"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6 xmlns:local="clr-namespace:XFEToolBox.Views.Pages"
7 mc:Ignorable="d"
8 d:DesignHeight="450" d:DesignWidth="800"
9 Title="DownloadInfoPage">
10
11 <Grid>
12
13 </Grid>
14 </Page>
Added XFEToolBox/Views/Pages/DownloadInfoPage.xaml.cs +28 -0
@@ -0,0 +1,28 @@
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6 using System.Windows;
7 using System.Windows.Controls;
8 using System.Windows.Data;
9 using System.Windows.Documents;
10 using System.Windows.Input;
11 using System.Windows.Media;
12 using System.Windows.Media.Imaging;
13 using System.Windows.Navigation;
14 using System.Windows.Shapes;
15
16 namespace XFEToolBox.Views.Pages
17 {
18 /// <summary>
19 /// DownloadInfoPage.xaml 的交互逻辑
20 /// </summary>
21 public partial class DownloadInfoPage : Page
22 {
23 public DownloadInfoPage()
24 {
25 InitializeComponent();
26 }
27 }
28 }
Modified XFEToolBox/Views/Pages/DownloadPage.xaml +5 -2
@@ -3,12 +3,15 @@
3 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 4 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5 5 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6 xmlns:viewmodel="clr-namespace:XFEToolBox.ViewModel.Pages"
6 7 xmlns:local="clr-namespace:XFEToolBox.Views.Pages"
7 8 mc:Ignorable="d"
8 9 d:DesignHeight="450" d:DesignWidth="800"
9 Title="DownloadPage">
10 Title="DownloadPage" d:DataContext="{d:DesignInstance Type=viewmodel:DownloadPageViewModel}">
10 11
11 12 <Grid>
12
13 <Button Click="Button_Click" VerticalAlignment="Top" HorizontalAlignment="Left">
14 <TextBlock Text="测试按钮"/>
15 </Button>
13 16 </Grid>
14 17 </Page>
Modified XFEToolBox/Views/Pages/DownloadPage.xaml.cs +12 -1
@@ -1,4 +1,7 @@
1 using System.Windows.Controls;
1 using System.Diagnostics;
2 using System.Windows.Controls;
3 using XFEToolBox.Utilities;
4 using XFEToolBox.ViewModel.Pages;
2 5
3 6 namespace XFEToolBox.Views.Pages;
4 7
@@ -8,9 +11,17 @@ namespace XFEToolBox.Views.Pages;
8 11 public partial class DownloadPage : Page
9 12 {
10 13 public static DownloadPage? Current { get; set; } = new();
14 public DownloadPageViewModel ViewModel { get; set; }
11 15 public DownloadPage()
12 16 {
13 17 Current = this;
18 DataContext = ViewModel = new(this);
14 19 InitializeComponent();
20 //Steam链接:https://cdn.akamai.steamstatic.com/client/installer/SteamSetup.exe
21 }
22
23 private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
24 {
25 Debug.WriteLine(PopupHelper.ShowNormalDialog("测试文本"));
15 26 }
16 27 }
Added XFEToolBox/Views/Pages/Popups/NormalDialogPopupPage.xaml +31 -0
@@ -0,0 +1,31 @@
1 <Page x:Class="XFEToolBox.Views.Pages.Popups.NormalDialogPopupPage"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6 xmlns:viewmodel="clr-namespace:XFEToolBox.ViewModel.Pages.Popups"
7 xmlns:ctr="clr-namespace:XFEToolBox.Views.Controls"
8 xmlns:local="clr-namespace:XFEToolBox.Views.Pages.Popups"
9 mc:Ignorable="d"
10 d:DesignHeight="450" d:DesignWidth="800"
11 Title="NormalDialogPopupPage"
12 d:DataContext="{d:DesignInstance Type=viewmodel:NormalDialogPopupPageViewModel}">
13
14 <Grid>
15 <Grid.ColumnDefinitions>
16 <ColumnDefinition Width="*"/>
17 <ColumnDefinition Width="*"/>
18 </Grid.ColumnDefinitions>
19 <Grid.RowDefinitions>
20 <RowDefinition Height="*"/>
21 <RowDefinition Height="Auto"/>
22 </Grid.RowDefinitions>
23 <Frame Grid.ColumnSpan="2" Content="{Binding Content}" NavigationUIVisibility="Hidden"/>
24 <ctr:RoundButton Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Command="{Binding ConfirmCommand}">
25 <TextBlock Text="{Binding ConfirmText}" Foreground="#9898e7" Margin="16,8"/>
26 </ctr:RoundButton>
27 <ctr:RoundButton Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Command="{Binding CancelCommand}">
28 <TextBlock Text="{Binding CancelText}" Foreground="#9898e7" Margin="16,8"/>
29 </ctr:RoundButton>
30 </Grid>
31 </Page>
Added XFEToolBox/Views/Pages/Popups/NormalDialogPopupPage.xaml.cs +20 -0
@@ -0,0 +1,20 @@
1 using System.Windows.Controls;
2 using XFEToolBox.ViewModel.Pages.Popups;
3 using XFEToolBox.Views.Windows;
4
5 namespace XFEToolBox.Views.Pages.Popups;
6
7 /// <summary>
8 /// NormalDialogPopupPage.xaml 的交互逻辑
9 /// </summary>
10 public partial class NormalDialogPopupPage : Page
11 {
12 public NormalDialogPopupPageViewModel ViewModel { get; set; }
13 public PopupWindow PopupWindow { get; set; }
14 public NormalDialogPopupPage(PopupWindow popupWindow)
15 {
16 PopupWindow = popupWindow;
17 DataContext = ViewModel = new(this);
18 InitializeComponent();
19 }
20 }
Modified XFEToolBox/Views/Pages/SettingPage.xaml +9 -3
@@ -2,7 +2,7 @@
2 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 4 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5 xmlns:viewmodel="clr-namespace:XFEToolBox.ViewModel"
5 xmlns:viewmodel="clr-namespace:XFEToolBox.ViewModel.Pages"
6 6 xmlns:model="clr-namespace:XFEToolBox.Model"
7 7 xmlns:ctr="clr-namespace:XFEToolBox.Views.Controls"
8 8 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -114,7 +114,7 @@
114 114 <TextBlock x:Name="downloadSettingBlock" VerticalAlignment="Center" Text="下载" Style="{StaticResource TabUnderLineText}"/>
115 115 <Border Background="{DynamicResource MainColor}" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Height="1" Tag="下载"/>
116 116 <StackPanel Grid.Row="1">
117 <ctr:SwitchButton x:Name="testSwitcher" Command="{Binding SwitchedCommand}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}}" Tag="XFEToolBox.Profiles.CrossVersionProfiles.DownloadProfile.UseNormalDownloader">
117 <ctr:SwitchButton Command="{Binding SwitchedCommand}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}}" Tag="XFEToolBox.Profiles.CrossVersionProfiles.DownloadProfile.UseNormalDownloader">
118 118 <TextBlock Text="使用普通下载模式(不加速)"/>
119 119 </ctr:SwitchButton>
120 120 <Grid Margin="0,10">
@@ -137,8 +137,14 @@
137 137 <ColumnDefinition Width="*"/>
138 138 </Grid.ColumnDefinitions>
139 139 <TextBlock Text="加速下载线程数量:" VerticalAlignment="Center" HorizontalAlignment="Left"/>
140 <ctr:TextEditor Grid.Column="1" CaretBrush="{DynamicResource MainColor}" SelectionBrush="{DynamicResource MainColor}" Margin="10,0,0,0" Padding="5" HintText="推荐为9个" HintTextHorizontalAlignment="Center" Width="80" HorizontalAlignment="Left" TextChanged="TextEditor_TextChanged" Tag="XFEToolBox.Profiles.CrossVersionProfiles.DownloadProfile.DownloadThread" VerticalAlignment="Center"/>
140 <ctr:TextEditor Grid.Column="1" CaretBrush="{DynamicResource MainColor}" SelectionBrush="{DynamicResource MainColor}" Margin="10,0,0,0" Padding="5" HintText="9" HintTextHorizontalAlignment="Center" MinWidth="30" HorizontalAlignment="Left" TextChanged="TextEditor_TextChanged" Tag="XFEToolBox.Profiles.CrossVersionProfiles.DownloadProfile.DownloadThread" VerticalAlignment="Center"/>
141 141 </Grid>
142 <ctr:SwitchButton Command="{Binding SwitchedCommand}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}}" Tag="XFEToolBox.Profiles.CrossVersionProfiles.DownloadProfile.AutoRunWhenComplete">
143 <TextBlock Text="下载完成后自动运行下载的文件(仅限exe)"/>
144 </ctr:SwitchButton>
145 <ctr:SwitchButton Command="{Binding SwitchedCommand}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}}" Tag="XFEToolBox.Profiles.CrossVersionProfiles.DownloadProfile.OpenFolderWhenComplete">
146 <TextBlock Text="下载完成后打开目录"/>
147 </ctr:SwitchButton>
142 148 </StackPanel>
143 149 </Grid>
144 150 <Grid Margin="0,20">
Modified XFEToolBox/Views/Pages/SettingPage.xaml.cs +3 -6
@@ -1,9 +1,7 @@
1 using System.Diagnostics;
2 using System.Windows;
1 using System.Windows;
3 2 using System.Windows.Controls;
4 using XFEExtension.NetCore.StringExtension;
5 3 using XFEToolBox.Profiles.CrossVersionProfiles;
6 using XFEToolBox.ViewModel;
4 using XFEToolBox.ViewModel.Pages;
7 5 using XFEToolBox.Views.Controls;
8 6
9 7 namespace XFEToolBox.Views.Pages;
@@ -17,8 +15,7 @@ public partial class SettingPage : Page
17 15 public SettingPageViewModel ViewModel { get; set; }
18 16 public SettingPage()
19 17 {
20 ViewModel = new(this);
21 DataContext = ViewModel;
18 DataContext = ViewModel = new(this);
22 19 Current = this;
23 20 InitializeComponent();
24 21 }
Modified XFEToolBox/Views/Windows/MainWindow.xaml +8 -4
@@ -3,7 +3,7 @@
3 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 4 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5 5 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 xmlns:viewmodel="clr-namespace:XFEToolBox.ViewModel"
6 xmlns:viewmodel="clr-namespace:XFEToolBox.ViewModel.Windows"
7 7 xmlns:ctr="clr-namespace:XFEToolBox.Views.Controls"
8 8 xmlns:local="clr-namespace:XFEToolBox.Views.Windows"
9 9 mc:Ignorable="d"
@@ -24,15 +24,19 @@
24 24 <Border Grid.Column="1" Grid.Row="0" Background="Transparent">
25 25 <Grid>
26 26 <Grid.ColumnDefinitions>
27 <ColumnDefinition Width="Auto"/>
27 28 <ColumnDefinition Width="*"/>
28 29 <ColumnDefinition Width="45"/>
29 30 <ColumnDefinition Width="45"/>
30 31 </Grid.ColumnDefinitions>
31 <Border x:Name="dragTabBorder" CornerRadius="0,0,20,20" Style="{StaticResource TabBorderStyle}" MouseMove="DragTabBorder_MouseMove" MouseDown="DragTabBorder_MouseDown">
32 <Border x:Name="backTabBorder" CornerRadius="10" Style="{StaticResource TabBorderStyle}" Visibility="Collapsed" MouseLeftButtonUp="BackTabBorder_MouseLeftButtonUp">
33 <Image HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4" Source="/Resources/Image/back.png"/>
34 </Border>
35 <Border Grid.Column="1" x:Name="dragTabBorder" CornerRadius="0,0,20,20" Style="{StaticResource TabBorderStyle}" MouseMove="DragTabBorder_MouseMove" MouseDown="DragTabBorder_MouseDown">
32 36 <Image x:Name="dragTabImage" Source="/Resources/Image/tabline.png" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4"/>
33 37 </Border>
34 <Image x:Name="minimizeImage" Style="{StaticResource RotorImage}" Grid.Column="1" Source="/Resources/Image/min.png" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4" MouseLeftButtonUp="MinimizeImage_MouseLeftButtonUp"/>
35 <Image x:Name="closeWindowImage" Style="{StaticResource HalfRotorImage}" Grid.Column="2" Source="/Resources/Image/close.png" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4" MouseLeftButtonUp="CloseWindowImage_MouseLeftButtonUp"/>
38 <Image x:Name="minimizeImage" Style="{StaticResource RotorImage}" Grid.Column="2" Source="/Resources/Image/min.png" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4" MouseLeftButtonUp="MinimizeImage_MouseLeftButtonUp"/>
39 <Image x:Name="closeWindowImage" Style="{StaticResource HalfRotorImage}" Grid.Column="3" Source="/Resources/Image/close.png" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4" MouseLeftButtonUp="CloseWindowImage_MouseLeftButtonUp"/>
36 40 </Grid>
37 41 </Border>
38 42 <Border Grid.Column="0" Grid.Row="0" Background="Transparent">
Modified XFEToolBox/Views/Windows/MainWindow.xaml.cs +4 -1
@@ -2,7 +2,8 @@
2 2 using System.Windows.Media.Animation;
3 3 using XFEExtension.NetCore.InputSimulator;
4 4 using XFEToolBox.Profiles.CrossVersionProfiles;
5 using XFEToolBox.ViewModel;
5 using XFEToolBox.Utilities;
6 using XFEToolBox.ViewModel.Windows;
6 7
7 8 namespace XFEToolBox.Views.Windows
8 9 {
@@ -72,5 +73,7 @@ namespace XFEToolBox.Views.Windows
72 73 }
73 74
74 75 private void CornerBorder_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) => ViewModel.InitializeToResize();
76
77 private void BackTabBorder_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) => NavigationCenter.GoBack();
75 78 }
76 79 }
Modified XFEToolBox/Views/Windows/PopupWindow.xaml +21 -4
@@ -3,13 +3,30 @@
3 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 4 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5 5 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6 xmlns:viewmodel="clr-namespace:XFEToolBox.ViewModel.Windows"
6 7 xmlns:local="clr-namespace:XFEToolBox.Views.Windows"
7 8 mc:Ignorable="d"
8 Title="PopupWindow" ShowInTaskbar="False" Height="100" Width="200" Background="Transparent" WindowStyle="None" AllowsTransparency="True" WindowStartupLocation="CenterOwner">
9 d:DataContext="{d:DesignInstance Type=viewmodel:PopupWindowViewModel}"
10 Title="PopupWindow" ShowInTaskbar="False" Width="300" Height="220" Background="Transparent" WindowStyle="None" AllowsTransparency="True" WindowStartupLocation="CenterOwner">
9 11 <Window.Effect>
10 <DropShadowEffect BlurRadius="3" ShadowDepth="3" Direction="-45"/>
12 <DropShadowEffect BlurRadius="8" ShadowDepth="3" Direction="-45"/>
11 13 </Window.Effect>
12 <Border CornerRadius="10" BorderThickness="2" BorderBrush="#5b5be7" Background="White">
13
14 <Border CornerRadius="15" Background="{Binding PopupBackground}" BorderBrush="{Binding PopupBorder}" BorderThickness="{Binding PopupThickness}" Margin="10">
15 <Grid>
16 <Grid.ColumnDefinitions>
17 <ColumnDefinition Width="*"/>
18 <ColumnDefinition Width="35"/>
19 </Grid.ColumnDefinitions>
20 <Grid.RowDefinitions>
21 <RowDefinition Height="25"/>
22 <RowDefinition Height="*"/>
23 </Grid.RowDefinitions>
24 <Border x:Name="dragTabBorder" CornerRadius="15,0,15,0" Style="{StaticResource TabBorderStyle}" MouseMove="DragTabBorder_MouseMove" Visibility="{Binding MoveButtonVisibility}">
25 <Image x:Name="dragTabImage" Source="/Resources/Image/tabline.png" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4"/>
26 </Border>
27 <Image x:Name="closeWindowImage" Style="{StaticResource HalfRotorImage}" Grid.Column="1" Source="/Resources/Image/close.png" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4" MouseLeftButtonUp="CloseWindowImage_MouseLeftButtonUp" Visibility="{Binding CloseButtonVisibility}"/>
28 <Frame Grid.Row="1" Grid.ColumnSpan="2" x:Name="contentFrame" Content="{Binding Content}" NavigationUIVisibility="Hidden" Background="{Binding PopupContentBackground}" Margin="0,0,0,15"/>
29 <Border Grid.Row="1" Grid.ColumnSpan="2" CornerRadius="0,0,15,15" Background="{Binding PopupContentBackground}" Height="15" VerticalAlignment="Bottom"/>
30 </Grid>
14 31 </Border>
15 32 </Window>
Modified XFEToolBox/Views/Windows/PopupWindow.xaml.cs +28 -22
@@ -1,27 +1,33 @@
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6 using System.Windows;
7 using System.Windows.Controls;
8 using System.Windows.Data;
9 using System.Windows.Documents;
10 using System.Windows.Input;
11 using System.Windows.Media;
12 using System.Windows.Media.Imaging;
13 using System.Windows.Shapes;
1 using System.Windows;
2 using XFEToolBox.ViewModel.Windows;
14 3
15 namespace XFEToolBox.Views.Windows
4 namespace XFEToolBox.Views.Windows;
5
6 /// <summary>
7 /// PopupWindow.xaml 的交互逻辑
8 /// </summary>
9 public partial class PopupWindow : Window
16 10 {
17 /// <summary>
18 /// PopupWindow.xaml 的交互逻辑
19 /// </summary>
20 public partial class PopupWindow : Window
11 public static PopupWindow? Current { get; set; }
12 public PopupWindowViewModel ViewModel { get; set; }
13 public MessageBoxResult? Result { get; set; }
14 public PopupWindow()
15 {
16 Current = this;
17 DataContext = ViewModel = new(this);
18 InitializeComponent();
19 }
20
21 private void CloseWindowImage_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
22 {
23 Result = MessageBoxResult.None;
24 DialogResult = false;
25 Close();
26 }
27
28 private void DragTabBorder_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
21 29 {
22 public PopupWindow()
23 {
24 InitializeComponent();
25 }
30 if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
31 DragMove();
26 32 }
27 33 }
Modified XFEToolBox/XFEToolBox.csproj +3 -1
@@ -7,13 +7,14 @@
7 7 <ImplicitUsings>enable</ImplicitUsings>
8 8 <UseWPF>true</UseWPF>
9 9 <ApplicationIcon>Resources\Icon\XFEToolBoxIcon.ico</ApplicationIcon>
10 <Version>0.1.0</Version>
10 <Version>0.2.0</Version>
11 11 </PropertyGroup>
12 12
13 13 <ItemGroup>
14 14 <None Remove="Resources\Icon\XFEToolBoxIcon.ico" />
15 15 <None Remove="Resources\Icon\XFEToolBoxLogo.png" />
16 16 <None Remove="Resources\Icon\XFEToolBoxSplashScreen.png" />
17 <None Remove="Resources\Image\back.png" />
17 18 <None Remove="Resources\Image\clean.png" />
18 19 <None Remove="Resources\Image\close.png" />
19 20 <None Remove="Resources\Image\console.png" />
@@ -45,6 +46,7 @@
45 46 <ItemGroup>
46 47 <Resource Include="Resources\Icon\XFEToolBoxIcon.ico" />
47 48 <Resource Include="Resources\Icon\XFEToolBoxLogo.png" />
49 <Resource Include="Resources\Image\back.png" />
48 50 <Resource Include="Resources\Image\clean.png" />
49 51 <Resource Include="Resources\Image\close.png" />
50 52 <Resource Include="Resources\Image\console.png" />