private void SaveFileAction() { IDialogService service = DialogServiceFactory.GetServiceInstance(); try { bool okToContinue = true; string filePath = m_ExplorerVm.ActiveFile.FilePath; if (!m_ExplorerVm.ActiveFile.IsFileBackedPhysically) { var options = new DialogOptions() { DefaultFileName = "Untitled.jef", FileFilter = "JEF Compiled File (*.jef)|*.jef", WindowTitle = "Save File" }; okToContinue = service.ShowSaveFileDialog(options, out filePath); } if (okToContinue) { m_ExplorerVm.SaveFileCommand.Execute(filePath); } } catch (Exception ex) { service.ShowErrorDialog("Save Error", ex.Message); } }
private void LoadFileAction() { IDialogService service = DialogServiceFactory.GetServiceInstance(); try { var options = new DialogOptions() { FileFilter = "RISC-V Assembly File (*.asm)|*.asm", WindowTitle = "Open File" }; bool okToContinue = service.ShowOpenFileDialog(options, out string filePath); if (okToContinue) { Cursor.Current = Cursors.WaitCursor; m_EditorVm.LoadFileCommand.Execute(filePath); } } catch (Exception ex) { service.ShowErrorDialog("Save Error", ex.Message); } finally { Cursor.Current = Cursors.Default; } }
private void ImportFileAction() { IDialogService service = DialogServiceFactory.GetServiceInstance(); try { var options = new DialogOptions() { FileFilter = "RISC-V ELF object file (*.o)|*.o|RISC-V JEF object file (*.jef)|*.jef", WindowTitle = "Import Compiled File" }; bool okToContinue = service.ShowOpenFileDialog(options, out string filePath); if (okToContinue) { m_EditorVm.DisassembleAndImportCmd.Execute(filePath); } } catch (Exception ex) { service.ShowErrorDialog("Import Error", ex.Message); } finally { Cursor.Current = Cursors.Default; } }
private void SaveFileAction() { IDialogService service = DialogServiceFactory.GetServiceInstance(); try { bool okToContinue = true; string filePath = m_EditorVm.ActiveFile.FilePath; if (!m_EditorVm.ActiveFile.IsFileBackedPhysically) { var options = new DialogOptions() { DefaultFileName = "Untitled.asm", FileFilter = "RISC-V Assembly File (*.asm)|*.asm", WindowTitle = "Save File" }; okToContinue = service.ShowSaveFileDialog(options, out filePath); } if (okToContinue) { Cursor.Current = Cursors.WaitCursor; m_EditorVm.SaveFileCommand.Execute(filePath); } } catch (Exception ex) { service.ShowErrorDialog("Save Error", ex.Message); } finally { Cursor.Current = Cursors.Default; } }
private void SaveFileAsAction() { IDialogService service = DialogServiceFactory.GetServiceInstance(); try { string defaultFileName = m_EditorVm.ActiveFile.FileName; if (string.IsNullOrEmpty(defaultFileName)) { defaultFileName = "Untitled.asm"; } // if there is an asterisk, strike that prior to printing. if (defaultFileName[defaultFileName.Length - 1] == '*') { defaultFileName = defaultFileName.Remove(defaultFileName.Length - 1); } var options = new DialogOptions() { DefaultFileName = defaultFileName, FileFilter = "RISC-V Assembly File (*.asm)|*.asm", WindowTitle = "Save File" }; bool okToContinue = service.ShowSaveFileDialog(options, out string filePath); if (okToContinue) { Cursor.Current = Cursors.WaitCursor; m_EditorVm.SaveFileCommand.Execute(filePath); } } catch (Exception ex) { service.ShowErrorDialog("Save Error", ex.Message); } finally { Cursor.Current = Cursors.Default; } }