Skip to content

Commit

Permalink
1.1.3 (beta) 更新
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceTimee committed Mar 29, 2022
1 parent 9cc2a06 commit 7c34dd1
Show file tree
Hide file tree
Showing 10 changed files with 283 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Controls/ToggleSwitch.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void BackRec_MouseDown(object sender, MouseButtonEventArgs e)
SwitchStatus();
}

private void SwitchStatus()
internal void SwitchStatus()
{
if (!IS_TOGGLED)
{
Expand Down
20 changes: 16 additions & 4 deletions Ona-Pix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<PackageReleaseNotes>Yet Another Pixiv Tool</PackageReleaseNotes>
<Authors>Space Time</Authors>
<Company>Space Time</Company>
<AssemblyVersion>1.1.2</AssemblyVersion>
<Version>1.1.2</Version>
<FileVersion>1.1.2</FileVersion>
<InformationalVersion>1.1.2</InformationalVersion>
<AssemblyVersion>1.1.3</AssemblyVersion>
<Version>1.1.3</Version>
<FileVersion>1.1.3</FileVersion>
<InformationalVersion>1.1.3</InformationalVersion>
<PackageTags>Tool;Pixiv;Ona;Pix</PackageTags>
<ApplicationIcon>Ona-Pix-Logo.ico</ApplicationIcon>
<PackageIcon>Ona Pix Logo.png</PackageIcon>
Expand Down Expand Up @@ -99,6 +99,11 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Update="Windows\SettingWindow.xaml.cs">
<SubType>Code</SubType>
</Compile>
Expand All @@ -112,6 +117,13 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>

<ItemGroup>
<Page Update="Windows\SettingWindow.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
Expand Down
2 changes: 1 addition & 1 deletion Pages/AppearancePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Label Content="暗色模式" />
<controls:ToggleSwitch x:Name="DarkModeToggle" Style="{StaticResource SettingToggle}" MouseDown="DarkModeToggle_MouseDown" />
</Grid>
<Grid x:Name="IconButtonGrid" Margin="0,0,0,10" IsEnabled="False">
<Grid x:Name="IconButtonGrid" Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="1*" />
Expand Down
35 changes: 30 additions & 5 deletions Pages/AppearancePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,48 @@ public AppearancePage()
InitializeComponent();
}

private void DarkModeToggle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
internal void DarkModeToggle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
((BundledTheme)Application.Current.Resources.MergedDictionaries[0]).BaseTheme =
DarkModeToggle.IS_TOGGLED ? BaseTheme.Dark : BaseTheme.Light;
if (DarkModeToggle.IS_TOGGLED)
{
((BundledTheme)Application.Current.Resources.MergedDictionaries[0]).BaseTheme = BaseTheme.Dark;
Properties.Settings.Default.IsDarkMode = true;
}
else
{
((BundledTheme)Application.Current.Resources.MergedDictionaries[0]).BaseTheme = BaseTheme.Light;
Properties.Settings.Default.IsDarkMode = false;
}

Properties.Settings.Default.Save();

SetButtonContent();
}
private void IconButtonToggle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
internal void IconButtonToggle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (IconButtonToggle.IS_TOGGLED)
Properties.Settings.Default.IsIconButton = true;
else
Properties.Settings.Default.IsIconButton = false;

Properties.Settings.Default.Save();

SetButtonContent();
}
private void LockAnimationToggle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
internal void LockAnimationToggle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (LockAnimationToggle.IS_TOGGLED)
{
Define.MAIN_WINDOW!.ActiveSpace_MouseIn(this, null!);
Properties.Settings.Default.IsAnimationLocked = true;
}
else
{
Define.MAIN_WINDOW!.ActiveSpace_MouseOut(this, null!);
Properties.Settings.Default.IsAnimationLocked = false;
}

Properties.Settings.Default.Save();
}
private void HideBorderToggle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
Expand Down
10 changes: 9 additions & 1 deletion Pages/BehaviorPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Content="禁用报错" />
<controls:ToggleSwitch x:Name="DisableExceptionToggle" Style="{StaticResource SettingToggle}" />
<controls:ToggleSwitch x:Name="DisableExceptionToggle" Style="{StaticResource SettingToggle}" MouseDown="DisableExceptionToggle_MouseDown" />
</Grid>
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Content="禁用一言" />
<controls:ToggleSwitch x:Name="DisableTipsToggle" Style="{StaticResource SettingToggle}" MouseDown="DisableTipsToggle_MouseDown" />
</Grid>
</StackPanel>
</UserControl>
19 changes: 19 additions & 0 deletions Pages/BehaviorPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,24 @@ public BehaviorPage()
{
InitializeComponent();
}

internal void DisableExceptionToggle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (DisableExceptionToggle.IS_TOGGLED)
Properties.Settings.Default.IsExceptionDisabled = true;
else
Properties.Settings.Default.IsExceptionDisabled = false;

Properties.Settings.Default.Save();
}
internal void DisableTipsToggle_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (DisableTipsToggle.IS_TOGGLED)
Properties.Settings.Default.IsTipsDisabled = true;
else
Properties.Settings.Default.IsTipsDisabled = false;

Properties.Settings.Default.Save();
}
}
}
98 changes: 98 additions & 0 deletions Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Properties/Settings.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Ona_Pix.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="IsFirstRun" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="IsDarkMode" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="IsIconButton" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="IsAnimationLocked" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="IsExceptionDisabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="IsTipsDisabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
36 changes: 36 additions & 0 deletions Windows/AboutWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,28 @@
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media.Imaging;
using Ona_Pix.Pages;
using WpfAnimatedGif;

namespace Ona_Pix
{
public partial class AboutWindow : Window
{
public static readonly string[] TIPS = new string[]
{
"主人","主...主人?","好的,主人","是,主人","收到,主人",
"主人累了吗","休息一下吧,主人","注意休息,主人","注意身体,主人",
"女仆的工作★","一起喝咖啡吧,主人","咖啡Suki★","咖啡Daisuki★",
"那里不可以,主人","啊,主人好棒","主人,❤",
"不可以瑟瑟","瑟瑟打咩!","H是不可以的!",
"Ona Pix","Ona Piksu?","Ona Piku★","Ona...阿嚏!",
"A B C D","A C G N","S S S S","Y A P T","L O V E",
"关于: 关于:",
"❤","✨","★",
"(。・ω・。)ノ♡","(๑• . •๑)","•ᴗ•",
"Esc?","Ctrl+W?"
};

public AboutWindow(bool isDarkMode)
{
InitializeComponent();
Expand All @@ -27,6 +43,26 @@ public AboutWindow(bool isDarkMode)

ImageBehavior.SetAnimatedSource(TanImage, bitmapImage);
}

if (!((BehaviorPage)Define.SETTING_WINDOW.Resources["behaviorPage"]).DisableTipsToggle.IS_TOGGLED)
{
Random random = new(Convert.ToInt32(DateTime.Now.Ticks & 0x0000FFFF));
Title = $"关于: {TIPS[random.Next(0, TIPS.Length)]}";

#region Tips 测试代码
//System.Threading.Tasks.Task.Run(() =>
//{
// Dispatcher.Invoke(() =>
// {
// for (int i = 0; i < TIPS.Length; i++)
// {
// Title = $"关于: {TIPS[i]}";
// System.Threading.Thread.Sleep(1000);
// }
// });
//});
#endregion Tips 测试代码
}
}
private void AboutWin_Loaded(object sender, RoutedEventArgs e)
{
Expand Down
Loading

0 comments on commit 7c34dd1

Please sign in to comment.