/// <summary> /// Called when click [import data execute]. /// </summary> /// <param name="pars">The pars.</param> private void OnImportDataExecute(object pars) { var dataImport = _directoryComputerImporter.DirectoryComputerCollections.Where(c => c.Id == 0).ToList(); if (dataImport.Count > 0) { var result = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <ImportFolderComputerResponse>( sc.ImportFolderComputer, dataImport)); if (result == null) { DialogHelper.Alert("Can not receive status data"); return; } DialogHelper.Alert(result.Message); if (_folderId.HasValue) { MakeTree(_folderId.Value, !string.IsNullOrWhiteSpace(ApplicationContext.SearchText), ApplicationContext.SearchText); } _directoryComputerImporter = null; FilePath = string.Empty; _view.Close(); } else { DialogHelper.Alert("There is no data to insert."); } }
private void OnExecuteImport_Dowork(object sender, DoWorkEventArgs e) { try { _view.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, (Action)(() => { ApplicationContext.IsBusy = true; CommandManager.InvalidateRequerySuggested(); var dataImport = _directoryComputerImporter.DirectoryComputerCollections.Where(c => c.Id == 0).ToList(); if (dataImport.Count > 0) { var result = ServiceManager.Invoke(sc => RequestResponseUtils.GetData <ImportFolderComputerResponse>( sc.ImportFolderComputer, dataImport)); if (result == null) { DialogHelper.Alert("Can not receive status data"); return; } _directoryComputerImporter = null; FilePath = string.Empty; } else { DialogHelper.Alert("There is no data to insert."); } })); } catch (Exception) { ApplicationContext.IsBusy = false; } }
/// <summary> /// Shows the unhandeled exception. /// </summary> /// <param name="e">The <see cref="DispatcherUnhandledExceptionEventArgs"/> instance containing the event data.</param> void ShowUnhandeledException(DispatcherUnhandledExceptionEventArgs e) { e.Handled = true; DialogHelper.Alert("Have an exception on GUI, please view log for details."); }