Ejemplo n.º 1
0
        private void OnMarkupActivated(object sender, System.EventArgs e)
        {
            if (ndocument == null) {
            StyleSelectDialog dialog = new StyleSelectDialog ();

            if (dialog.Run () == (int) ResponseType.Ok) {
                try {
                    string format = dialog.Box.ActiveText;
                    if (format != null)
                        ndocument = rdocument.Normalize (format);

                    MarkupHTML marker = new MarkupHTML (ndocument);
                    html_document = marker.CreateHTMLDocument ();
                    textview.Buffer.Text = html_document.GetText ();
                    Markup.Sensitive = false;
                    Normalize.Sensitive = false;
                    Preview.Sensitive = true;

                } catch (StyleException exception){
                    MessageDialog md = new MessageDialog (this,
                        DialogFlags.DestroyWithParent,
                        MessageType.Error,
                        ButtonsType.Ok,
                        exception.Message);
                    md.Run ();
                    md.Destroy();
                } catch (NormalizerException exception){
                    MessageDialog md = new MessageDialog (this,
                        DialogFlags.DestroyWithParent,
                        MessageType.Error,
                        ButtonsType.Ok,
                        exception.Message);
                    md.Run ();
                    md.Destroy();
                }
            }

            dialog.Destroy ();
            } else {
            MarkupHTML marker = new MarkupHTML (ndocument);
            html_document = marker.CreateHTMLDocument ();
            textview.Buffer.Text = html_document.GetText ();
            Markup.Sensitive = false;
            Normalize.Sensitive = false;
            Preview.Sensitive = true;
            }
        }