From 9af6154f9e87623dfcf64fc7c11c4d75ebe011e6 Mon Sep 17 00:00:00 2001 From: syneffort Date: Tue, 11 Jul 2023 16:38:48 +0900 Subject: [PATCH] progressbar mvvm --- .../ViewModel/EmpViewModel.cs | 1 - PacticeSolution/PacticeSolution.sln | 6 + .../ProgressBarMVVMSample/App.config | 6 + .../ProgressBarMVVMSample/App.xaml | 9 ++ .../ProgressBarMVVMSample/App.xaml.cs | 17 +++ .../Command/DelegateCommand.cs | 47 +++++++ .../ProgressBarMVVMSample/MainWindow.xaml | 32 +++++ .../ProgressBarMVVMSample/MainWindow.xaml.cs | 28 +++++ .../Model/BindableBase.cs | 33 +++++ .../ProgressBarMVVMSample.csproj | 101 +++++++++++++++ .../Properties/AssemblyInfo.cs | 55 ++++++++ .../Properties/Resources.Designer.cs | 71 +++++++++++ .../Properties/Resources.resx | 117 ++++++++++++++++++ .../Properties/Settings.Designer.cs | 30 +++++ .../Properties/Settings.settings | 7 ++ .../ViewModel/MainViewModel.cs | 96 ++++++++++++++ 16 files changed, 655 insertions(+), 1 deletion(-) create mode 100644 PacticeSolution/ProgressBarMVVMSample/App.config create mode 100644 PacticeSolution/ProgressBarMVVMSample/App.xaml create mode 100644 PacticeSolution/ProgressBarMVVMSample/App.xaml.cs create mode 100644 PacticeSolution/ProgressBarMVVMSample/Command/DelegateCommand.cs create mode 100644 PacticeSolution/ProgressBarMVVMSample/MainWindow.xaml create mode 100644 PacticeSolution/ProgressBarMVVMSample/MainWindow.xaml.cs create mode 100644 PacticeSolution/ProgressBarMVVMSample/Model/BindableBase.cs create mode 100644 PacticeSolution/ProgressBarMVVMSample/ProgressBarMVVMSample.csproj create mode 100644 PacticeSolution/ProgressBarMVVMSample/Properties/AssemblyInfo.cs create mode 100644 PacticeSolution/ProgressBarMVVMSample/Properties/Resources.Designer.cs create mode 100644 PacticeSolution/ProgressBarMVVMSample/Properties/Resources.resx create mode 100644 PacticeSolution/ProgressBarMVVMSample/Properties/Settings.Designer.cs create mode 100644 PacticeSolution/ProgressBarMVVMSample/Properties/Settings.settings create mode 100644 PacticeSolution/ProgressBarMVVMSample/ViewModel/MainViewModel.cs diff --git a/PacticeSolution/ListBoxSortFilterSearch/ViewModel/EmpViewModel.cs b/PacticeSolution/ListBoxSortFilterSearch/ViewModel/EmpViewModel.cs index 38d1891..e41274c 100644 --- a/PacticeSolution/ListBoxSortFilterSearch/ViewModel/EmpViewModel.cs +++ b/PacticeSolution/ListBoxSortFilterSearch/ViewModel/EmpViewModel.cs @@ -19,6 +19,5 @@ namespace ListBoxSortFilterSearch.ViewModel this.Add(new Emp() { EmpNo = 5, Name = "Smith", Job = "Guard" }); this.Add(new Emp() { EmpNo = 6, Name = "Michel", Job = "Manager" }); } - } } diff --git a/PacticeSolution/PacticeSolution.sln b/PacticeSolution/PacticeSolution.sln index f7ec801..fabcbf2 100644 --- a/PacticeSolution/PacticeSolution.sln +++ b/PacticeSolution/PacticeSolution.sln @@ -81,6 +81,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ValueConverterSample", "Val EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ListBoxSortFilterSearch", "ListBoxSortFilterSearch\ListBoxSortFilterSearch.csproj", "{31C1503F-1735-4A7E-A5AC-2935E0076160}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProgressBarMVVMSample", "ProgressBarMVVMSample\ProgressBarMVVMSample.csproj", "{AAF51128-FFDA-495A-947F-0206993C1814}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -243,6 +245,10 @@ Global {31C1503F-1735-4A7E-A5AC-2935E0076160}.Debug|Any CPU.Build.0 = Debug|Any CPU {31C1503F-1735-4A7E-A5AC-2935E0076160}.Release|Any CPU.ActiveCfg = Release|Any CPU {31C1503F-1735-4A7E-A5AC-2935E0076160}.Release|Any CPU.Build.0 = Release|Any CPU + {AAF51128-FFDA-495A-947F-0206993C1814}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AAF51128-FFDA-495A-947F-0206993C1814}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AAF51128-FFDA-495A-947F-0206993C1814}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AAF51128-FFDA-495A-947F-0206993C1814}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/PacticeSolution/ProgressBarMVVMSample/App.config b/PacticeSolution/ProgressBarMVVMSample/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/PacticeSolution/ProgressBarMVVMSample/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/PacticeSolution/ProgressBarMVVMSample/App.xaml b/PacticeSolution/ProgressBarMVVMSample/App.xaml new file mode 100644 index 0000000..e608a24 --- /dev/null +++ b/PacticeSolution/ProgressBarMVVMSample/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/PacticeSolution/ProgressBarMVVMSample/App.xaml.cs b/PacticeSolution/ProgressBarMVVMSample/App.xaml.cs new file mode 100644 index 0000000..3d595d5 --- /dev/null +++ b/PacticeSolution/ProgressBarMVVMSample/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace ProgressBarMVVMSample +{ + /// + /// App.xaml에 대한 상호 작용 논리 + /// + public partial class App : Application + { + } +} diff --git a/PacticeSolution/ProgressBarMVVMSample/Command/DelegateCommand.cs b/PacticeSolution/ProgressBarMVVMSample/Command/DelegateCommand.cs new file mode 100644 index 0000000..4926e0e --- /dev/null +++ b/PacticeSolution/ProgressBarMVVMSample/Command/DelegateCommand.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace ProgressBarMVVMSample.Command +{ + internal class DelegateCommand : ICommand + { + private readonly Action _execute; + private readonly Predicate _canExecute; + + public event EventHandler CanExecuteChanged; + //{ + // add { CommandManager.RequerySuggested += value; } + // remove { CommandManager.RequerySuggested -= value; } + //} + + public DelegateCommand(Action execute, Predicate canExecute) + { + _execute = execute; + _canExecute = canExecute; + } + + public DelegateCommand(Action execute) : this(execute, null) + { + + } + + public DelegateCommand(Action execute, bool b) : this(execute, null) + { + + } + + public bool CanExecute(object parameter) + { + return _canExecute == null ? true : _canExecute(parameter); + } + + public void Execute(object parameter) + { + _execute.Invoke(parameter); + } + } +} diff --git a/PacticeSolution/ProgressBarMVVMSample/MainWindow.xaml b/PacticeSolution/ProgressBarMVVMSample/MainWindow.xaml new file mode 100644 index 0000000..9336e36 --- /dev/null +++ b/PacticeSolution/ProgressBarMVVMSample/MainWindow.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + +