diff --git a/BodyshopUploader/App.config b/BodyshopUploader/App.config index 5235ea7..98477bb 100644 --- a/BodyshopUploader/App.config +++ b/BodyshopUploader/App.config @@ -14,6 +14,22 @@ + + + + + + + + + + + + + + + + diff --git a/BodyshopUploader/BodyshopUploader.csproj b/BodyshopUploader/BodyshopUploader.csproj index 680f953..e1ee7c2 100644 --- a/BodyshopUploader/BodyshopUploader.csproj +++ b/BodyshopUploader/BodyshopUploader.csproj @@ -84,22 +84,28 @@ ..\packages\NLog.4.6.8\lib\net45\NLog.dll + + ..\packages\Ookii.Dialogs.1.0\lib\net35\Ookii.Dialogs.Wpf.dll + ..\packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll True True + + ..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll + - - ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll + + ..\packages\System.Console.4.3.1\lib\net46\System.Console.dll True True - - ..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll + + ..\packages\System.Diagnostics.DiagnosticSource.4.7.0\lib\net46\System.Diagnostics.DiagnosticSource.dll ..\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll @@ -147,8 +153,11 @@ True True - - ..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll + + ..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll + + + ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll True True @@ -158,18 +167,24 @@ True + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + ..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll True True - - ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + + ..\packages\System.Runtime.4.3.1\lib\net462\System.Runtime.dll True True - - ..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.7.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Runtime.Extensions.4.3.1\lib\net462\System.Runtime.Extensions.dll True True @@ -185,7 +200,7 @@ - ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll + ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net463\System.Security.Cryptography.Algorithms.dll True True @@ -199,14 +214,14 @@ True True - - ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll True True - ..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll + ..\packages\System.Text.RegularExpressions.4.3.1\lib\net463\System.Text.RegularExpressions.dll True True @@ -220,7 +235,7 @@ 4.0 - ..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll + ..\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll True True @@ -250,6 +265,7 @@ + @@ -340,5 +356,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + \ No newline at end of file diff --git a/BodyshopUploader/Properties/Resources.Designer.cs b/BodyshopUploader/Properties/Resources.Designer.cs index 58301f0..8b7d30a 100644 --- a/BodyshopUploader/Properties/Resources.Designer.cs +++ b/BodyshopUploader/Properties/Resources.Designer.cs @@ -105,6 +105,15 @@ namespace BodyshopUploader.Properties { } } + /// + /// Looks up a localized string similar to Add Path. + /// + public static string Label_AddMonitoringPath { + get { + return ResourceManager.GetString("Label_AddMonitoringPath", resourceCulture); + } + } + /// /// Looks up a localized string similar to Login. /// diff --git a/BodyshopUploader/Properties/Resources.resx b/BodyshopUploader/Properties/Resources.resx index 79bbf2d..993bb3e 100644 --- a/BodyshopUploader/Properties/Resources.resx +++ b/BodyshopUploader/Properties/Resources.resx @@ -132,6 +132,9 @@ Exit + + Add Path + Login diff --git a/BodyshopUploader/Properties/Settings.Designer.cs b/BodyshopUploader/Properties/Settings.Designer.cs index 7f43b15..bef4441 100644 --- a/BodyshopUploader/Properties/Settings.Designer.cs +++ b/BodyshopUploader/Properties/Settings.Designer.cs @@ -45,5 +45,17 @@ namespace BodyshopUploader.Properties { this["Password"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("C:\\ImEX\r\nC:\\000")] + public global::System.Collections.ObjectModel.ObservableCollection MonitoringPaths { + get { + return ((global::System.Collections.ObjectModel.ObservableCollection)(this["MonitoringPaths"])); + } + set { + this["MonitoringPaths"] = value; + } + } } } diff --git a/BodyshopUploader/Properties/Settings.settings b/BodyshopUploader/Properties/Settings.settings index e75ac4e..13c3c86 100644 --- a/BodyshopUploader/Properties/Settings.settings +++ b/BodyshopUploader/Properties/Settings.settings @@ -8,5 +8,9 @@ + + C:\ImEX +C:\000 + \ No newline at end of file diff --git a/BodyshopUploader/Utils/TrayIcon.cs b/BodyshopUploader/Utils/TrayIcon.cs new file mode 100644 index 0000000..c2a8964 --- /dev/null +++ b/BodyshopUploader/Utils/TrayIcon.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace BodyshopUploader.Utils +{ + public class OpenMainWindowCommand : ICommand + { + public void Execute(object parameter) + { + new Views.Main().Show(); + } + + public bool CanExecute(object parameter) + { + return true; + } + + public event EventHandler CanExecuteChanged; + } +} diff --git a/BodyshopUploader/ViewModels/LoginViewModel.commands.cs b/BodyshopUploader/ViewModels/LoginViewModel.commands.cs index ec0f6b0..a63a969 100644 --- a/BodyshopUploader/ViewModels/LoginViewModel.commands.cs +++ b/BodyshopUploader/ViewModels/LoginViewModel.commands.cs @@ -14,7 +14,7 @@ namespace BodyshopUploader.ViewModels if (_loginCommand == null) { _loginCommand = new RelayCommand( - p => !string.IsNullOrEmpty(UserName) && UserPassword?.Length > 6, + p => !string.IsNullOrEmpty(UserName) && UserPassword?.Length > 5, async p => { await LoginAsync(p as Window); }); } return _loginCommand; diff --git a/BodyshopUploader/ViewModels/MainViewModel.commands.cs b/BodyshopUploader/ViewModels/MainViewModel.commands.cs index 202b7e3..01fa1e7 100644 --- a/BodyshopUploader/ViewModels/MainViewModel.commands.cs +++ b/BodyshopUploader/ViewModels/MainViewModel.commands.cs @@ -22,5 +22,53 @@ namespace BodyshopUploader.ViewModels return _testCommand; } } + + private ICommand _openMainWindowCommand; + public ICommand OpenMainWindowCommand + { + get + { + if (_openMainWindowCommand == null) + { + _openMainWindowCommand = new RelayCommand( + p => true, + p => Console.WriteLine("nada") + ); ; + } + return _openMainWindowCommand; + } + } + + private ICommand _addMonitoringPathCommand; + public ICommand AddMonitoringPathCommand + { + get + { + if (_addMonitoringPathCommand == null) + { + _addMonitoringPathCommand = new RelayCommand( + p => true, + p => AddFolderMonitoringPath() + ); + } + return _addMonitoringPathCommand; + } + } + + private ICommand _removeMonitoringPathCommand; + public ICommand RemoveMonitoringPathCommand + { + get + { + if (_removeMonitoringPathCommand == null) + { + _removeMonitoringPathCommand = new RelayCommand( + p => true, + p => RemoveFolderMonitoringPath(p as string) + ); + } + return _removeMonitoringPathCommand; + } + } } } diff --git a/BodyshopUploader/ViewModels/MainViewModel.cs b/BodyshopUploader/ViewModels/MainViewModel.cs index 4fe8c80..a7b1e89 100644 --- a/BodyshopUploader/ViewModels/MainViewModel.cs +++ b/BodyshopUploader/ViewModels/MainViewModel.cs @@ -2,9 +2,11 @@ using GraphQL.Common.Request; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; namespace BodyshopUploader.ViewModels { @@ -15,41 +17,62 @@ namespace BodyshopUploader.ViewModels public MainViewModel() { logger.Trace("Main VM Created."); + + //Create Variables + if (MonitoringPaths == null) MonitoringPaths = new ObservableCollection(); + MonitoringPaths.CollectionChanged += MonitoringPathsChanged; + } + + private void MonitoringPathsChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + logger.Warn("TODO: Change monitoring lifecycles for folder watchers."); + } + + public void AddFolderMonitoringPath() + { + var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); + if (dialog.ShowDialog().GetValueOrDefault()) + { + logger.Debug("Adding folder {0} to monitoring paths.", dialog.SelectedPath); + MonitoringPaths.Add(dialog.SelectedPath); + Properties.Settings.Default.MonitoringPaths = MonitoringPaths; + Properties.Settings.Default.Save(); + } + } + + public void RemoveFolderMonitoringPath(string Path) + { + logger.Debug("Removing folder {0} to monitoring paths.", Path); + MonitoringPaths.Remove(Path); + Properties.Settings.Default.MonitoringPaths = MonitoringPaths; + Properties.Settings.Default.Save(); } public async Task TestGql() { - var r = new GraphQLRequest - { - Query = @" - query { - jobs { - id - est_number - ro_number - job_status { - id - name - } - scheduled_completion - scheduled_delivery - vehicle { - id - v_model_yr - v_make_desc - v_model_desc - plate_no - } - } - } - " - }; + if (MonitoringPaths == null) MonitoringPaths = new ObservableCollection(); + MonitoringPaths.Add(@"C:\IMEX"); + Properties.Settings.Default.MonitoringPaths = MonitoringPaths; + Properties.Settings.Default.Save(); - using (var g = Utils.GraphQL.CreateGQLClient()) - { - var graphQLResponse = await g.PostAsync(r); - logger.Info(graphQLResponse.Data.jobs); - } + //var r = new GraphQLRequest + //{ + // Query = @" + // query { + // jobs { + // id + // est_number + // ro_number + // } + // } + // " + //}; + + //using (var g = Utils.GraphQL.CreateGQLClient()) + //{ + // var graphQLResponse = await g.PostAsync(r); + // logger.Info(graphQLResponse.Data.jobs); + //} } } } diff --git a/BodyshopUploader/ViewModels/MainViewModel.props.cs b/BodyshopUploader/ViewModels/MainViewModel.props.cs index 2d1e511..a915376 100644 --- a/BodyshopUploader/ViewModels/MainViewModel.props.cs +++ b/BodyshopUploader/ViewModels/MainViewModel.props.cs @@ -15,5 +15,12 @@ namespace BodyshopUploader.ViewModels get { return _progress; } set { SetProperty(ref _progress, value); } } + + private ObservableCollection _monitoringPaths = Properties.Settings.Default.MonitoringPaths ; + public ObservableCollection MonitoringPaths + { + get { return _monitoringPaths; } + set { SetProperty(ref _monitoringPaths, value); } + } } } diff --git a/BodyshopUploader/Views/Login.xaml b/BodyshopUploader/Views/Login.xaml index f90f512..73b017d 100644 --- a/BodyshopUploader/Views/Login.xaml +++ b/BodyshopUploader/Views/Login.xaml @@ -7,8 +7,8 @@ xmlns:vm="clr-namespace:BodyshopUploader.ViewModels" mc:Ignorable="d" Title="{x:Static p:Resources.Title_Login}" - Height="450" - Width="800" + Height="169.084" + Width="389.618" xmlns:p="clr-namespace:BodyshopUploader.Properties" xmlns:util="clr-namespace:BodyshopUploader.Utils" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" @@ -35,6 +35,7 @@ VerticalAlignment="Center" /> @@ -45,10 +46,11 @@ KeyDown="PasswordBox_KeyDown" PasswordChanged="PasswordBox_PasswordChanged" Width="300" + materialDesign:TextFieldAssist.HasClearButton="True" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" /> - + diff --git a/BodyshopUploader/Views/Main.xaml b/BodyshopUploader/Views/Main.xaml index 5b431c2..15dcfd5 100644 --- a/BodyshopUploader/Views/Main.xaml +++ b/BodyshopUploader/Views/Main.xaml @@ -10,12 +10,26 @@ xmlns:vm="clr-namespace:BodyshopUploader.ViewModels" Width="800" xmlns:tb="http://www.hardcodet.net/taskbar" - xmlns:p="clr-namespace:BodyshopUploader.Properties"> + xmlns:p="clr-namespace:BodyshopUploader.Properties" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + TextElement.Foreground="{DynamicResource MaterialDesignBody}" + TextElement.FontWeight="Regular" + TextElement.FontSize="13" + TextOptions.TextFormattingMode="Ideal" + TextOptions.TextRenderingMode="Auto" + Background="{DynamicResource MaterialDesignPaper}" + FontFamily="{DynamicResource MaterialDesignFont}" + Loaded="Window_Loaded" + xmlns:util="clr-namespace:BodyshopUploader.Utils"> + + + @@ -37,10 +51,45 @@ - - Main Window - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BodyshopUploader/Views/Main.xaml.cs b/BodyshopUploader/Views/Main.xaml.cs index 2f55e55..b07ac79 100644 --- a/BodyshopUploader/Views/Main.xaml.cs +++ b/BodyshopUploader/Views/Main.xaml.cs @@ -25,6 +25,9 @@ namespace BodyshopUploader.Views } - + private void Window_Loaded(object sender, RoutedEventArgs e) + { + Application.Current.MainWindow = this; + } } } diff --git a/BodyshopUploader/packages.config b/BodyshopUploader/packages.config index b618089..e5b3837 100644 --- a/BodyshopUploader/packages.config +++ b/BodyshopUploader/packages.config @@ -6,20 +6,22 @@ - - + + - + + + - + - + @@ -31,30 +33,33 @@ - - + + + + - - + + + - + - + - + - + \ No newline at end of file