public async void BrowseLogFilesAndProcess() { var dialog = new CommonOpenFileDialog { IsFolderPicker = true }; if (dialog.ShowDialog() != CommonFileDialogResult.Ok) { return; } StopOtherWork(); LoadingPanel.ShowBrowseLogFilesAndProcessMessage(_currenTokenSource, dialog.FileName); var options = new ProcessingOptions { Directory = dialog.FileName, Parcer = ParcingEngine, LogFileName = Settings.LogFileName, CancellationToken = _currenTokenSource.Token, SearchOption = (Settings.SearchAllDirs) ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly, Config = LogParcerConfig.CurrentConfig }; _analizedData = await Task.Run(() => LogicUtilities.LoadFromDir(options)); var infVM = await GetViewModelCollection(); LoadingPanel.HideBrowseLogFilesAndProcessMessage(); LogItems.Clear(); LogItems.AddRange(infVM); infVM.Clear(); }
public async void LoadViewModel() { var ofd = new OpenFileDialog(); if (!(ofd.ShowDialog() ?? false)) { return; } StopOtherWork(); LoadingPanel.ShowLoadMessage(_currenTokenSource, ofd.FileName); _analizedData = await Task.Run(() => LogicUtilities.LoadList(ofd.FileName), _currenTokenSource.Token); await RefreshListViewItems(); LoadingPanel.HideMessage(); }
public async void ExportToExcel() { var saveDialog = new SaveFileDialog { FileName = "report.xlsx", DefaultExt = "xlsx", Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*" }; if (!(saveDialog.ShowDialog() ?? false)) { return; } StopOtherWork(); LoadingPanel.ShowExcelConvertMessage(_currenTokenSource); await Task.Run( () => LogicUtilities.ExportViewModelToExcel(LogItems.ToList().ConvertAll(i => i.Item), saveDialog.FileName), _currenTokenSource.Token); LoadingPanel.HideExcelConvertMessage(() => Process.Start(saveDialog.FileName)); }
public async void ConvertToExcel() { var dialog = new CommonOpenFileDialog { IsFolderPicker = true }; if (dialog.ShowDialog() != CommonFileDialogResult.Ok) { return; } var saveDialog = new SaveFileDialog { FileName = "report.xlsx", DefaultExt = "xlsx", Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*" }; if (!(saveDialog.ShowDialog() ?? false)) { return; } StopOtherWork(); LoadingPanel.ShowExcelConvertMessage(_currenTokenSource); var options = new ProcessingOptions { Directory = dialog.FileName, OutFile = saveDialog.FileName, Parcer = ParcingEngine, LogFileName = Settings.LogFileName, CancellationToken = _currenTokenSource.Token, SearchOption = (Settings.SearchAllDirs) ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly, Config = LogParcerConfig.CurrentConfig }; if (Settings.UseMinExecTimeInExcell) { options.MinExecutionTime = Settings.MinExecutionTimeDecimal; } await Task.Factory.StartNew(() => LogicUtilities.DoConvertOperation(options), TaskCreationOptions.LongRunning); LoadingPanel.HideExcelConvertMessage(() => Process.Start(options.OutFile)); lock (this) { _isInProcess = false; } _currenTokenSource = null; }