diff --git a/BodyshopUploader/Properties/AssemblyInfo.cs b/BodyshopUploader/Properties/AssemblyInfo.cs index 7bcd34b..ffb4f33 100644 --- a/BodyshopUploader/Properties/AssemblyInfo.cs +++ b/BodyshopUploader/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ using System.Windows; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("ImEX Systems Inc.")] [assembly: AssemblyProduct("ImEX Online Partner")] -[assembly: AssemblyCopyright("Copyright © Snapt Software Inc. 2020")] +[assembly: AssemblyCopyright("Copyright © Snapt Software Inc. 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/BodyshopUploader/Properties/Resources.Designer.cs b/BodyshopUploader/Properties/Resources.Designer.cs index fd4105d..aa2489a 100644 --- a/BodyshopUploader/Properties/Resources.Designer.cs +++ b/BodyshopUploader/Properties/Resources.Designer.cs @@ -213,6 +213,15 @@ namespace BodyshopPartner.Properties { } } + /// + /// Looks up a localized string similar to Remove All Paths. + /// + public static string Label_RemoveAllPaths { + get { + return ResourceManager.GetString("Label_RemoveAllPaths", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Restart. /// diff --git a/BodyshopUploader/Properties/Resources.resx b/BodyshopUploader/Properties/Resources.resx index 418131f..45f3edf 100644 --- a/BodyshopUploader/Properties/Resources.resx +++ b/BodyshopUploader/Properties/Resources.resx @@ -168,6 +168,9 @@ Re_move + + Remove All Paths + _Restart diff --git a/BodyshopUploader/ViewModels/MainViewModel.commands.cs b/BodyshopUploader/ViewModels/MainViewModel.commands.cs index 26635d7..e5624bb 100644 --- a/BodyshopUploader/ViewModels/MainViewModel.commands.cs +++ b/BodyshopUploader/ViewModels/MainViewModel.commands.cs @@ -70,13 +70,38 @@ namespace BodyshopPartner.ViewModels { _removeMonitoringPathCommand = new RelayCommand( p => true, - p => RemoveFolderMonitoringPath(p as Models.Monitor) + p => + { + RemoveFolderMonitoringPath(p as Models.Monitor); + + } ); } return _removeMonitoringPathCommand; } } + + private ICommand _removeAllMonitoringPathCommand; + public ICommand RemoveAllMonitoringPathCommand + { + get + { + if (_removeAllMonitoringPathCommand == null) + { + _removeAllMonitoringPathCommand = new RelayCommand( + p => true, + p => + { + RemoveAllFolderMonitors(); + + } + ); + } + return _removeAllMonitoringPathCommand; + } + } + private ICommand _startFolderMonitorsCommand; public ICommand StartFolderMonitorsCommand { diff --git a/BodyshopUploader/ViewModels/MainViewModel.cs b/BodyshopUploader/ViewModels/MainViewModel.cs index 48fe92e..cc2e1b8 100644 --- a/BodyshopUploader/ViewModels/MainViewModel.cs +++ b/BodyshopUploader/ViewModels/MainViewModel.cs @@ -179,6 +179,24 @@ namespace BodyshopPartner.ViewModels IndeterminateLoading = false; } + + public void RemoveAllFolderMonitors() + { + IndeterminateLoading = true; + if (MonitoringPaths.Count > 0) + foreach (var m in MonitoringPaths.ToList()) + { + logger.Debug("Removing folder {0} to monitoring paths.", m.FilePath); + m.StopMonitor(); + MonitoringPaths.Remove(m); + + } + Properties.Settings.Default.MonitoringPaths = MonitoringPaths.Select(x => x.FilePath).ToList(); + Properties.Settings.Default.Save(); + + IndeterminateLoading = false; + } + public void BrowseForQbFolder() { diff --git a/BodyshopUploader/Views/Main.xaml b/BodyshopUploader/Views/Main.xaml index 2b97e29..7d55ff7 100644 --- a/BodyshopUploader/Views/Main.xaml +++ b/BodyshopUploader/Views/Main.xaml @@ -21,6 +21,7 @@ Background="{DynamicResource MaterialDesignPaper}" FontFamily="{DynamicResource MaterialDesignFont}" Loaded="Window_Loaded" + Name="MainWindow" Closing="Window_Closing"> @@ -59,8 +60,7 @@ DoubleClickCommand="{Binding OpenMainWindowCommand}" DoubleClickCommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" PopupActivation="LeftClick" - MenuActivation="RightClick" - > + MenuActivation="RightClick">