From 9dbf8306af9b5d30230b2ef9510b249c7053de4a Mon Sep 17 00:00:00 2001 From: Taskeren Date: Sat, 6 Apr 2024 00:41:29 +0800 Subject: [PATCH] Added color support for on/off text --- 3074.csproj | 10 --- 3074.sln.DotSettings.user | 2 +- App.xaml | 13 +++- App.xaml.cs | 7 +- OverlayWindow.xaml | 16 ++--- OverlayWindow.xaml.cs | 25 +++++++ Properties/AssemblyInfo.cs | 10 +-- Properties/Resources.Designer.cs | 71 ------------------ Properties/Resources.resx | 120 ------------------------------- 9 files changed, 55 insertions(+), 219 deletions(-) delete mode 100644 Properties/Resources.Designer.cs delete mode 100644 Properties/Resources.resx diff --git a/3074.csproj b/3074.csproj index a4f5311..2d9d91f 100644 --- a/3074.csproj +++ b/3074.csproj @@ -85,19 +85,9 @@ Code - - True - True - Resources.resx - - - ResXFileCodeGenerator - Resources.Designer.cs - - diff --git a/3074.sln.DotSettings.user b/3074.sln.DotSettings.user index 035b726..2aaabe6 100644 --- a/3074.sln.DotSettings.user +++ b/3074.sln.DotSettings.user @@ -1,3 +1,3 @@  - True + True \ No newline at end of file diff --git a/App.xaml b/App.xaml index b710d19..efbba5f 100644 --- a/App.xaml +++ b/App.xaml @@ -5,6 +5,17 @@ Startup="App_OnStartup" DispatcherUnhandledException="App_OnDispatcherUnhandledException"> - + + + diff --git a/App.xaml.cs b/App.xaml.cs index 69489c5..d278f35 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -30,12 +30,13 @@ namespace _3074 writer.WriteLine("An exception occurred when loading tsf."); writer.WriteLine(e.Exception); } - - Console.WriteLine(_3074.Properties.Resources.CrashTextOutputAt); + Console.WriteLine("TSF is crashed."); Console.WriteLine(fileName); + + Console.WriteLine(e.Exception); - Shutdown(); e.Handled = true; + Shutdown(); } [DllImport("shell32.dll", SetLastError = true)] diff --git a/OverlayWindow.xaml b/OverlayWindow.xaml index a243f22..a1e20e4 100644 --- a/OverlayWindow.xaml +++ b/OverlayWindow.xaml @@ -24,18 +24,18 @@ - + - + - + - + - + - + - + - + \ No newline at end of file diff --git a/OverlayWindow.xaml.cs b/OverlayWindow.xaml.cs index 44d887e..0acb61e 100644 --- a/OverlayWindow.xaml.cs +++ b/OverlayWindow.xaml.cs @@ -1,6 +1,9 @@ using System; using System.ComponentModel; +using System.Globalization; using System.Windows; +using System.Windows.Data; +using System.Windows.Media; namespace _3074 { @@ -50,4 +53,26 @@ namespace _3074 Tsf.FFullGame.OnStateChanged += () => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FFullGame))); } } + + public class OnOrOffColorSelector : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (!(value is string str)) return Colors.Orange; + switch (str.ToLower()) + { + case "on": + return Colors.GreenYellow; + case "off": + return Colors.Red; + default: + return Colors.BlueViolet; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new Exception(); + } + } } \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 2d732e8..b518d06 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -7,12 +7,12 @@ using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("_3074")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyTitle("TSF_3074")] +[assembly: AssemblyDescription("ThirtySeventyFour_3074")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("_3074")] -[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyCompany("The Genius Warlock")] +[assembly: AssemblyProduct("TSF_3074")] +[assembly: AssemblyCopyright("Copyright © The Genius Warlock 2024")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs deleted file mode 100644 index 8c34e3a..0000000 --- a/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace _3074.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("_3074.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Tsf has crashed because of unhandled exceptions. Thrown exception log is output at:. - /// - internal static string CrashTextOutputAt { - get { - return ResourceManager.GetString("CrashTextOutputAt", resourceCulture); - } - } - } -} diff --git a/Properties/Resources.resx b/Properties/Resources.resx deleted file mode 100644 index e1633c9..0000000 --- a/Properties/Resources.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tsf has crashed because of unhandled exceptions. Thrown exception log is output at: - - \ No newline at end of file