Esempio n. 1
0
        private TreeGridItem GetCommentTree(Comment comment)
        {
            List <string> top5 = comment.GetTopNWords(5);

            TreeGridItem tgi = new TreeGridItem();

            if (top5.Count > 0)
            {
                string all5 = string.Empty;
                foreach (string s in top5)
                {
                    all5 += s + " ";
                }
                tgi.Values = new object[] { all5 };
                RichTextArea rta = new RichTextArea();
                rta.Text = comment.Text;

                tgi.Children.Add(new TreeGridItem()
                {
                    Values = new object[] { comment.Text }
                });
                foreach (Comment commentChild in comment.Comments)
                {
                    TreeGridItem tgic = GetCommentTree(commentChild);
                    tgi.Children.Add(tgic);
                }
            }
            else
            {
                tgi.Tag = "empty";
            }
            return(tgi);
        }
Esempio n. 2
0
        private TreeGridItem GetCommentTree(children child)
        {
            List <string> top5 = child.GetTopNWords(5);

            TreeGridItem tgi = new TreeGridItem();

            if (top5.Count > 0)
            {
                string all5 = string.Empty;
                foreach (string s in top5)
                {
                    all5 += s + " ";
                }
                tgi.Values = new object[] { all5 };
                RichTextArea rta = new RichTextArea();
                rta.Text = WebUtility.HtmlDecode(child.text);

                tgi.Children.Add(new TreeGridItem()
                {
                    Values = new object[] { WebUtility.HtmlDecode(child.text) }
                });
                foreach (children commentchild in child.Children)
                {
                    TreeGridItem tgic = GetCommentTree(commentchild);
                    tgi.Children.Add(tgic);
                }
            }
            else
            {
                tgi.Tag = "empty";
            }
            return(tgi);
        }
        void InitializeComponent()
        {
            Title      = "Firmware Uploader";
            ClientSize = new Size(400, 300);

            var tlMain = new TableLayout();

            tlMain.Spacing = new Size(5, 5);
            Content        = tlMain;

            var l1 = new Label();

            l1.Wrap = WrapMode.Word;
            l1.Text = "This is the firmware uploader, it is used to upload firmware to your hardware device, allowing you to update the firmware in your device, follow the steps below to upload your firmware:\n\n1. Download the compiled *.hex firmware file for your device\n2. Press browse and select your *.hex file\n3. Press select port to select the port of your device\n4. Press upload, then wait around 30 seconds for the firmware to be uploaded to your hardware, a command line window will pop up during the upload\n";
            tlMain.Rows.Add(l1);

            var slFile = new StackLayout();

            slFile.Spacing     = 5;
            slFile.Orientation = Orientation.Horizontal;
            slFile.VerticalContentAlignment = VerticalAlignment.Center;
            tlMain.Rows.Add(slFile);

            LSelectedFile      = new Label();
            LSelectedFile.Text = "No file seelcted";
            slFile.Items.Add(LSelectedFile);

            BtnSelectFile         = new Button();
            BtnSelectFile.Text    = "Browse";
            BtnSelectFile.ToolTip = "Browse";
            slFile.Items.Add(BtnSelectFile);

            var slPort = new StackLayout();

            slPort.Spacing     = 5;
            slPort.Orientation = Orientation.Horizontal;
            slPort.VerticalContentAlignment = VerticalAlignment.Center;
            tlMain.Rows.Add(slPort);

            LSelectedPort      = new Label();
            LSelectedPort.Text = "No Ports Selected";
            slPort.Items.Add(LSelectedPort);

            BtnPorts         = new Button();
            BtnPorts.Text    = "Select Port";
            BtnPorts.ToolTip = "Select Port";
            slPort.Items.Add(BtnPorts);

            BtnUpload         = new Button();
            BtnUpload.Text    = "Upload";
            BtnUpload.ToolTip = "Upload";
            slPort.Items.Add(BtnUpload);

            PBMain = new ProgressBar();
            tlMain.Rows.Add(PBMain);

            RTAStatus          = new RichTextArea();
            RTAStatus.ReadOnly = true;
            tlMain.Rows.Add(RTAStatus);
        }
        public DisassemblerControl(IMachineState state)
        {
            // TODO: maybe I don't need the ENTIRE state
            _state = state;

            _textArea = new RichTextArea
            {
                //BackgroundColor = Color.FromRgb(0),
                //TextColor = Color.FromGrayscale(1, 1),
                Font     = new Font("Monospace", 10),
                Width    = 300,
                ReadOnly = true,
            };

            //var stream = new MemoryStream();
            //var sw = new StreamWriter(stream);
            //sw.WriteLine("{\\rtf1 Hi {\\b Hi } \\line \\par asdf }");
            //sw.Flush();

            var stream = DisassembleAndFormat(100);

            _textArea.Buffer.Load(stream, RichTextAreaFormat.Rtf);

            Content = _textArea;
        }
        private void CreateUi()
        {
            //textarea1 = new RichTextArea() { Width=this.Width/2, Height=this.Height, Text="何かしらの文字列。" };
            textarea1 = new RichTextArea()
            {
                Width = 1, Height = 1, Text = "何かしらの文字列。"
            };
            textarea1.Focus();
            textarea1.KeyDown += Textarea1_KeyDown;
            webView1           = new WebView()
            {
                Width = 1, Height = 1, Url = new Uri("https://www.google.co.jp")
            };
            //webView1 = new WebView() { Width=this.Width/2, Height=this.Height, Url=new Uri("https://www.google.co.jp") } ;
            var splitter = new Eto.Forms.Splitter();

            splitter.Panel1 = textarea1;
            splitter.Panel2 = webView1;
            //splitter.Panel1.Width = this.Width / 2;
            fontDialog1              = new FontDialog();
            fontDialog1.FontChanged += Dialog_FontChanged;
            Content = new TableLayout()
            {
                Padding = 0,
                Spacing = new Size(0, 0),
                Rows    =
                {
                    new TableRow(splitter),
                }
            };
        }
Esempio n. 6
0
 private static void UpdateTextForeground(RichTextArea rta, Range <int>?currentSegmentRange)
 {
     rta.Buffer.SetForeground(new Range <int>(0, rta.Text.Length), Colors.Gray);
     if (currentSegmentRange != null)
     {
         rta.Buffer.SetForeground(FixRichTextAreaInputRange(rta, currentSegmentRange.Value), Colors.Black);
     }
 }
Esempio n. 7
0
        Control RichTextAreaControl()
        {
            var control = new RichTextArea {
                Text = "RichTextArea"
            };

            LogEvents(control);
            return(control);
        }
        private void CreateUi()
        {
            //textarea1 = new RichTextArea() { Width=this.Width/2, Height=this.Height, Text="何かしらの文字列。" };
            textarea1 = new RichTextArea()
            {
                Width = 1, Height = 1, Text = "何かしらの文字列。"
            };
            textarea1.Focus();
            textarea1.KeyDown += Textarea1_KeyDown;
            webView1           = new WebView()
            {
                Width = 1, Height = 1, Url = new Uri("https://www.google.co.jp")
            };
            //webView1 = new WebView() { Width=this.Width/2, Height=this.Height, Url=new Uri("https://www.google.co.jp") } ;
            var splitter = new Eto.Forms.Splitter();

            splitter.Panel1 = textarea1;
            splitter.Panel2 = webView1;
            //splitter.Panel1.Width = this.Width / 2;
            fontDialog1              = new FontDialog();
            fontDialog1.FontChanged += Dialog_FontChanged;
            textareaContextMenu1     = new ContextMenu();
            Command showFontDialog = new Command();

            showFontDialog.MenuText  = "フォント";
            showFontDialog.Executed += Command_Executed;
            textareaContextMenu1.Items.Add(showFontDialog);

            // デフォルトMouseDownイベントを消せない……
            //textarea1.MouseDown -= textarea1.MouseDown;
            //textarea1.MouseDown += null;
            //foreach (Delegate d in (textarea1.MouseDown as Eto.Widget.Hander).GetInvocationList()) {
            //EventHandler.RemoveAll();
            //foreach (EventHandler<Eto.Forms.MouseEventArgs> d in (textarea1.MouseDown as Eto.Widget.Hander).GetInvocationList()) {
            //foreach (EventHandler<Eto.Forms.MouseEventArgs> d in (textarea1.MouseDown as EventHandler<Eto.Forms.MouseEventArgs>).GetInvocationList()) {
            //    textarea1.MouseDown -= d;
            //};
            //textarea1.MouseDown as EventHandler
            //EventHandler a = new EventHandler((object sender, EventArgs e)=>{});
            //a.GetInvocationList();
            //Delegate.RemoveAll(textarea1.MouseDown);
            //textarea1.MouseDown.GetInvocationList()
            //textarea1.GetType().GetRuntimeFields()
            //textarea1.GetType().GetRuntimeProperties()
            //foreach (EventInfo info in textarea1.GetType().GetRuntimeEvents()) {
            //}
            textarea1.MouseDown += Textarea1_MouseDown;
            Content              = new TableLayout()
            {
                Padding = 0,
                Spacing = new Size(0, 0),
                Rows    =
                {
                    new TableRow(splitter),
                }
            };
        }
Esempio n. 9
0
        private static Range <int> FixRichTextAreaOutputRange(RichTextArea rta, Range <int> range)
        {
            if (rta.Platform.IsWpf)
            {
                int startDelta, endDelta;
                GetRichTextAreaFixDelta(rta, range, out startDelta, out endDelta);
                return(new Range <int>(range.Start + startDelta, range.End + endDelta));
            }

            return(range);
        }
Esempio n. 10
0
        public void SetViewRTF(string text)
        {
            try {
                RichTextArea rtfBox = new RichTextArea();
                rtfBox.ReadOnly = true;
                rtfBox.Text     = text;

                SetViewControl(rtfBox);
            } catch (Exception ex) {
                Logger.LogWrite("MediaViewerWin.SetViewRTF(): " + ex.Message);
            }
        }
Esempio n. 11
0
        public void EnabledShouldChangeEditable()
        {
            Invoke(() =>
            {
                var richTextArea = new RichTextArea();
                var handler      = richTextArea.Handler as RichTextAreaHandler;

                Assert.IsTrue(richTextArea.Enabled, "#1");
                Assert.IsFalse(richTextArea.ReadOnly, "#2");
                Assert.IsTrue(handler.Control.Selectable, "#3");
                Assert.IsTrue(handler.Control.Editable, "#4");
                richTextArea.Enabled = false;

                Assert.IsFalse(handler.Control.Selectable, "#5");
                Assert.IsFalse(handler.Control.Editable, "#6");
                richTextArea.Enabled = true;

                Assert.IsTrue(handler.Control.Selectable, "#7");
                Assert.IsTrue(handler.Control.Editable, "#8");

                richTextArea.ReadOnly = true;
                Assert.IsTrue(handler.Control.Selectable, "#9");
                Assert.IsFalse(handler.Control.Editable, "#10");

                richTextArea.Enabled = false;
                Assert.IsFalse(handler.Control.Selectable, "#11");
                Assert.IsFalse(handler.Control.Editable, "#12");

                richTextArea.Enabled = true;
                Assert.IsTrue(handler.Control.Selectable, "#13");
                Assert.IsFalse(handler.Control.Editable, "#14");

                richTextArea.ReadOnly = false;
                Assert.IsTrue(handler.Control.Selectable, "#15");
                Assert.IsTrue(handler.Control.Editable, "#16");

                richTextArea.Enabled = false;
                Assert.IsFalse(handler.Control.Selectable, "#17");
                Assert.IsFalse(handler.Control.Editable, "#18");

                richTextArea.ReadOnly = true;
                Assert.IsFalse(handler.Control.Selectable, "#19");
                Assert.IsFalse(handler.Control.Editable, "#20");

                richTextArea.Enabled = true;
                Assert.IsTrue(handler.Control.Selectable, "#21");
                Assert.IsFalse(handler.Control.Editable, "#22");

                richTextArea.ReadOnly = false;
                Assert.IsTrue(handler.Control.Selectable, "#23");
                Assert.IsTrue(handler.Control.Editable, "#24");
            });
        }
Esempio n. 12
0
        void InitializeComponent()
        {
            var scMain = new Scrollable();

            scMain.Border = BorderType.None;

            RTAMain        = new RichTextArea();
            scMain.Content = RTAMain;

            this.Size = new Size(400, 400);

            Content = scMain;
        }
Esempio n. 13
0
        RichTextArea CreateRichTextArea()
        {
            var richTextArea = new RichTextArea {
                Text = "RichTextArea", Size = new Size(150, 50)
            };

            richTextArea.Buffer.SetBold(new Range <int>(0, 3), true);
            richTextArea.Buffer.SetForeground(new Range <int>(0, 3), Colors.Blue);
            richTextArea.Buffer.SetItalic(new Range <int>(4, 7), true);
            richTextArea.Buffer.SetStrikethrough(new Range <int>(4, 7), true);
            richTextArea.Buffer.SetForeground(new Range <int>(4, 7), Colors.Green);
            richTextArea.Buffer.SetUnderline(new Range <int>(8, 11), true);
            richTextArea.Buffer.SetForeground(new Range <int>(8, 11), Colors.Red);
            return(richTextArea);
        }
Esempio n. 14
0
        public HistoryStoreMemo()
        {
            Title      = "储存详细信息";
            ClientSize = new Size(300, 200);

            var layout = new DynamicLayout()
            {
                Padding = new Padding(5),
                Spacing = new Size(3, 3)
            };

            title = new TextBox
            {
                PlaceholderText = "标题"
            };

            layout.AddRow(title);

            memo = new RichTextArea
            {
                Size = new Size(-1, 135)
            };

            layout.AddRow(memo);

            var noBtn = new Button {
                Text = "取消"
            };

            noBtn.Click += (sd, e) => Close();
            var okBtn = new Button {
                Text = "确定"
            };

            okBtn.Click += OkBtn_Click;

            var btnGroup = new DynamicLayout
            {
                Size    = new Size(-1, 12),
                Spacing = new Size(3, 3)
            };

            btnGroup.AddRow(null, noBtn, okBtn);

            layout.AddRow(btnGroup);

            Content = layout;
        }
Esempio n. 15
0
        private static void GetRichTextAreaFixDelta(RichTextArea rta, Range <int> range, out int startDelta, out int endDelta)
        {
            int delta = 0;
            int index = 0;

            while ((index = rta.Text.IndexOf(Environment.NewLine, index, StringComparison.Ordinal)) != -1)
            {
                if (index > range.Start)
                {
                    break;
                }
                delta += Environment.NewLine.Length;
                index += Environment.NewLine.Length;
            }
            startDelta = delta;
            endDelta   = delta + (index == range.End ? 1 : 0);
        }
Esempio n. 16
0
        public CreditsScreen(string textToDisplay)
        {
            Title = CentralProperties.productName + " " + CentralProperties.version;
            TableLayout content = new TableLayout();

            Content = content;

            Size = new Size(600, 430);

            Panel     imageHolder = new Panel();
            ImageView image       = new ImageView {
                Image = resources.images.quiltImage()
            };

            imageHolder.Size    = new Size((int)(image.Image.Width * 0.4f), (int)(image.Image.Height * 0.4f));
            imageHolder.Content = image;
            content.Rows.Add(new TableRow());
            content.Rows[0].Cells.Add(new TableCell()
            {
                Control = TableLayout.AutoSized(imageHolder, centered: true)
            });

            content.Rows.Add(new TableRow());
            RichTextArea textBox_credits = new RichTextArea();

            try
            {
                textBox_credits.Font = SystemFonts.Default(13 * 0.66f);
            }
            catch (Exception)
            {
            }
            textBox_credits.Size       = new Size(550, 260);
            textBox_credits.Wrap       = true;
            textBox_credits.ReadOnly   = true;
            textBox_credits.Text       = textToDisplay;
            textBox_credits.CaretIndex = 0;

            content.Rows[1].Cells.Add(new TableCell()
            {
                Control = TableLayout.AutoSized(textBox_credits, centered: true)
            });

            Resizable   = false;
            Maximizable = false;
        }
        public BindingEditorDialog(string currentBinding = null)
        {
            Title  = "Binding Editor";
            Result = currentBinding;

            var inputHandler = new RichTextArea
            {
                Text          = "Press a key or press a mouse button",
                Width         = 300,
                Height        = 150,
                TextAlignment = TextAlignment.Center,
                ReadOnly      = true
            };

            inputHandler.KeyDown   += CreateKeyBinding;
            inputHandler.MouseDown += CreateMouseBinding;

            var clearCommand = new Command {
                MenuText = "Clear"
            };

            clearCommand.Executed += ClearBinding;
            var clearButton = new Button
            {
                Text    = "Clear",
                Command = clearCommand,
            };

            clearButton.KeyDown += CreateKeyBinding;

            this.Content = new TableLayout
            {
                Rows =
                {
                    inputHandler,
                    clearButton
                },
                Padding = new Padding(5),
                Spacing = new Size(5, 5)
            };
        }
Esempio n. 18
0
        private static Panel GenMessagePanel()
        {
            var vm = MessageViewModel.Instance;

            var layout = new DynamicLayout {
                DataContext = vm
            };

            layout.Spacing        = new Size(5, 5);
            layout.Padding        = new Padding(10);
            layout.DefaultSpacing = new Size(2, 2);

            var textArea = new RichTextArea();

            textArea.Height = 300;

            textArea.TextBinding.BindDataContext((MessageViewModel m) => m.MessageText);
            layout.AddSeparateRow(textArea);

            return(layout);
        }
        private void Create()
        {
            this.pipeline = new MarkdownPipelineBuilder()
                            .UseAdvancedExtensions()
                            .UseSyntaxHighlighting()
                            .Build();

            richTextAreaMd = new RichTextArea()
            {
                Width = 320, Height = 600
            };
            richTextAreaHtml = new RichTextArea()
            {
                Width = 320, Height = 600
            };
            previewer = new WebView()
            {
                Width = 320, Height = 600
            };

            richTextAreaMd.Focus();
            richTextAreaMd.TextChanged += (object sender, EventArgs e) =>
            {
                richTextAreaHtml.Text = Markdig.Markdown.ToHtml((sender as RichTextArea).Text, pipeline);
                previewer.LoadHtml(richTextAreaHtml.Text);
            };
            //richTextAreaMd.Text = new StreamReader(new FileStream("/tmp/work/Projects/HelloMarkdown/HelloMarkdown/HelloMarkdown/DefaultMarkdown.md", FileMode.Open)).ReadToEnd();
            //richTextAreaMd.Text = new StreamReader(new FileStream("./DefaultMarkdown.md", FileMode.Open)).ReadToEnd();
            richTextAreaMd.Text = new StreamReader(new FileStream(System.IO.Path.Combine(System.AppContext.BaseDirectory, "DefaultMarkdown.md"), FileMode.Open)).ReadToEnd();
            Content             = new TableLayout
            {
                Padding = 0,
                Spacing = new Size(0, 0),
                Rows    =
                {
                    new TableRow(richTextAreaMd, richTextAreaHtml, previewer),
                }
            };
        }
Esempio n. 20
0
        public void ShowPreview(RichTextArea rta)
        {
            WriteableBitmap image = new WriteableBitmap(rta, null);

            previewImage.Source = image;
        }
Esempio n. 21
0
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            PrintPreview cw = new PrintPreview();

            cw.ShowPreview(rta);
            cw.HasCloseButton = false;
            cw.Closed        += (t, a) =>
            {
                if (cw.DialogResult.Value)
                {
                    PrintDocument theDoc = new PrintDocument();
                    RichTextArea  rta2   = new RichTextArea();
                    rta2.Width        = 816;
                    rta2.TextWrapping = TextWrapping.Wrap;
                    rta.FontSize      = 20;
                    Paragraph         p    = null;
                    Paragraph         bp   = null;
                    InlineUIContainer iuic = null;
                    Run r  = null;
                    Run br = null;
                    for (int i = 0; i < rta.Blocks.Count; i++)
                    {
                        if (rta.Blocks[i] is Paragraph)
                        {
                            p  = new Paragraph();
                            bp = ((Paragraph)rta.Blocks[i]);
                            for (int j = 0; j < bp.Inlines.Count; j++)
                            {
                                if (bp.Inlines[j] is Run)
                                {
                                    br = ((Run)bp.Inlines[j]);

                                    r                 = new Run();
                                    r.Text            = br.Text;
                                    r.FontFamily      = br.FontFamily;
                                    r.FontSize        = br.FontSize;
                                    r.FontStretch     = br.FontStretch;
                                    r.FontStyle       = br.FontStyle;
                                    r.FontWeight      = br.FontWeight;
                                    r.Foreground      = br.Foreground;
                                    r.TextDecorations = br.TextDecorations;
                                    p.Inlines.Add(r);
                                }
                                if (bp.Inlines[j] is InlineUIContainer)
                                {
                                    iuic = new InlineUIContainer();
                                    if (((InlineUIContainer)bp.Inlines[j]).Child is Image)
                                    {
                                        iuic.Child = getImage();
                                    }
                                    else if (((InlineUIContainer)bp.Inlines[j]).Child is DataGrid)
                                    {
                                        iuic.Child = getDataGrid();
                                    }
                                    else if (((InlineUIContainer)bp.Inlines[j]).Child is Calendar)
                                    {
                                        iuic.Child = getCalendar();
                                    }
                                    p.Inlines.Add(iuic);
                                }
                            }
                            rta2.Blocks.Add(p);
                        }
                    }

                    theDoc.DocumentName = "Silverlight 4 Text Editor";
                    theDoc.PrintPage   += (s, args) =>
                    {
                        //Size sz = args.PrintableArea;

                        //layout again
                        //WriteableBitmap wb = new WriteableBitmap(rta2, null);
                        //Image previewImage = new Image();
                        //previewImage.Source = wb;
                        //args.PageVisual = previewImage;
                        args.PageVisual   = rta2;
                        args.HasMorePages = false;
                    };

                    theDoc.EndPrint += (s, args) =>
                    {
                        MessageBox.Show("The document printed successfully", "Text Editor", MessageBoxButton.OK);
                    };

                    theDoc.Print();
                    ReturnFocus();
                }
            };
            cw.Show();
        }
Esempio n. 22
0
 public RichTextAreaSink(RichTextArea richTextArea)
 {
     _richTextArea = richTextArea;
 }
Esempio n. 23
0
        private void SetFileRef(GEDCOMFileReferenceWithTitle value)
        {
            fFileRef = value;
            Title    = fFileRef.Title;
            Control ctl = null;

            MultimediaKind mmKind = GKUtils.GetMultimediaKind(fFileRef.MultimediaFormat);

            try {
                switch (mmKind)
                {
                case MultimediaKind.mkImage:
                {
                    IImage img = fBase.Context.LoadMediaImage(fFileRef, false);
                    if (img != null)
                    {
                        SetViewImage(((ImageHandler)img).Handle, fFileRef);
                    }
                    break;
                }

                case MultimediaKind.mkAudio:
                case MultimediaKind.mkVideo:
                {
                    string targetFile = fBase.Context.MediaLoad(fFileRef);
                    SetViewMedia(targetFile);
                    break;
                }

                case MultimediaKind.mkText:
                {
                    Stream fs = fBase.Context.MediaLoad(fFileRef, false);

                    switch (fFileRef.MultimediaFormat)
                    {
                    case GEDCOMMultimediaFormat.mfTXT:
                    {
                        TextArea txtBox = new TextArea();
                        txtBox.ReadOnly = true;

                        try {
                            // FIXME: fix encoding! and test other!!!
                            using (StreamReader strd = new StreamReader(fs, Encoding.GetEncoding(1251))) {
                                txtBox.Text = strd.ReadToEnd();
                            }
                        } catch (Exception ex) {
                            Logger.LogWrite("MediaViewerWin.SetFileRef.1(): " + ex.Message);
                        }

                        ctl = txtBox;
                        SetViewControl(ctl);
                    }
                    break;

                    case GEDCOMMultimediaFormat.mfRTF:
                    {
                        RichTextArea rtfBox = new RichTextArea();
                        rtfBox.ReadOnly = true;

                        try {
                            using (StreamReader strd = new StreamReader(fs)) {
                                rtfBox.Text = strd.ReadToEnd();
                            }
                        } catch (Exception ex) {
                            Logger.LogWrite("MediaViewerWin.SetFileRef.2(): " + ex.Message);
                        }

                        ctl = rtfBox;
                        SetViewControl(ctl);
                    }
                    break;

                    case GEDCOMMultimediaFormat.mfHTM:
                    {
                        var browser = new WebView();

                        try {
                            browser.LoadHtml(fs);

                            /*using (StreamReader strd = new StreamReader(fs)) {
                             *  browser.DocumentText = strd.ReadToEnd();
                             *  // didn't work, because didn't defines codepage from page's header (?!)
                             * }*/
                        } catch (Exception ex) {
                            Logger.LogWrite("MediaViewerWin.SetFileRef.3(): " + ex.Message);
                        }

                        ctl = browser;
                        SetViewControl(ctl);
                    }
                    break;
                    }
                    if (fs != null && !(ctl is WebView))
                    {
                        fs.Dispose();
                    }

                    break;
                }
                }
            } catch (Exception ex) {
                if (ctl != null)
                {
                    ctl.Dispose();
                }

                Logger.LogWrite("MediaViewerWin.SetFileRef(): " + ex.Message);
            }
        }
Esempio n. 24
0
        public RichTextAreaSection()
        {
            var richText = new RichTextArea();

            richText.Size = new Size(-1, 300);
            //richText.Font = new Font("Arial", 10);

            var buffer = richText.Buffer;

            /**/
            richText.Text = LoremText;

            var range = new Range <int>(6, 10);

            buffer.SetFont(range, Fonts.Cursive(20, FontStyle.Bold, FontDecoration.Underline));
            buffer.SetForeground(range, Colors.Blue);
            buffer.SetBackground(range, Colors.Yellow);

            buffer.SetBold(new Range <int>(11, 16), true);
            buffer.SetItalic(new Range <int>(18, 20), true);
            buffer.SetUnderline(new Range <int>(22, 25), true);
            buffer.SetStrikethrough(new Range <int>(28, 38), true);

            richText.CaretIndex = LoremText.Length - 1;
            /**/


            richText.SelectionChanged += (sender, e) =>
            {
                UpdateBindings(BindingUpdateMode.Destination);
                Log.Write(sender, "SelectionChanged: {0}", richText.Selection);
            };

            var boldButton = new CheckBox {
                Text = "Bold"
            };

            boldButton.CheckedBinding.Bind(richText, r => r.SelectionBold);
            boldButton.CheckedChanged += (sender, e) =>
            {
                richText.Focus();
                UpdateBindings(BindingUpdateMode.Destination);
            };

            var italicButton = new CheckBox {
                Text = "Italic"
            };

            italicButton.CheckedBinding.Bind(richText, r => r.SelectionItalic);
            italicButton.CheckedChanged += (sender, e) =>
            {
                richText.Focus();
                UpdateBindings(BindingUpdateMode.Destination);
            };

            var underlineButton = new CheckBox {
                Text = "Underline"
            };

            underlineButton.CheckedBinding.Bind(richText, r => r.SelectionUnderline);
            underlineButton.CheckedChanged += (sender, e) => richText.Focus();

            var strikethroughButton = new CheckBox {
                Text = "Strikethrough"
            };

            strikethroughButton.CheckedBinding.Bind(richText, r => r.SelectionStrikethrough);
            strikethroughButton.CheckedChanged += (sender, e) => richText.Focus();

            var backgroundButton = new ColorPicker {
            };

            backgroundButton.ValueBinding.Bind(() => richText.SelectionBackground, val => richText.SelectionBackground = val, h => Binding.AddPropertyEvent(richText, r => r.SelectionBackground, h), h => Binding.RemovePropertyEvent(richText, h));
            backgroundButton.ValueChanged += (sender, e) => richText.Focus();

            var foregroundButton = new ColorPicker {
            };

            foregroundButton.ValueBinding.Bind(richText, r => r.SelectionForeground);
            foregroundButton.ValueChanged += (sender, e) => richText.Focus();

            var fontButton = new Button();

            fontButton.Bind(c => c.Text, new DelegateBinding <string>(() =>
            {
                var font = richText.SelectionFont;
                if (font == null)
                {
                    return("<No Font>");
                }
                return(string.Format("{0}, {1}, {2:0.00}pt", font.FamilyName, font.Typeface.Name, font.Size));
            }));
            var fd = new FontDialog();

            fontButton.Click += (sender, e) =>
            {
                fd.Font         = richText.SelectionFont;
                fd.FontChanged += (s, ee) =>
                {
                    richText.SelectionFont = fd.Font;
                    UpdateBindings(BindingUpdateMode.Destination);
                };
                if (fd.ShowDialog(this) == DialogResult.Ok)
                {
                    richText.Focus();
                }
            };

            var familyDropDown = new DropDown();

            familyDropDown.DataStore = Fonts.AvailableFontFamilies.OrderBy(r => r.Name);
            familyDropDown.SelectedValueBinding.Bind(richText, r => r.SelectionFamily);
            familyDropDown.SelectedValueChanged += (sender, e) =>
            {
                richText.Focus();
                UpdateBindings(BindingUpdateMode.Destination);
            };

            var formatEnum = new EnumDropDown <RichTextAreaFormat>();

            formatEnum.SelectedValue = RichTextAreaFormat.Rtf;

            var loadButton = new Button {
                Text = "Load"
            };

            loadButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue);
            loadButton.Click  += (sender, e) => buffer.Load(new MemoryStream(Encoding.UTF8.GetBytes(formatEnum.SelectedValue == RichTextAreaFormat.Rtf ? RtfString : LoremText)), formatEnum.SelectedValue);

            var saveButton = new Button {
                Text = "Save"
            };

            saveButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue);
            saveButton.Click  += (sender, e) =>
            {
                var stream = new MemoryStream();
                buffer.Save(stream, formatEnum.SelectedValue);
                stream.Position = 0;
                Log.Write(richText, "Saved {0}:\n{1}", formatEnum.SelectedValue, new StreamReader(stream).ReadToEnd());
            };

            formatEnum.SelectedValueChanged += (sender, e) => saveButton.Enabled = loadButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue);

            var clearButton = new Button {
                Text = "Clear"
            };

            clearButton.Click += (sender, e) => buffer.Clear();

            var formatting1 = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                Spacing     = 5,
                Items       =
                {
                    null,
                    boldButton,
                    italicButton,
                    underlineButton,
                    strikethroughButton,
                    null
                }
            };

            var formatting2 = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                Spacing     = 5,
                Items       =
                {
                    null,
                    new Label {
                        Text = "Foreground",               VerticalAlignment                     = VerticalAlignment.Center
                    },
                    TableLayout.AutoSized(foregroundButton,centered: true),
                    new Label {
                        Text = "Background",               VerticalAlignment                     = VerticalAlignment.Center
                    },
                    TableLayout.AutoSized(backgroundButton,centered: true),
                    null
                }
            };
            var formatting3 = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                Spacing     = 5,
                Items       =
                {
                    null,
                    fontButton,
                    familyDropDown,
                    null
                }
            };

            var buttons = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                Spacing     = 5,
                Items       =
                {
                    null,
                    formatEnum,
                    loadButton,
                    saveButton,
                    clearButton,
                    null
                }
            };

            Content = new StackLayout
            {
                Padding = new Padding(10),
                Spacing = 5,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Items =
                {
                    buttons,
                    TextAreaSection.TextAreaOptions(richText),
                    TextAreaSection.TextAreaOptions2(richText),
                    TextAreaSection.TextAreaOptions3(richText),
                    formatting1,
                    formatting2,
                    formatting3,
                    new StackLayoutItem(richText, expand: true)
                }
            };
        }
Esempio n. 25
0
        public Editor(Application application, string baseDirectory, string codeFilename)
        {
            systemPath  = baseDirectory + "/System.txt";
            programPath = baseDirectory + "/Program.txt";
            WindowState = WindowState.Maximized;
            Title       = TitleText;
            Menu        = new MenuBar {
                IncludeSystemItems = MenuBarSystemItems.Quit
            };
            runCommand      = new Command(OnRun);
            continueCommand = new Command(OnContinue);
            stepCommand     = new Command(OnStep)
            {
                Shortcut = Keys.F10
            };
            Button runButton = new Button {
                Command = runCommand, Text = RunText
            };
            Button continueButton = new Button {
                Command = continueCommand, Text = ContinueText
            };
            Button stepButton = new Button {
                Command = stepCommand, Text = StepText
            };

            systemEdit = new RichTextArea()
            {
                TextReplacements = TextReplacements.None
            };
            systemEdit.Text = File.ReadAllText(systemPath);
            programEdit     = new RichTextArea()
            {
                TextReplacements = TextReplacements.None
            };
            programEdit.Text = File.ReadAllText(programPath);
            codeTree         = new TreeGridView()
            {
                ShowHeader = false
            };
            codeTree.Border = BorderType.Line;
            codeTree.Columns.Add(new GridColumn {
                Editable = false, DataCell = new TextBoxCell(0), Resizable = false
            });
            codeTree.Columns.Add(new GridColumn {
                Editable = false, DataCell = new TextBoxCell(1), Resizable = false
            });
            codeTree.SelectedItemChanged += OnCodeTreeViewSelectedItemChanged;
            frameStack = new ListBox {
                Style = "ListNative"
            };
            frameStack.SelectedIndexChanged += OnCallStackListBoxSelectedIndexChanged;
            valueStack = new ListBox {
                Style = "ListNative"
            };
            outputArea        = new RichTextArea();
            documentationView = new WebView();
            Scrollable documentationwindow = new Scrollable();

            documentationwindow.Content = documentationView;
            TableLayout  buttons    = TableLayout.Horizontal(runButton, continueButton, stepButton, new Panel());
            DocumentPage systemPage = new DocumentPage(systemEdit)
            {
                Closable = false, Text = "System"
            };
            DocumentPage programPage = new DocumentPage(programEdit)
            {
                Closable = false, Text = "Program"
            };
            DocumentControl editsDocument = new DocumentControl()
            {
                AllowReordering = false
            };

            editsDocument.Pages.Add(systemPage);
            editsDocument.Pages.Add(programPage);
            TableLayout outputControls = TableLayout.HorizontalScaled(outputArea, documentationwindow);

            outputControls.Height = StandardDimensionHeight;
            TableLayout codeOutputControls = new TableLayout(editsDocument, outputControls);

            codeOutputControls.SetRowScale(0);
            TableLayout stacks = new TableLayout(codeTree, frameStack, valueStack);

            stacks.SetRowScale(0);
            stacks.SetRowScale(1);
            stacks.SetRowScale(2);
            stacks.Width = StandardDimensionWidth;
            TableLayout codeControls = TableLayout.Horizontal(codeOutputControls, stacks);

            codeControls.SetColumnScale(0);
            Content = codeControls;
            TableLayout mainControls = new TableLayout(buttons, codeControls);

            mainControls.SetRowScale(1);
            Content              = mainControls;
            runtime              = new Mira(application, baseDirectory);
            runtime.Breaking    += UpdateUI;
            runtime.Outputting  += OnOutputting;
            runtime.Stepping    += UpdateUI;
            runtime.Terminating += OnTerminating;
            runtime.Code         = codeFilename;
            timer.Interval       = 0.33;
            timer.Elapsed       += OnElapsed;
            timer.Start();
            LoadComplete += OnLoadComplete;
        }
Esempio n. 26
0
        private void InitializeComponent()
        {
            #region Controls

            plugins           = new ComboBox();
            selectedInputPath = new TextBox {
                ReadOnly = true
            };
            subDirectoryBox = new CheckBox {
                Text = "Sub Directories"
            };
            selectedOutputPath = new TextBox {
                ReadOnly = true
            };
            timerLabel = new Label {
                Text = "Avg time per file:"
            };
            log = new RichTextArea {
                ReadOnly = true, BackgroundColor = KnownColors.Black, TextColor = KnownColors.NeonGreen
            };

            #endregion

            #region Commands

            selectInputCommand  = new Command();
            selectOutputCommand = new Command();
            executeCommand      = new Command();

            #endregion

            Title   = "BatchDialog";
            Padding = new Padding(6);
            Size    = new Size(700, 300);

            #region Content

            var pluginLabel = new Label {
                Text = "Plugins"
            };
            var selectInputButton = new Button {
                Text = "Select Input...", Command = selectInputCommand, Size = new Size(130, -1)
            };
            var selectOutputButton = new Button {
                Text = "Select Output...", Command = selectOutputCommand, Size = new Size(130, -1)
            };
            var executeButton = new Button {
                Text = "Execute", Command = executeCommand, Size = new Size(130, -1)
            };

            var inputLayout = new StackLayout
            {
                Orientation = Orientation.Vertical,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,

                Spacing = 6,

                Items =
                {
                    pluginLabel,
                    plugins,
                    selectedInputPath,
                    new StackLayout
                    {
                        Orientation = Orientation.Horizontal,
                        VerticalContentAlignment = VerticalAlignment.Stretch,

                        Spacing = 6,

                        Items =
                        {
                            selectInputButton,
                            subDirectoryBox
                        }
                    },
                    selectedOutputPath,
                    selectOutputButton
                }
            };

            Content = new TableLayout
            {
                AllowDrop = true,
                Spacing   = new Size(6, 6),

                Rows =
                {
                    new TableRow
                    {
                        Cells =
                        {
                            new TableLayout
                            {
                                Rows =
                                {
                                    inputLayout,
                                    new TableLayout
                                    {
                                        Rows =
                                        {
                                            new TableRow {
                                                ScaleHeight = true
                                            },
                                            executeButton
                                        }
                                    }
                                }
                            },
                            new TableLayout
                            {
                                Spacing = new Size(6, 6),
                                Rows    =
                                {
                                    timerLabel,
                                    log
                                }
                            }
                        }
                    }
                }
            };

            #endregion
        }
Esempio n. 27
0
        public RichTextAreaSection()
        {
            var richText = new RichTextArea();

            richText.Size = new Size(-1, 300);
            //richText.Font = new Font("Arial", 10);

            var buffer = richText.Buffer;

            /**/
            richText.Text = LastText;

            var range = new Range <int>(6, 10);

            buffer.SetFont(range, Fonts.Cursive(20, FontStyle.Bold, FontDecoration.Underline));
            buffer.SetForeground(range, Colors.Blue);
            buffer.SetBackground(range, Colors.Yellow);

            buffer.SetBold(new Range <int>(11, 16), true);
            buffer.SetItalic(new Range <int>(18, 20), true);
            buffer.SetUnderline(new Range <int>(22, 25), true);
            buffer.SetStrikethrough(new Range <int>(28, 38), true);

            richText.CaretIndex = LastText.Length - 1;
            /**/


            richText.SelectionChanged += (sender, e) =>
            {
                UpdateBindings(BindingUpdateMode.Destination);
                Log.Write(sender, "SelectionChanged: {0}", richText.Selection);
            };

            var boldButton = new CheckBox {
                Text = "Bold"
            };

            boldButton.CheckedBinding.Bind(richText, r => r.SelectionBold);
            boldButton.CheckedChanged += (sender, e) =>
            {
                richText.Focus();
                UpdateBindings(BindingUpdateMode.Destination);
            };

            var italicButton = new CheckBox {
                Text = "Italic"
            };

            italicButton.CheckedBinding.Bind(richText, r => r.SelectionItalic);
            italicButton.CheckedChanged += (sender, e) =>
            {
                richText.Focus();
                UpdateBindings(BindingUpdateMode.Destination);
            };

            var underlineButton = new CheckBox {
                Text = "Underline"
            };

            underlineButton.CheckedBinding.Bind(richText, r => r.SelectionUnderline);
            underlineButton.CheckedChanged += (sender, e) => richText.Focus();

            var strikethroughButton = new CheckBox {
                Text = "Strikethrough"
            };

            strikethroughButton.CheckedBinding.Bind(richText, r => r.SelectionStrikethrough);
            strikethroughButton.CheckedChanged += (sender, e) => richText.Focus();

            var backgroundButton = new ColorPicker {
            };

            backgroundButton.ValueBinding.Bind(() => richText.SelectionBackground, val => richText.SelectionBackground = val, h => Binding.AddPropertyEvent(richText, r => r.SelectionBackground, h), h => Binding.RemovePropertyEvent(richText, h));
            backgroundButton.ValueChanged += (sender, e) => richText.Focus();

            var foregroundButton = new ColorPicker {
            };

            foregroundButton.ValueBinding.Bind(richText, r => r.SelectionForeground);
            foregroundButton.ValueChanged += (sender, e) => richText.Focus();

            var fontButton = new FontPicker();

            fontButton.ValueBinding.Bind(richText, r => r.SelectionFont);
            fontButton.ValueChanged += (sender, e) =>
            {
                richText.Focus();
                UpdateBindings(BindingUpdateMode.Destination);
            };

            var typefaceDropDown = new DropDown();

            typefaceDropDown.ItemKeyBinding = Binding.Property((FontTypeface f) => f.Name);
            typefaceDropDown.DataStore      = richText.SelectionFamily.Typefaces;
            var tyepfaceBinding = typefaceDropDown.SelectedValueBinding.Bind(richText, r => r.SelectionTypeface);

            typefaceDropDown.SelectedValueChanged += (sender, e) =>
            {
                richText.Focus();
                UpdateBindings(BindingUpdateMode.Destination);
            };

            var familyDropDown = new DropDown();

            familyDropDown.ItemTextBinding = Binding.Property((FontFamily f) => f.LocalizedName);
            familyDropDown.DataStore       = Fonts.AvailableFontFamilies.OrderBy(r => r.LocalizedName);
            familyDropDown.SelectedValueBinding.Bind(richText, r => r.SelectionFamily);
            familyDropDown.SelectedValueChanged += (sender, e) =>
            {
                var family = familyDropDown.SelectedValue as FontFamily;
                //tyepfaceBinding.Mode = DualBindingMode.Manual;
                typefaceDropDown.DataStore = family?.Typefaces;
                //tyepfaceBinding.Mode = DualBindingMode.TwoWay;
                richText.Focus();
                UpdateBindings(BindingUpdateMode.Destination);
            };

            var formatEnum = new EnumDropDown <RichTextAreaFormat>();

            formatEnum.SelectedValue = RichTextAreaFormat.Rtf;

            var loadButton = new Button {
                Text = "Load"
            };

            loadButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue);
            loadButton.Click  += (sender, e) => buffer.Load(new MemoryStream(Encoding.UTF8.GetBytes(formatEnum.SelectedValue == RichTextAreaFormat.Rtf ? RtfString : LastText)), formatEnum.SelectedValue);

            var loadFileButton = new Button {
                Text = "Load File..."
            };

            loadFileButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue);
            loadFileButton.Click  += (sender, e) =>
            {
                var dlg = new OpenFileDialog {
                    Filters = { new FileFilter("RTF", ".rtf"), new FileFilter("TXT", "txt") }
                };
                if (dlg.ShowDialog(this) == DialogResult.Ok)
                {
                    var useRtf = string.Equals(Path.GetExtension(dlg.FileName), ".rtf", StringComparison.OrdinalIgnoreCase);
                    var fs     = File.OpenRead(dlg.FileName);
                    buffer.Load(fs, useRtf ? RichTextAreaFormat.Rtf : RichTextAreaFormat.PlainText);
                }
            };

            var saveButton = new Button {
                Text = "Save"
            };

            saveButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue);
            saveButton.Click  += (sender, e) =>
            {
                var stream = new MemoryStream();
                buffer.Save(stream, formatEnum.SelectedValue);
                stream.Position = 0;
                if (formatEnum.SelectedValue == RichTextAreaFormat.Rtf)
                {
                    RtfString = Encoding.UTF8.GetString(stream.ToArray());
                }
                else
                {
                    LastText = Encoding.UTF8.GetString(stream.ToArray());
                }
                Log.Write(richText, "Saved {0}:\n{1}", formatEnum.SelectedValue, new StreamReader(stream).ReadToEnd());
            };

            formatEnum.SelectedValueChanged += (sender, e) => saveButton.Enabled = loadButton.Enabled = buffer.SupportedFormats.Contains(formatEnum.SelectedValue);

            var clearButton = new Button {
                Text = "Clear"
            };

            clearButton.Click += (sender, e) => buffer.Clear();

            var formatting1 = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                Spacing     = 5,
                Items       =
                {
                    null,
                    boldButton,
                    italicButton,
                    underlineButton,
                    strikethroughButton,
                    null
                }
            };

            var formatting2 = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                Spacing     = 5,
                Items       =
                {
                    null,
                    new Label {
                        Text = "Foreground",               VerticalAlignment                     = VerticalAlignment.Center
                    },
                    TableLayout.AutoSized(foregroundButton,centered: true),
                    new Label {
                        Text = "Background",               VerticalAlignment                     = VerticalAlignment.Center
                    },
                    TableLayout.AutoSized(backgroundButton,centered: true),
                    null
                }
            };
            var formatting3 = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                Spacing     = 5,
                Items       =
                {
                    null,
                    fontButton,
                    familyDropDown,
                    typefaceDropDown,
                    null
                }
            };

            var buttons = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                Spacing     = 5,
                Items       =
                {
                    null,
                    formatEnum,
                    loadButton,
                    saveButton,
                    loadFileButton,
                    clearButton,
                    null
                }
            };

            Content = new StackLayout
            {
                Padding = new Padding(10),
                Spacing = 5,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Items =
                {
                    buttons,
                    TextAreaSection.TextAreaOptions(richText),
                    TextAreaSection.TextAreaOptions2(richText),
                    TextAreaSection.TextAreaOptions3(richText),
                    formatting1,
                    formatting2,
                    formatting3,
                    new StackLayoutItem(richText, expand: true)
                }
            };
        }
        private void InitializeComponent()
        {
            #region Controls

            parameterBox = new GroupBox {
                Text = "Parameters"
            };
            log = new RichTextArea {
                ReadOnly = true, BackgroundColor = KnownColors.Black
            };

            typeLabel = new Label {
                Text = "TypeExtension:"
            };
            extensions   = new ComboBox();
            selectedPath = new TextBox {
                ReadOnly = true
            };
            subDirectoryBox = new CheckBox {
                Text = "Sub Directories"
            };

            autoExecuteBox = new CheckBox {
                Text = "Auto-Execute on Drop"
            };

            #endregion

            #region Commands

            selectFolderCommand = new Command();
            selectFileCommand   = new Command();
            executeCommand      = new Command();

            #endregion

            Title   = "TypeExtensionDialog";
            Padding = new Padding(6);
            Size    = new Size(700, 300);

            #region Content

            selectFolderButton = new Button {
                Text = "Select Folder...", Command = selectFolderCommand, Size = new Size(130, -1)
            };
            selectFileButton = new Button {
                Text = "Select File...", Command = selectFileCommand
            };
            executeButton = new Button {
                Text = "Execute", Command = executeCommand
            };

            var inputLayout = new StackLayout
            {
                Orientation = Orientation.Vertical,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,

                Size    = new Size(250, -1),
                Spacing = 6,

                Items =
                {
                    typeLabel,
                    extensions,
                    selectedPath,
                    new StackLayout
                    {
                        Orientation = Orientation.Horizontal,
                        VerticalContentAlignment = VerticalAlignment.Stretch,

                        Spacing = 6,

                        Items =
                        {
                            selectFolderButton,
                            subDirectoryBox
                        }
                    },
                    selectFileButton
                }
            };

            var executeLayout = new StackLayout
            {
                Orientation = Orientation.Horizontal,
                VerticalContentAlignment = VerticalAlignment.Stretch,

                Spacing = 6,

                Items =
                {
                    executeButton,
                    autoExecuteBox
                }
            };

            Content = new TableLayout
            {
                Spacing   = new Size(6, 6),
                AllowDrop = true,

                Rows =
                {
                    new TableRow
                    {
                        Cells =
                        {
                            inputLayout,
                            parameterBox
                        }
                    },
                    new TableRow
                    {
                        Cells =
                        {
                            new TableLayout
                            {
                                Rows =
                                {
                                    new TableRow {
                                        ScaleHeight = true
                                    },
                                    new TableRow
                                    {
                                        Cells =  { executeLayout}
                                    }
                                }
                            },
                            log
                        }
                    }
                }
            };

            #endregion
        }
Esempio n. 29
0
 public RTAContextMenu(RichTextArea rta)
 {
     this.rta = rta;
 }
        public Dialog_EPOutputs(HB.SimulationOutput simulationOutput)
        {
            try
            {
                var output = simulationOutput;

                Padding     = new Padding(5);
                Resizable   = true;
                Title       = $"EnergyPlus Output Names - {DialogHelper.PluginName}";
                WindowStyle = WindowStyle.Default;
                MinimumSize = new Size(450, 500);
                this.Icon   = DialogHelper.HoneybeeIcon;

                var layout = new DynamicLayout();
                layout.Spacing = new Size(8, 8);
                layout.Padding = new Padding(15);

                //Outputs
                var outputListBox = new RichTextArea();
                outputListBox.TextBinding.Bind(() =>
                {
                    output.Outputs = output.Outputs ?? new List <string>()
                    {
                        "Zone Electric Equipment Electric Energy", "Zone Lights Electric Energy"
                    };
                    var s = string.Join(Environment.NewLine, output.Outputs);
                    return(s);
                },
                                               v =>
                {
                    output.Outputs = v.Split(new[] { Environment.NewLine, "\n" }, StringSplitOptions.RemoveEmptyEntries).Select(_ => _.Trim()).ToList();
                }
                                               );
                outputListBox.Height = 200;

                layout.AddRow("EnergyPlus Output Names:");
                layout.AddRow(outputListBox);

                //SummaryReports
                var sumReportsListBox = new RichTextArea();
                sumReportsListBox.Height = 100;
                sumReportsListBox.TextBinding.Bind(
                    () =>
                {
                    output.SummaryReports = output.SummaryReports ?? new List <string>()
                    {
                        "AllSummary"
                    };
                    var s = string.Join(Environment.NewLine, output.SummaryReports);
                    return(s);
                },
                    v =>
                {
                    output.SummaryReports = v.Split(new[] { Environment.NewLine, "\n" }, StringSplitOptions.RemoveEmptyEntries).Select(_ => _.Trim()).ToList();
                }
                    );
                layout.AddRow("EnergyPlus Summary Report:");
                layout.AddSeparateRow(sumReportsListBox);


                DefaultButton = new Button {
                    Text = "OK"
                };
                DefaultButton.Click += (sender, e) => {
                    Close(output);
                };

                AbortButton = new Button {
                    Text = "Cancel"
                };
                AbortButton.Click += (sender, e) => Close();

                var buttons = new TableLayout
                {
                    Padding = new Padding(5, 10, 5, 5),
                    Spacing = new Size(10, 10),
                    Rows    = { new TableRow(null, this.DefaultButton, this.AbortButton, null) }
                };

                layout.AddSeparateRow(buttons);
                layout.AddRow(null);
                //Create layout
                Content = layout;
            }
            catch (Exception e)
            {
                throw e;
            }
        }