Issue with double clicking tray icon. Added list management.

This commit is contained in:
Patrick Fic
2020-01-17 00:41:41 -08:00
parent 32aec8e4ff
commit 2b3d9ac76b
15 changed files with 292 additions and 69 deletions

View File

@@ -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;

View File

@@ -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;
}
}
}
}

View File

@@ -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<string>();
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<string>();
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);
//}
}
}
}

View File

@@ -15,5 +15,12 @@ namespace BodyshopUploader.ViewModels
get { return _progress; }
set { SetProperty(ref _progress, value); }
}
private ObservableCollection<string> _monitoringPaths = Properties.Settings.Default.MonitoringPaths ;
public ObservableCollection<string> MonitoringPaths
{
get { return _monitoringPaths; }
set { SetProperty(ref _monitoringPaths, value); }
}
}
}