79 lines
2.6 KiB
C#
79 lines
2.6 KiB
C#
using GraphQL.Client;
|
|
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
|
|
{
|
|
public partial class MainViewModel : BaseViewModel
|
|
{
|
|
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
|
|
|
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()
|
|
{
|
|
if (MonitoringPaths == null) MonitoringPaths = new ObservableCollection<string>();
|
|
MonitoringPaths.Add(@"C:\IMEX");
|
|
Properties.Settings.Default.MonitoringPaths = MonitoringPaths;
|
|
Properties.Settings.Default.Save();
|
|
|
|
//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);
|
|
//}
|
|
}
|
|
}
|
|
}
|