diff --git a/docs/WPF 기초를 위한 토이프로젝트.pptx b/docs/WPF 기초를 위한 토이프로젝트.pptx new file mode 100644 index 0000000..ca775ea Binary files /dev/null and b/docs/WPF 기초를 위한 토이프로젝트.pptx differ diff --git a/docs/sampleApp/WPFBeginner.deps.json b/docs/sampleApp/WPFBeginner.deps.json new file mode 100644 index 0000000..0a725f8 --- /dev/null +++ b/docs/sampleApp/WPFBeginner.deps.json @@ -0,0 +1,75 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "WPFBeginner/1.0.0": { + "dependencies": { + "CommunityToolkit.Mvvm": "8.2.2", + "Microsoft.Extensions.DependencyInjection": "8.0.0" + }, + "runtime": { + "WPFBeginner.dll": {} + } + }, + "CommunityToolkit.Mvvm/8.2.2": { + "runtime": { + "lib/net6.0/CommunityToolkit.Mvvm.dll": { + "assemblyVersion": "8.2.0.0", + "fileVersion": "8.2.2.1" + } + } + }, + "Microsoft.Extensions.DependencyInjection/8.0.0": { + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" + }, + "runtime": { + "lib/net8.0/Microsoft.Extensions.DependencyInjection.dll": { + "assemblyVersion": "8.0.0.0", + "fileVersion": "8.0.23.53103" + } + } + }, + "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0": { + "runtime": { + "lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": { + "assemblyVersion": "8.0.0.0", + "fileVersion": "8.0.23.53103" + } + } + } + } + }, + "libraries": { + "WPFBeginner/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "CommunityToolkit.Mvvm/8.2.2": { + "type": "package", + "serviceable": true, + "sha512": "sha512-r0g0k9tGYdrnz8R7T3x5UiokDffeevzK/2P/9SBL6fqLgN8B157MIi/bVUWI1KAz6ZorZrK9AdABCWUeXZZsvA==", + "path": "communitytoolkit.mvvm/8.2.2", + "hashPath": "communitytoolkit.mvvm.8.2.2.nupkg.sha512" + }, + "Microsoft.Extensions.DependencyInjection/8.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-V8S3bsm50ig6JSyrbcJJ8bW2b9QLGouz+G1miK3UTaOWmMtFwNNNzUf4AleyDWUmTrWMLNnFSLEQtxmxgNQnNQ==", + "path": "microsoft.extensions.dependencyinjection/8.0.0", + "hashPath": "microsoft.extensions.dependencyinjection.8.0.0.nupkg.sha512" + }, + "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg==", + "path": "microsoft.extensions.dependencyinjection.abstractions/8.0.0", + "hashPath": "microsoft.extensions.dependencyinjection.abstractions.8.0.0.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/docs/sampleApp/WPFBeginner.pdb b/docs/sampleApp/WPFBeginner.pdb new file mode 100644 index 0000000..6241a75 Binary files /dev/null and b/docs/sampleApp/WPFBeginner.pdb differ diff --git a/docs/sampleApp/WPFBeginner.runtimeconfig.json b/docs/sampleApp/WPFBeginner.runtimeconfig.json new file mode 100644 index 0000000..8fbd17c --- /dev/null +++ b/docs/sampleApp/WPFBeginner.runtimeconfig.json @@ -0,0 +1,19 @@ +{ + "runtimeOptions": { + "tfm": "net8.0", + "frameworks": [ + { + "name": "Microsoft.NETCore.App", + "version": "8.0.0" + }, + { + "name": "Microsoft.WindowsDesktop.App", + "version": "8.0.0" + } + ], + "configProperties": { + "System.Reflection.Metadata.MetadataUpdater.IsSupported": false, + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true + } + } +} \ No newline at end of file diff --git a/resource/appsettings.json b/docs/sampleApp/appsettings.json similarity index 100% rename from resource/appsettings.json rename to docs/sampleApp/appsettings.json diff --git a/resource/Buttons.xaml b/resource/Buttons.xaml deleted file mode 100644 index f3c11be..0000000 --- a/resource/Buttons.xaml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/resource/Colors/DefaultTheme.xaml b/resource/Colors/DefaultTheme.xaml deleted file mode 100644 index b3899a4..0000000 --- a/resource/Colors/DefaultTheme.xaml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/resource/Colors/LightTheme.xaml b/resource/Colors/LightTheme.xaml deleted file mode 100644 index 446ec6c..0000000 --- a/resource/Colors/LightTheme.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/resource/DrawingImages.xaml b/resource/DrawingImages.xaml deleted file mode 100644 index e2188a4..0000000 --- a/resource/DrawingImages.xaml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/resource/Images/bg_login.jpeg b/resource/Images/bg_login.jpeg deleted file mode 100644 index f59b076..0000000 Binary files a/resource/Images/bg_login.jpeg and /dev/null differ diff --git a/resource/Images/btn_search_001.png b/resource/Images/btn_search_001.png deleted file mode 100644 index dfcd6cb..0000000 Binary files a/resource/Images/btn_search_001.png and /dev/null differ diff --git a/resource/Images/ico_pw.png b/resource/Images/ico_pw.png deleted file mode 100644 index 7cd31c8..0000000 Binary files a/resource/Images/ico_pw.png and /dev/null differ diff --git a/resource/Images/ico_user.png b/resource/Images/ico_user.png deleted file mode 100644 index 9d85395..0000000 Binary files a/resource/Images/ico_user.png and /dev/null differ diff --git a/src/WPFEduSolution/WPFBeginner/App.xaml b/src/WPFEduSolution/WPFBeginner/App.xaml deleted file mode 100644 index f239d22..0000000 --- a/src/WPFEduSolution/WPFBeginner/App.xaml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/WPFEduSolution/WPFBeginner/App.xaml.cs b/src/WPFEduSolution/WPFBeginner/App.xaml.cs deleted file mode 100644 index 3394a1d..0000000 --- a/src/WPFEduSolution/WPFBeginner/App.xaml.cs +++ /dev/null @@ -1,104 +0,0 @@ -using CommunityToolkit.Mvvm.DependencyInjection; -using Microsoft.Extensions.DependencyInjection; -using System.IO; -using System.Text.Json; -using System.Windows; -using WPFBeginner.Configurations; -using WPFBeginner.Exceptions; -using WPFBeginner.Services; -using WPFBeginner.ViewModels; -using WPFBeginner.Views; - -namespace WPFBeginner -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - private readonly static Dictionary _languages = new Dictionary(); - private static ResourceDictionary _currentLanguage; - - private readonly static Dictionary _themes = new Dictionary(); - private static ResourceDictionary _currentTheme; - - public static AppSettings Config { get; private set; } - - private void Application_Startup(object sender, StartupEventArgs e) - { - InitializeService(); - var main = new MainWindow(); - App.Current.MainWindow = main; - try - { - Login(); - - Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; - App.Current.MainWindow.Show(); - } - catch (Exception ex) - { - App.Current.MainWindow.Close(); - Environment.Exit(0); - } - } - - private void UnhandledExceptionHandle(object e) - { - if (e is UnhandledExceptionEventArgs uee && uee.ExceptionObject is LoginFailedException) - { - - } - } - - private static void InitializeService() - { - Config = JsonSerializer.Deserialize(File.ReadAllText("appsettings.json")); - - _languages.Add("ko-KR", ResourceExplorer.GetLanguageResourceDic("ko-KR")); - _languages.Add("en-US", ResourceExplorer.GetLanguageResourceDic("en-US")); - SetLanguage(Config.Language); - - _themes.Add("DefaultTheme", ResourceExplorer.GetThemeResourceDic("DefaultTheme")); - _themes.Add("LightTheme", ResourceExplorer.GetThemeResourceDic("LightTheme")); - SetTheme(Config.Theme); - - Config.LanguageChanged += (s, e) => SetLanguage(e.New); - Config.ThemeChanged += (s, e) => SetTheme(e.New); - - Ioc.Default.ConfigureServices( - new ServiceCollection() - .AddSingleton(new MainWindowViewModel()) - .BuildServiceProvider()); - } - - private static void SetTheme(string code) - { - if (_currentTheme != null) - App.Current.Resources.MergedDictionaries.Remove(_currentTheme); - - _currentTheme = ResourceExplorer.GetThemeResourceDic(code); - App.Current.Resources.MergedDictionaries.Add(_currentTheme); - } - - private static void SetLanguage(string code) - { - if (_currentLanguage != null) - App.Current.Resources.MergedDictionaries.Remove(_currentLanguage); - - _currentLanguage = ResourceExplorer.GetLanguageResourceDic(code); - App.Current.Resources.MergedDictionaries.Add(_currentLanguage); - } - - private static void Login() - { - var login = new LoginWindow(); - var isSuccess = login.ShowDialog(); - - if (isSuccess != true) - throw new LoginFailedException(); - } - } - -} - diff --git a/src/WPFEduSolution/WPFBeginner/AssemblyInfo.cs b/src/WPFEduSolution/WPFBeginner/AssemblyInfo.cs deleted file mode 100644 index b0ec827..0000000 --- a/src/WPFEduSolution/WPFBeginner/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Windows; - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] diff --git a/src/WPFEduSolution/WPFBeginner/Behaviors/WindowBehavior.cs b/src/WPFEduSolution/WPFBeginner/Behaviors/WindowBehavior.cs deleted file mode 100644 index a892e0d..0000000 --- a/src/WPFEduSolution/WPFBeginner/Behaviors/WindowBehavior.cs +++ /dev/null @@ -1,279 +0,0 @@ -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Interop; - -namespace WPFBeginner.Behaviors -{ - public class WindowBehavior - { - #region Win32 imports - - private const int GWL_STYLE = -16; - private const int WS_SYSMENU = 0x80000; - private const int WS_MAXIMIZEBOX = 0x80000; - private const int WS_MINIMIZEBOX = 0x80000; - - [DllImport("user32.dll", SetLastError = true)] - private static extern int GetWindowLong(IntPtr hWnd, int nIndex); - [DllImport("user32.dll")] - private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); - - #endregion - - private static readonly Type OwnerType = typeof(WindowBehavior); - - #region HideCloseButton (attached property) - - private static readonly RoutedEventHandler HideCloseButtonWhenLoadedDelegate = (sender, args) => - { - if (sender is Window == false) - return; - - var w = (Window)sender; - HideCloseButton(w); - w.Loaded -= HideCloseButtonWhenLoadedDelegate; - }; - - private static readonly RoutedEventHandler ShowCloseButtonWhenLoadedDelegate = (sender, args) => - { - if (sender is Window == false) - return; - - var w = (Window)sender; - ShowCloseButton(w); - w.Loaded -= ShowCloseButtonWhenLoadedDelegate; - }; - - public static readonly DependencyProperty HideCloseButtonProperty = - DependencyProperty.RegisterAttached("HideCloseButton", typeof(bool), OwnerType, - new FrameworkPropertyMetadata(false, new PropertyChangedCallback(HideCloseButtonChangedCallback))); - - [AttachedPropertyBrowsableForType(typeof(Window))] - public static bool GetHideCloseButton(Window obj) => (bool)obj.GetValue(HideCloseButtonProperty); - - [AttachedPropertyBrowsableForType(typeof(Window))] - public static void SetHideCloseButton(Window obj, bool value) => obj.SetValue(HideCloseButtonProperty, value); - - private static void HideCloseButtonChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var window = d as Window; - if (window == null) return; - - var hideCloseButton = (bool)e.NewValue; - if (hideCloseButton && !GetIsHiddenCloseButton(window)) - { - if (!window.IsLoaded) - window.Loaded += HideCloseButtonWhenLoadedDelegate; - else - HideCloseButton(window); - - SetIsHiddenCloseButton(window, true); - } - else if (!hideCloseButton && GetIsHiddenCloseButton(window)) - { - if (!window.IsLoaded) - window.Loaded -= ShowCloseButtonWhenLoadedDelegate; - else - ShowCloseButton(window); - - SetIsHiddenCloseButton(window, false); - } - } - - - - private static void HideCloseButton(Window w) - { - var hwnd = new WindowInteropHelper(w).Handle; - SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU); - } - - private static void ShowCloseButton(Window w) - { - var hwnd = new WindowInteropHelper(w).Handle; - SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_SYSMENU); - } - - #endregion - - #region IsHiddenCloseButton (readonly attached property) - - private static readonly DependencyPropertyKey IsHiddenCloseButtonKey = - DependencyProperty.RegisterAttachedReadOnly("IsHiddenCloseButton", typeof(bool), OwnerType, new FrameworkPropertyMetadata(false)); - - public static readonly DependencyProperty IsHiddenCloseButtonProperty = IsHiddenCloseButtonKey.DependencyProperty; - - [AttachedPropertyBrowsableForType(typeof(Window))] - public static bool GetIsHiddenCloseButton(Window obj) => (bool)obj.GetValue(IsHiddenCloseButtonProperty); - - private static void SetIsHiddenCloseButton(Window obj, bool value) => obj.SetValue(IsHiddenCloseButtonKey, value); - - #endregion - - //#region HideMinimizeButton - - //private static readonly RoutedEventHandler HideMinimizeButtonWhenLoadedDelegate = (sender, args) => { - // if (sender is Window == false) - // return; - - // var w = (Window)sender; - // HideMinimizeButton(w); - // w.Loaded -= HideMinimizeButtonWhenLoadedDelegate; - //}; - - //private static readonly RoutedEventHandler ShowMinimizeButtonWhenLoadedDelegate = (sender, args) => { - // if (sender is Window == false) - // return; - - // var w = (Window)sender; - // ShowMinimizeButton(w); - // w.Loaded -= ShowMinimizeButtonWhenLoadedDelegate; - //}; - - //public static readonly DependencyProperty HideMinimizeButtonProperty = - // DependencyProperty.RegisterAttached("HideMinimizeButton", typeof(bool), OwnerType, - // new FrameworkPropertyMetadata(false, new PropertyChangedCallback(HideMinimizeButtonChangedCallback))); - - //[AttachedPropertyBrowsableForType(typeof(Window))] - //public static bool GetHideMinimizeButton(Window obj) => (bool)obj.GetValue(HideCloseButtonProperty); - - //[AttachedPropertyBrowsableForType(typeof(Window))] - //public static void SetHideMinimizeButton(Window obj, bool value) => obj.SetValue(HideCloseButtonProperty, value); - - //private static void HideMinimizeButtonChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) - //{ - // var window = d as Window; - // if (window == null) return; - - // var hideCloseButton = (bool)e.NewValue; - // if (hideCloseButton && !GetIsHiddenMinimizeButton(window)) - // { - // if (!window.IsLoaded) - // window.Loaded += HideMinimizeButtonWhenLoadedDelegate; - // else - // HideMinimizeButton(window); - - // SetIsHiddenMinimizeButton(window, true); - // } - // else if (!hideCloseButton && GetIsHiddenMinimizeButton(window)) - // { - // if (!window.IsLoaded) - // window.Loaded -= ShowMinimizeButtonWhenLoadedDelegate; - // else - // ShowMinimizeButton(window); - - // SetIsHiddenMinimizeButton(window, false); - // } - //} - - //private static void HideMinimizeButton(Window w) - //{ - // var hwnd = new WindowInteropHelper(w).Handle; - // SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_MINIMIZEBOX); - //} - - //private static void ShowMinimizeButton(Window w) - //{ - // var hwnd = new WindowInteropHelper(w).Handle; - // SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_MINIMIZEBOX); - //} - - //#endregion - - //#region IsHiddenMinimizeButton (readonly attached property) - //private static readonly DependencyPropertyKey IsHiddenMinimizeButtonKey = - // DependencyProperty.RegisterAttachedReadOnly("IsHiddenMinimizeButton", typeof(bool), OwnerType, new FrameworkPropertyMetadata(false)); - - //public static readonly DependencyProperty IsHiddenMinimizeButtonProperty = IsHiddenMinimizeButtonKey.DependencyProperty; - - //[AttachedPropertyBrowsableForType(typeof(Window))] - //public static bool GetIsHiddenMinimizeButton(Window obj) => (bool)obj.GetValue(IsHiddenMinimizeButtonProperty); - - //private static void SetIsHiddenMinimizeButton(Window obj, bool value) => obj.SetValue(IsHiddenMinimizeButtonProperty, value); - //#endregion - - //#region HideMaximizeButton - - //private static readonly RoutedEventHandler HideMaximizeButtonWhenLoadedDelegate = (sender, args) => { - // if (sender is Window == false) - // return; - - // var w = (Window)sender; - // HideMaximizeButton(w); - // w.Loaded -= HideMaximizeButtonWhenLoadedDelegate; - //}; - - //private static readonly RoutedEventHandler ShowMaximizeButtonWhenLoadedDelegate = (sender, args) => { - // if (sender is Window == false) - // return; - - // var w = (Window)sender; - // ShowMaximizeButton(w); - // w.Loaded -= ShowMaximizeButtonWhenLoadedDelegate; - //}; - - //public static readonly DependencyProperty HideMaximizeButtonProperty = - // DependencyProperty.RegisterAttached("HideMaximizeButton", typeof(bool), OwnerType, - // new FrameworkPropertyMetadata(false, new PropertyChangedCallback(HideMaximizeButtonChangedCallback))); - - //[AttachedPropertyBrowsableForType(typeof(Window))] - //public static bool GetHideMaximizeButton(Window obj) => (bool)obj.GetValue(HideCloseButtonProperty); - - //[AttachedPropertyBrowsableForType(typeof(Window))] - //public static void SetHideMaximizeButton(Window obj, bool value) => obj.SetValue(HideCloseButtonProperty, value); - - //private static void HideMaximizeButtonChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) - //{ - // var window = d as Window; - // if (window == null) return; - - // var hideCloseButton = (bool)e.NewValue; - // if (hideCloseButton && !GetIsHiddenMaximizeButton(window)) - // { - // if (!window.IsLoaded) - // window.Loaded += HideMaximizeButtonWhenLoadedDelegate; - // else - // HideMaximizeButton(window); - - // SetIsHiddenMaximizeButton(window, true); - // } - // else if (!hideCloseButton && GetIsHiddenMaximizeButton(window)) - // { - // if (!window.IsLoaded) - // window.Loaded -= ShowMaximizeButtonWhenLoadedDelegate; - // else - // ShowMaximizeButton(window); - - // SetIsHiddenMaximizeButton(window, false); - // } - //} - - //private static void HideMaximizeButton(Window w) - //{ - // var hwnd = new WindowInteropHelper(w).Handle; - // SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_MINIMIZEBOX); - //} - - //private static void ShowMaximizeButton(Window w) - //{ - // var hwnd = new WindowInteropHelper(w).Handle; - // SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_MINIMIZEBOX); - //} - - //#endregion - - //#region IsHiddenMaximizeButton (readonly attached property) - //private static readonly DependencyPropertyKey IsHiddenMaximizeButtonKey = - // DependencyProperty.RegisterAttachedReadOnly("IsHiddenMaximizeButton", typeof(bool), OwnerType, new FrameworkPropertyMetadata(false)); - - //public static readonly DependencyProperty IsHiddenMaximizeButtonProperty = IsHiddenMaximizeButtonKey.DependencyProperty; - - //[AttachedPropertyBrowsableForType(typeof(Window))] - //public static bool GetIsHiddenMaximizeButton(Window obj) => (bool)obj.GetValue(IsHiddenMaximizeButtonProperty); - - //private static void SetIsHiddenMaximizeButton(Window obj, bool value) => obj.SetValue(IsHiddenMaximizeButtonProperty, value); - //#endregion - - - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Configurations/AppSettings.cs b/src/WPFEduSolution/WPFBeginner/Configurations/AppSettings.cs deleted file mode 100644 index 0c0cec4..0000000 --- a/src/WPFEduSolution/WPFBeginner/Configurations/AppSettings.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System.Text.Json.Serialization; -using WPFBeginner.Models; - -namespace WPFBeginner.Configurations -{ - public class AppSettings - { - public EventHandler LanguageChanged; - public EventHandler ThemeChanged; - - [JsonPropertyName("Login")] - public LoginInfo Login { get; set; } - - private string language; - [JsonPropertyName("Language")] - public string Language - { - get => language; - set - { - var eventArg = new StringChangedEventArg() - { - Old = language, - New = value - }; - - language = value; - - if (eventArg.NotChanged) - return; - - LanguageChanged?.Invoke(null, eventArg); - } - } - - private string theme; - [JsonPropertyName("Theme")] - public string Theme - { - get => theme; - set - { - var eventArg = new StringChangedEventArg() - { - Old = theme, - New = value - }; - - theme = value; - - if (eventArg.NotChanged) - return; - - ThemeChanged?.Invoke(null, eventArg); - } - } - - [JsonPropertyName("DefaultMembers")] - public List Members { get; set; } - } - - public class StringChangedEventArg : EventArgs - { - public string Old { get; set; } - public string New { get; set; } - - public bool NotChanged => Old?.Equals(New, StringComparison.OrdinalIgnoreCase) ?? true; - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Configurations/LoginInfo.cs b/src/WPFEduSolution/WPFBeginner/Configurations/LoginInfo.cs deleted file mode 100644 index 2eeda77..0000000 --- a/src/WPFEduSolution/WPFBeginner/Configurations/LoginInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace WPFBeginner.Configurations -{ - public class LoginInfo - { - [JsonPropertyName("User")] - public string User { get; set; } - - public string Password { get; set; } - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Controls/MemberInputPanel.xaml b/src/WPFEduSolution/WPFBeginner/Controls/MemberInputPanel.xaml deleted file mode 100644 index 1d94db5..0000000 --- a/src/WPFEduSolution/WPFBeginner/Controls/MemberInputPanel.xaml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/WPFEduSolution/WPFBeginner/Controls/MemberInputPanel.xaml.cs b/src/WPFEduSolution/WPFBeginner/Controls/MemberInputPanel.xaml.cs deleted file mode 100644 index 977a145..0000000 --- a/src/WPFEduSolution/WPFBeginner/Controls/MemberInputPanel.xaml.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Windows; -using System.Windows.Controls; - -namespace WPFBeginner.Controls -{ - /// - /// MemberInputPanel.xaml에 대한 상호 작용 논리 - /// - public partial class MemberInputPanel : UserControl - { - public static readonly DependencyProperty MemberNameProperty = - DependencyProperty.Register(nameof(MemberName), typeof(string), typeof(MemberInputPanel), new FrameworkPropertyMetadata() { BindsTwoWayByDefault = true }); - - public string MemberName - { - get => (string)GetValue(MemberNameProperty); - set => SetValue(MemberNameProperty, value); - } - - public static readonly DependencyProperty EmployeeNoProperty = - DependencyProperty.Register(nameof(EmployeeNo), typeof(string), typeof(MemberInputPanel), new FrameworkPropertyMetadata() { BindsTwoWayByDefault = true }); - - public string EmployeeNo - { - get => (string)GetValue(EmployeeNoProperty); - set => SetValue(EmployeeNoProperty, value); - } - - public static readonly DependencyProperty CallProperty = - DependencyProperty.Register(nameof(Call), typeof(string), typeof(MemberInputPanel), new FrameworkPropertyMetadata() { BindsTwoWayByDefault = true }); - - public string Call - { - get => (string)GetValue(CallProperty); - set => SetValue(CallProperty, value); - } - - public static readonly DependencyProperty EmailProperty = - DependencyProperty.Register(nameof(Email), typeof(string), typeof(MemberInputPanel), new FrameworkPropertyMetadata() { BindsTwoWayByDefault = true }); - - public string Email - { - get => (string)GetValue(EmailProperty); - set => SetValue(EmailProperty, value); - } - - public MemberInputPanel() - { - InitializeComponent(); - } - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Converters/BaseConverter.cs b/src/WPFEduSolution/WPFBeginner/Converters/BaseConverter.cs deleted file mode 100644 index a9e53b6..0000000 --- a/src/WPFEduSolution/WPFBeginner/Converters/BaseConverter.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Windows.Markup; - -namespace WPFBeginner.Converters -{ - public abstract class BaseConverter : MarkupExtension - { - protected BaseConverter() { } - - public override object ProvideValue(IServiceProvider serviceProvider) - { - return this; - } - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Converters/InverseBoolConverter.cs b/src/WPFEduSolution/WPFBeginner/Converters/InverseBoolConverter.cs deleted file mode 100644 index c4e6edb..0000000 --- a/src/WPFEduSolution/WPFBeginner/Converters/InverseBoolConverter.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Windows.Data; - -namespace WPFBeginner.Converters -{ - [ValueConversion(typeof(bool), typeof(bool))] - public class InverseBoolConverter : BaseConverter, IValueConverter - { - public InverseBoolConverter() { } - - public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - return !(bool)value; - } - - public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) - { - return !(bool)value; - } - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Exceptions/LoginFailedException.cs b/src/WPFEduSolution/WPFBeginner/Exceptions/LoginFailedException.cs deleted file mode 100644 index aa759a7..0000000 --- a/src/WPFEduSolution/WPFBeginner/Exceptions/LoginFailedException.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace WPFBeginner.Exceptions -{ - internal class LoginFailedException : Exception - { - public LoginFailedException() : base() - { - - } - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Models/Member.cs b/src/WPFEduSolution/WPFBeginner/Models/Member.cs deleted file mode 100644 index 7bc0631..0000000 --- a/src/WPFEduSolution/WPFBeginner/Models/Member.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Text.Json.Serialization; - -namespace WPFBeginner.Models -{ - public class Member - { - [JsonPropertyName("Name")] - public string Name { get; set; } - [JsonPropertyName("Call")] - public string Call { get; set; } - [JsonPropertyName("EMail")] - public string EMail { get; set; } - [JsonPropertyName("No")] - public string EmployeeNo { get; set; } - - public static Member Create(string name, string call, string email, string employeeNo) - { - return new Member() - { - Name = name, - Call = call, - EMail = email, - EmployeeNo = employeeNo - }; - } - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Resources/Images/DrawingImages.xaml b/src/WPFEduSolution/WPFBeginner/Resources/Images/DrawingImages.xaml deleted file mode 100644 index e2188a4..0000000 --- a/src/WPFEduSolution/WPFBeginner/Resources/Images/DrawingImages.xaml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/WPFEduSolution/WPFBeginner/Resources/Images/bg_login.jpeg b/src/WPFEduSolution/WPFBeginner/Resources/Images/bg_login.jpeg deleted file mode 100644 index f59b076..0000000 Binary files a/src/WPFEduSolution/WPFBeginner/Resources/Images/bg_login.jpeg and /dev/null differ diff --git a/src/WPFEduSolution/WPFBeginner/Resources/Images/btn_search_001.png b/src/WPFEduSolution/WPFBeginner/Resources/Images/btn_search_001.png deleted file mode 100644 index dfcd6cb..0000000 Binary files a/src/WPFEduSolution/WPFBeginner/Resources/Images/btn_search_001.png and /dev/null differ diff --git a/src/WPFEduSolution/WPFBeginner/Resources/Images/ico_pw.png b/src/WPFEduSolution/WPFBeginner/Resources/Images/ico_pw.png deleted file mode 100644 index 7cd31c8..0000000 Binary files a/src/WPFEduSolution/WPFBeginner/Resources/Images/ico_pw.png and /dev/null differ diff --git a/src/WPFEduSolution/WPFBeginner/Resources/Images/ico_user.png b/src/WPFEduSolution/WPFBeginner/Resources/Images/ico_user.png deleted file mode 100644 index 9d85395..0000000 Binary files a/src/WPFEduSolution/WPFBeginner/Resources/Images/ico_user.png and /dev/null differ diff --git a/src/WPFEduSolution/WPFBeginner/Resources/SharedResourceDictionary.cs b/src/WPFEduSolution/WPFBeginner/Resources/SharedResourceDictionary.cs deleted file mode 100644 index ed2dfa1..0000000 --- a/src/WPFEduSolution/WPFBeginner/Resources/SharedResourceDictionary.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Windows; - -namespace WPFBeginner.Resources -{ - public class SharedResourceDictionary : ResourceDictionary - { - private static Dictionary _cache = new Dictionary(); - - private Uri source; - - public new Uri Source - { - get => source; - set - { - source = value; - if (!_cache.ContainsKey(source)) - { - AddToCache(); - } - else - { - WeakReference weakReference = _cache[source]; - if (weakReference != null && weakReference.IsAlive) - MergedDictionaries.Add((ResourceDictionary)weakReference.Target); - else - AddToCache(); - - } - - } - } - - private void AddToCache() - { - base.Source = source; - if (_cache.ContainsKey(source)) - _cache.Remove(source); - - _cache.Add(source, new WeakReference(this, false)); - } - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Services/EnterFocusAssistanct.cs b/src/WPFEduSolution/WPFBeginner/Services/EnterFocusAssistanct.cs deleted file mode 100644 index 7a0f291..0000000 --- a/src/WPFEduSolution/WPFBeginner/Services/EnterFocusAssistanct.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Windows; -using System.Windows.Input; - -namespace WPFBeginner.Services -{ - public class EnterKeyTraversal - { - public static readonly DependencyProperty IsEnabledProperty = - DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(EnterKeyTraversal), new UIPropertyMetadata(false, IsEnabledChanged)); - - public static bool GetIsEnabled(DependencyObject obj) => (bool)obj.GetValue(IsEnabledProperty); - - public static void SetIsEnabled(DependencyObject obj, bool value) => obj.SetValue(IsEnabledProperty, value); - - static void PreviewKeyDown(object sender, KeyEventArgs e) - { - var uiElement = e.OriginalSource as FrameworkElement; - - if (e.Key == Key.Enter) - { - e.Handled = true; - uiElement.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); - } - } - - private static void Unloaded(object sender, RoutedEventArgs e) - { - var uiElement = sender as FrameworkElement; - if (uiElement == null) - return; - - uiElement.Unloaded -= Unloaded; - uiElement.PreviewKeyDown -= PreviewKeyDown; - } - - static void IsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var ue = d as FrameworkElement; - if (ue == null) return; - - if ((bool)e.NewValue) - { - ue.Unloaded += Unloaded; - ue.PreviewKeyDown += PreviewKeyDown; - } - else - { - ue.PreviewKeyDown -= PreviewKeyDown; - } - } - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Services/PasswordBoxAssistant.cs b/src/WPFEduSolution/WPFBeginner/Services/PasswordBoxAssistant.cs deleted file mode 100644 index 7c814d7..0000000 --- a/src/WPFEduSolution/WPFBeginner/Services/PasswordBoxAssistant.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System.Windows; -using System.Windows.Controls; - -namespace WPFBeginner.Services -{ - public static class PasswordBoxAssistant - { - #region BoundPassword Property - - public static readonly DependencyProperty BoundPassword = - DependencyProperty.RegisterAttached(nameof(BoundPassword), typeof(string), typeof(PasswordBoxAssistant), new PropertyMetadata(string.Empty, OnBoundPasswordChanged)); - - public static string GetBoundPassword(DependencyObject dp) => (string)dp.GetValue(BoundPassword); - - public static void SetBoundPassword(DependencyObject dp, string value) => dp.SetValue(BoundPassword, value); - - private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var box = d as PasswordBox; - - // only handle this event when the property is attached to a PasswordBox - // and when the BindPassword attached property has been set to true - if (d == null || !GetEnableBindingPassword(d)) - return; - - // avoid recursive updating by ignoring the box's changed event - box.PasswordChanged -= HandlePasswordChanged; - - string newPassword = (string)e.NewValue; - - if (!GetUpdatingPassword(box)) - box.Password = newPassword; - - box.PasswordChanged += HandlePasswordChanged; - } - - #endregion - - #region EnableBindingPassword - - public static readonly DependencyProperty EnableBindingPassword = - DependencyProperty.RegisterAttached(nameof(EnableBindingPassword), typeof(bool), typeof(PasswordBoxAssistant), new PropertyMetadata(false, OnEnableBindingPasswordChanged)); - - public static bool GetEnableBindingPassword(DependencyObject dp) => (bool)dp.GetValue(EnableBindingPassword); - - public static void SetEnableBindingPassword(DependencyObject dp, bool value) => dp.SetValue(EnableBindingPassword, value); - - private static void OnEnableBindingPasswordChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e) - { - // when the BindPassword attached property is set on a PasswordBox, - // start listening to its PasswordChanged event - - var box = dp as PasswordBox; - - if (box == null) - return; - - bool wasBound = (bool)(e.OldValue); - bool needToBind = (bool)(e.NewValue); - - if (wasBound) - box.PasswordChanged -= HandlePasswordChanged; - - if (needToBind) - box.PasswordChanged += HandlePasswordChanged; - } - - #endregion - - #region UpdatingPassword - #endregion - - private static readonly DependencyProperty UpdatingPassword = - DependencyProperty.RegisterAttached(nameof(UpdatingPassword), typeof(bool), typeof(PasswordBoxAssistant), new PropertyMetadata(false)); - - private static bool GetUpdatingPassword(DependencyObject dp) => (bool)dp.GetValue(UpdatingPassword); - - private static void SetUpdatingPassword(DependencyObject dp, bool value) => dp.SetValue(UpdatingPassword, value); - - private static void HandlePasswordChanged(object sender, RoutedEventArgs e) - { - var box = sender as PasswordBox; - - // set a flag to indicate that we're updating the password - SetUpdatingPassword(box, true); - // push the new password into the BoundPassword property - SetBoundPassword(box, box.Password); - SetUpdatingPassword(box, false); - } - - - - - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Services/ResourceExplorer.cs b/src/WPFEduSolution/WPFBeginner/Services/ResourceExplorer.cs deleted file mode 100644 index 432aba1..0000000 --- a/src/WPFEduSolution/WPFBeginner/Services/ResourceExplorer.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Windows; - -namespace WPFBeginner.Services -{ - internal static class ResourceExplorer - { - public static string GetStringResource(string key) - { - var cultureCode = App.Config.Language; - var rd = App.Current.Resources.MergedDictionaries.FirstOrDefault(i => i.Source.AbsolutePath.EndsWith($"{cultureCode}.xaml")); - if (rd == null) - return null; - - return rd[key] as string; - } - - public static void ChangeXamlResource(string oldRes, string newRes) - { - var found = App.Current.Resources.MergedDictionaries.Select((item, i) => new { Item = item, Index = i }).FirstOrDefault(i => i.Item.Source.AbsoluteUri.Equals($"{oldRes}", StringComparison.OrdinalIgnoreCase)); - if (found == null) - return; - - var newResource = new ResourceDictionary() - { - Source = new Uri(newRes, UriKind.RelativeOrAbsolute) - }; - App.Current.Resources.MergedDictionaries.Remove(found.Item); - App.Current.Resources.MergedDictionaries.Add(newResource); - } - - public static ResourceDictionary GetLanguageResourceDic(string name) - { - var foundName = $"pack://application:,,,/Themes/Cultures/{name}.xaml"; - //var foundName = $"/WPFBeginner;component/Themes/Cultures/{name}.xaml"; - var found = App.Current.Resources.MergedDictionaries.Select((item, i) => new { Item = item, Index = i }).FirstOrDefault(i => i.Item.Source.AbsoluteUri.Equals(foundName, StringComparison.OrdinalIgnoreCase)); - if (found == null) - return new ResourceDictionary() { Source = new Uri(foundName, UriKind.RelativeOrAbsolute) }; - - return found.Item; - } - - public static ResourceDictionary GetThemeResourceDic(string name) - { - var foundName = $"pack://application:,,,/Themes/Colors/{name}.xaml"; - //var foundName = $"/WPFBeginner;component/Themes/Colors/{name}.xaml"; - var found = App.Current.Resources.MergedDictionaries.Select((item, i) => new { Item = item, Index = i }).FirstOrDefault(i => i.Item.Source.AbsoluteUri.Equals(foundName, StringComparison.OrdinalIgnoreCase)); - if (found == null) - return new ResourceDictionary() { Source = new Uri(foundName, UriKind.RelativeOrAbsolute) }; - - return found.Item; - } - - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Services/ViewModelLocator.cs b/src/WPFEduSolution/WPFBeginner/Services/ViewModelLocator.cs deleted file mode 100644 index b05dd1c..0000000 --- a/src/WPFEduSolution/WPFBeginner/Services/ViewModelLocator.cs +++ /dev/null @@ -1,10 +0,0 @@ -using CommunityToolkit.Mvvm.DependencyInjection; -using WPFBeginner.ViewModels; - -namespace WPFBeginner.Services -{ - internal class ViewModelLocator - { - public MainWindowViewModel MainWindowViewModel => Ioc.Default.GetService(); - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Themes/Colors/DefaultTheme.xaml b/src/WPFEduSolution/WPFBeginner/Themes/Colors/DefaultTheme.xaml deleted file mode 100644 index b3899a4..0000000 --- a/src/WPFEduSolution/WPFBeginner/Themes/Colors/DefaultTheme.xaml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/WPFEduSolution/WPFBeginner/Themes/Colors/LightTheme.xaml b/src/WPFEduSolution/WPFBeginner/Themes/Colors/LightTheme.xaml deleted file mode 100644 index 446ec6c..0000000 --- a/src/WPFEduSolution/WPFBeginner/Themes/Colors/LightTheme.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/WPFEduSolution/WPFBeginner/Themes/Cultures/en-US.xaml b/src/WPFEduSolution/WPFBeginner/Themes/Cultures/en-US.xaml deleted file mode 100644 index f27922c..0000000 --- a/src/WPFEduSolution/WPFBeginner/Themes/Cultures/en-US.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - Duplicated execution. - Please check your ID and password again. - Login - Please enter your ID and password. - - Contact Management Program - Name: - Contact - Employee Number: - Email: - No search condition provided. Please enter a search condition. - - Add - Search - Delete - Reset - - Name - Contact - Employee Number - Email - - Register - Cancel - Name or employee number is required. - - \ No newline at end of file diff --git a/src/WPFEduSolution/WPFBeginner/Themes/Cultures/ko-KR.xaml b/src/WPFEduSolution/WPFBeginner/Themes/Cultures/ko-KR.xaml deleted file mode 100644 index 3b142e5..0000000 --- a/src/WPFEduSolution/WPFBeginner/Themes/Cultures/ko-KR.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - 중복된 실행입니다. - 아이디와 비번을 다시 한번 확인해주세요 - 로그인 - 아이디와 비번을 입력해주세요 - - 연락처 관리 프로그램 - 이름: - 연락처 - 사번: - 이메일: - 검색 조건이 없습니다. 검색 조건을 입력해주세요 - - 추가 - 검 색 - 삭제 - 초기화 - - 이름 - 연락처 - 사번 - 이메일 - - 등록 - 취소 - 이름 또는 사번은 반드시 필요합니다. - - \ No newline at end of file diff --git a/src/WPFEduSolution/WPFBeginner/Themes/Styles/Buttons.xaml b/src/WPFEduSolution/WPFBeginner/Themes/Styles/Buttons.xaml deleted file mode 100644 index ba639e6..0000000 --- a/src/WPFEduSolution/WPFBeginner/Themes/Styles/Buttons.xaml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/WPFEduSolution/WPFBeginner/ViewModels/LoginWindowViewModel.cs b/src/WPFEduSolution/WPFBeginner/ViewModels/LoginWindowViewModel.cs deleted file mode 100644 index f84adf0..0000000 --- a/src/WPFEduSolution/WPFBeginner/ViewModels/LoginWindowViewModel.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using System.Windows; -using System.Windows.Input; -using WPFBeginner.Services; - -namespace WPFBeginner.ViewModels -{ - public partial class LoginWindowViewModel : ObservableObject - { - [ObservableProperty] - private string user; - - [ObservableProperty] - private string password; - - [ObservableProperty] - private string message; - - public ICommand LoginClickCommand => new RelayCommand((window) => - { - if (CheckID() && CheckPassword()) - window.DialogResult = true; - else - Message = ResourceExplorer.GetStringResource("Cultures.LoginWindow.ErrorMessage.InvalidUser"); - }); - - public ICommand CloseClickCommand => new RelayCommand((window) => - { - window.DialogResult = false; - }); - - private bool CheckID() => user?.Equals(App.Config.Login.User, StringComparison.OrdinalIgnoreCase) ?? false; - - private bool CheckPassword() => password?.Equals(App.Config.Login.Password, StringComparison.OrdinalIgnoreCase) ?? false; - } -} diff --git a/src/WPFEduSolution/WPFBeginner/ViewModels/MainWindowViewModel.cs b/src/WPFEduSolution/WPFBeginner/ViewModels/MainWindowViewModel.cs deleted file mode 100644 index b03f63d..0000000 --- a/src/WPFEduSolution/WPFBeginner/ViewModels/MainWindowViewModel.cs +++ /dev/null @@ -1,217 +0,0 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using System.Collections.ObjectModel; -using System.Windows; -using System.Windows.Input; -using WPFBeginner.Models; -using WPFBeginner.Services; -using WPFBeginner.Views; - -namespace WPFBeginner.ViewModels -{ - public partial class MainWindowViewModel : ObservableRecipient - { - private ObservableCollection members; - public ObservableCollection Members - { - get - { - if (filterMemebers != null) - return filterMemebers; - - return members; - } - set => SetProperty(ref members, value); - } - - private ObservableCollection filterMemebers; - - [ObservableProperty] - private Member selectedMember; - - private Member searchModel; - - public string MemberName - { - get => searchModel?.Name; - set - { - if (searchModel == null) - searchModel = new Member(); - - searchModel.Name = value; - OnPropertyChanged(); - } - } - - public string Call - { - get => searchModel?.Call; - set - { - if (searchModel == null) - searchModel = new Member(); - - searchModel.Call = value; - OnPropertyChanged(); - } - } - public string EmployeeNo - { - get => searchModel?.EmployeeNo; - set - { - if (searchModel == null) - searchModel = new Member(); - - searchModel.EmployeeNo = value; - OnPropertyChanged(); - } - } - - public string EMail - { - get => searchModel.EMail; - set - { - if (searchModel == null) - searchModel = new Member(); - - searchModel.EMail = value; - OnPropertyChanged(); - } - } - - public ICommand SearchClickCommand => new RelayCommand(() => - { - var errorMessage = ValidateSearchValues(); - if (errorMessage != null) - { - MessageBox.Show(errorMessage); - filterMemebers = null; - return; - } - - IEnumerable result = Members; - - if (!string.IsNullOrWhiteSpace(MemberName)) - result = result.Where(i => i.Name?.Contains(MemberName) ?? false); - - if (!string.IsNullOrWhiteSpace(EMail)) - result = result.Where(i => i.EMail?.Contains(EMail) ?? false); - - if (!string.IsNullOrWhiteSpace(Call)) - result = result.Where(i => i.Call?.Contains(Call) ?? false); - - if (!string.IsNullOrWhiteSpace(EmployeeNo)) - result = result.Where(i => i.EmployeeNo?.Contains(EmployeeNo) ?? false); - - if (result == null) - filterMemebers = new ObservableCollection(); - else - filterMemebers = new ObservableCollection(result); - - OnPropertyChanged(nameof(Members)); - }); - - public ICommand CloseCommand => new RelayCommand(window => window.Close()); - - public ICommand MinimizeCommand => new RelayCommand(window => window.WindowState = WindowState.Minimized); - - public ICommand MaximizeCommad => new RelayCommand(window => - { - switch (window.WindowState) - { - case WindowState.Maximized: - window.WindowState = WindowState.Normal; - break; - - case WindowState.Normal: - window.WindowState = WindowState.Maximized; - break; - } - }); - - public bool IsKorean => App.Config.Language.Equals("ko-KR", StringComparison.OrdinalIgnoreCase); - public bool IsEnglish => App.Config.Language.Equals("en-US", StringComparison.OrdinalIgnoreCase); - - - public ICommand LangueChangeCommand => new RelayCommand(code => - { - App.Config.Language = code; - OnPropertyChanged(nameof(IsKorean)); - OnPropertyChanged(nameof(IsEnglish)); - }); - - - - public bool IsDefaultTheme => App.Config.Theme.Equals("DefaultTheme", StringComparison.OrdinalIgnoreCase); - public bool IsLightTheme => App.Config.Theme.Equals("LightTheme", StringComparison.OrdinalIgnoreCase); - - public ICommand ThemeChangeCommand => new RelayCommand(code => - { - App.Config.Theme = code; - OnPropertyChanged(nameof(IsDefaultTheme)); - OnPropertyChanged(nameof(IsLightTheme)); - }); - - private string ValidateSearchValues() - { - if (string.IsNullOrWhiteSpace(MemberName) - && string.IsNullOrWhiteSpace(EmployeeNo) - && string.IsNullOrWhiteSpace(Call) - && string.IsNullOrWhiteSpace(EMail)) - return ResourceExplorer.GetStringResource("Cultures.MainWindow.ErrorMessage.SearchConditionEmpty"); - - return null; - } - - public ICommand DeleteClickCommand => new RelayCommand(() => - { - if (SelectedMember == null) - return; - - Members.Remove(SelectedMember); - }); - - public ICommand InitClickCommand => new RelayCommand(() => - { - filterMemebers = null; - searchModel = new Member(); - OnPropertyChanged(nameof(MemberName)); - OnPropertyChanged(nameof(EmployeeNo)); - OnPropertyChanged(nameof(EMail)); - OnPropertyChanged(nameof(Call)); - OnPropertyChanged(nameof(Members)); - }); - - public ICommand AddClickCommand => new RelayCommand((parentWindow) => - { - var registDialog = new RegistMemberWindow(); - registDialog.Owner = parentWindow; - var result = registDialog.ShowDialog(); - if (result == true) - { - var dx = registDialog.DataContext as RegistMemberWindowViewModel; - if (dx == null) - return; - Members.Add(Member.Create(dx.MemberName, dx.Call, dx.Email, dx.EmployeeNo)); - } - }); - - - public MainWindowViewModel() - { - CreateDefaultMember(); - searchModel = new Member(); - } - - private void CreateDefaultMember() - { - members = new ObservableCollection(); - foreach (var member in App.Config.Members) - members.Add(Member.Create(member.Name, member.Call, member.EMail, member.EmployeeNo)); - OnPropertyChanged(nameof(Members)); - } - } -} diff --git a/src/WPFEduSolution/WPFBeginner/ViewModels/RegistMemberWindowViewModel.cs b/src/WPFEduSolution/WPFBeginner/ViewModels/RegistMemberWindowViewModel.cs deleted file mode 100644 index e247631..0000000 --- a/src/WPFEduSolution/WPFBeginner/ViewModels/RegistMemberWindowViewModel.cs +++ /dev/null @@ -1,49 +0,0 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; -using System.Windows; -using System.Windows.Input; -using WPFBeginner.Services; - -namespace WPFBeginner.ViewModels -{ - public partial class RegistMemberWindowViewModel : ObservableRecipient - { - [ObservableProperty] - private string memberName; - - [ObservableProperty] - private string call; - - [ObservableProperty] - private string employeeNo; - - [ObservableProperty] - private string email; - - public ICommand RegistClickCommand => new RelayCommand((window) => - { - var result = Validate(); - if (result != null) - MessageBox.Show(result); - else - window.DialogResult = true; - }); - - public ICommand CancelClickCommand => new RelayCommand((window) => - { - window.DialogResult = false; - }); - - - - private string Validate() - { - if (string.IsNullOrWhiteSpace(MemberName) || string.IsNullOrWhiteSpace(EmployeeNo)) - return ResourceExplorer.GetStringResource("Cultures.RegistMemberWindow.ErrorMessage.FillMustValue"); - - return null; - } - - - } -} diff --git a/src/WPFEduSolution/WPFBeginner/Views/LoginWindow.xaml b/src/WPFEduSolution/WPFBeginner/Views/LoginWindow.xaml deleted file mode 100644 index 478c7bf..0000000 --- a/src/WPFEduSolution/WPFBeginner/Views/LoginWindow.xaml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -