예제 #1
0
        public void StartFolderMonitor()
        {
            var sourcePath = Configuration.ConfigurationManager.GetConfigurationPaths().BaseSourcePath;

            Logger.Info(CultureInfo.CurrentCulture, "Starts folder monitoring at path: {0}", sourcePath);
            TaskWatcher.WatchTask(_folderMonitor.StartMonitoringAsync(sourcePath));
        }
 public EmployeesAdministrationPageViewModel()
 {
     ReturnToMainMenuCommand = new DelegateCommand(o => ReturnToMainMenu());
     Service          = new EmployeeService();
     GetEmployeesTask = new TaskWatcher <ObservableCollection <Employee> >(Service.GetAllEmployees());
     GetEmployeesTask.Task.GetAwaiter().OnCompleted(() => PopulateBindingData());
 }
예제 #3
0
 public ClientsPageViewModel()
 {
     ReturnToMainMenuCommand = new DelegateCommand(o => ReturnToMainMenu());
     Service        = new ClientService();
     GetClientsTask = new TaskWatcher <ObservableCollection <Client> >(Service.GetAllClients());
     GetClientsTask.Task.GetAwaiter().OnCompleted(() => PopulateBindingData());
 }
예제 #4
0
 public WorkspacePageViewModel()
 {
     ReturnToMainMenuCommand = new DelegateCommand(o => ReturnToMainMenu());
     Service           = new WorkspaceService();
     GetWorkspacesTask = new TaskWatcher <ObservableCollection <Workspace> >(Service.GetAllWorkspaces());
     GetWorkspacesTask.Task.GetAwaiter().OnCompleted(() => PopulateBindingData());
 }
예제 #5
0
        public object GetVerifiableParameters()
        {
            ExportedQuestTask exportedQuestTask = new ExportedQuestTask();

            exportedQuestTask.zone       = Zone.ZoneName;
            exportedQuestTask.threshold  = Threshold;
            exportedQuestTask.comparison = (int)Comparison;
            exportedQuestTask.watchers   = new List <ExportedTaskWatcher>();
            for (int i = 0; i < Watchers.Length; i++)
            {
                TaskWatcher         taskWatcher         = Watchers[i];
                ExportedTaskWatcher exportedTaskWatcher = new ExportedTaskWatcher();
                if (!string.IsNullOrEmpty(taskWatcher.CriteriaSwitchName))
                {
                    GameObject gameObject = GameObject.Find(taskWatcher.CriteriaSwitchName);
                    if (gameObject == null)
                    {
                        Disney.LaunchPadFramework.Log.LogError(this, "Unable to find switch criteria object " + taskWatcher.CriteriaSwitchName + ". Will not be exported");
                        continue;
                    }
                    Switch component = gameObject.GetComponent <Switch>();
                    exportedTaskWatcher.criteriaSwitch = ExportedSwitch.Create(component);
                }
                exportedTaskWatcher.type       = taskWatcher.GetWatcherType();
                exportedTaskWatcher.parameters = taskWatcher.GetExportParameters();
                exportedQuestTask.watchers.Add(exportedTaskWatcher);
            }
            return(exportedQuestTask);
        }
예제 #6
0
 public BaseViewModel()
 {
     _sharedService           = AppFactory.GetInstance <ISharedService>();
     Logger                   = AppFactory.GetInstance <ILogger>();
     Watcher                  = new TaskWatcher();
     Watcher.PropertyChanged += Watcher_PropertyChanged;
 }
        public override void LoadAsyncData()
        {
            GetCryptoListTask = new TaskWatcher <List <string> >(_compareService.GetAvailableCrypto());
            GetCryptoListTask.PropertyChanged += CoinListLoaded;

            FilterDictionary = new Dictionary <string, CryptoRequestParameters>();
            FilterStrings    = new ObservableCollection <string>();
        }
예제 #8
0
        public void GetCTScan(string patientId, ICTScanRetrievedCallback callback)
        {
            ScriptExecutor scriptExecutor = new ScriptExecutor();

            TaskWatcher.WatchTask(scriptExecutor.Execute(patientId, new List <ICTScanRetrievedCallback> {
                callback, _dataFlowSynchronizer
            }));
        }
예제 #9
0
 public void OnPipelineStarted(object sender, PipelineStartedArgs args)
 {
     TaskWatcher.AddTask(Task.Run(() =>
     {
         _createdFolderStructures.Enqueue(args.PermStorageFolderStructure);
         SynchronizeDataFlows();
     }));
 }
 public async Task <PermStorageFolderStructure> CreateFolderStructure()
 {
     return(await Task.Run(async() =>
     {
         var structure = await _folderCreator.CreateFolderStructureForProjectionsAsync();
         TaskWatcher.AddTask(_folderCreator.CreateFoldersAsync(structure));
         return structure;
     }));
 }
예제 #11
0
        public override void LoadAsyncData()
        {
            if (SelectedCoinString == null)
            {
                return;
            }
            GetCryptoTask = new TaskWatcher <AdvancedCryptoModel>(_cryptoCompareService.GetCrypto(SelectedCoinString));

            GetCryptoTask.PropertyChanged += GetCryptoCommand_PropertyChanged;
        }
예제 #12
0
        public void CorrectCTScan(Application app, string patientId, string cbctId,
                                  ICorrectedCTScanRetrievedCallback callback)
        {
            ScriptExecutor scriptExecutor = new ScriptExecutor();

            TaskWatcher.WatchTask(scriptExecutor.Execute(app, patientId, cbctId,
                                                         new List <ICorrectedCTScanRetrievedCallback> {
                callback, _dataFlowSynchronizer
            }));
        }
예제 #13
0
 protected override void ConfirmAction()
 {
     ActionWatcher = new TaskWatcher <SingleResponse <ServiceDiscountActionsResponse> >(ServicePlaceHolder.InsertOrEditService(service));
     ActionWatcher.Task.GetAwaiter().OnCompleted(() => {
         var success = ActionWatcher.Result;
         var originalServicesList = ViewModelFactory <ServiceAdministrationPageViewModel> .GetView("ServiceAdministratorPage").Services;
         if (ActionWatcher.Result.Success == 1)
         {
             if (IsEdit)
             {
                 var serviceToUpdate = originalServicesList.FirstOrDefault(c => c.ServiceId == service.ServiceId);
                 if (serviceToUpdate != null)
                 {
                     serviceToUpdate.ServiceName  = ServiceName;
                     serviceToUpdate.ServicePrice = ServicePrice;
                     serviceToUpdate.Active       = ServiceActive;
                     if (ServiceDiscount > 0)
                     {
                         if (serviceToUpdate.ServiceDiscount == null)
                         {
                             serviceToUpdate.ServiceDiscount = new ServiceDiscounts();
                         }
                         if (serviceToUpdate.ServiceDiscount.ServiceDiscountId == 0)
                         {
                             serviceToUpdate.ServiceDiscount.ServiceDiscountId = ActionWatcher.Result.Data.ServiceDiscountId;
                         }
                         serviceToUpdate.ServiceDiscount.ServiceDiscount = ServiceDiscount;
                         serviceToUpdate.ServiceDiscount.StartDate       = StartDiscountDate;
                         serviceToUpdate.ServiceDiscount.EndDate         = EndDiscountDate;
                         serviceToUpdate.ServiceDiscount.Active          = ServiceDiscountActive;
                     }
                 }
                 else
                 {
                     ConsoleManager.Show();
                     Console.WriteLine("Ooppss! Error al actualizar cliente");
                 }
             }
             else
             {
                 service.ServiceId = ActionWatcher.Result.Data.ServiceId;
                 service.ServiceDiscount.ServiceDiscountId = ActionWatcher.Result.Data.ServiceDiscountId;
                 ViewModelFactory <ServiceAdministrationPageViewModel> .GetView("ServiceAdministratorPage").Services.Add(service);
             }
             ViewModelFactory <ServiceAdministrationPageViewModel> .GetView("ServiceAdministratorPage").CurrentAction = new ServicesListViewModel(originalServicesList);
         }
         else
         {
             ConsoleManager.Show();
             Console.WriteLine("Ooppss! Error en edicion/adicion de cliente");
         }
         ViewModelFactory <ServiceAdministrationPageViewModel> .GetView("ServiceAdministratorPage").CurrentAction = new ServicesListViewModel(originalServicesList);
     });
 }
예제 #14
0
        public async override void LoadAsyncData()
        {
            LoadCryptoTask = new TaskWatcher <List <CryptoDataModel> >(_trackerPriceService.GetTrackedCrypto());

            LoadCryptoTask.PropertyChanged += LoadCryptoCompleted;

            if (LoadCryptoTask.IsCompleted)
            {
                LoadCryptoTask.RaisePropertyChanged(this, "Result");
            }
        }
예제 #15
0
 public Task CreateFoldersAsync(PermStorageFolderStructure structure)
 {
     if (structure == null)
     {
         throw new ArgumentNullException(nameof(structure));
     }
     return(Task.Run(async() =>
     {
         Logger.Info("Creates target folders.");
         await _fileUtil.CreateFolderAsync(structure.BasePath);
         TaskWatcher.AddTask(_fileUtil.CreateFolderAsync(structure.XimPath));
         TaskWatcher.AddTask(_fileUtil.CreateFolderAsync(structure.MhaPath));
         TaskWatcher.AddTask(_fileUtil.CreateFolderAsync(structure.CtPath));
     }));
 }
예제 #16
0
        public Task StartNewFileMonitorInNewFolderAsync(string path, string folderName)
        {
            return(Task.Run(async() =>
            {
                var folderStructure = await _projectionFolderCreator.CreateFolderStructure();

                var newFileMonitor = await Task.Run(() => _monitorFactory.CreateFileMonitor());
                var processor = StartPipeline(newFileMonitor, folderStructure);

                TaskWatcher.AddTask(Task.Run(() => PipelineStarted?.Invoke(this, new PipelineStartedArgs(folderStructure, processor))));

                Logger.Info(CultureInfo.CurrentCulture, "Starts file monitoring at path: {0}", path);
                TaskWatcher.AddTask(newFileMonitor.StartMonitoringAsync(path));
            }));
        }
예제 #17
0
        public bool StartMonitoring()
        {
            if (TaskWatcher.HasSubscriber())
            {
                var subfolderController = CreateFileController();
                subfolderController.PipelineStarted += _dataFlowSynchronizer.OnPipelineStarted;
                subfolderController.PipelineStarted += OnPipelineStarted;
                var baseFolderController = CreateBaseFolderController(subfolderController);

                baseFolderController.StartFolderMonitor();
                return(true);
            }

            Logger.Fatal("No errorhandler is subscribed.");
            return(false);
        }
예제 #18
0
        public void WatchTask_ThrowsExceptionOnFatalError_ExceptionIsCatched()
        {
            //Arrange:
            var fakeErrorHandler = Substitute.For <IErrorHandler>();

            TaskWatcher.AddErrorListener(fakeErrorHandler);

            //Act:
            Task t           = new Task(() => throw new Exception("Test"));
            Task watcherTask = TaskWatcher.WatchTask(t);

            t.Start();
            Task.WaitAll(watcherTask);

            //Assert:
            fakeErrorHandler.Received(1).OnFatalError(Arg.Any <string>());
        }
예제 #19
0
        private IReconstructionProcessor StartPipeline(IFileMonitor fileMonitor, PermStorageFolderStructure folderStructure)
        {
            BlockingCollection <TempProjectionInfo> queue1 = new BlockingCollection <TempProjectionInfo>();
            BlockingCollection <PermProjectionInfo> queue2 = new BlockingCollection <PermProjectionInfo>();

            var eventHandler = _projectionPipelineFactory.CreateFileMonitorListener(folderStructure, queue1);

            fileMonitor.Created  += eventHandler.OnNewFileDetected;
            fileMonitor.Finished += eventHandler.OnMonitorFinished;

            var copier = _projectionPipelineFactory.CreateProjectionCopier(queue1, queue2, folderStructure);

            TaskWatcher.AddTask(copier.StartCopyingFiles());

            var reconstructionProcessor = _projectionPipelineFactory.CreateReconstructionProcessor(queue2, folderStructure);

            TaskWatcher.AddTask(reconstructionProcessor.StartConsumingProjections());
            return(reconstructionProcessor);
        }
예제 #20
0
 private void PerformReconstruction(List <PermProjectionInfo> infos)
 {
     TaskWatcher.AddTask(Task.Run(() =>
     {
         lock (_lock)
         {
             try
             {
                 _rtkWrapper.PerformReconstruction(infos[0].FilePath, infos[1].FilePath,
                                                   infos[2].FilePath, _targetPath);
             }
             catch (Exception e)
             {
                 Logger.Fatal(e);
                 throw;
             }
         }
     }));
 }
예제 #21
0
    private ExportedTaskWatcher exportTaskWatcher(TaskWatcher watcherDef)
    {
        ExportedTaskWatcher exportedTaskWatcher = new ExportedTaskWatcher();

        if (!string.IsNullOrEmpty(watcherDef.CriteriaSwitchName))
        {
            GameObject gameObject = GameObject.Find(watcherDef.CriteriaSwitchName);
            if (gameObject == null)
            {
                Log.LogError(this, "Unable to find switch criteria object " + watcherDef.CriteriaSwitchName + " for WatcherSwitch " + base.name + ". Will not be exported");
                return(null);
            }
            Switch component = gameObject.GetComponent <Switch>();
            exportedTaskWatcher.criteriaSwitch = ExportedSwitch.Create(component);
        }
        exportedTaskWatcher.type       = watcherDef.GetWatcherType();
        exportedTaskWatcher.parameters = watcherDef.GetExportParameters();
        return(exportedTaskWatcher);
    }
 protected override void DeleteAction()
 {
     ActionWatcher = new TaskWatcher <SingleResponse <int> >(ServicePlaceHolder.DeleteEmployee(employee));
     ActionWatcher.Task.GetAwaiter().OnCompleted(() => {
         var success = ActionWatcher.Result;
         var originalEmployeesList = ViewModelFactory <EmployeesAdministrationPageViewModel> .GetView("EmployeesAdministrationPage").Employees;
         if (ActionWatcher.Result.Success == 1)
         {
             var employeeToRemove = ViewModelFactory <EmployeesAdministrationPageViewModel> .GetView("EmployeesAdministrationPage").Employees.FirstOrDefault(c => c.EmployeeId == employee.EmployeeId);
             originalEmployeesList.Remove(employeeToRemove);
         }
         else
         {
             ConsoleManager.Show();
             Console.WriteLine("Ooppss! Error al eliminar cliente");
         }
         ViewModelFactory <EmployeesAdministrationPageViewModel> .GetView("EmployeesAdministrationPage").CurrentAction = new EmployeesListViewModel(originalEmployeesList);
     });
 }
 protected override void ConfirmAction()
 {
     ActionWatcher = new TaskWatcher <SingleResponse <int> >(ServicePlaceHolder.InsertOrEditClient(client));
     ActionWatcher.Task.GetAwaiter().OnCompleted(() => {
         var success             = ActionWatcher.Result;
         var originalClientsList = ViewModelFactory <ClientsPageViewModel> .GetView("ClientsPage").Clients;
         if (ActionWatcher.Result.Success == 1)
         {
             if (IsEdit)
             {
                 var clientToUpdate = originalClientsList.FirstOrDefault(c => c.ClientId == client.ClientId);
                 if (clientToUpdate != null)
                 {
                     clientToUpdate.ClientName      = ClientName;
                     clientToUpdate.ClientAddress   = ClientAddress;
                     clientToUpdate.ClientCellPhone = ClientCellPhone;
                     clientToUpdate.ClientPhone     = ClientPhone;
                     clientToUpdate.ClientEmail     = ClientEmail;
                 }
                 else
                 {
                     ConsoleManager.Show();
                     Console.WriteLine("Ooppss! Error al actualizar cliente");
                 }
             }
             else
             {
                 client.ClientId = ActionWatcher.Result.Data;
                 ViewModelFactory <ClientsPageViewModel> .GetView("ClientsPage").Clients.Add(client);
             }
             ViewModelFactory <ClientsPageViewModel> .GetView("ClientsPage").CurrentAction = new ClientsListViewModel(originalClientsList);
         }
         else
         {
             ConsoleManager.Show();
             Console.WriteLine("Ooppss! Error en edicion/adicion de cliente");
         }
         ViewModelFactory <ClientsPageViewModel> .GetView("ClientsPage").CurrentAction = new ClientsListViewModel(originalClientsList);
     });
 }
 protected override void ConfirmAction()
 {
     ActionWatcher = new TaskWatcher <SingleResponse <int> >(ServicePlaceHolder.InsertOrEditEmployee(employee));
     ActionWatcher.Task.GetAwaiter().OnCompleted(() => {
         var success = ActionWatcher.Result;
         var originalEmployeesList = ViewModelFactory <EmployeesAdministrationPageViewModel> .GetView("EmployeesAdministrationPage").Employees;
         if (ActionWatcher.Result.Success == 1)
         {
             if (IsEdit)
             {
                 var employeeToUpdate = originalEmployeesList.FirstOrDefault(c => c.EmployeeId == employee.EmployeeId);
                 if (employeeToUpdate != null)
                 {
                     employeeToUpdate.EmployeeName      = EmployeeName;
                     employeeToUpdate.EmployeeAddress   = EmployeeAddress;
                     employeeToUpdate.EmployeeCellPhone = EmployeeCellPhone;
                     employeeToUpdate.EmployeeHomePhone = EmployeePhone;
                 }
                 else
                 {
                     ConsoleManager.Show();
                     Console.WriteLine("Ooppss! Error al actualizar cliente");
                 }
             }
             else
             {
                 employee.EmployeeId = ActionWatcher.Result.Data;
                 ViewModelFactory <EmployeesAdministrationPageViewModel> .GetView("EmployeesAdministrationPage").Employees.Add(employee);
             }
             ViewModelFactory <EmployeesAdministrationPageViewModel> .GetView("EmployeesAdministrationPage").CurrentAction = new EmployeesListViewModel(originalEmployeesList);
         }
         else
         {
             ConsoleManager.Show();
             Console.WriteLine("Ooppss! Error en edicion/adicion de cliente");
         }
         ViewModelFactory <EmployeesAdministrationPageViewModel> .GetView("EmployeesAdministrationPage").CurrentAction = new EmployeesListViewModel(originalEmployeesList);
     });
 }
예제 #25
0
        public Task Execute(Application app, string patientId, string id, List <ICorrectedCTScanRetrievedCallback> callbacks)
        {
            return(Task.Run(async() =>
            {
                var patient = await GetPatient(app, patientId);
                var planSetup = GetPlanSetup(patient);
                var ctId = Guid.NewGuid().ToString();
                var cmdFilePath = CreateCmdFilePath(ctId);

                await _dicomMoveScriptGenerator.GenerateDicomMoveScript(patient, planSetup, cmdFilePath);

                await ExecuteCmdFile(cmdFilePath);
                var ctInfo = await CreateCtScanInfoFromFiles(ctId);

                CTAnonymizer.AnonymizeCT(ctInfo);

                foreach (var callback in callbacks)
                {
                    TaskWatcher.AddTask(Task.Run(() => callback.OnCorrectedCTScanRetrieved(ctInfo, id)));
                }
            }));
        }
 protected override void ConfirmAction()
 {
     ActionWatcher = new TaskWatcher <SingleResponse <int> >(ServicePlaceHolder.InsertOrEditWorkspace(workspace));
     ActionWatcher.Task.GetAwaiter().OnCompleted(() => {
         var success = ActionWatcher.Result;
         var originalWorkspacesList = ViewModelFactory <WorkspacePageViewModel> .GetView("WorkspacePage").Workspaces;
         if (ActionWatcher.Result.Success == 1)
         {
             if (IsEdit)
             {
                 var workspaceToUpdate = originalWorkspacesList.FirstOrDefault(c => c.WorkspaceId == workspace.WorkspaceId);
                 if (workspaceToUpdate != null)
                 {
                     workspaceToUpdate.WorkspaceName = WorkspaceName;
                 }
                 else
                 {
                     ConsoleManager.Show();
                     Console.WriteLine("Ooppss! Error al actualizar cliente");
                 }
             }
             else
             {
                 workspace.WorkspaceId = ActionWatcher.Result.Data;
                 ViewModelFactory <WorkspacePageViewModel> .GetView("WorkspacePage").Workspaces.Add(workspace);
             }
             ViewModelFactory <WorkspacePageViewModel> .GetView("WorkspacePage").CurrentAction = new WorkspacesListViewModel(originalWorkspacesList);
         }
         else
         {
             ConsoleManager.Show();
             Console.WriteLine("Ooppss! Error en edicion/adicion de cliente");
         }
         ViewModelFactory <WorkspacePageViewModel> .GetView("WorkspacePage").CurrentAction = new WorkspacesListViewModel(originalWorkspacesList);
     });
 }
예제 #27
0
 public override void LoadAsyncData()
 {
     AllCoinsTask = new TaskWatcher <List <BasicCryptoModel> >(_coinMarketCapService.GetAllCoins());
     AllCoinsTask.PropertyChanged += AllCoinsTask_PropertyChanged;
 }
예제 #28
0
        public Task CancelTasks(IProgress <Dictionary <ProgressType, string> > progress, TaskWatcher taskWatch, CancellationToken cancelToken)
        {
            Errors = new Dictionary <string, string>();
            return(Task.Run(() =>
            {
                try
                {
                    taskWatch.Running = true;

                    var progressCancelTaskDictionary = new Dictionary <ProgressType, string>();
                    progressCancelTaskDictionary[ProgressType.Output] = MessageStrings.GatheringTasks;
                    progress.Report(progressCancelTaskDictionary);

                    var runningTasks = sessionOctopusSettings.OctRepository.Tasks.GetAllActive();
                    foreach (var runningTask in runningTasks)
                    {
                        var cancelationMessage = string.Empty;
                        if (runningTask.Name == ResourceStrings.DeployTaskName)
                        {
                            var deployment = DeploymentHelper.GetDeploymentFromTask(sessionOctopusSettings.OctRepository, runningTask);
                            var project = ProjectHelper.GetProjectById(sessionOctopusSettings.OctRepository, deployment.ProjectId);

                            cancelationMessage = string.Format(MessageStrings.CancelTaskProject, runningTask.Id, project.Name);
                        }
                        else
                        {
                            cancelationMessage = string.Format(MessageStrings.CancelTaskOther, runningTask.Id, runningTask.Description);
                        }
                        if (cancelToken.IsCancellationRequested)
                        {
                            break;
                        }
                        if (!sessionCancelSettings.AutoApprove)
                        {
                            progressCancelTaskDictionary = new Dictionary <ProgressType, string>();
                            progressCancelTaskDictionary[ProgressType.Output] = cancelationMessage;
                            progressCancelTaskDictionary[ProgressType.Warning] = MessageStrings.ValidateCancelTask;
                            progress.Report(progressCancelTaskDictionary);
                            var consoleKey = Console.ReadKey(true);
                            while (consoleKey.Key != ConsoleKey.Y && consoleKey.Key != ConsoleKey.N && (consoleKey.Key != ConsoleKey.C && consoleKey.Modifiers != ConsoleModifiers.Control))
                            {
                                var progressInvalidKeyTaskDictionary = new Dictionary <ProgressType, string>();
                                progressInvalidKeyTaskDictionary[ProgressType.Warning] = MessageStrings.ValidateCancelTask;
                                progress.Report(progressInvalidKeyTaskDictionary);
                                consoleKey = Console.ReadKey(true);
                            }
                            if (consoleKey.Key == ConsoleKey.Y)
                            {
                                sessionOctopusSettings.OctRepository.Tasks.Cancel(runningTask);
                                var progressCancelTaskCancelDictionary = new Dictionary <ProgressType, string>();
                                progressCancelTaskCancelDictionary[ProgressType.Output] = MessageStrings.CancellingTask;
                                progress.Report(progressCancelTaskCancelDictionary);
                            }
                            else if (consoleKey.Key == ConsoleKey.N)
                            {
                                var progressCancelTaskSkipDictionary = new Dictionary <ProgressType, string>();
                                progressCancelTaskSkipDictionary[ProgressType.Output] = MessageStrings.SkippingTask;
                                progress.Report(progressCancelTaskSkipDictionary);
                            }
                            else if (consoleKey.Key == ConsoleKey.C && consoleKey.Modifiers == ConsoleModifiers.Control)
                            {
                                if (cancelToken.IsCancellationRequested)
                                {
                                    break;
                                }
                            }
                            if (cancelToken.IsCancellationRequested)
                            {
                                break;
                            }
                        }
                        else
                        {
                            progressCancelTaskDictionary = new Dictionary <ProgressType, string>();
                            progressCancelTaskDictionary[ProgressType.Output] = cancelationMessage;
                            progress.Report(progressCancelTaskDictionary);
                            sessionOctopusSettings.OctRepository.Tasks.Cancel(runningTask);
                            if (cancelToken.IsCancellationRequested)
                            {
                                break;
                            }
                        }
                    }
                    var progressCompleteDictionary = new Dictionary <ProgressType, string>();
                    if (cancelToken.IsCancellationRequested)
                    {
                        progressCompleteDictionary[ProgressType.Output] = MessageStrings.ProgressCancelled;
                        progress.Report(progressCompleteDictionary);
                        taskWatch.Running = false;
                    }
                    else
                    {
                        progressCompleteDictionary[ProgressType.Output] = MessageStrings.ProgressComplete;
                        progress.Report(progressCompleteDictionary);
                        taskWatch.Running = false;
                    }
                }
                catch (Exception ex)
                {
                    var progressCriticalErrorDictionary = new Dictionary <ProgressType, string>();
                    progressCriticalErrorDictionary[ProgressType.Error] = string.Format(MessageStrings.ErrorFormattingText, ex.Message);
                    progressCriticalErrorDictionary[ProgressType.Output] = MessageStrings.ProgressFailed;
                    progress.Report(progressCriticalErrorDictionary);
                    taskWatch.Running = false;
                }
            }, cancelToken));
        }
예제 #29
0
 public void UnsubscribeErrorHandler(IErrorHandler errorHandler)
 {
     TaskWatcher.RemoveErrorListener(errorHandler);
 }
예제 #30
0
 private void HandleNewFolder(object sender, SearchDirectoryArgs args)
 {
     Logger.Info(CultureInfo.CurrentCulture, "New folder detected: {0}", args.FileName);
     TaskWatcher.AddTask(_subfolderController.StartNewFileMonitorInNewFolderAsync(args.Path, args.FileName));
 }