diff --git a/Modules/PSO2Logger.Modules.Chat/Behaviors/DataGridBehavior.cs b/Modules/PSO2Logger.Modules.Chat/Behaviors/DataGridBehavior.cs index 5e8cd30..5f92247 100644 --- a/Modules/PSO2Logger.Modules.Chat/Behaviors/DataGridBehavior.cs +++ b/Modules/PSO2Logger.Modules.Chat/Behaviors/DataGridBehavior.cs @@ -7,13 +7,16 @@ namespace PSO2Logger.Modules.Chat.Behaviors { class DataGridBehavior { public static readonly DependencyProperty AutoscrollProperty = DependencyProperty.RegisterAttached( - "Autoscroll", typeof(bool), typeof(DataGridBehavior), new PropertyMetadata(default(bool), OnAutoScrollPropertyChanged)); + "Autoscroll", + typeof(bool), + typeof(DataGridBehavior), + new PropertyMetadata(default(bool), OnAutoScrollPropertyChanged) + ); - private static readonly Dictionary handlersDict = new Dictionary(); + private static readonly Dictionary handlersDict = new(); private static void OnAutoScrollPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args) { - var dataGrid = dependencyObject as DataGrid; - if (dataGrid == null) { + if (dependencyObject is not DataGrid dataGrid) { throw new InvalidOperationException("Dependency object is not DataGrid."); } diff --git a/Modules/PSO2Logger.Modules.Chat/Converters/ChatTypeColorConverter.cs b/Modules/PSO2Logger.Modules.Chat/Converters/ChatTypeColorConverter.cs new file mode 100644 index 0000000..8371105 --- /dev/null +++ b/Modules/PSO2Logger.Modules.Chat/Converters/ChatTypeColorConverter.cs @@ -0,0 +1,28 @@ +using PSO2Logger.Models; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace PSO2Logger.Modules.Chat.Converters { + class ChatTypeColorConverter : IValueConverter { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { + return value switch { + ChatType.PUBLIC => Color.White.Name, + ChatType.PARTY => "#53A2BA", + ChatType.GUILD => "#CECA66", + ChatType.REPLY => "#BA536E", + ChatType.GROUP => "#53BA85", + _ => Color.White.ToString(), + }; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { + throw new NotImplementedException(); + } + } +} diff --git a/Modules/PSO2Logger.Modules.Chat/Core/DefaultChatColor.cs b/Modules/PSO2Logger.Modules.Chat/Core/DefaultChatColor.cs new file mode 100644 index 0000000..8bede2e --- /dev/null +++ b/Modules/PSO2Logger.Modules.Chat/Core/DefaultChatColor.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PSO2Logger.Modules.Chat.Core { + static class DefaultChatColor { + readonly static string PublicChat = "White"; + readonly static string PartyChat = "Blue"; + readonly static string TeamChat = "Yellow"; + readonly static string WhisperChat = "Cyan"; + readonly static string GroupChat = "Green"; + } +} diff --git a/Modules/PSO2Logger.Modules.Chat/Interfaces/IChatDataStore.cs b/Modules/PSO2Logger.Modules.Chat/Interfaces/IChatDataStore.cs deleted file mode 100644 index f30ced1..0000000 --- a/Modules/PSO2Logger.Modules.Chat/Interfaces/IChatDataStore.cs +++ /dev/null @@ -1,20 +0,0 @@ -using PSO2Logger.Interfaces; -using PSO2Logger.Models; -using Reactive.Bindings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace PSO2Logger.Modules.Chat.Interfaces { - interface IChatDataStore { - ReactiveCollection ChatLines { get; } - ILogService LogService { get; } - IWatcherService WatcherService { get; } - - IList GetNewLines(); - void OverrideLogService(ILogService logService); - void OverrideWatcherService(IWatcherService watcherService); - } -} diff --git a/Modules/PSO2Logger.Modules.Chat/Models/ChatDataStore.cs b/Modules/PSO2Logger.Modules.Chat/Models/ChatDataStore.cs index 2e91805..f442737 100644 --- a/Modules/PSO2Logger.Modules.Chat/Models/ChatDataStore.cs +++ b/Modules/PSO2Logger.Modules.Chat/Models/ChatDataStore.cs @@ -8,7 +8,6 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; -using System.Text; using System.Threading.Tasks; namespace PSO2Logger.Modules.Chat.Models { diff --git a/Modules/PSO2Logger.Modules.Chat/Settings.cs b/Modules/PSO2Logger.Modules.Chat/Settings.cs new file mode 100644 index 0000000..26adcf2 --- /dev/null +++ b/Modules/PSO2Logger.Modules.Chat/Settings.cs @@ -0,0 +1,28 @@ +namespace PSO2Logger.Modules.Chat.Properties { + + + // このクラスでは設定クラスでの特定のイベントを処理することができます: + // SettingChanging イベントは、設定値が変更される前に発生します。 + // PropertyChanged イベントは、設定値が変更された後に発生します。 + // SettingsLoaded イベントは、設定値が読み込まれた後に発生します。 + // SettingsSaving イベントは、設定値が保存される前に発生します。 + internal sealed partial class Settings { + + public Settings() { + // // 設定の保存と変更のイベント ハンドラーを追加するには、以下の行のコメントを解除します: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { + // SettingChangingEvent イベントを処理するコードをここに追加してください。 + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { + // SettingsSaving イベントを処理するコードをここに追加してください。 + } + } +} diff --git a/Modules/PSO2Logger.Modules.Chat/ViewModels/CombinedChatViewModel.cs b/Modules/PSO2Logger.Modules.Chat/ViewModels/CombinedChatViewModel.cs index 7f4bf16..f92c5d1 100644 --- a/Modules/PSO2Logger.Modules.Chat/ViewModels/CombinedChatViewModel.cs +++ b/Modules/PSO2Logger.Modules.Chat/ViewModels/CombinedChatViewModel.cs @@ -1,15 +1,8 @@ -using Prism.Commands; -using Prism.Mvvm; -using Prism.Regions; -using PSO2Logger.Core; +using Prism.Mvvm; using PSO2Logger.Interfaces; using PSO2Logger.Models; using PSO2Logger.Modules.Chat.Models; -using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.Linq; using System.Windows.Data; namespace PSO2Logger.Modules.Chat.ViewModels { @@ -20,7 +13,37 @@ public class CombinedChatViewModel : BindableBase { public ObservableCollection PartyChats { get; set; } public ObservableCollection TeamChats { get; set; } public ObservableCollection WhisperChats { get; set; } - public ObservableCollection GroupChats { get; set; } + public ObservableCollection GroupChats { get; set; } + + private string _publicChatColor; + public string PublicChatColor { + get { return _publicChatColor; } + set { SetProperty(ref _publicChatColor, value); } + } + + private string _partyChatColor; + public string PartyChatColor { + get { return _partyChatColor; } + set { SetProperty(ref _partyChatColor, value); } + } + + private string _teamChatColor; + public string TeamChatColor { + get { return _teamChatColor; } + set { SetProperty(ref _teamChatColor, value); } + } + + private string _whisperChatColor; + public string WhisperChatColor { + get { return _whisperChatColor; } + set { SetProperty(ref _whisperChatColor, value); } + } + + private string _groupChatColor; + public string GroupChatColor { + get { return _groupChatColor; } + set { SetProperty(ref _groupChatColor, value); } + } public CombinedChatViewModel(ILogService logService, IWatcherService watcherService) { chatDataStore = new ChatDataStore(logService, watcherService); diff --git a/Modules/PSO2Logger.Modules.Chat/Views/CombinedChat.xaml b/Modules/PSO2Logger.Modules.Chat/Views/CombinedChat.xaml index 8a0dd96..17cf60d 100644 --- a/Modules/PSO2Logger.Modules.Chat/Views/CombinedChat.xaml +++ b/Modules/PSO2Logger.Modules.Chat/Views/CombinedChat.xaml @@ -6,19 +6,58 @@ mc:Ignorable="d" xmlns:prism="http://prismlibrary.com/" xmlns:core="clr-namespace:PSO2Logger.Core;assembly=PSO2Logger.Core" + xmlns:model="clr-namespace:PSO2Logger.Models;assembly=PSO2Logger.Models" xmlns:behavior="clr-namespace:PSO2Logger.Modules.Chat.Behaviors" + xmlns:converter="clr-namespace:PSO2Logger.Modules.Chat.Converters" prism:ViewModelLocator.AutoWireViewModel="True"> + + + + - + + + @@ -31,104 +70,44 @@ + + Name="PUBLIC"> - - - - - - - - - - - - - + + - - - - - - - - - - - - - + + + Name="TEAM"> - - - - - - - - - - - - - + + - - - - - - - - - - - - - + + + Name="GROUP"> - - - - - - - - - - - - - + diff --git a/Modules/PSO2Logger.Modules.Settings/PSO2Logger.Modules.Settings.csproj b/Modules/PSO2Logger.Modules.Settings/PSO2Logger.Modules.Settings.csproj index f815cdc..9fa7780 100644 --- a/Modules/PSO2Logger.Modules.Settings/PSO2Logger.Modules.Settings.csproj +++ b/Modules/PSO2Logger.Modules.Settings/PSO2Logger.Modules.Settings.csproj @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/Modules/PSO2Logger.Modules.Settings/ViewModels/SettingViewModel.cs b/Modules/PSO2Logger.Modules.Settings/ViewModels/SettingViewModel.cs index 2056ecc..2bbeef0 100644 --- a/Modules/PSO2Logger.Modules.Settings/ViewModels/SettingViewModel.cs +++ b/Modules/PSO2Logger.Modules.Settings/ViewModels/SettingViewModel.cs @@ -1,19 +1,40 @@ using Prism.Commands; using Prism.Mvvm; +using PSO2Logger.Interfaces; +using PSO2Logger.Models; using System; using System.Collections.Generic; +using System.IO; using System.Linq; namespace PSO2Logger.Modules.Settings.ViewModels { public class SettingViewModel : BindableBase { + private readonly ILogService logService; + private readonly IWatcherService watcherService; + private string _folderPath; + public string FolderPath { get { return _folderPath; } - set { SetProperty(ref _folderPath, value); } + set { + SetProperty(ref _folderPath, value); + UpdateServiceFolderPath(value); + } + } + + public SettingViewModel(ILogService logService, IWatcherService watcherService) { + this.logService = logService; + this.watcherService = watcherService; + + FolderPath = logService.FolderPath; } - public SettingViewModel() { + private void UpdateServiceFolderPath(string folderPath) { + if (!Directory.Exists(folderPath)) + return; + this.logService.FolderPath = folderPath; + this.watcherService.FolderPath = folderPath; } } } diff --git a/Modules/PSO2Logger.Modules.Settings/Views/Setting.xaml b/Modules/PSO2Logger.Modules.Settings/Views/Setting.xaml index c93f269..17cdde2 100644 --- a/Modules/PSO2Logger.Modules.Settings/Views/Setting.xaml +++ b/Modules/PSO2Logger.Modules.Settings/Views/Setting.xaml @@ -15,13 +15,28 @@ - - - - - - + + + + + + + + + + + + + + + +