public void OnEventAcquired(object sender, ParserEventArgs args) { try { //Update property window anyway PropertyGridViewModel.Clear(); DataViewModel?.Clear(); if (args == null) { throw new NullReferenceException("Invalid arguments passed"); } PropertyGridViewModel.AddData(args.TreeNode?.Properties); var argsType = args.ArgsType; if ((argsType & MessageType.ProcessAll) != 0) { DataViewModel = MarkupManager.Resolve(args.TreeNode?.Markup) ?? new DataGridViewModel(); DataViewModel.ProcessNodeData(args.TreeNode); } DataViewModel?.Refresh(); PropertyGridViewModel.Refresh(); } catch (Exception ex) { MessageBoxInstance.Raise(ex.Message); } }
private void StartExportCommandHandler() { try { if (string.IsNullOrEmpty(ExportPath) || CurrentExporter == null || !ExportNodes.Any()) { throw new NullReferenceException("Bad Export path // no export nodes // no exporter chosen"); } exportTask = Task.Run(() => { var dataList = new List <DataTuple>(); foreach (var node in ExportNodes) { dataList.AddRange(GatherExportList(node)); } ExportProcess(dataList); }); } catch (Exception ex) { MessageBoxInstance.Raise(ex.Message); PLogger.Log(ex.Message); } }
private void ExportCommandHandler() { var exportNodes = TreeViewModel.GatherExportNodes().ToList(); if (exportNodes.Count == 0) { MessageBoxInstance?.Raise("There are no export nodes!"); return; } ExportViewModel.ExportNodes = exportNodes; ExportViewModel.ToggleModalWindow(); }
private void OpenCommandHandler() { try { var path = FileDialogInstance.Raise(); var rootStorage = PluginManager?.FetchPlugins(path); if (rootStorage == null) { PLogger.Log("Storage Ptr is Zero..."); return; } Utilities.RunDispatcherTask(() => { TreeViewModel.AddElementBack(Utilities.FormNodeFromStorage(rootStorage)); }); } catch (Exception ex) { MessageBoxInstance.Raise(ex.Message); } }
private void ExportProcess(List <DataTuple> data) { try { ProgressBarMaximum = data.Count; CurrentExporter.ExportPath = ExportPath; CurrentExporter.Init("OutData"); IsStartButtonEnabled = false; IsStopButtonEnabled = true; IsPauseButtonEnabled = true; for (var index = 0; index < data.Count; ++index) { //check if we need to pause WaitHandle.WaitAny(new WaitHandle[] { pauseEvent, cancelEvent }); if (cancelationRequested) { PLogger.Log("Export cancellation requested"); cancelationRequested = false; ProgressBarValue = 0; return; } CurrentExporter.Export(data[index]); ProgressBarValue = index; } IsStartButtonEnabled = true; IsStopButtonEnabled = false; IsPauseButtonEnabled = false; ProgressBarValue = 0; } catch (Exception ex) { MessageBoxInstance.Raise(ex.Message); PLogger.Log(ex.Message); } }