public SettingsViewModel(IDialogCoordinator coordinator) { _dialogCoordinator = coordinator; DatabaseImport = new RelayCommand(x => { var dlg = new OpenFileDialog { Filter = "Zip filer (.zip)|*.zip" }; dlg.FileOk += ValidateDatabaseFile; var result = dlg.ShowDialog(); if (result == true) { ApplicationDatabase.Import(dlg.FileName); DisplayTimedMessage("Succes", "Databasen er importeret succesfuldt. ", 2); } DatabaseExport.NotifyCanExecuteChanged(); }); DatabaseExport = new RelayCommand(x => { var dlg = new SaveFileDialog { Filter = "Zip filer (.zip)|*.zip", FileName = "database", DefaultExt = ".zip" }; var result = dlg.ShowDialog(); if (result != true) { return; } ApplicationDatabase.Export(dlg.FileName); DisplayTimedMessage("Succes", "Databasen er eksporteret succesfuldt. ", 2); }, x => ApplicationDatabase.Exists); RunOfferSettingsDialogCmd = new RelayCommand(x => { OpenOfferSettingsDialog(instanceCanceled => { _dialogCoordinator.HideMetroDialogAsync(this, _customDialog); }, async instanceCompleted => { await _dialogCoordinator.HideMetroDialogAsync(this, _customDialog); DisplayTimedMessage("Information gemt!", "", 2); }); }); NavigateBackCmd = new RelayCommand(async x => { if (!IsDataSaved) { var result = await NavigationService.ConfirmDiscardChanges(_dialogCoordinator); if (result == false) { return; } } NavigationService.GoBack(); }); }
private void cmdBrowse_Click(System.Object eventSender, System.EventArgs eventArgs) { string strSelect = null; ex = new DatabaseExport(); strSelect = "CSV"; switch (strSelect) { case "CSV": if (ex.ShowSave(cmdlgSave, DatabaseExport.DatabaseExportEnum.CSV)) { Text1.Text = ex.FilePath; } break; } }
private void ex_ExportStarted(DatabaseExport.DatabaseExportEnum ExportingFormat) { this.Cursor = System.Windows.Forms.Cursors.WaitCursor; Debug.Print((ExportingFormat == DatabaseExport.DatabaseExportEnum.CSV ? "CSV" : (ExportingFormat == DatabaseExport.DatabaseExportEnum.HTML ? "HTML" : "Excel"))); }
private void ex_ExportComplete(bool Success, DatabaseExport.DatabaseExportEnum ExportingFormat) { if (Success == true) { Interaction.MsgBox("Export Completed!", MsgBoxStyle.OkOnly + MsgBoxStyle.Information + MsgBoxStyle.ApplicationModal, "Export Utilies"); } else { Interaction.MsgBox("Export Completed!", MsgBoxStyle.OkOnly + MsgBoxStyle.Information + MsgBoxStyle.ApplicationModal, "Export Utilies"); } this.Close(); }