private void MnuSaveAsClick(object sender, EventArgs e) { IDocumentForm document = this.GetDocument(); if (document != null) { try { document.SaveAs(); } catch (Exception ex) { Helper.Exceptions.Show(string.Format(Strings.FileErrorSave, document.GetTitle()), ex); } } }
private void SetDocumentMenus(IDocumentForm document) { bool isDocument = document != null; bool isVisible; bool isEnabled; if (isDocument && this.systemEditorForm != null) { this.systemEditorForm.DataPath = document.DataPath; } this.SetMenuVisible(this.mnuSave, isDocument); this.SetMenuVisible(this.mnuSaveAs, isDocument); this.SetMenuVisible(this.mnuSaveAll, isDocument); this.SetMenuVisible(this.mnuSaveSeperator, isDocument); this.SetMenuVisible(this.mnuWindowsSeperator, isDocument); this.SetMenuVisible(this.mnuClose, isDocument); this.mnuCloseAllDocuments.Enabled = isDocument; isVisible = isDocument && document.CanSave(); this.SetMenuVisible(this.mnuSave, isVisible); this.SetMenuVisible(this.mnuSaveAs, isVisible); if (isVisible) { string title = document.GetTitle(); this.mnuSave.Text = string.Format(Strings.FileEditorSave, title); this.mnuSaveAs.Text = string.Format(Strings.FileEditorSaveAs, title); } this.mnuUndo.Enabled = isDocument && document.CanUndo(); this.mnuRedo.Enabled = isDocument && document.CanRedo(); this.mnuCopy.Enabled = isDocument && document.ObjectSelected(); this.mnuCut.Enabled = isDocument && document.ObjectSelected(); this.mnuPaste.Enabled = isDocument && document.CanPaste(); this.mnuAdd.Enabled = isDocument && document.CanAdd(); this.mnuAdd.DropDown = isDocument ? document.MultipleAddDropDown() : null; this.mnuSelectAll.Enabled = isDocument && document.CanSelectAll(); this.mnu3dEditor.Enabled = isDocument && document.CanDisplay3DViewer(); isVisible = isDocument && document.CanFocusSelected(false); isEnabled = isVisible && document.CanFocusSelected(true); this.SetMenuVisible(this.mnuFocusSelected, isVisible, isEnabled); this.SetMenuVisible(this.mnuLookAtSelected, isVisible, isEnabled); this.SetMenuVisible(this.mnuFocusSelectedSeperator, isVisible); isVisible = isDocument && document.CanTrackSelected(false); isEnabled = isVisible && document.CanTrackSelected(true); this.SetMenuVisible(this.mnuTrackSelected, isVisible, isEnabled); isVisible = isDocument && document.CanManipulatePosition(); isEnabled = isVisible && document.CanManipulateRotationScale(); this.SetMenuVisible(this.mnuManipulationNone, isVisible); this.SetMenuVisible(this.mnuManipulationTranslate, isVisible); this.SetMenuVisible(this.mnuManipulationRotate, isVisible, isEnabled); this.SetMenuVisible(this.mnuManipulationScale, isVisible, isEnabled); this.SetMenuVisible(this.mnuManipulationSeperator, isVisible); isVisible = isDocument && document.CanChangeVisibility(false); isEnabled = isVisible && document.CanChangeVisibility(true); this.SetMenuVisible(this.mnuChangeVisibility, isVisible, isEnabled); this.SetMenuVisible(this.mnuShowModels, isVisible); this.SetMenuVisible(this.mnuShowModelsSeperator, isVisible); }