Skip to content

Commit

Permalink
替换 UI 控件库为 UI.WPF.Modern,优化界面,整理代码
Browse files Browse the repository at this point in the history
  • Loading branch information
STBBRD committed Dec 24, 2023
1 parent e6a8d0b commit 609bb43
Show file tree
Hide file tree
Showing 14 changed files with 167 additions and 347 deletions.
6 changes: 3 additions & 3 deletions ZongziTEK_Blackboard_Sticker/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ZongziTEK_Blackboard_Sticker"
StartupUri="MainWindow.xaml"
xmlns:ui="http://schemas.modernwpf.com/2019">
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Style/Dark.xaml"/>
<ui:ThemeResources/>
<ui:XamlControlsResources />
<ui:XamlControlsResources/>
<!-- Other merged dictionaries here -->
<ResourceDictionary Source="Style/Light.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
<!-- Other app resources here -->
Expand Down
1 change: 0 additions & 1 deletion ZongziTEK_Blackboard_Sticker/Classes/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
using Windows.Gaming.XboxLive;

namespace ZongziTEK_Blackboard_Sticker
{
Expand Down
4 changes: 2 additions & 2 deletions ZongziTEK_Blackboard_Sticker/FullScreenClock.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ private async void Grid_MouseDown(object sender, MouseButtonEventArgs e)
From = new Thickness(200),
To = new Thickness(150),
Duration = new Duration(TimeSpan.FromMilliseconds(250)),
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }
};

var BorderCloseBigClockExitDoubleAnimation = new DoubleAnimation()
{
From = 1,
To = 0,
Duration = new Duration(TimeSpan.FromMilliseconds(250)),
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }
EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }
};

BorderCloseBigClock.BeginAnimation(MarginProperty, BorderCloseBigClockExitThicknessAnimation);
Expand Down
35 changes: 17 additions & 18 deletions ZongziTEK_Blackboard_Sticker/LauncherEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@
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.modernwpf.com/2019"
xmlns:local="clr-namespace:ZongziTEK_Blackboard_Sticker.Resources"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:local="clr-namespace:ZongziTEK_Blackboard_Sticker"
mc:Ignorable="d"
Title="ZongziTEK 黑板贴 - 启动台编辑器" Height="450" Width="800" MinHeight="450" MinWidth="800"
ui:WindowHelper.UseModernWindowStyle="True"
ui:ThemeManager.RequestedTheme="Light"
Background="#fff3f3f3" WindowStartupLocation="CenterScreen">
ui:WindowHelper.SystemBackdropType="Mica" ui:WindowHelper.UseModernWindowStyle="True" ui:WindowHelper.FixMaximizedWindow="False" ui:ThemeManager.RequestedTheme="Light"
WindowStartupLocation="CenterScreen">
<Grid>
<TextBlock Text="编辑启动台" Margin="24,12,24,12" FontSize="32"/>
<ui:ProgressBar Name="ListProgressBar" IsIndeterminate="True" Margin="48" Visibility="Collapsed"/>
<ui:ProgressRing Name="ListProgressBar" IsIndeterminate="True" Margin="48" Visibility="Collapsed"/>
<ScrollViewer Name="ListScrollViewer" Margin="24,64,24,64" PanningMode="VerticalOnly">
<local:SimpleStackPanel x:Name="ListStackPanel" Spacing="8"/>
<ui:SimpleStackPanel x:Name="ListStackPanel" Spacing="8"/>
</ScrollViewer>
<local:SimpleStackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="24,12,24,12" Spacing="8" Orientation="Horizontal" >
<Button Content="刷新列表" Width="80" Click="ButtonRefresh_Click"/>
<Button Content="新建" Width="80" Click="ButtonNew_Click"/>
</local:SimpleStackPanel>
<ui:SimpleStackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="24,12,24,12" Height="32" Spacing="8" Orientation="Horizontal" >
<Button Content="刷新" Width="80" Click="ButtonRefresh_Click" VerticalAlignment="Stretch"/>
<Button Content="新建" Width="80" Click="ButtonNew_Click" VerticalAlignment="Stretch"/>
</ui:SimpleStackPanel>

<Border Name="BorderNew" Background="#fff3f3f3" Visibility="Collapsed">
<Grid>
<local:SimpleStackPanel Margin="24,12,24,12" Spacing="8">
<ui:SimpleStackPanel Margin="24,12,24,12" Spacing="8">
<TextBlock Text="新建项" FontSize="32"/>
<TextBlock Text="实验性功能,部分文件添加后可能不会显示在启动台中" Foreground="Gray"/>
</local:SimpleStackPanel>
</ui:SimpleStackPanel>
<ScrollViewer Margin="24,84,24,64" PanningMode="VerticalOnly">
<local:SimpleStackPanel Spacing="8">
<ui:SimpleStackPanel Spacing="8">
<TextBlock Text="文件路径" FontSize="16"/>
<Grid Name="GridDataLocation">
<Grid.ColumnDefinitions>
Expand All @@ -41,12 +40,12 @@

<TextBlock Text="名称" FontSize="16"/>
<TextBox Name="TextBoxLinkName"/>
</local:SimpleStackPanel>
</ui:SimpleStackPanel>
</ScrollViewer>
<local:SimpleStackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="24,12,24,12" Spacing="8" Orientation="Horizontal" >
<ui:SimpleStackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="24,12,24,12" Spacing="8" Orientation="Horizontal" >
<Button Name="ButtonCancelNew" Content="取消" Width="80" Click="ButtonCancelNew_Click"/>
<Button Name="ButtonSaveNew" Content="保存" Background="#ff0078d7" Width="80" Foreground="White" Click="ButtonSaveNew_Click"/>
</local:SimpleStackPanel>
<Button Name="ButtonSaveNew" Content="保存" Style="{StaticResource AccentButtonStyle}" Width="80" Click="ButtonSaveNew_Click"/>
</ui:SimpleStackPanel>
</Grid>
</Border>
</Grid>
Expand Down
12 changes: 7 additions & 5 deletions ZongziTEK_Blackboard_Sticker/LauncherEditor.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using IWshRuntimeLibrary;
using iNKORE.UI.WPF.Modern.Controls;
using IWshRuntimeLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -16,6 +17,7 @@
using System.Xml.Linq;
using Drawing = System.Drawing;
using File = System.IO.File;
using MessageBox = iNKORE.UI.WPF.Modern.Controls.MessageBox;

namespace ZongziTEK_Blackboard_Sticker
{
Expand Down Expand Up @@ -86,7 +88,7 @@ private async void LoadList()
};

//按钮里面的布局
ModernWpf.Controls.SimpleStackPanel ContentStackPanel = new()
SimpleStackPanel ContentStackPanel = new()
{
Spacing = 8,
Margin = new(8, 8, 8, 8),
Expand Down Expand Up @@ -129,9 +131,9 @@ private async void LoadList()
Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0))
};

ModernWpf.Controls.SymbolIcon DeleteIcon = new()
SymbolIcon DeleteIcon = new()
{
Symbol = ModernWpf.Controls.Symbol.Delete
Symbol = Symbol.Delete
};

Viewbox DeleteIconViewbox = new()
Expand Down Expand Up @@ -175,7 +177,7 @@ private void DeleteButton_Click(object sender, RoutedEventArgs e)
if (MessageBox.Show("确认删除吗", "编辑启动台", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
{
string LinkPath = AppDomain.CurrentDomain.BaseDirectory + @"LauncherLinks\";
string filePath = LinkPath + ((TextBlock)((ModernWpf.Controls.SimpleStackPanel)((Grid)((Button)sender).Parent).Children[0]).Children[2]).Text + ".lnk";
string filePath = LinkPath + ((TextBlock)((SimpleStackPanel)((Grid)((Button)sender).Parent).Children[0]).Children[2]).Text + ".lnk";
try
{
File.Delete(filePath);
Expand Down
Loading

0 comments on commit 609bb43

Please sign in to comment.