├── .gitignore ├── LICENSE ├── README.md ├── documents └── _dummy ├── images ├── XIVNote.ico ├── XIVNote_256.png ├── XIVNote_512.png ├── XIVNote_overview.png └── _dummy └── source ├── Thirdparty └── _dummy ├── XIVNote.sln ├── XIVNote ├── App.config ├── App.xaml ├── App.xaml.cs ├── Config.DefaultValues.cs ├── Config.cs ├── FodyWeavers.xml ├── FodyWeavers.xsd ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Note.Default.cs ├── Note.cs ├── Notes.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ViewModels │ ├── ConfigViewModel.cs │ ├── MainWindowViewModel.cs │ ├── NoteConfigViewModel.cs │ ├── NoteViewModel.cs │ └── WidgetViewModel.cs ├── Views │ ├── ConfigView.xaml │ ├── ConfigView.xaml.cs │ ├── INoteOverlay.cs │ ├── NoteConfigView.xaml │ ├── NoteConfigView.xaml.cs │ ├── NoteView.xaml │ ├── NoteView.xaml.cs │ ├── WidgetView.xaml │ └── WidgetView.xaml.cs ├── XIVNote.csproj ├── XIVNote.ico ├── app.manifest └── images │ └── _dummy ├── aframe ├── documents │ └── _dummy ├── images │ └── _dummy ├── source │ ├── _dummy │ ├── aframe.Core │ │ ├── AppLogger.Server.cs │ │ ├── AppLogger.Wrapper.cs │ │ ├── AppLogger.cs │ │ ├── Bases │ │ │ ├── JsonConfigBase.cs │ │ │ └── RestClientBase.cs │ │ ├── Constants.cs │ │ ├── Controls │ │ │ └── BindableRichTextBox.cs │ │ ├── Converters │ │ │ ├── BooleanConverter.cs │ │ │ ├── BooleanToHiddenConverter.cs │ │ │ ├── BooleanToIntConverter.cs │ │ │ ├── BooleanToNotVisibilityConverter.cs │ │ │ ├── ColorToBrushConverter.cs │ │ │ ├── CompanyNameConverter.cs │ │ │ ├── CompanyNameOmitConverter.cs │ │ │ ├── CompanyNameToShortConverter.cs │ │ │ ├── DayOfWeekToBrushConverter.cs │ │ │ ├── EnumBooleanConverter.cs │ │ │ ├── EnumToDisplayNameConverter.cs │ │ │ ├── FontFamilyToNameConverter.cs │ │ │ ├── FontSizeToLargeConverter.cs │ │ │ ├── FontSizeToSmallConverter.cs │ │ │ ├── InverseBooleanConverter.cs │ │ │ └── StringToDoubleConverter.cs │ │ ├── Crypter.cs │ │ ├── Dialogs │ │ │ ├── ColorDialogResult.cs │ │ │ ├── ColorDialogWrapper.cs │ │ │ ├── FontDialogResult.cs │ │ │ ├── FontDialogWrapper.cs │ │ │ └── Views │ │ │ │ ├── ColorDialog.cs │ │ │ │ ├── ColorDialogContent.xaml │ │ │ │ ├── ColorDialogContent.xaml.cs │ │ │ │ ├── ColorDialogViewModel.cs │ │ │ │ ├── Dialog.xaml │ │ │ │ ├── Dialog.xaml.cs │ │ │ │ ├── FontDialog.cs │ │ │ │ ├── FontDialogContent.xaml │ │ │ │ └── FontDialogContent.xaml.cs │ │ ├── Extensions │ │ │ ├── AssemblyExtensions.cs │ │ │ ├── DateTimeExtensions.cs │ │ │ ├── DependencyObjectExtensions.cs │ │ │ ├── EnumExtensions.cs │ │ │ ├── EnumerableExtensions.cs │ │ │ ├── ExceptionExtensions.cs │ │ │ ├── ObjectExtensions.cs │ │ │ ├── ObservableCollectionExtensions.cs │ │ │ ├── StringExtensions.cs │ │ │ └── TreeViewExtensions.cs │ │ ├── FodyWeavers.xml │ │ ├── FodyWeavers.xsd │ │ ├── FontInfo.cs │ │ ├── Helpers │ │ │ ├── CommandHelper.cs │ │ │ ├── DocumentHelper.cs │ │ │ ├── MessageBoxHelper.cs │ │ │ ├── ScrollViewerHelper.cs │ │ │ ├── WPFHelper.cs │ │ │ └── WebBrowserHelper.cs │ │ ├── Models │ │ │ └── VersionInfoModel.cs │ │ ├── NativeMethods.cs │ │ ├── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ ├── Settings.Designer.cs │ │ │ └── Settings.settings │ │ ├── SuspendableObservableCollection.cs │ │ ├── Updater.ico │ │ ├── Updater │ │ │ ├── ReleaseChannels.cs │ │ │ ├── ReleaseNote.cs │ │ │ ├── ReleaseNotes.cs │ │ │ └── UpdateChecker.cs │ │ ├── ViewModels │ │ │ ├── HelpViewModel.cs │ │ │ └── UpdateCheckerViewModel.cs │ │ ├── Views │ │ │ ├── CreditView.xaml │ │ │ ├── CreditView.xaml.cs │ │ │ ├── HelpView.xaml │ │ │ ├── HelpView.xaml.cs │ │ │ ├── IOverlay.cs │ │ │ ├── MessageView.xaml │ │ │ ├── MessageView.xaml.cs │ │ │ ├── MessageWindow.xaml │ │ │ ├── MessageWindow.xaml.cs │ │ │ ├── UpdateCheckerView.xaml │ │ │ └── UpdateCheckerView.xaml.cs │ │ ├── WaColors.cs │ │ ├── WrappingStream.cs │ │ └── aframe.Core.csproj │ ├── aframe.Updater │ │ ├── App.config │ │ ├── FodyWeavers.xml │ │ ├── FodyWeavers.xsd │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Updater.ico │ │ ├── aframe.Updater.csproj │ │ └── app.manifest │ ├── aframe.sln │ └── restore_packages.ps1 └── tools │ └── nuget.exe └── tools ├── 7za.exe ├── Version.master.cs └── libz.exe /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 anoyetta 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XIVNote 2 | [![Downloads](https://img.shields.io/github/downloads/anoyetta/XIVNote/total.svg)](https://github.com/anoyetta/XIVNote/releases) 3 | [![License](https://img.shields.io/github/license/anoyetta/XIVNote.svg)](https://github.com/anoyetta/XIVNote) 4 |   5 | ![XIVNote Overview](https://github.com/anoyetta/XIVNote/blob/master/images/XIVNote_overview.png?raw=true) 6 | 7 | 「14ノート」とでも呼んでください。 8 |   9 | FFXIV向けの付箋ツールです。 10 | FFXIVのウィンドウに対して常に前面にいるように設定されたいわゆる付箋ツールです。 11 | FFXIVのメモリ、ログ、パケットを読み取ることは一切ありません。 12 | 13 | 地図探索時の座標メモや攻略時のボスの攻撃シーケンスのカンペなどご自由にお使いください。 14 | 15 | **[Lastest-Release](https://github.com/anoyetta/XIVTags/releases)** 16 | -------------------------------------------------------------------------------- /documents/_dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/documents/_dummy -------------------------------------------------------------------------------- /images/XIVNote.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/images/XIVNote.ico -------------------------------------------------------------------------------- /images/XIVNote_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/images/XIVNote_256.png -------------------------------------------------------------------------------- /images/XIVNote_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/images/XIVNote_512.png -------------------------------------------------------------------------------- /images/XIVNote_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/images/XIVNote_overview.png -------------------------------------------------------------------------------- /images/_dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/images/_dummy -------------------------------------------------------------------------------- /source/Thirdparty/_dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/source/Thirdparty/_dummy -------------------------------------------------------------------------------- /source/XIVNote.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28714.193 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aframe.Core", "aframe\source\aframe.Core\aframe.Core.csproj", "{1E602601-AEA4-47CD-8F44-6C5E1D7387A5}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aframe.Updater", "aframe\source\aframe.Updater\aframe.Updater.csproj", "{38E4D044-78F5-453E-A52C-96F6B201C8B8}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XIVNote", "XIVNote\XIVNote.csproj", "{7FE1DE40-7B3D-4B06-A29C-D199754F45C3}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {1E602601-AEA4-47CD-8F44-6C5E1D7387A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {1E602601-AEA4-47CD-8F44-6C5E1D7387A5}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {1E602601-AEA4-47CD-8F44-6C5E1D7387A5}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {1E602601-AEA4-47CD-8F44-6C5E1D7387A5}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {38E4D044-78F5-453E-A52C-96F6B201C8B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {38E4D044-78F5-453E-A52C-96F6B201C8B8}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {38E4D044-78F5-453E-A52C-96F6B201C8B8}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {38E4D044-78F5-453E-A52C-96F6B201C8B8}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {7FE1DE40-7B3D-4B06-A29C-D199754F45C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {7FE1DE40-7B3D-4B06-A29C-D199754F45C3}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {7FE1DE40-7B3D-4B06-A29C-D199754F45C3}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {7FE1DE40-7B3D-4B06-A29C-D199754F45C3}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {B02AAB55-E009-4683-A86E-C8F7D1D54733} 36 | SolutionGuid = {D1BC3741-3A21-4CE3-8E3A-98EAAB6019E9} 37 | EndGlobalSection 38 | EndGlobal 39 | -------------------------------------------------------------------------------- /source/XIVNote/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /source/XIVNote/App.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 39 | 40 | 57 | 58 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /source/XIVNote/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Reflection; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Interop; 8 | using System.Windows.Media; 9 | using System.Windows.Threading; 10 | using aframe; 11 | 12 | namespace XIVNote 13 | { 14 | /// 15 | /// App.xaml の相互作用ロジック 16 | /// 17 | public partial class App : Application 18 | { 19 | public App() 20 | { 21 | AppDomain.CurrentDomain.AssemblyResolve += CefSharpResolver; 22 | 23 | this.ShutdownMode = ShutdownMode.OnMainWindowClose; 24 | RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; 25 | 26 | this.Startup += this.App_Startup; 27 | this.Exit += this.App_Exit; 28 | this.DispatcherUnhandledException += this.App_DispatcherUnhandledException; 29 | } 30 | 31 | private async void App_Startup(object sender, StartupEventArgs e) 32 | { 33 | var c = Config.Instance; 34 | c.SetStartup(c.IsStartupWithWindows); 35 | 36 | var notes = await Task.Run(() => Notes.Instance); 37 | await notes.ShowNotesAsync(); 38 | 39 | await Task.Delay(10); 40 | notes.StartForegroundAppSubscriber(); 41 | 42 | c.StartAutoSave(); 43 | } 44 | 45 | private void App_Exit(object sender, ExitEventArgs e) 46 | { 47 | // NO-OP 48 | } 49 | 50 | private async void App_DispatcherUnhandledException( 51 | object sender, 52 | DispatcherUnhandledExceptionEventArgs e) 53 | { 54 | await Task.Run(() => 55 | { 56 | Notes.Instance.Save(); 57 | Config.Instance.Save(); 58 | 59 | File.WriteAllText( 60 | @".\XIVNote.error.log", 61 | e.Exception.ToString(), 62 | new UTF8Encoding(false)); 63 | }); 64 | 65 | if (this.MainWindow != null) 66 | { 67 | MessageBoxHelper.ShowDialogMessageWindow( 68 | "XIVNote - Fatal", 69 | "予期しない例外を検知しました。アプリケーションを終了します。", 70 | e.Exception); 71 | } 72 | else 73 | { 74 | MessageBox.Show( 75 | "予期しない例外を検知しました。アプリケーションを終了します。\n\n" + 76 | e.Exception, 77 | "XIVNote - Fatal", 78 | MessageBoxButton.OK, 79 | MessageBoxImage.Error); 80 | } 81 | } 82 | 83 | private static Assembly CefSharpResolver(object sender, ResolveEventArgs args) 84 | { 85 | if (args.Name.StartsWith("CefSharp", StringComparison.OrdinalIgnoreCase)) 86 | { 87 | var assemblyName = args.Name.Split(new[] { ',' }, 2)[0] + ".dll"; 88 | var archSpecificPath = Path.Combine( 89 | AppDomain.CurrentDomain.SetupInformation.ApplicationBase, 90 | Environment.Is64BitProcess ? "x64" : "x86", 91 | assemblyName); 92 | 93 | return File.Exists(archSpecificPath) ? 94 | Assembly.LoadFile(archSpecificPath) : 95 | null; 96 | } 97 | 98 | return null; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /source/XIVNote/Config.DefaultValues.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace XIVNote 5 | { 6 | public partial class Config 7 | { 8 | public static readonly double DefaultWidth = 380; 9 | public static readonly double DefaultHeight = 640; 10 | 11 | public override Dictionary DefaultValues => new Dictionary() 12 | { 13 | { nameof(Scale), 1.0d }, 14 | { nameof(X), 200 }, 15 | { nameof(Y), 100 }, 16 | { nameof(W), DefaultWidth }, 17 | { nameof(H), DefaultHeight }, 18 | { nameof(IsStartupWithWindows), false }, 19 | { nameof(IsMinimizeStartup), false }, 20 | { nameof(IsHideWhenNotExistsFFXIV), false }, 21 | { nameof(ImageFileDirectory), Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) }, 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/XIVNote/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /source/XIVNote/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using MahApps.Metro.Controls; 4 | using XIVNote.ViewModels; 5 | 6 | namespace XIVNote 7 | { 8 | /// 9 | /// MainWindow.xaml の相互作用ロジック 10 | /// 11 | public partial class MainWindow : MetroWindow 12 | { 13 | public MainWindow() 14 | { 15 | this.InitializeComponent(); 16 | 17 | this.StateChanged += this.MainWindow_StateChanged; 18 | 19 | if (Config.Instance.IsMinimizeStartup) 20 | { 21 | this.ShowInTaskbar = false; 22 | this.WindowState = WindowState.Minimized; 23 | 24 | this.Loaded += (_, __) => 25 | { 26 | this.ToHide(); 27 | this.ShowInTaskbar = true; 28 | }; 29 | } 30 | else 31 | { 32 | this.Loaded += (_, __) => this.Activate(); 33 | } 34 | 35 | this.ViewModel.ShowCallback = () => this.ToShow(); 36 | } 37 | 38 | public MainWindowViewModel ViewModel => this.DataContext as MainWindowViewModel; 39 | 40 | private void MainWindow_StateChanged(object sender, EventArgs e) 41 | { 42 | if (this.WindowState == WindowState.Minimized) 43 | { 44 | this.ToHide(); 45 | } 46 | else 47 | { 48 | this.ToShow(); 49 | } 50 | } 51 | 52 | public void ToShow() 53 | { 54 | this.Show(); 55 | this.WindowState = WindowState.Normal; 56 | this.NotifyIcon.Visibility = Visibility.Collapsed; 57 | 58 | this.Activate(); 59 | } 60 | 61 | public void ToHide() 62 | { 63 | this.NotifyIcon.Visibility = Visibility.Visible; 64 | this.Hide(); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /source/XIVNote/Note.Default.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Serialization; 3 | using aframe; 4 | using Prism.Mvvm; 5 | 6 | namespace XIVNote 7 | { 8 | public partial class Note : BindableBase 9 | { 10 | public static readonly double DefaultNoteSize = 350; 11 | public static readonly double DefaultWidgetNoteSize = 530; 12 | 13 | public static readonly double MinWidth = 200; 14 | 15 | public static readonly double MinHeight = 100; 16 | 17 | public static Note CreateNew() 18 | { 19 | var obj = (Notes.Instance.DefaultNote ?? DefaultNoteStyle).Clone(); 20 | obj.ID = Guid.NewGuid(); 21 | obj.Text = string.Empty; 22 | return obj; 23 | } 24 | 25 | [XmlIgnore] 26 | public static readonly Note DefaultNoteStyle = new Note() 27 | { 28 | IsDefault = true, 29 | W = DefaultNoteSize, 30 | H = DefaultNoteSize, 31 | ForegroundColorString = "#000000", 32 | BackgroundColorString = "#fcc800", 33 | Opacity = 0.9, 34 | Font = FontInfo.DefaultFont, 35 | }; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/XIVNote/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | [assembly: AssemblyTitle("XIVNote")] 6 | [assembly: AssemblyDescription("https://github.com/anoyetta/XIVNote")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("XIVNote")] 10 | [assembly: AssemblyCopyright("Copyright © anoyetta 2019")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: ThemeInfo( 15 | ResourceDictionaryLocation.None, 16 | ResourceDictionaryLocation.SourceAssembly 17 | )] 18 | [assembly: AssemblyVersion("2.2.1.0")] 19 | -------------------------------------------------------------------------------- /source/XIVNote/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace XIVNote.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 17 | /// 18 | // このクラスは StronglyTypedResourceBuilder クラスが ResGen 19 | // または Visual Studio のようなツールを使用して自動生成されました。 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に 21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("XIVNote.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします 51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /source/XIVNote/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /source/XIVNote/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // このコードはツールによって生成されました。 4 | // ランタイム バージョン:4.0.30319.42000 5 | // 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 7 | // コードが再生成されるときに損失したりします。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace XIVNote.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/XIVNote/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /source/XIVNote/ViewModels/ConfigViewModel.cs: -------------------------------------------------------------------------------- 1 | using aframe; 2 | using Prism.Commands; 3 | using Prism.Mvvm; 4 | 5 | namespace XIVNote.ViewModels 6 | { 7 | public class ConfigViewModel : BindableBase 8 | { 9 | public ConfigViewModel() 10 | { 11 | } 12 | 13 | public Config Config => Config.Instance; 14 | 15 | public Note DefaultNote => Notes.Instance.DefaultNote; 16 | 17 | private DelegateCommand changeBackgroundCommand; 18 | 19 | public DelegateCommand ChangeBackgroundCommand => 20 | this.changeBackgroundCommand ?? (this.changeBackgroundCommand = new DelegateCommand( 21 | () => CommandHelper.ExecuteChangeColor( 22 | () => this.DefaultNote.BackgroundColor, 23 | color => this.DefaultNote.BackgroundColor = color))); 24 | 25 | private DelegateCommand changeForegroundCommand; 26 | 27 | public DelegateCommand ChangeForegroundCommand => 28 | this.changeForegroundCommand ?? (this.changeForegroundCommand = new DelegateCommand( 29 | () => CommandHelper.ExecuteChangeColor( 30 | () => this.DefaultNote.ForegroundColor, 31 | color => this.DefaultNote.ForegroundColor = color))); 32 | 33 | private DelegateCommand changeFontCommand; 34 | 35 | public DelegateCommand ChangeFontCommand => 36 | this.changeFontCommand ?? (this.changeFontCommand = new DelegateCommand( 37 | () => CommandHelper.ExecuteChangeFont( 38 | () => this.DefaultNote.Font, 39 | font => this.DefaultNote.Font = font))); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/XIVNote/ViewModels/MainWindowViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using aframe; 5 | using Prism.Commands; 6 | using Prism.Mvvm; 7 | using XIVNote.Views; 8 | 9 | namespace XIVNote.ViewModels 10 | { 11 | public class MainWindowViewModel : BindableBase 12 | { 13 | public Action ShowCallback { get; set; } 14 | 15 | public MainWindowViewModel() 16 | { 17 | Notes.Instance.NoteList.CollectionChanged += (_, __) => this.RaisePropertyChanged(nameof(this.NoteList)); 18 | } 19 | 20 | public Config Config => Config.Instance; 21 | 22 | public IEnumerable NoteList => Notes.Instance.NoteList.Where(x => !x.IsDefault); 23 | 24 | #region Show 25 | 26 | private DelegateCommand showCommand; 27 | 28 | public DelegateCommand ShowCommand => 29 | this.showCommand ?? (this.showCommand = new DelegateCommand(this.ExecuteShowCommand)); 30 | 31 | private void ExecuteShowCommand() => this.ShowCallback?.Invoke(); 32 | 33 | #endregion Show 34 | 35 | #region ShowConfig 36 | 37 | private DelegateCommand showConfigCommand; 38 | 39 | public DelegateCommand ShowConfigCommand => 40 | this.showConfigCommand ?? (this.showConfigCommand = new DelegateCommand(this.ExecuteShowConfigCommand)); 41 | 42 | private void ExecuteShowConfigCommand() 43 | { 44 | var mainView = WPFHelper.MainWindow; 45 | 46 | var configView = new ConfigView(); 47 | configView.Height = mainView.Height; 48 | configView.Left = mainView.Left + mainView.Width + 3; 49 | configView.Top = mainView.Top; 50 | 51 | configView.Show(); 52 | } 53 | 54 | #endregion ShowConfig 55 | 56 | #region Exit 57 | 58 | private DelegateCommand exitCommand; 59 | 60 | public DelegateCommand ExitCommand => 61 | this.exitCommand ?? (this.exitCommand = new DelegateCommand(this.ExecuteExitCommand)); 62 | 63 | private void ExecuteExitCommand() => WPFHelper.MainWindow?.Close(); 64 | 65 | #endregion Exit 66 | 67 | #region AddWidget 68 | 69 | private DelegateCommand addWidgetCommand; 70 | 71 | public DelegateCommand AddWidgetCommand => 72 | this.addWidgetCommand ?? (this.addWidgetCommand = new DelegateCommand(this.ExecuteAddWidgetCommand)); 73 | 74 | private async void ExecuteAddWidgetCommand() => await Notes.Instance.AddNoteAsync( 75 | Notes.Instance.NoteList.LastOrDefault(x => !x.IsDefault), 76 | true); 77 | 78 | #endregion AddWidget 79 | 80 | #region AddNote 81 | 82 | private DelegateCommand addNoteCommand; 83 | 84 | public DelegateCommand AddNoteCommand => 85 | this.addNoteCommand ?? (this.addNoteCommand = new DelegateCommand(this.ExecuteAddNoteCommand)); 86 | 87 | private async void ExecuteAddNoteCommand() => await Notes.Instance.AddNoteAsync( 88 | Notes.Instance.NoteList.LastOrDefault(x => !x.IsDefault)); 89 | 90 | #endregion AddNote 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /source/XIVNote/ViewModels/NoteConfigViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using aframe; 3 | using Prism.Commands; 4 | using Prism.Mvvm; 5 | 6 | namespace XIVNote.ViewModels 7 | { 8 | public class NoteConfigViewModel : BindableBase 9 | { 10 | public NoteConfigViewModel() 11 | { 12 | } 13 | 14 | private Note model = WPFHelper.IsDesignMode ? Note.DefaultNoteStyle : null; 15 | 16 | public Note Model 17 | { 18 | get => this.model; 19 | set => this.SetProperty(ref this.model, value); 20 | } 21 | 22 | public Guid ID => this.Model?.ID ?? Guid.Empty; 23 | 24 | private DelegateCommand changeBackgroundCommand; 25 | 26 | public DelegateCommand ChangeBackgroundCommand => 27 | this.changeBackgroundCommand ?? (this.changeBackgroundCommand = new DelegateCommand( 28 | () => CommandHelper.ExecuteChangeColor( 29 | () => this.model.BackgroundColor, 30 | color => this.model.BackgroundColor = color))); 31 | 32 | private DelegateCommand changeForegroundCommand; 33 | 34 | public DelegateCommand ChangeForegroundCommand => 35 | this.changeForegroundCommand ?? (this.changeForegroundCommand = new DelegateCommand( 36 | () => CommandHelper.ExecuteChangeColor( 37 | () => this.model.ForegroundColor, 38 | color => this.model.ForegroundColor = color))); 39 | 40 | private DelegateCommand changeFontCommand; 41 | 42 | public DelegateCommand ChangeFontCommand => 43 | this.changeFontCommand ?? (this.changeFontCommand = new DelegateCommand( 44 | () => CommandHelper.ExecuteChangeFont( 45 | () => this.model.Font, 46 | font => this.model.Font = font))); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/XIVNote/ViewModels/NoteViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Threading; 3 | using aframe; 4 | using Prism.Commands; 5 | using Prism.Mvvm; 6 | using XIVNote.Views; 7 | 8 | namespace XIVNote.ViewModels 9 | { 10 | public class NoteViewModel : BindableBase 11 | { 12 | public NoteViewModel() 13 | { 14 | if (!AutoSaveTimer.IsEnabled) 15 | { 16 | AutoSaveTimer.Start(); 17 | } 18 | } 19 | 20 | private Note model = WPFHelper.IsDesignMode ? Note.DefaultNoteStyle : null; 21 | 22 | public Note Model 23 | { 24 | get => this.model; 25 | set => this.SetProperty(ref this.model, value); 26 | } 27 | 28 | public Guid ID => this.Model?.ID ?? Guid.Empty; 29 | 30 | public Config Config => Config.Instance; 31 | 32 | #region AddNote 33 | 34 | private DelegateCommand addNoteCommand; 35 | 36 | public DelegateCommand AddNoteCommand => 37 | this.addNoteCommand ?? (this.addNoteCommand = new DelegateCommand(this.ExecuteAddNoteCommand)); 38 | 39 | private async void ExecuteAddNoteCommand() => await Notes.Instance.AddNoteAsync(this.Model); 40 | 41 | #endregion AddNote 42 | 43 | #region ShowConfig 44 | 45 | private DelegateCommand showConfigCommand; 46 | 47 | public DelegateCommand ShowConfigCommand => 48 | this.showConfigCommand ?? (this.showConfigCommand = new DelegateCommand(this.ExecuteShowConfigCommand)); 49 | 50 | private void ExecuteShowConfigCommand() 51 | { 52 | var config = new NoteConfigView(); 53 | 54 | config.ViewModel.Model = this.Model; 55 | config.Height = this.Model.H; 56 | config.Top = this.Model.Y; 57 | config.Left = this.Model.X + this.Model.W + 3; 58 | 59 | config.Show(); 60 | } 61 | 62 | #endregion ShowConfig 63 | 64 | #region Minimize 65 | 66 | private DelegateCommand minimizeCommand; 67 | 68 | public DelegateCommand MinimizeCommand => 69 | this.minimizeCommand ?? (this.minimizeCommand = new DelegateCommand(this.ExecuteMinimizeCommand)); 70 | 71 | private void ExecuteMinimizeCommand() 72 | { 73 | this.Model.IsVisible = false; 74 | Notes.Instance.EnqueueSave(); 75 | } 76 | 77 | #endregion Minimize 78 | 79 | #region Close 80 | 81 | private DelegateCommand closeCommand; 82 | 83 | public DelegateCommand CloseCommand => 84 | this.closeCommand ?? (this.closeCommand = new DelegateCommand(this.ExecuteCloseCommand)); 85 | 86 | private async void ExecuteCloseCommand() => await Notes.Instance.RemoveNoteAsync(this.Model); 87 | 88 | #endregion Close 89 | 90 | #region Auto Save Timer 91 | 92 | public static volatile bool IsSaveQueue = false; 93 | 94 | private static readonly Lazy LazyAutoSaveTimer = new Lazy(CreateAutoSaveTimer); 95 | 96 | private static DispatcherTimer AutoSaveTimer => LazyAutoSaveTimer.Value; 97 | 98 | private static DispatcherTimer CreateAutoSaveTimer() 99 | { 100 | var timer = new DispatcherTimer(DispatcherPriority.ContextIdle) 101 | { 102 | Interval = TimeSpan.FromSeconds(6), 103 | }; 104 | 105 | timer.Tick += (_, __) => 106 | { 107 | if (IsSaveQueue) 108 | { 109 | IsSaveQueue = false; 110 | Notes.Instance.EnqueueSave(); 111 | } 112 | }; 113 | 114 | return timer; 115 | } 116 | 117 | #endregion Auto Save Timer 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /source/XIVNote/ViewModels/WidgetViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using System.Windows.Threading; 4 | using aframe; 5 | using Prism.Commands; 6 | using Prism.Mvvm; 7 | 8 | namespace XIVNote.ViewModels 9 | { 10 | public class WidgetViewModel : BindableBase 11 | { 12 | public WidgetViewModel() 13 | { 14 | if (!AutoSaveTimer.IsEnabled) 15 | { 16 | AutoSaveTimer.Start(); 17 | } 18 | } 19 | 20 | private Note model = WPFHelper.IsDesignMode ? Note.DefaultNoteStyle : null; 21 | 22 | public Note Model 23 | { 24 | get => this.model; 25 | set => this.SetProperty(ref this.model, value); 26 | } 27 | 28 | public Guid ID => this.Model?.ID ?? Guid.Empty; 29 | 30 | public Config Config => Config.Instance; 31 | 32 | private DelegateCommand changeBackgroundCommand; 33 | 34 | public DelegateCommand ChangeBackgroundCommand => 35 | this.changeBackgroundCommand ?? (this.changeBackgroundCommand = new DelegateCommand( 36 | () => CommandHelper.ExecuteChangeColor( 37 | () => this.model.BackgroundColor, 38 | color => this.model.BackgroundColor = color))); 39 | 40 | #region Minimize 41 | 42 | private DelegateCommand minimizeCommand; 43 | 44 | public DelegateCommand MinimizeCommand => 45 | this.minimizeCommand ?? (this.minimizeCommand = new DelegateCommand(this.ExecuteMinimizeCommand)); 46 | 47 | private async void ExecuteMinimizeCommand() 48 | { 49 | this.Model.IsVisible = false; 50 | await Task.Run(Notes.Instance.Save); 51 | } 52 | 53 | #endregion Minimize 54 | 55 | #region Close 56 | 57 | private DelegateCommand closeCommand; 58 | 59 | public DelegateCommand CloseCommand => 60 | this.closeCommand ?? (this.closeCommand = new DelegateCommand(this.ExecuteCloseCommand)); 61 | 62 | private async void ExecuteCloseCommand() => await Notes.Instance.RemoveNoteAsync(this.Model); 63 | 64 | #endregion Close 65 | 66 | #region Auto Save Timer 67 | 68 | public static volatile bool IsSaveQueue = false; 69 | 70 | private static readonly Lazy LazyAutoSaveTimer = new Lazy(CreateAutoSaveTimer); 71 | 72 | private static DispatcherTimer AutoSaveTimer => LazyAutoSaveTimer.Value; 73 | 74 | private static DispatcherTimer CreateAutoSaveTimer() 75 | { 76 | var timer = new DispatcherTimer(DispatcherPriority.ContextIdle) 77 | { 78 | Interval = TimeSpan.FromSeconds(7), 79 | }; 80 | 81 | timer.Tick += (_, __) => 82 | { 83 | if (IsSaveQueue) 84 | { 85 | IsSaveQueue = false; 86 | Notes.Instance.EnqueueSave(); 87 | } 88 | }; 89 | 90 | return timer; 91 | } 92 | 93 | #endregion Auto Save Timer 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /source/XIVNote/Views/ConfigView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using MahApps.Metro.Controls; 3 | 4 | namespace XIVNote.Views 5 | { 6 | /// 7 | /// ConfigView.xaml の相互作用ロジック 8 | /// 9 | public partial class ConfigView : MetroWindow 10 | { 11 | public ConfigView() 12 | { 13 | this.InitializeComponent(); 14 | 15 | this.Closing += async (_, __) => 16 | { 17 | await Task.Run(() => 18 | { 19 | Config.Instance.Save(); 20 | Notes.Instance.Save(); 21 | }); 22 | }; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/XIVNote/Views/INoteOverlay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using aframe.Views; 3 | 4 | namespace XIVNote.Views 5 | { 6 | public interface INoteOverlay : IOverlay 7 | { 8 | Guid ID { get; } 9 | 10 | Note Note { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /source/XIVNote/Views/NoteConfigView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MahApps.Metro.Controls; 3 | using XIVNote.ViewModels; 4 | 5 | namespace XIVNote.Views 6 | { 7 | /// 8 | /// NoteConfigView.xaml の相互作用ロジック 9 | /// 10 | public partial class NoteConfigView : MetroWindow 11 | { 12 | public NoteConfigView() 13 | { 14 | this.InitializeComponent(); 15 | } 16 | 17 | public NoteConfigViewModel ViewModel => this.DataContext as NoteConfigViewModel; 18 | 19 | public Guid ID => this.ViewModel?.Model?.ID ?? Guid.Empty; 20 | 21 | public Config Config => Config.Instance; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/XIVNote/Views/NoteView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using aframe.Views; 6 | using XIVNote.ViewModels; 7 | 8 | namespace XIVNote.Views 9 | { 10 | /// 11 | /// NoteView.xaml の相互作用ロジック 12 | /// 13 | public partial class NoteView : Window, INoteOverlay 14 | { 15 | public NoteView() 16 | { 17 | this.InitializeComponent(); 18 | 19 | this.MinWidth = Note.MinWidth; 20 | this.MinHeight = Note.MinHeight; 21 | 22 | this.Image.MouseLeftButtonDown += (_, __) => this.DragMove(); 23 | this.ToolBarGrid.MouseLeftButtonDown += (_, __) => this.DragMove(); 24 | 25 | this.MouseEnter += (_, __) => this.ToolBarGrid.Visibility = Visibility.Visible; 26 | this.MouseLeave += (_, __) => this.ToolBarGrid.Visibility = Visibility.Collapsed; 27 | 28 | this.Loaded += (_, __) => 29 | { 30 | this.ViewModel.Model.PropertyChanged += this.Model_PropertyChanged; 31 | 32 | this.InitializeOverlayVisible( 33 | ref this.overlayVisible, 34 | this.ViewModel.Model?.IsVisible ?? true); 35 | 36 | this.ToolBarGrid.Visibility = this.IsMouseOver ? 37 | Visibility.Visible : 38 | Visibility.Collapsed; 39 | 40 | this.SubscribeZOrderCorrector(); 41 | }; 42 | 43 | this.Closed += (_, __) => 44 | { 45 | this.ViewModel.Model.PropertyChanged -= this.Model_PropertyChanged; 46 | }; 47 | 48 | this.LeftThumb.DragDelta += (_, e) => 49 | { 50 | this.Left += e.HorizontalChange; 51 | this.Width -= e.HorizontalChange; 52 | }; 53 | 54 | this.RightThumb.DragDelta += (_, e) => 55 | { 56 | this.Width += e.HorizontalChange; 57 | }; 58 | 59 | this.TopThumb.DragDelta += (_, e) => 60 | { 61 | this.Top += e.VerticalChange; 62 | this.Height -= e.VerticalChange; 63 | }; 64 | 65 | this.BottomThumb.DragDelta += (_, e) => 66 | { 67 | this.Height += e.VerticalChange; 68 | }; 69 | } 70 | 71 | public NoteViewModel ViewModel => this.DataContext as NoteViewModel; 72 | 73 | public Guid ID => this.ViewModel?.Model?.ID ?? Guid.Empty; 74 | 75 | public Note Note 76 | { 77 | get => this.ViewModel.Model; 78 | set => this.ViewModel.Model = value; 79 | } 80 | 81 | private void Model_PropertyChanged(object sender, PropertyChangedEventArgs e) 82 | { 83 | var model = sender as Note; 84 | 85 | switch (e.PropertyName) 86 | { 87 | case nameof(Note.IsVisible): 88 | this.OverlayVisible = model.IsVisible; 89 | break; 90 | 91 | default: 92 | break; 93 | } 94 | 95 | NoteViewModel.IsSaveQueue = true; 96 | } 97 | 98 | private void NoteTextBox_TextChanged(object sender, TextChangedEventArgs e) 99 | => this.ViewModel.Model.Text = this.NoteTextBox.Text; 100 | 101 | #region IOverlay 102 | 103 | public int ZOrder => 0; 104 | 105 | private bool overlayVisible; 106 | 107 | public bool OverlayVisible 108 | { 109 | get => this.overlayVisible; 110 | set => this.SetOverlayVisible(ref this.overlayVisible, value); 111 | } 112 | 113 | #endregion IOverlay 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /source/XIVNote/XIVNote.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/source/XIVNote/XIVNote.ico -------------------------------------------------------------------------------- /source/XIVNote/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | true/PM 23 | 24 | 25 | 26 | 27 | 28 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /source/XIVNote/images/_dummy: -------------------------------------------------------------------------------- 1 | # Markdown file -------------------------------------------------------------------------------- /source/aframe/documents/_dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/source/aframe/documents/_dummy -------------------------------------------------------------------------------- /source/aframe/images/_dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/source/aframe/images/_dummy -------------------------------------------------------------------------------- /source/aframe/source/_dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anoyetta/XIVNote/b7a0dff302cf8b0d44538e1aa38a89c949161c53/source/aframe/source/_dummy -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/AppLogger.Server.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Runtime.CompilerServices; 4 | using Microsoft.AspNetCore.Mvc; 5 | 6 | namespace aframe 7 | { 8 | public static partial class AppLogger 9 | { 10 | public static void WriteApiErrorLog( 11 | ControllerBase controller, 12 | Exception exception, 13 | [CallerMemberName] string callerMemberName = null, 14 | [CallerFilePath] string callerFilePath = null) 15 | { 16 | var caller = string.Empty; 17 | if (!string.IsNullOrEmpty(callerMemberName) && 18 | !string.IsNullOrEmpty(callerFilePath)) 19 | { 20 | caller = $"{Path.GetFileNameWithoutExtension(callerFilePath)} {callerMemberName}()"; 21 | } 22 | 23 | var uri = default(string); 24 | var request = controller.Request; 25 | if (request != null) 26 | { 27 | uri = $"{request.Method} {request.Path}{request.QueryString}"; 28 | } 29 | 30 | AppLogger.Error( 31 | uri != null ? $"[{caller}] {uri}" : $"[{caller}]", 32 | exception); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/AppLogger.Wrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Runtime.CompilerServices; 4 | using System.Threading.Tasks; 5 | 6 | namespace aframe 7 | { 8 | public static partial class AppLogger 9 | { 10 | public delegate bool ExceptionHandler(string methodName, Exception catchedException); 11 | 12 | public static Action Wrap( 13 | Func action, 14 | ExceptionHandler exceptionHandler = null, 15 | [CallerMemberName] string callerMemberName = null, 16 | [CallerFilePath] string callerFilePath = null) 17 | => new Action(async () => 18 | { 19 | var caller = string.Empty; 20 | if (!string.IsNullOrEmpty(callerMemberName) && 21 | !string.IsNullOrEmpty(callerFilePath)) 22 | { 23 | caller = $"{Path.GetFileNameWithoutExtension(callerFilePath)} {callerMemberName}()"; 24 | } 25 | 26 | try 27 | { 28 | AppLogger.Write($"{caller} begin."); 29 | await action(); 30 | } 31 | catch (Exception ex) 32 | { 33 | AppLogger.Error($"{caller} catched exception.", ex); 34 | 35 | var handled = false; 36 | if (exceptionHandler != null) 37 | { 38 | handled = exceptionHandler.Invoke(caller, ex); 39 | } 40 | 41 | if (!handled) 42 | { 43 | throw; 44 | } 45 | } 46 | finally 47 | { 48 | AppLogger.Write($"{caller} end."); 49 | } 50 | }); 51 | 52 | public static Action Wrap( 53 | Action action, 54 | ExceptionHandler exceptionHandler = null, 55 | [CallerMemberName] string callerMemberName = null, 56 | [CallerFilePath] string callerFilePath = null) 57 | => new Action(() => 58 | { 59 | var caller = string.Empty; 60 | if (!string.IsNullOrEmpty(callerMemberName) && 61 | !string.IsNullOrEmpty(callerFilePath)) 62 | { 63 | caller = $"{Path.GetFileNameWithoutExtension(callerFilePath)} {callerMemberName}()"; 64 | } 65 | 66 | try 67 | { 68 | AppLogger.Write($"{caller} begin."); 69 | action(); 70 | } 71 | catch (Exception ex) 72 | { 73 | AppLogger.Error($"{caller} catched exception.", ex); 74 | 75 | var handled = false; 76 | if (exceptionHandler != null) 77 | { 78 | handled = exceptionHandler.Invoke(caller, ex); 79 | } 80 | 81 | if (!handled) 82 | { 83 | throw; 84 | } 85 | } 86 | finally 87 | { 88 | AppLogger.Write($"{caller} end."); 89 | } 90 | }); 91 | 92 | public static void RunWrap( 93 | Func action, 94 | ExceptionHandler exceptionHandler = null, 95 | [CallerMemberName] string callerMemberName = null, 96 | [CallerFilePath] string callerFilePath = null) 97 | => Wrap(action, exceptionHandler, callerMemberName, callerFilePath).Invoke(); 98 | 99 | public static void RunWrap( 100 | Action action, 101 | ExceptionHandler exceptionHandler = null, 102 | [CallerMemberName] string callerMemberName = null, 103 | [CallerFilePath] string callerFilePath = null) 104 | => Wrap(action, exceptionHandler, callerMemberName, callerFilePath).Invoke(); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Bases/RestClientBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Specialized; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Net.Http; 6 | using System.Net.Http.Headers; 7 | using System.Threading.Tasks; 8 | using System.Web; 9 | using aframe.Models; 10 | using aframe.ViewModels; 11 | 12 | namespace aframe 13 | { 14 | public abstract class RestClientBase : 15 | IDisposable 16 | { 17 | public abstract Uri BaseAddress { get; } 18 | 19 | private readonly HttpClient client = new HttpClient(); 20 | 21 | public RestClientBase() 22 | { 23 | this.InitializeClient(); 24 | } 25 | 26 | private void InitializeClient() 27 | { 28 | this.client.BaseAddress = this.BaseAddress; 29 | this.client.DefaultRequestHeaders.Accept.Clear(); 30 | this.client.DefaultRequestHeaders.Accept.Add( 31 | new MediaTypeWithQualityHeaderValue("application/json")); 32 | } 33 | 34 | public async Task CreateAsync( 35 | string uri, 36 | T data, 37 | NameValueCollection queryString = null) 38 | { 39 | if (queryString != null) 40 | { 41 | uri += "?" + queryString.ToString(); 42 | } 43 | 44 | var res = await this.client.PostAsJsonAsync(uri, data); 45 | res.EnsureSuccessStatusCode(); 46 | return res; 47 | } 48 | 49 | public async Task GetAsync( 50 | string uri, 51 | NameValueCollection queryString = null) 52 | { 53 | if (queryString != null) 54 | { 55 | uri += "?" + queryString.ToString(); 56 | } 57 | 58 | return await this.client.GetAsync(uri); 59 | } 60 | 61 | public async Task UpdateAsync( 62 | string uri, 63 | object id, 64 | T data, 65 | NameValueCollection queryString = null) 66 | { 67 | uri = Path.Combine(uri, id.ToString()); 68 | uri = uri.Replace("\\", "/"); 69 | 70 | if (queryString != null) 71 | { 72 | uri += "?" + queryString.ToString(); 73 | } 74 | 75 | var res = await this.client.PutAsJsonAsync(uri, data); 76 | res.EnsureSuccessStatusCode(); 77 | return res; 78 | } 79 | 80 | public async Task DeleteAsync( 81 | string uri, 82 | object id, 83 | NameValueCollection queryString = null) 84 | { 85 | uri = Path.Combine(uri, id.ToString()); 86 | uri = uri.Replace("\\", "/"); 87 | 88 | if (queryString != null) 89 | { 90 | uri += "?" + queryString.ToString(); 91 | } 92 | 93 | var res = await client.DeleteAsync(uri); 94 | res.EnsureSuccessStatusCode(); 95 | return res; 96 | } 97 | 98 | public async Task GetVersionAsync() 99 | { 100 | try 101 | { 102 | var result = await this.GetAsync("version"); 103 | var vi = await result?.Content?.ReadAsAsync(); 104 | if (vi != null) 105 | { 106 | HelpViewModel.Instance.AddVersionInfos(vi); 107 | } 108 | } 109 | catch (Exception ex) 110 | { 111 | Debug.WriteLine(ex); 112 | } 113 | } 114 | 115 | public NameValueCollection CreateQueryStringParser() 116 | => HttpUtility.ParseQueryString(string.Empty); 117 | 118 | public void Dispose() 119 | { 120 | this.client?.Dispose(); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace aframe 2 | { 3 | public static class Constants 4 | { 5 | /// 6 | /// フォントサイズの拡大基本レート 7 | /// 8 | public const double FontSizeScalingRate = 0.1; 9 | 10 | public static double ScalingL => 1.0 + (Constants.FontSizeScalingRate * 1.0); 11 | 12 | public static double ScalingXL => 1.0 + (Constants.FontSizeScalingRate * 2.0); 13 | 14 | public static double ScalingS => 1.0 - (Constants.FontSizeScalingRate * 1.0); 15 | 16 | public static double ScalingXS => 1.0 - (Constants.FontSizeScalingRate * 2.0); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Controls/BindableRichTextBox.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Documents; 4 | 5 | namespace aframe 6 | { 7 | public class BindableRichTextBox : RichTextBox 8 | { 9 | public static readonly DependencyProperty DocumentProperty = DependencyProperty.Register( 10 | nameof(Document), 11 | typeof(FlowDocument), 12 | typeof(BindableRichTextBox), 13 | new UIPropertyMetadata( 14 | null, 15 | OnRichTextItemsChanged)); 16 | 17 | public new FlowDocument Document 18 | { 19 | get => (FlowDocument)this.GetValue(DocumentProperty); 20 | set => this.SetValue(DocumentProperty, value); 21 | } 22 | 23 | private static void OnRichTextItemsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 24 | { 25 | var control = sender as RichTextBox; 26 | if (control != null) 27 | { 28 | control.Document = e.NewValue as FlowDocument; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/BooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace aframe 7 | { 8 | public class BooleanConverter : IValueConverter 9 | { 10 | public BooleanConverter( 11 | T trueValue, 12 | T falseValue) 13 | { 14 | this.True = trueValue; 15 | this.False = falseValue; 16 | } 17 | 18 | public T True { get; set; } 19 | 20 | public T False { get; set; } 21 | 22 | public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture) 23 | => value is bool && ((bool)value) ? True : False; 24 | 25 | public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 26 | => value is T && EqualityComparer.Default.Equals((T)value, True); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/BooleanToHiddenConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace aframe 4 | { 5 | public class BooleanToHiddenConverter : 6 | BooleanConverter 7 | { 8 | public BooleanToHiddenConverter() : 9 | base(Visibility.Visible, Visibility.Hidden) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/BooleanToIntConverter.cs: -------------------------------------------------------------------------------- 1 | namespace aframe 2 | { 3 | public class BooleanToIntConverter : 4 | BooleanConverter 5 | { 6 | public BooleanToIntConverter() : 7 | base(1, 0) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/BooleanToNotVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace aframe 4 | { 5 | public class BooleanToNotVisibilityConverter : 6 | BooleanConverter 7 | { 8 | public BooleanToNotVisibilityConverter() : 9 | base(Visibility.Collapsed, Visibility.Visible) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/ColorToBrushConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows.Media; 5 | 6 | namespace aframe 7 | { 8 | public class ColorToBrushConverter : 9 | IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 12 | { 13 | if (value is Color color) 14 | { 15 | return new SolidColorBrush(color); 16 | } 17 | 18 | return null; 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | => value; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/CompanyNameConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace aframe 5 | { 6 | public static class CompanyNameConverter 7 | { 8 | #region 会社称号の定義テーブル 9 | 10 | private static readonly IReadOnlyList<(string Formal, string Short)> CompanySubtitles = new List<(string Formal, string Short)>() 11 | { 12 | // 株式会社 13 | ("株式会社", "(株)"), 14 | ("株式会社", "㈱"), 15 | ("株式会社", "(株"), 16 | ("株式会社", "株)"), 17 | ("株式会社", "(カ)"), 18 | ("株式会社", "(カ"), 19 | ("株式会社", "カ)"), 20 | 21 | // 有限会社 22 | ("有限会社", "(有)"), 23 | ("有限会社", "㈲"), 24 | ("有限会社", "(有"), 25 | ("有限会社", "有)"), 26 | ("有限会社", "(ユ)"), 27 | ("有限会社", "(ユ"), 28 | ("有限会社", "ユ)"), 29 | 30 | // 医療法人 31 | ("医療法人", "(医)"), 32 | ("医療法人", "(医"), 33 | ("医療法人", "医)"), 34 | ("医療法人", "(イ)"), 35 | ("医療法人", "(イ"), 36 | ("医療法人", "イ)"), 37 | ("医療法人社団", "(医)"), 38 | ("医療法人社団", "(医"), 39 | ("医療法人社団", "医)"), 40 | ("医療法人社団", "(イ)"), 41 | ("医療法人社団", "(イ"), 42 | ("医療法人社団", "イ)"), 43 | ("医療法人財団", "(医)"), 44 | ("医療法人財団", "(医"), 45 | ("医療法人財団", "医)"), 46 | ("医療法人財団", "(イ)"), 47 | ("医療法人財団", "(イ"), 48 | ("医療法人財団", "イ)"), 49 | ("社会医療法人", "(医)"), 50 | ("社会医療法人", "(医"), 51 | ("社会医療法人", "医)"), 52 | ("社会医療法人", "(イ)"), 53 | ("社会医療法人", "(イ"), 54 | ("社会医療法人", "イ)"), 55 | 56 | // 福祉系 57 | ("宗教法人", "(宗)"), 58 | ("宗教法人", "宗)"), 59 | ("宗教法人", "(宗"), 60 | ("宗教法人", "(シユウ)"), 61 | ("宗教法人", "シユウ)"), 62 | ("宗教法人", "(シユウ"), 63 | ("学校法人", "(学)"), 64 | ("学校法人", "学)"), 65 | ("学校法人", "(学"), 66 | ("学校法人", "(ガク)"), 67 | ("学校法人", "ガク)"), 68 | ("学校法人", "(ガク"), 69 | ("社会福祉法人", "(福)"), 70 | ("社会福祉法人", "福)"), 71 | ("社会福祉法人", "(福"), 72 | ("社会福祉法人", "(フク)"), 73 | ("社会福祉法人", "フク)"), 74 | ("社会福祉法人", "(フク"), 75 | 76 | // 士業系 77 | ("税理士法人", "(税)"), 78 | ("税理士法人", "税)"), 79 | ("税理士法人", "(税"), 80 | ("税理士法人", "(ゼイ)"), 81 | ("税理士法人", "ゼイ)"), 82 | ("税理士法人", "(ゼイ"), 83 | ("弁護士法人", "(弁)"), 84 | ("弁護士法人", "弁)"), 85 | ("弁護士法人", "(弁"), 86 | ("弁護士法人", "(ベン)"), 87 | ("弁護士法人", "ベン)"), 88 | ("弁護士法人", "(ベン"), 89 | ("行政書士法人", "(行)"), 90 | ("行政書士法人", "行)"), 91 | ("行政書士法人", "(行"), 92 | ("行政書士法人", "(ギヨ)"), 93 | ("行政書士法人", "ギヨ)"), 94 | ("行政書士法人", "(ギヨ"), 95 | ("司法書士法人", "(司)"), 96 | ("司法書士法人", "司)"), 97 | ("司法書士法人", "(司"), 98 | ("司法書士法人", "(シホウ)"), 99 | ("司法書士法人", "シホウ)"), 100 | ("司法書士法人", "(シホウ"), 101 | ("社会保険労務士法人", "(労)"), 102 | ("社会保険労務士法人", "労)"), 103 | ("社会保険労務士法人", "(労"), 104 | ("社会保険労務士法人", "(ロウム)"), 105 | ("社会保険労務士法人", "ロウム)"), 106 | ("社会保険労務士法人", "(ロウム"), 107 | }; 108 | 109 | #endregion 会社称号の定義テーブル 110 | 111 | /// 112 | /// 会社名から称号を除去する 113 | /// 114 | /// 115 | /// 116 | public static string Omit( 117 | string companyName) 118 | { 119 | var result = companyName; 120 | 121 | // 一旦全角に変換する 122 | result = result.ToWide(); 123 | 124 | foreach (var entry in CompanySubtitles) 125 | { 126 | result = result.Replace(entry.Formal, string.Empty); 127 | result = result.Replace(entry.Short.ToWide(), string.Empty); 128 | } 129 | 130 | result = result.Trim(); 131 | 132 | return result; 133 | } 134 | 135 | /// 136 | /// 会社名の称号を正式表記にする 137 | /// 138 | /// 139 | /// 140 | public static string ToFormal( 141 | string companyName) 142 | { 143 | var result = companyName; 144 | 145 | // 一旦全角に変換する 146 | result = result.ToWide(); 147 | 148 | foreach (var entry in CompanySubtitles) 149 | { 150 | result = result.Replace(entry.Short.ToWide(), entry.Formal); 151 | } 152 | 153 | result = result.Trim(); 154 | 155 | return result; 156 | } 157 | 158 | /// 159 | /// 会社名の称号を省略表記にする 160 | /// 161 | /// 162 | /// 163 | public static string ToShort( 164 | string companyName) 165 | { 166 | var result = companyName; 167 | 168 | // 一旦正式表記に変換する 169 | result = ToFormal(result); 170 | 171 | var topSubtitles = CompanySubtitles 172 | .GroupBy(x => x.Formal) 173 | .Select(x => x.First()); 174 | 175 | foreach (var entry in topSubtitles) 176 | { 177 | result = result.Replace(entry.Formal, entry.Short.ToNarrow()); 178 | } 179 | 180 | result = result.Trim(); 181 | 182 | return result; 183 | } 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/CompanyNameOmitConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace aframe 6 | { 7 | /// 8 | /// 会社名の称号をカットするコンバーター 9 | /// 10 | /// 11 | /// 株式会社ほげ -> ほげ 12 | /// 有限会社ふー -> ふー 13 | /// (株)ほげ -> ほげ 14 | /// (有)ふー -> ふー 15 | /// 16 | public class CompanyNameOmitConverter : 17 | IValueConverter 18 | { 19 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 20 | { 21 | if (!(value is string text)) 22 | { 23 | return value; 24 | } 25 | 26 | return CompanyNameConverter.Omit(text); 27 | } 28 | 29 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 30 | => value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/CompanyNameToShortConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace aframe 6 | { 7 | /// 8 | /// 会社名の称号を省略表記にするコンバーター 9 | /// 10 | /// 11 | /// 株式会社 -> (株) 12 | /// 有限会社 -> (有) 13 | /// 14 | public class CompanyNameToShortConverter : 15 | IValueConverter 16 | { 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | if (!(value is string text)) 20 | { 21 | return value; 22 | } 23 | 24 | return CompanyNameConverter.ToShort(text); 25 | } 26 | 27 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 28 | => value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/DayOfWeekToBrushConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows.Media; 5 | 6 | namespace aframe 7 | { 8 | public class DayOfWeekToBrushConverter : 9 | IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 12 | { 13 | if (!(value is DateTime date)) 14 | { 15 | return null; 16 | } 17 | 18 | switch (date.DayOfWeek) 19 | { 20 | case DayOfWeek.Saturday: 21 | return Brushes.Blue; 22 | 23 | case DayOfWeek.Sunday: 24 | return Brushes.Red; 25 | 26 | default: 27 | return Brushes.Transparent; 28 | } 29 | } 30 | 31 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 32 | => value; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/EnumBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace aframe 7 | { 8 | public class EnumBooleanConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | var parameterString = parameter as string; 13 | if (parameterString == null) 14 | { 15 | return DependencyProperty.UnsetValue; 16 | } 17 | 18 | if (Enum.IsDefined(value.GetType(), value) == false) 19 | { 20 | return DependencyProperty.UnsetValue; 21 | } 22 | 23 | var parameterValue = Enum.Parse(value.GetType(), parameterString); 24 | 25 | return parameterValue.Equals(value); 26 | } 27 | 28 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 29 | { 30 | var parameterString = parameter as string; 31 | if (parameterString == null) 32 | { 33 | return DependencyProperty.UnsetValue; 34 | } 35 | 36 | return Enum.Parse(targetType, parameterString); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/EnumToDisplayNameConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace aframe 6 | { 7 | public class EnumToDisplayNameConverter : 8 | IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (!(value is Enum e)) 13 | { 14 | return value; 15 | } 16 | 17 | return e.ToDisplayName(); 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 21 | => value; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/FontFamilyToNameConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | using System.Threading; 5 | using System.Windows.Data; 6 | using System.Windows.Media; 7 | 8 | namespace aframe 9 | { 10 | public class FontFamilyToNameConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | var v = value as FontFamily; 15 | var cul = Thread.CurrentThread.CurrentCulture; 16 | return v.FamilyNames.FirstOrDefault(o => 17 | o.Key.IetfLanguageTag.ToLower() == cul.IetfLanguageTag.ToLower()).Value ?? v.Source; 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | return null; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/FontSizeToLargeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace aframe 6 | { 7 | public class FontSizeToLargeConverter : 8 | IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (!(value is double size)) 13 | { 14 | return value; 15 | } 16 | 17 | var rate = Constants.FontSizeScalingRate; 18 | if (parameter != null && 19 | parameter is double rateParam) 20 | { 21 | rate = rateParam; 22 | } 23 | 24 | return size + (size * rate); 25 | } 26 | 27 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 28 | { 29 | if (!(value is double size)) 30 | { 31 | return value; 32 | } 33 | 34 | var rate = Constants.FontSizeScalingRate; 35 | if (parameter != null && 36 | parameter is double rateParam) 37 | { 38 | rate = rateParam; 39 | } 40 | 41 | return size - (size * rate); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/FontSizeToSmallConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace aframe 6 | { 7 | public class FontSizeToSmallConverter : 8 | IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (!(value is double size)) 13 | { 14 | return value; 15 | } 16 | 17 | var rate = Constants.FontSizeScalingRate; 18 | if (parameter != null && 19 | parameter is double rateParam) 20 | { 21 | rate = rateParam; 22 | } 23 | 24 | return size - (size * rate); 25 | } 26 | 27 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 28 | { 29 | if (!(value is double size)) 30 | { 31 | return value; 32 | } 33 | 34 | var rate = Constants.FontSizeScalingRate; 35 | if (parameter != null && 36 | parameter is double rateParam) 37 | { 38 | rate = rateParam; 39 | } 40 | 41 | return size + (size * rate); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/InverseBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace aframe 6 | { 7 | [ValueConversion(typeof(bool), typeof(bool))] 8 | public class InverseBooleanConverter : IValueConverter 9 | { 10 | #region IValueConverter Members 11 | 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | if (targetType != typeof(bool)) 15 | throw new InvalidOperationException("The target must be a boolean"); 16 | 17 | return !(bool)value; 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | throw new NotSupportedException(); 23 | } 24 | 25 | #endregion IValueConverter Members 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Converters/StringToDoubleConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace aframe 6 | { 7 | public class StringToDoubleConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | double d; 12 | double.TryParse((string)value, out d); 13 | return d; 14 | } 15 | 16 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | if (parameter == null) 19 | { 20 | return ((double)value).ToString(); 21 | } 22 | else 23 | { 24 | return ((double)value).ToString((string)parameter); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Crypter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | using System.Text; 4 | 5 | namespace aframe 6 | { 7 | public class Crypter 8 | { 9 | /// 10 | /// 初期Salt 11 | /// 12 | private static readonly string DefaultSalt = "L+DCZF4pmD8SVAv.$m5sYv/3$,x$wXAW"; 13 | 14 | /// 15 | /// 初期パスワード 16 | /// 17 | private static readonly string DefaultPassword = "ym%#EPcY5g(WN4CRTE|mv5c/rvqVXA7m"; 18 | 19 | /// 20 | /// 文字列を暗号化する 21 | /// 22 | /// 暗号化する文字列 23 | /// 暗号化に使用するパスワード 24 | /// 暗号化された文字列 25 | public static string EncryptString( 26 | string sourceString, 27 | string password = null) 28 | { 29 | if (string.IsNullOrEmpty(password)) 30 | { 31 | password = DefaultPassword; 32 | } 33 | 34 | var encryptedString = string.Empty; 35 | 36 | using (var rijndael = new RijndaelManaged()) 37 | { 38 | byte[] key, iv; 39 | Crypter.GenerateKeyFromPassword(password, rijndael.KeySize, out key, rijndael.BlockSize, out iv); 40 | rijndael.Key = key; 41 | rijndael.IV = iv; 42 | 43 | var strBytes = Encoding.UTF8.GetBytes(sourceString); 44 | 45 | using (var encryptor = rijndael.CreateEncryptor()) 46 | { 47 | var encBytes = encryptor.TransformFinalBlock(strBytes, 0, strBytes.Length); 48 | encryptedString = Convert.ToBase64String(encBytes); 49 | } 50 | } 51 | 52 | return encryptedString; 53 | } 54 | 55 | /// 56 | /// 暗号化された文字列を復号化する 57 | /// 58 | /// 暗号化された文字列 59 | /// 暗号化に使用したパスワード 60 | /// 復号化された文字列 61 | public static string DecryptString( 62 | string sourceString, 63 | string password = null) 64 | { 65 | if (string.IsNullOrEmpty(password)) 66 | { 67 | password = DefaultPassword; 68 | } 69 | 70 | var decryptedString = string.Empty; 71 | 72 | using (var rijndael = new RijndaelManaged()) 73 | { 74 | byte[] key, iv; 75 | Crypter.GenerateKeyFromPassword(password, rijndael.KeySize, out key, rijndael.BlockSize, out iv); 76 | rijndael.Key = key; 77 | rijndael.IV = iv; 78 | 79 | var strBytes = Convert.FromBase64String(sourceString); 80 | 81 | using (var decryptor = rijndael.CreateDecryptor()) 82 | { 83 | var decBytes = decryptor.TransformFinalBlock(strBytes, 0, strBytes.Length); 84 | decryptedString = Encoding.UTF8.GetString(decBytes); 85 | } 86 | } 87 | 88 | return decryptedString; 89 | } 90 | 91 | /// 92 | /// パスワードから共有キーと初期化ベクタを生成する 93 | /// 94 | /// 基になるパスワード 95 | /// 共有キーのサイズ(ビット) 96 | /// 作成された共有キー 97 | /// 初期化ベクタのサイズ(ビット) 98 | /// 作成された初期化ベクタ 99 | private static void GenerateKeyFromPassword( 100 | string password, 101 | int keySize, 102 | out byte[] key, 103 | int blockSize, 104 | out byte[] iv) 105 | { 106 | // パスワードから共有キーと初期化ベクタを作成する 107 | // saltを決める 108 | var salt = Encoding.UTF8.GetBytes(DefaultSalt); 109 | 110 | // Rfc2898DeriveBytesオブジェクトを作成する 111 | var deriveBytes = new Rfc2898DeriveBytes(password, salt); 112 | 113 | // 反復処理回数を指定する 114 | deriveBytes.IterationCount = 1000; 115 | 116 | // 共有キーと初期化ベクタを生成する 117 | key = deriveBytes.GetBytes(keySize / 8); 118 | iv = deriveBytes.GetBytes(blockSize / 8); 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Dialogs/ColorDialogResult.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Runtime.Serialization; 3 | using System.Runtime.Serialization.Json; 4 | using System.Text; 5 | using System.Windows.Media; 6 | using FFXIV.Framework.Extensions; 7 | 8 | namespace FFXIV.Framework.Dialog 9 | { 10 | [DataContract] 11 | public class ColorDialogResult 12 | { 13 | public const string SymbolKeyword = nameof(ColorDialogResult); 14 | 15 | [DataMember(Order = 1)] 16 | public string Symbol { get; set; } = SymbolKeyword; 17 | 18 | [DataMember(Order = 2)] 19 | public bool Result { get; set; } 20 | 21 | [DataMember(Order = 3)] 22 | public Color Color { get; set; } 23 | 24 | [DataMember(Order = 4)] 25 | public bool IgnoreAlpha { get; set; } 26 | 27 | public System.Drawing.Color LegacyColor => this.Color.ToLegacy(); 28 | 29 | public static ColorDialogResult FromString( 30 | string json) 31 | { 32 | var obj = default(ColorDialogResult); 33 | 34 | var serializer = new DataContractJsonSerializer(typeof(ColorDialogResult)); 35 | var data = Encoding.UTF8.GetBytes(json); 36 | using (var ms = new MemoryStream(data)) 37 | { 38 | obj = (ColorDialogResult)serializer.ReadObject(ms); 39 | } 40 | 41 | return obj; 42 | } 43 | 44 | public override string ToString() 45 | { 46 | var json = string.Empty; 47 | 48 | var serializer = new DataContractJsonSerializer(typeof(ColorDialogResult)); 49 | using (var ms = new MemoryStream()) 50 | { 51 | serializer.WriteObject(ms, this); 52 | json = Encoding.UTF8.GetString(ms.ToArray()); 53 | } 54 | 55 | return json; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Dialogs/ColorDialogWrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Media; 2 | using FFXIV.Framework.Dialog.Views; 3 | using FFXIV.Framework.Extensions; 4 | 5 | namespace FFXIV.Framework.Dialog 6 | { 7 | public class ColorDialogWrapper 8 | { 9 | public static ColorDialogResult ShowDialog( 10 | System.Drawing.Color? color = null, 11 | bool ignoreAlpha = false) 12 | { 13 | var wpfColor = color?.ToWPF(); 14 | return ColorDialogWrapper.ShowDialog(wpfColor, ignoreAlpha); 15 | } 16 | 17 | public static ColorDialogResult ShowDialog( 18 | Color? color = null, 19 | bool ignoreAlpha = false) 20 | { 21 | var result = new ColorDialogResult() 22 | { 23 | Color = color.HasValue ? color.Value : Colors.Transparent, 24 | IgnoreAlpha = ignoreAlpha, 25 | }; 26 | 27 | ColorDialog.Color = result.Color; 28 | ColorDialog.IgnoreAlpha = result.IgnoreAlpha; 29 | if (ColorDialog.ShowDialog() ?? false) 30 | { 31 | result.Color = ColorDialog.Color; 32 | result.Result = true; 33 | } 34 | 35 | return result; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Dialogs/FontDialogResult.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Runtime.Serialization; 3 | using System.Runtime.Serialization.Json; 4 | using System.Text; 5 | using FFXIV.Framework.Common; 6 | 7 | namespace FFXIV.Framework.Dialog 8 | { 9 | [DataContract] 10 | public class FontDialogResult 11 | { 12 | public const string SymbolKeyword = nameof(FontDialogResult); 13 | 14 | [DataMember(Order = 1)] 15 | public string Symbol { get; set; } = SymbolKeyword; 16 | 17 | [DataMember(Order = 2)] 18 | public bool Result { get; set; } 19 | 20 | [DataMember(Order = 3)] 21 | public FontInfo Font { get; set; } 22 | 23 | public static FontDialogResult FromString( 24 | string json) 25 | { 26 | var obj = default(FontDialogResult); 27 | 28 | var serializer = new DataContractJsonSerializer(typeof(FontDialogResult)); 29 | var data = Encoding.UTF8.GetBytes(json); 30 | using (var ms = new MemoryStream(data)) 31 | { 32 | obj = (FontDialogResult)serializer.ReadObject(ms); 33 | } 34 | 35 | return obj; 36 | } 37 | 38 | public override string ToString() 39 | { 40 | var json = string.Empty; 41 | 42 | var serializer = new DataContractJsonSerializer(typeof(FontDialogResult)); 43 | using (var ms = new MemoryStream()) 44 | { 45 | serializer.WriteObject(ms, this); 46 | json = Encoding.UTF8.GetString(ms.ToArray()); 47 | } 48 | 49 | return json; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Dialogs/FontDialogWrapper.cs: -------------------------------------------------------------------------------- 1 | using FFXIV.Framework.Common; 2 | using FFXIV.Framework.Dialog.Views; 3 | 4 | namespace FFXIV.Framework.Dialog 5 | { 6 | public class FontDialogWrapper 7 | { 8 | public static FontDialogResult ShowDialog( 9 | FontInfo font = null) 10 | { 11 | var result = new FontDialogResult() 12 | { 13 | Font = font, 14 | }; 15 | 16 | FontDialog.Font = result.Font; 17 | if (FontDialog.ShowDialog() ?? false) 18 | { 19 | result.Font = FontDialog.Font; 20 | result.Result = true; 21 | } 22 | 23 | return result; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Dialogs/Views/ColorDialog.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Interop; 3 | using System.Windows.Media; 4 | 5 | namespace aframe 6 | { 7 | public static class ColorDialog 8 | { 9 | private static ColorDialogContent CreateContent() => new ColorDialogContent() 10 | { 11 | Color = ColorDialog.Color, 12 | IgnoreAlpha = ColorDialog.IgnoreAlpha, 13 | }; 14 | 15 | private static Dialog CreateDialog(ColorDialogContent content) => new Dialog() 16 | { 17 | Title = "Color", 18 | Content = content, 19 | MaxWidth = 1390, 20 | MaxHeight = 700, 21 | }; 22 | 23 | public static Color Color { get; set; } = Colors.White; 24 | 25 | public static bool IgnoreAlpha { get; set; } 26 | 27 | public static bool? ShowDialog() 28 | { 29 | var content = CreateContent(); 30 | var dialog = CreateDialog(content); 31 | 32 | dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen; 33 | 34 | dialog.OkButton.Click += (x, y) => content.Apply(); 35 | 36 | var result = dialog.ShowDialog(); 37 | if (result.Value) 38 | { 39 | Color = content.Color; 40 | } 41 | 42 | return result; 43 | } 44 | 45 | public static bool? ShowDialog( 46 | Window owner) 47 | { 48 | var content = CreateContent(); 49 | var dialog = CreateDialog(content); 50 | 51 | dialog.WindowStartupLocation = owner != null ? 52 | WindowStartupLocation.CenterOwner : 53 | WindowStartupLocation.CenterScreen; 54 | 55 | if (owner != null) 56 | { 57 | dialog.Owner = owner; 58 | } 59 | 60 | dialog.OkButton.Click += (x, y) => content.Apply(); 61 | 62 | var result = dialog.ShowDialog(); 63 | if (result.Value) 64 | { 65 | Color = content.Color; 66 | } 67 | 68 | return result; 69 | } 70 | 71 | public static bool? ShowDialog( 72 | System.Windows.Forms.Form owner) 73 | { 74 | var content = CreateContent(); 75 | var dialog = CreateDialog(content); 76 | 77 | dialog.WindowStartupLocation = owner != null ? 78 | WindowStartupLocation.CenterOwner : 79 | WindowStartupLocation.CenterScreen; 80 | 81 | if (owner != null) 82 | { 83 | var helper = new WindowInteropHelper(dialog); 84 | helper.Owner = owner.Handle; 85 | } 86 | 87 | dialog.OkButton.Click += (x, y) => content.Apply(); 88 | 89 | var result = dialog.ShowDialog(); 90 | if (result.Value) 91 | { 92 | Color = content.Color; 93 | } 94 | 95 | return result; 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Dialogs/Views/ColorDialogContent.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Media; 6 | 7 | namespace aframe 8 | { 9 | public partial class ColorDialogContent : UserControl 10 | { 11 | public ColorDialogContent() 12 | { 13 | this.InitializeComponent(); 14 | 15 | this.Color = Colors.White; 16 | 17 | this.Loaded += this.ColorDialogContent_Loaded; 18 | this.PredefinedColorsListBox.SelectionChanged += this.PredefinedColorsListBox_SelectionChanged; 19 | this.RTextBox.ValueChanged += (s, e) => this.ToHex(); 20 | this.GTextBox.ValueChanged += (s, e) => this.ToHex(); 21 | this.BTextBox.ValueChanged += (s, e) => this.ToHex(); 22 | this.ATextBox.ValueChanged += (s, e) => this.ToHex(); 23 | this.HexTextBox.LostFocus += (s, e) => 24 | { 25 | var color = Colors.White; 26 | 27 | try 28 | { 29 | color = (Color)ColorConverter.ConvertFromString(this.HexTextBox.Text); 30 | } 31 | catch 32 | { 33 | } 34 | 35 | this.RTextBox.Value = color.R; 36 | this.GTextBox.Value = color.G; 37 | this.BTextBox.Value = color.B; 38 | this.ATextBox.Value = !this.IgnoreAlpha ? color.A : 255; 39 | 40 | this.ToPreview(); 41 | }; 42 | } 43 | 44 | public Color Color { get; set; } 45 | 46 | private bool ignoreAlpha; 47 | 48 | public bool IgnoreAlpha 49 | { 50 | get => this.ignoreAlpha; 51 | set 52 | { 53 | if (this.ignoreAlpha != value) 54 | { 55 | this.ignoreAlpha = value; 56 | 57 | if (this.ignoreAlpha) 58 | { 59 | this.ATextBox.Value = 255; 60 | this.APanel.Visibility = Visibility.Collapsed; 61 | } 62 | else 63 | { 64 | this.APanel.Visibility = Visibility.Visible; 65 | } 66 | } 67 | } 68 | } 69 | 70 | public void Apply() 71 | { 72 | var color = Colors.White; 73 | 74 | try 75 | { 76 | color = (Color)ColorConverter.ConvertFromString(this.HexTextBox.Text); 77 | } 78 | catch 79 | { 80 | } 81 | 82 | this.Color = color; 83 | } 84 | 85 | private async void ColorDialogContent_Loaded(object sender, RoutedEventArgs e) 86 | { 87 | var item = await Task.Run(() => 88 | this.PredefinedColorsListBox.Items.Cast() 89 | .FirstOrDefault(x => x.Color == this.Color)); 90 | 91 | if (item != null) 92 | { 93 | this.PredefinedColorsListBox.SelectedItem = item; 94 | (this.PredefinedColorsListBox.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem)?.Focus(); 95 | } 96 | 97 | if (this.PredefinedColorsListBox.SelectedItem == null && 98 | this.Color != null) 99 | { 100 | this.RTextBox.Value = this.Color.R; 101 | this.GTextBox.Value = this.Color.G; 102 | this.BTextBox.Value = this.Color.B; 103 | this.ATextBox.Value = !this.IgnoreAlpha ? this.Color.A : 255; 104 | } 105 | } 106 | 107 | private void PredefinedColorsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) 108 | { 109 | if (this.PredefinedColorsListBox.SelectedItem != null) 110 | { 111 | var color = ((PredefinedColor)this.PredefinedColorsListBox.SelectedItem).Color; 112 | 113 | this.RTextBox.Value = color.R; 114 | this.GTextBox.Value = color.G; 115 | this.BTextBox.Value = color.B; 116 | this.ATextBox.Value = !this.IgnoreAlpha ? color.A : 255; 117 | } 118 | } 119 | 120 | private void ToHex() 121 | { 122 | var color = Color.FromArgb( 123 | (byte)(this.ATextBox.Value ?? 0), 124 | (byte)(this.RTextBox.Value ?? 0), 125 | (byte)(this.GTextBox.Value ?? 0), 126 | (byte)(this.BTextBox.Value ?? 0)); 127 | 128 | this.HexTextBox.Text = color.ToString(); 129 | 130 | this.ToPreview(); 131 | } 132 | 133 | private void ToPreview() 134 | { 135 | var color = Colors.White; 136 | 137 | try 138 | { 139 | color = (Color)ColorConverter.ConvertFromString(this.HexTextBox.Text); 140 | } 141 | catch 142 | { 143 | } 144 | 145 | this.PreviewRectangle.Fill = new SolidColorBrush(color); 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Dialogs/Views/ColorDialogViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel; 3 | using System.Linq; 4 | using System.Runtime.CompilerServices; 5 | using System.Threading.Tasks; 6 | using System.Windows.Media; 7 | 8 | namespace aframe 9 | { 10 | public class ColorDialogViewModel : INotifyPropertyChanged 11 | { 12 | private static PredefinedColor[] predefinedColors; 13 | 14 | public PredefinedColor[] PredefinedColors 15 | { 16 | get { return predefinedColors ?? (predefinedColors = this.EnumlatePredefinedColors()); } 17 | set 18 | { 19 | predefinedColors = value; 20 | this.RaisePropertyChanged(); 21 | } 22 | } 23 | 24 | private PredefinedColor[] EnumlatePredefinedColors() 25 | { 26 | var list = new List(); 27 | 28 | var t1 = Task.Run(() => 29 | { 30 | var solidColors = new List(); 31 | foreach (var color in typeof(Colors).GetProperties()) 32 | { 33 | try 34 | { 35 | solidColors.Add(new PredefinedColor() 36 | { 37 | Name = color.Name, 38 | Color = (Color)ColorConverter.ConvertFromString(color.Name) 39 | }); 40 | } 41 | catch 42 | { 43 | } 44 | } 45 | 46 | return solidColors.OrderBy(x => x.Color.ToString()); 47 | }); 48 | 49 | var t2 = Task.Run(() => 50 | { 51 | var waColors = new List(); 52 | foreach (var color in typeof(WaColors).GetProperties()) 53 | { 54 | try 55 | { 56 | waColors.Add(new PredefinedColor() 57 | { 58 | Name = color.Name, 59 | Color = (Color)color.GetValue(null, null), 60 | }); 61 | } 62 | catch 63 | { 64 | } 65 | } 66 | 67 | return waColors.OrderBy(x => x.Color.ToString()); 68 | }); 69 | 70 | list.AddRange(t1.Result); 71 | list.AddRange(t2.Result); 72 | 73 | return list.ToArray(); 74 | } 75 | 76 | #region Implementation of INotifyPropertyChanged 77 | 78 | public event PropertyChangedEventHandler PropertyChanged; 79 | 80 | private void RaisePropertyChanged([CallerMemberName] string caller = "") 81 | { 82 | if (this.PropertyChanged != null) 83 | { 84 | this.PropertyChanged(this, new PropertyChangedEventArgs(caller)); 85 | } 86 | } 87 | 88 | #endregion Implementation of INotifyPropertyChanged 89 | } 90 | 91 | public class PredefinedColor 92 | { 93 | public SolidColorBrush Brush => new SolidColorBrush(this.Color); 94 | public Color Color { get; set; } 95 | public string Name { get; set; } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /source/aframe/source/aframe.Core/Dialogs/Views/Dialog.xaml: -------------------------------------------------------------------------------- 1 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 33 | 34 | 35 | 36 | 42 |