public static void SaveAs(bool worksheet, EditableView pnlView) { var strFilename = FileDialog.ShowSave(FileDialog.Context.Document, "SAW 7|*" + Document.StandardExtension + "|SAW 6|*.sss", Path.GetFileName(CurrentDocument.FilenameWithExtension(Document.StandardExtension))); if (string.IsNullOrEmpty(strFilename)) { return; } CurrentDocument.SAWHeader.SetWindowBounds(pnlView.GetDocumentScreenCoords()); if (strFilename.ToLower().EndsWith(".sss")) { using (var op = new Globals.Operation("[Save_SAW6]")) { var oldDoc = new SAW6Doc(CurrentDocument); using (var writer = new ArchiveWriter(strFilename, oldDoc.m_Header.Version)) { oldDoc.Write(writer); } op.ConfirmSuccess(true); } } else { if (!CurrentDocument.IsPaletteWithin) { CurrentDocument.Filename = strFilename; } CurrentDocument.DisplayName = ""; // otherwise the original worksheet name remains in the title bar, rather than the filename SaveFile(pnlView); } }
public override void Trigger(EditableView.ClickPosition.Sources source, EditableView pnlView, Transaction transaction) { if (CurrentDocument.IsPaletteWithin) { MessageBox.Show(Strings.Item("Palette_CannotSwitchUser")); return; } CurrentDocument.SAWHeader.SetWindowBounds(pnlView.GetDocumentScreenCoords()); Config.UserCurrent.StorePalettePositions(); Globals.Root.User = Users.User; Globals.Root.ShowRunScreen(); }
public static void Save(EditableView pnlView) { if (CurrentDocument.IsPaletteWithin) { MessageBox.Show("Cannot_Save_Palette"); return; } if (pnlView.Visible && pnlView.CurrentPage != null) // second condition essential. If this is triggered by save question when closing application in run mode, it would be null and GetDocumentScreenCoords would crash { CurrentDocument.SAWHeader.SetWindowBounds(pnlView.GetDocumentScreenCoords()); } if (CurrentDocument.NoSaveOverOriginalFile || string.IsNullOrEmpty(CurrentDocument.Filename)) // NoSaveOverOriginalFile will be true for SAW6 files { SaveAs(false, pnlView); } else { SaveFile(pnlView); // so this can only happen for SAW7 format. SaveAs handles saving in the old format } }