From 1e4c4ec4393bfb0351e33b4a5c7c4b7d6dfa80e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dongmin=20Jang=20=28=EC=9E=A5=EB=8F=99=EB=AF=BC=29?= Date: Mon, 17 Jun 2024 09:10:32 +0900 Subject: [PATCH] Add resizing changed event --- .../ViewModels/OrganizerSettingsViewModel.cs | 30 +- .../Views/OrganizerSettingsView.xaml | 318 ++++++++++++++++-- .../Bindings/LayoutChangedEventArgs.cs | 22 ++ .../Controls/DashboardHost.xaml.cs | 23 ++ .../Corathing.UI.WPF/Corathing.UI.WPF.csproj | 4 + 5 files changed, 370 insertions(+), 27 deletions(-) create mode 100644 src/Shared/Corathing.Dashboards.WPF/Bindings/LayoutChangedEventArgs.cs diff --git a/src/Apps/Corathing.Organizer/ViewModels/OrganizerSettingsViewModel.cs b/src/Apps/Corathing.Organizer/ViewModels/OrganizerSettingsViewModel.cs index 3e324b8..be2a1f6 100644 --- a/src/Apps/Corathing.Organizer/ViewModels/OrganizerSettingsViewModel.cs +++ b/src/Apps/Corathing.Organizer/ViewModels/OrganizerSettingsViewModel.cs @@ -27,23 +27,41 @@ public partial class OrganizerSettingsViewModel : ObservableRecipient private bool _isInitialized = false; #endregion + #region 11. 설정파일 + [ObservableProperty] - private string _appVersion = string.Empty; + private bool? _useGlobalConfiguration; [ObservableProperty] - private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown; + private bool? _useAppPathConfiguration; [ObservableProperty] - private ApplicationLanguage _currentApplicationLanguage = ApplicationLanguage.Unknown; + private string _customPath; + + #endregion + #region 12. 게스트 모드 [ObservableProperty] - private bool? _useGlobalConfiguration; + private bool? _useGuestMode = false; [ObservableProperty] - private bool? _useAppPathConfiguration; + private bool? _showSettingsButtonOnDashboard = true; [ObservableProperty] - private string _customPath; + private string _username; + + [ObservableProperty] + private string _password; + #endregion + + [ObservableProperty] + private string _appVersion = string.Empty; + + [ObservableProperty] + private ApplicationTheme _currentApplicationTheme = ApplicationTheme.Unknown; + + [ObservableProperty] + private ApplicationLanguage _currentApplicationLanguage = ApplicationLanguage.Unknown; public OrganizerSettingsViewModel( IThemeService themeService, diff --git a/src/Apps/Corathing.Organizer/Views/OrganizerSettingsView.xaml b/src/Apps/Corathing.Organizer/Views/OrganizerSettingsView.xaml index ac4bf0a..402f0c1 100644 --- a/src/Apps/Corathing.Organizer/Views/OrganizerSettingsView.xaml +++ b/src/Apps/Corathing.Organizer/Views/OrganizerSettingsView.xaml @@ -8,6 +8,7 @@ xmlns:converters="clr-namespace:Corathing.Organizer.Converters" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" xmlns:localizations="clr-namespace:Corathing.Dashboards.WPF.Bindings;assembly=Corathing.Dashboards.WPF" + xmlns:converters2="clr-namespace:Corathing.Dashboards.WPF.Converters;assembly=Corathing.Dashboards.WPF" mc:Ignorable="d" Background="{DynamicResource ApplicationBackgroundBrush}" Foreground="{DynamicResource TextFillColorPrimaryBrush}" @@ -22,6 +23,8 @@ + + @@ -53,6 +56,11 @@ + + + + + @@ -182,38 +190,306 @@ - - - - + + + + + + + + + + Text="{localizations:Localization Corathing.Organizer.CurrentConfigureFileDescription}" /> + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Icon="{ui:SymbolIcon KeyboardLayoutResize24}"> @@ -222,7 +498,7 @@ + Text="핫키 제어" /> @@ -231,12 +507,12 @@ - - + + - + @@ -248,7 +524,7 @@ + Text="사용자 검색" /> @@ -258,7 +534,7 @@ MinWidth="200" SelectedIndex="{Binding CurrentApplicationTheme, Converter={StaticResource ThemeToIndexConverter}, Mode=TwoWay}"> - + diff --git a/src/Shared/Corathing.Dashboards.WPF/Bindings/LayoutChangedEventArgs.cs b/src/Shared/Corathing.Dashboards.WPF/Bindings/LayoutChangedEventArgs.cs new file mode 100644 index 0000000..d4db048 --- /dev/null +++ b/src/Shared/Corathing.Dashboards.WPF/Bindings/LayoutChangedEventArgs.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Corathing.Dashboards.WPF.Bindings; + +public enum LayoutChangedType +{ + None, + New, + Remove, + Drag, + Resize, + +} + +public class LayoutChangedEventArgs : EventArgs +{ + public LayoutChangedType ChangedType; +} diff --git a/src/Shared/Corathing.Dashboards.WPF/Controls/DashboardHost.xaml.cs b/src/Shared/Corathing.Dashboards.WPF/Controls/DashboardHost.xaml.cs index 46f060e..3f68be7 100644 --- a/src/Shared/Corathing.Dashboards.WPF/Controls/DashboardHost.xaml.cs +++ b/src/Shared/Corathing.Dashboards.WPF/Controls/DashboardHost.xaml.cs @@ -28,6 +28,7 @@ using Corathing.Contracts.Bases.Interfaces; using System.Windows.Media.Animation; using Corathing.Dashboards.Bases; +using CommunityToolkit.Mvvm.Input; namespace Corathing.Dashboards.WPF.Controls { @@ -38,6 +39,18 @@ public partial class DashboardHost : ItemsControl { #region Public Fields + public static readonly DependencyProperty LayoutChangedProperty = DependencyProperty.Register( + nameof(LayoutChanged), + typeof(EventHandler), + typeof(DashboardHost), + new PropertyMetadata(default)); + + public EventHandler LayoutChanged + { + get => (EventHandler)GetValue(LayoutChangedProperty); + set => SetValue(LayoutChangedProperty, value); + } + /// /// The enalbe column limit property /// @@ -1223,6 +1236,11 @@ private void WidgetHost_DragMoveStarted(WidgetHost widgetHost) _draggingWidgetLayout = null; _draggingHost = null; _widgetDestinationHighlight.Visibility = Visibility.Hidden; + + LayoutChanged.Invoke(this, new LayoutChangedEventArgs() + { + ChangedType = LayoutChangedType.Drag + }); } } @@ -1299,6 +1317,11 @@ private void ResizingEnded() _draggingWidgetLayout = null; _draggingHost = null; _widgetDestinationHighlight.Visibility = Visibility.Hidden; + + LayoutChanged.Invoke(this, new LayoutChangedEventArgs() + { + ChangedType = LayoutChangedType.Resize + }); } private void Dashboard_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) diff --git a/src/Shared/Corathing.UI.WPF/Corathing.UI.WPF.csproj b/src/Shared/Corathing.UI.WPF/Corathing.UI.WPF.csproj index d9d3026..63974fc 100644 --- a/src/Shared/Corathing.UI.WPF/Corathing.UI.WPF.csproj +++ b/src/Shared/Corathing.UI.WPF/Corathing.UI.WPF.csproj @@ -16,4 +16,8 @@ + + + +