private bool ProcessMessage(string message) { ArgumentAction action; string actionParm; bool result; result = SplitMessage(message, out action, out actionParm); if (!result) { return(true); } switch (action) { case ArgumentAction.NoOp: result = true; break; case ArgumentAction.Open: Activate(); if (IsCurrentModalForm && Enabled) { result = this.appWorkspace.OpenFileInNewWorkspace(actionParm); } break; case ArgumentAction.Print: Activate(); if (IsCurrentModalForm && Enabled) { result = this.appWorkspace.OpenFileInNewWorkspace(actionParm); if (result) { DocumentWorkspace dw = this.appWorkspace.ActiveDocumentWorkspace; PrintAction pa = new PrintAction(); dw.PerformAction(pa); CloseWorkspaceAction cwa = new CloseWorkspaceAction(dw); this.appWorkspace.PerformAction(cwa); if (this.appWorkspace.DocumentWorkspaces.Length == 0) { Startup.CloseApplication(); } } } break; default: throw new InvalidEnumArgumentException(); } return(result); }
private bool ProcessMessage(string message) { if (IsDisposed) { return(false); } bool result = SplitMessage(message, out ArgumentAction action, out string actionParm); if (!result) { return(true); } switch (action) { case ArgumentAction.NoOp: result = true; break; case ArgumentAction.Open: Activate(); if (IsCurrentModalForm && Enabled) { result = this.appWorkspace.OpenFileInNewWorkspace(actionParm); } break; case ArgumentAction.OpenUntitled: Activate(); if (!string.IsNullOrEmpty(actionParm) && IsCurrentModalForm && Enabled) { result = this.appWorkspace.OpenFileInNewWorkspace(actionParm, false); if (result) { this.appWorkspace.ActiveDocumentWorkspace.SetDocumentSaveOptions(null, null, null); this.appWorkspace.ActiveDocumentWorkspace.Document.Dirty = true; } } break; case ArgumentAction.Print: Activate(); if (!string.IsNullOrEmpty(actionParm) && IsCurrentModalForm && Enabled) { result = this.appWorkspace.OpenFileInNewWorkspace(actionParm); if (result) { DocumentWorkspace dw = this.appWorkspace.ActiveDocumentWorkspace; PrintAction pa = new PrintAction(); dw.PerformAction(pa); CloseWorkspaceAction cwa = new CloseWorkspaceAction(dw); this.appWorkspace.PerformAction(cwa); if (this.appWorkspace.DocumentWorkspaces.Length == 0) { Startup.CloseApplication(); } } } break; default: throw new InvalidEnumArgumentException(); } return(result); }