/*************************************************************************** * exec */ /** * Called from Exec to execute the command. * * @param sender Command object. ***************************************************************************/ public override void exec(object sender, EventArgs e) { /*---------------------------------------------*/ /* Load the form and set the current extension */ /* to the extension for the document. */ /*---------------------------------------------*/ CommentStyleForm form = new CommentStyleForm(); try { form.cbxStyle.SelectedValue = extensions.get(app.ActiveDocument); DialogResult rv = new WinWrapper(package.uiShell).showDialog(form); /*---------------------------------------------------*/ /* Reset the file extension to the actual extension. */ /*---------------------------------------------------*/ if (rv == DialogResult.Ignore) { extensions.set(app.ActiveDocument, null); } /*-----------------------------------------------*/ /* Set the file extension to the selected value. */ /*-----------------------------------------------*/ if (rv == DialogResult.OK) { extensions.set(app.ActiveDocument, (string)form.cbxStyle.SelectedValue); } } finally { form.Dispose(); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { WinWrapper.UnregisterAll(); } catch (Exception ex) { Logger.GetLogger().CatchException("MainWindow", "Window_Closing", ex.Message); throw; } }