aboutsummaryrefslogtreecommitdiff
path: root/source/ShiftUI/Dialogs
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-07-20 09:40:36 -0400
committerMichaelTheShifter <[email protected]>2016-07-20 09:40:36 -0400
commitd40fed5ce2bc806a91245adb18039634eac13ed0 (patch)
treef1d7168aee6db109ac2c738ad18c9db667a6ba69 /source/ShiftUI/Dialogs
parentf1856e8ed30ed882229fd3fa2a4038122a5fb441 (diff)
downloadshiftos-c--d40fed5ce2bc806a91245adb18039634eac13ed0.tar.gz
shiftos-c--d40fed5ce2bc806a91245adb18039634eac13ed0.tar.bz2
shiftos-c--d40fed5ce2bc806a91245adb18039634eac13ed0.zip
Move ShiftUI source code to ShiftOS
This'll be a lot easier to work on.
Diffstat (limited to 'source/ShiftUI/Dialogs')
-rw-r--r--source/ShiftUI/Dialogs/StringArrayDialog.cs558
-rw-r--r--source/ShiftUI/Dialogs/ThreadExceptionDialog.cs233
2 files changed, 791 insertions, 0 deletions
diff --git a/source/ShiftUI/Dialogs/StringArrayDialog.cs b/source/ShiftUI/Dialogs/StringArrayDialog.cs
new file mode 100644
index 0000000..5f99ff8
--- /dev/null
+++ b/source/ShiftUI/Dialogs/StringArrayDialog.cs
@@ -0,0 +1,558 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Drawing;
+
+namespace ShiftUI.Dialogs
+{
+ public interface IEditorDialog
+ {
+ object Value { get; }
+ void ShowEditor();
+ }
+
+ public class StringArrayDialog : Form, IEditorDialog
+ {
+ private string[] lines = null;
+
+ public object Value
+ {
+ get { return lines; }
+ }
+
+ public void ShowEditor()
+ {
+ this.StartPosition = FormStartPosition.CenterScreen;
+ this.ShowDialog();
+ }
+
+ public StringArrayDialog()
+ {
+ this.AllowTransparency = false;
+ this.AutoScale = true;
+ this.AutoScaleBaseSize = new Size(5, 13);
+ this.AutoScroll = false;
+ this.AutoSize = false;
+ this.AutoSizeMode = AutoSizeMode.GrowOnly;
+ this.AutoValidate = AutoValidate.Inherit;
+ this.BackColor = Color.FromArgb(240, 240, 240);
+ this.ClientSize = new Size(397, 391);
+ this.WidgetBox = true;
+ this.DesktopLocation = new Point(0, 0);
+ this.DialogResult = DialogResult.None;
+ this.FormBorderStyle = FormBorderStyle.Sizable;
+ this.HelpButton = false;
+ this.IsMdiContainer = false;
+ this.KeyPreview = false;
+ this.MaximizeBox = true;
+ this.MaximumSize = new Size(0, 0);
+ this.MinimizeBox = true;
+ this.MinimumSize = new Size(0, 0);
+ this.RightToLeftLayout = false;
+ this.ShowIcon = true;
+ this.ShowInTaskbar = true;
+ this.Size = new Size(397, 391);
+ this.SizeGripStyle = SizeGripStyle.Auto;
+ this.StartPosition = FormStartPosition.WindowsDefaultLocation;
+ this.TabIndex = 0;
+ this.TabStop = true;
+ this.TopLevel = true;
+ this.TopMost = false;
+ this.WindowState = FormWindowState.Normal;
+ this.Text = "String collection";
+ this.Location = new Point(0, 0);
+ this.AutoScaleMode = AutoScaleMode.Inherit;
+ this.AutoScrollMargin = new Size(0, 0);
+ this.AutoScrollMinSize = new Size(0, 0);
+ this.AutoScrollPosition = new Point(0, 0);
+ this.Alignment = (ContentAlignment)0;
+ this.AccessibleDefaultActionDescription = "";
+ this.AccessibleDescription = "";
+ this.AccessibleName = "";
+ this.AccessibleRole = AccessibleRole.Default;
+ this.AllowDrop = false;
+ this.Anchor = AnchorStyles.Top | AnchorStyles.Left;
+ this.AutoScrollOffset = new Point(0, 0);
+ this.BackgroundImageLayout = ImageLayout.Tile;
+ this.Capture = false;
+ this.CausesValidation = true;
+ this.Dock = DockStyle.None;
+ this.Enabled = true;
+ this.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ this.ForeColor = Color.FromArgb(0, 0, 0);
+ this.Height = 391;
+ this.ImeMode = ImeMode.NoControl;
+ this.IsAccessible = false;
+ this.Left = 0;
+ this.Name = "StringArrayDialog";
+ this.RightToLeft = RightToLeft.No;
+ this.Top = 0;
+ this.UseWaitCursor = false;
+ this.Visible = false;
+ this.Width = 397;
+
+ rtb_contents = new RichTextBox();
+ rtb_contents.AllowDrop = false;
+ rtb_contents.AutoSize = false;
+ rtb_contents.AutoWordSelection = false;
+ rtb_contents.BackgroundImageLayout = ImageLayout.Tile;
+ rtb_contents.BulletIndent = 0;
+ rtb_contents.DetectUrls = true;
+ rtb_contents.EnableAutoDragDrop = false;
+ rtb_contents.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ rtb_contents.ForeColor = Color.FromArgb(0, 0, 0);
+ rtb_contents.LanguageOption = RichTextBoxLanguageOptions.AutoFontSizeAdjust;
+ rtb_contents.MaxLength = 2147483647;
+ rtb_contents.Multiline = true;
+ rtb_contents.RichTextShortcutsEnabled = true;
+ rtb_contents.RightMargin = 0;
+ rtb_contents.ScrollBars = RichTextBoxScrollBars.Both;
+ rtb_contents.SelectedText = "";
+ rtb_contents.SelectionAlignment = HorizontalAlignment.Left;
+ rtb_contents.SelectionBackColor = Color.FromArgb(240, 240, 240);
+ rtb_contents.SelectionBullet = false;
+ rtb_contents.SelectionCharOffset = 0;
+ rtb_contents.SelectionColor = Color.FromArgb(0, 0, 0);
+ rtb_contents.SelectionFont = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ rtb_contents.SelectionHangingIndent = 0;
+ rtb_contents.SelectionIndent = 0;
+ rtb_contents.SelectionLength = 0;
+ rtb_contents.SelectionProtected = false;
+ rtb_contents.SelectionRightIndent = 0;
+ rtb_contents.ShowSelectionMargin = false;
+ rtb_contents.Text = "";
+ rtb_contents.AcceptsTab = false;
+ rtb_contents.BackColor = Color.FromArgb(255, 255, 255);
+ rtb_contents.BorderStyle = BorderStyle.Fixed3D;
+ rtb_contents.HideSelection = true;
+ rtb_contents.Modified = false;
+ rtb_contents.ReadOnly = false;
+ rtb_contents.SelectionStart = 0;
+ rtb_contents.ShortcutsEnabled = true;
+ rtb_contents.WordWrap = true;
+ rtb_contents.Alignment = (ContentAlignment)0;
+ rtb_contents.AccessibleDefaultActionDescription = "";
+ rtb_contents.AccessibleDescription = "";
+ rtb_contents.AccessibleName = "";
+ rtb_contents.AccessibleRole = AccessibleRole.Default;
+ rtb_contents.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ rtb_contents.AutoScrollOffset = new Point(0, 0);
+ rtb_contents.MaximumSize = new Size(0, 0);
+ rtb_contents.MinimumSize = new Size(0, 0);
+ rtb_contents.Capture = false;
+ rtb_contents.CausesValidation = true;
+ rtb_contents.ClientSize = new Size(372, 281);
+ rtb_contents.Dock = DockStyle.None;
+ rtb_contents.Enabled = true;
+ rtb_contents.Height = 285;
+ rtb_contents.ImeMode = ImeMode.NoControl;
+ rtb_contents.IsAccessible = false;
+ rtb_contents.Left = 10;
+ rtb_contents.Location = new Point(10, 65);
+ rtb_contents.Name = "rtb_contents";
+ rtb_contents.RightToLeft = RightToLeft.No;
+ rtb_contents.Size = new Size(376, 285);
+ rtb_contents.TabIndex = 0;
+ rtb_contents.TabStop = true;
+ rtb_contents.Top = 35;
+ rtb_contents.UseWaitCursor = false;
+ rtb_contents.Visible = true;
+ rtb_contents.Width = 376;
+
+ this.Widgets.Add(rtb_contents);
+ rtb_contents.Show();
+ lbtoplabel = new Label();
+ lbtoplabel.AutoEllipsis = false;
+ lbtoplabel.AutoSize = false;
+ lbtoplabel.BackgroundImageLayout = ImageLayout.Tile;
+ lbtoplabel.BorderStyle = BorderStyle.None;
+ lbtoplabel.FlatStyle = FlatStyle.Standard;
+ lbtoplabel.ImageAlign = ContentAlignment.MiddleCenter;
+ lbtoplabel.ImageIndex = -1;
+ lbtoplabel.ImageKey = "";
+ lbtoplabel.ImeMode = ImeMode.NoControl;
+ lbtoplabel.TabStop = false;
+ lbtoplabel.TextAlign = ContentAlignment.TopLeft;
+ lbtoplabel.UseMnemonic = true;
+ lbtoplabel.UseCompatibleTextRendering = true;
+ lbtoplabel.Text = "Enter each item on a separate line.";
+ lbtoplabel.Alignment = (ContentAlignment)0;
+ lbtoplabel.AccessibleDefaultActionDescription = "";
+ lbtoplabel.AccessibleDescription = "";
+ lbtoplabel.AccessibleName = "";
+ lbtoplabel.AccessibleRole = AccessibleRole.Default;
+ lbtoplabel.AllowDrop = false;
+ lbtoplabel.Anchor = AnchorStyles.Top | AnchorStyles.Left;
+ lbtoplabel.AutoScrollOffset = new Point(0, 0);
+ lbtoplabel.MaximumSize = new Size(0, 0);
+ lbtoplabel.MinimumSize = new Size(0, 0);
+ lbtoplabel.BackColor = Color.FromArgb(240, 240, 240);
+ lbtoplabel.Capture = false;
+ lbtoplabel.CausesValidation = true;
+ lbtoplabel.ClientSize = new Size(189, 23);
+ lbtoplabel.Dock = DockStyle.None;
+ lbtoplabel.Enabled = true;
+ lbtoplabel.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ lbtoplabel.ForeColor = Color.FromArgb(0, 0, 0);
+ lbtoplabel.Height = 23;
+ lbtoplabel.IsAccessible = false;
+ lbtoplabel.Left = 16;
+ lbtoplabel.Location = new Point(16, 45);
+ lbtoplabel.Name = "lbtoplabel";
+ lbtoplabel.RightToLeft = RightToLeft.No;
+ lbtoplabel.Size = new Size(189, 23);
+ lbtoplabel.TabIndex = 1;
+ lbtoplabel.Top = 15;
+ lbtoplabel.UseWaitCursor = false;
+ lbtoplabel.Visible = true;
+ lbtoplabel.Width = 189;
+
+ this.Widgets.Add(lbtoplabel);
+ lbtoplabel.Show();
+ btnok = new Button();
+ btnok.Click += (o, a) =>
+ {
+ this.DialogResult = DialogResult.OK;
+ lines = rtb_contents.Lines;
+ this.Close();
+ };
+ btnok.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ btnok.DialogResult = DialogResult.None;
+ btnok.AutoEllipsis = false;
+ btnok.AutoSize = true;
+ btnok.BackColor = Color.FromArgb(240, 240, 240);
+ btnok.FlatStyle = FlatStyle.Standard;
+ btnok.ImageAlign = ContentAlignment.MiddleCenter;
+ btnok.ImageIndex = -1;
+ btnok.ImageKey = "";
+ btnok.ImeMode = ImeMode.Disable;
+ btnok.Text = "OK";
+ btnok.TextAlign = ContentAlignment.MiddleCenter;
+ btnok.TextImageRelation = TextImageRelation.Overlay;
+ btnok.UseCompatibleTextRendering = true;
+ btnok.UseMnemonic = true;
+ btnok.UseVisualStyleBackColor = true;
+ btnok.Alignment = (ContentAlignment)0;
+ btnok.AccessibleDefaultActionDescription = "";
+ btnok.AccessibleDescription = "";
+ btnok.AccessibleName = "";
+ btnok.AccessibleRole = AccessibleRole.Default;
+ btnok.AllowDrop = false;
+ btnok.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ btnok.AutoScrollOffset = new Point(0, 0);
+ btnok.MaximumSize = new Size(0, 0);
+ btnok.MinimumSize = new Size(0, 0);
+ btnok.BackgroundImageLayout = ImageLayout.Tile;
+ btnok.Capture = false;
+ btnok.CausesValidation = true;
+ btnok.ClientSize = new Size(39, 23);
+ btnok.Dock = DockStyle.None;
+ btnok.Enabled = true;
+ btnok.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ btnok.ForeColor = Color.FromArgb(0, 0, 0);
+ btnok.Height = 23;
+ btnok.IsAccessible = false;
+ btnok.Left = 11;
+ btnok.Location = new Point(11, 355);
+ btnok.Name = "btnok";
+ btnok.RightToLeft = RightToLeft.No;
+ btnok.Size = new Size(39, 23);
+ btnok.TabIndex = 2;
+ btnok.TabStop = true;
+ btnok.Top = 325;
+ btnok.UseWaitCursor = false;
+ btnok.Visible = true;
+ btnok.Width = 39;
+
+ this.Widgets.Add(btnok);
+ btnok.Show();
+
+ }
+ public RichTextBox rtb_contents = null;
+ public Label lbtoplabel = null;
+ public Button btnok = null;
+ }
+
+ public class ComboBoxEditorDialog : Form, IEditorDialog
+ {
+ ComboBox.ObjectCollection lines = null;
+
+ public object Value
+ {
+ get {
+ return lines;
+ }
+ }
+
+ public void ShowEditor()
+ {
+ this.StartPosition = FormStartPosition.CenterScreen;
+ this.ShowDialog();
+ }
+
+ public ComboBoxEditorDialog(ComboBox owner)
+ {
+ this.AllowTransparency = false;
+ this.AutoScale = true;
+ this.AutoScaleBaseSize = new Size(5, 13);
+ this.AutoScroll = false;
+ this.AutoSize = false;
+ this.AutoSizeMode = AutoSizeMode.GrowOnly;
+ this.AutoValidate = AutoValidate.Inherit;
+ this.BackColor = Color.FromArgb(240, 240, 240);
+ this.ClientSize = new Size(397, 391);
+ this.WidgetBox = true;
+ this.DesktopLocation = new Point(0, 0);
+ this.DialogResult = DialogResult.None;
+ this.FormBorderStyle = FormBorderStyle.Sizable;
+ this.HelpButton = false;
+ this.IsMdiContainer = false;
+ this.KeyPreview = false;
+ this.MaximizeBox = true;
+ this.MaximumSize = new Size(0, 0);
+ this.MinimizeBox = true;
+ this.MinimumSize = new Size(0, 0);
+ this.RightToLeftLayout = false;
+ this.ShowIcon = true;
+ this.ShowInTaskbar = true;
+ this.Size = new Size(397, 391);
+ this.SizeGripStyle = SizeGripStyle.Auto;
+ this.StartPosition = FormStartPosition.WindowsDefaultLocation;
+ this.TabIndex = 0;
+ this.TabStop = true;
+ this.TopLevel = true;
+ this.TopMost = false;
+ this.WindowState = FormWindowState.Normal;
+ this.Text = "ComboBox item collection";
+ this.Location = new Point(0, 0);
+ this.AutoScaleMode = AutoScaleMode.Inherit;
+ this.AutoScrollMargin = new Size(0, 0);
+ this.AutoScrollMinSize = new Size(0, 0);
+ this.AutoScrollPosition = new Point(0, 0);
+ this.Alignment = (ContentAlignment)0;
+ this.AccessibleDefaultActionDescription = "";
+ this.AccessibleDescription = "";
+ this.AccessibleName = "";
+ this.AccessibleRole = AccessibleRole.Default;
+ this.AllowDrop = false;
+ this.Anchor = AnchorStyles.Top | AnchorStyles.Left;
+ this.AutoScrollOffset = new Point(0, 0);
+ this.BackgroundImageLayout = ImageLayout.Tile;
+ this.Capture = false;
+ this.CausesValidation = true;
+ this.Dock = DockStyle.None;
+ this.Enabled = true;
+ this.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ this.ForeColor = Color.FromArgb(0, 0, 0);
+ this.Height = 391;
+ this.ImeMode = ImeMode.NoControl;
+ this.IsAccessible = false;
+ this.Left = 0;
+ this.Name = "StringArrayDialog";
+ this.RightToLeft = RightToLeft.No;
+ this.Top = 0;
+ this.UseWaitCursor = false;
+ this.Visible = false;
+ this.Width = 397;
+
+ rtb_contents = new RichTextBox();
+ rtb_contents.AllowDrop = false;
+ rtb_contents.AutoSize = false;
+ rtb_contents.AutoWordSelection = false;
+ rtb_contents.BackgroundImageLayout = ImageLayout.Tile;
+ rtb_contents.BulletIndent = 0;
+ rtb_contents.DetectUrls = true;
+ rtb_contents.EnableAutoDragDrop = false;
+ rtb_contents.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ rtb_contents.ForeColor = Color.FromArgb(0, 0, 0);
+ rtb_contents.LanguageOption = RichTextBoxLanguageOptions.AutoFontSizeAdjust;
+ rtb_contents.MaxLength = 2147483647;
+ rtb_contents.Multiline = true;
+ rtb_contents.RichTextShortcutsEnabled = true;
+ rtb_contents.RightMargin = 0;
+ rtb_contents.ScrollBars = RichTextBoxScrollBars.Both;
+ rtb_contents.SelectedText = "";
+ rtb_contents.SelectionAlignment = HorizontalAlignment.Left;
+ rtb_contents.SelectionBackColor = Color.FromArgb(240, 240, 240);
+ rtb_contents.SelectionBullet = false;
+ rtb_contents.SelectionCharOffset = 0;
+ rtb_contents.SelectionColor = Color.FromArgb(0, 0, 0);
+ rtb_contents.SelectionFont = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ rtb_contents.SelectionHangingIndent = 0;
+ rtb_contents.SelectionIndent = 0;
+ rtb_contents.SelectionLength = 0;
+ rtb_contents.SelectionProtected = false;
+ rtb_contents.SelectionRightIndent = 0;
+ rtb_contents.ShowSelectionMargin = false;
+ rtb_contents.Text = "";
+ rtb_contents.AcceptsTab = false;
+ rtb_contents.BackColor = Color.FromArgb(255, 255, 255);
+ rtb_contents.BorderStyle = BorderStyle.Fixed3D;
+ rtb_contents.HideSelection = true;
+ rtb_contents.Modified = false;
+ rtb_contents.ReadOnly = false;
+ rtb_contents.SelectionStart = 0;
+ rtb_contents.ShortcutsEnabled = true;
+ rtb_contents.WordWrap = true;
+ rtb_contents.Alignment = (ContentAlignment)0;
+ rtb_contents.AccessibleDefaultActionDescription = "";
+ rtb_contents.AccessibleDescription = "";
+ rtb_contents.AccessibleName = "";
+ rtb_contents.AccessibleRole = AccessibleRole.Default;
+ rtb_contents.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ rtb_contents.AutoScrollOffset = new Point(0, 0);
+ rtb_contents.MaximumSize = new Size(0, 0);
+ rtb_contents.MinimumSize = new Size(0, 0);
+ rtb_contents.Capture = false;
+ rtb_contents.CausesValidation = true;
+ rtb_contents.ClientSize = new Size(372, 281);
+ rtb_contents.Dock = DockStyle.None;
+ rtb_contents.Enabled = true;
+ rtb_contents.Height = 285;
+ rtb_contents.ImeMode = ImeMode.NoControl;
+ rtb_contents.IsAccessible = false;
+ rtb_contents.Left = 10;
+ rtb_contents.Location = new Point(10, 65);
+ rtb_contents.Name = "rtb_contents";
+ rtb_contents.RightToLeft = RightToLeft.No;
+ rtb_contents.Size = new Size(376, 285);
+ rtb_contents.TabIndex = 0;
+ rtb_contents.TabStop = true;
+ rtb_contents.Top = 35;
+ rtb_contents.UseWaitCursor = false;
+ rtb_contents.Visible = true;
+ rtb_contents.Width = 376;
+ foreach(var line in owner.Items)
+ {
+ if (string.IsNullOrEmpty(rtb_contents.Text))
+ {
+ rtb_contents.Text += "\r\n" + line.ToString();
+ }
+ else
+ {
+ rtb_contents.Text += "\r\n" + line.ToString();
+ }
+ }
+
+ this.Widgets.Add(rtb_contents);
+ rtb_contents.Show();
+ lbtoplabel = new Label();
+ lbtoplabel.AutoEllipsis = false;
+ lbtoplabel.AutoSize = false;
+ lbtoplabel.BackgroundImageLayout = ImageLayout.Tile;
+ lbtoplabel.BorderStyle = BorderStyle.None;
+ lbtoplabel.FlatStyle = FlatStyle.Standard;
+ lbtoplabel.ImageAlign = ContentAlignment.MiddleCenter;
+ lbtoplabel.ImageIndex = -1;
+ lbtoplabel.ImageKey = "";
+ lbtoplabel.ImeMode = ImeMode.NoControl;
+ lbtoplabel.TabStop = false;
+ lbtoplabel.TextAlign = ContentAlignment.TopLeft;
+ lbtoplabel.UseMnemonic = true;
+ lbtoplabel.UseCompatibleTextRendering = true;
+ lbtoplabel.Text = "Enter each item on a separate line.";
+ lbtoplabel.Alignment = (ContentAlignment)0;
+ lbtoplabel.AccessibleDefaultActionDescription = "";
+ lbtoplabel.AccessibleDescription = "";
+ lbtoplabel.AccessibleName = "";
+ lbtoplabel.AccessibleRole = AccessibleRole.Default;
+ lbtoplabel.AllowDrop = false;
+ lbtoplabel.Anchor = AnchorStyles.Top | AnchorStyles.Left;
+ lbtoplabel.AutoScrollOffset = new Point(0, 0);
+ lbtoplabel.MaximumSize = new Size(0, 0);
+ lbtoplabel.MinimumSize = new Size(0, 0);
+ lbtoplabel.BackColor = Color.FromArgb(240, 240, 240);
+ lbtoplabel.Capture = false;
+ lbtoplabel.CausesValidation = true;
+ lbtoplabel.ClientSize = new Size(189, 23);
+ lbtoplabel.Dock = DockStyle.None;
+ lbtoplabel.Enabled = true;
+ lbtoplabel.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ lbtoplabel.ForeColor = Color.FromArgb(0, 0, 0);
+ lbtoplabel.Height = 23;
+ lbtoplabel.IsAccessible = false;
+ lbtoplabel.Left = 16;
+ lbtoplabel.Location = new Point(16, 45);
+ lbtoplabel.Name = "lbtoplabel";
+ lbtoplabel.RightToLeft = RightToLeft.No;
+ lbtoplabel.Size = new Size(189, 23);
+ lbtoplabel.TabIndex = 1;
+ lbtoplabel.Top = 15;
+ lbtoplabel.UseWaitCursor = false;
+ lbtoplabel.Visible = true;
+ lbtoplabel.Width = 189;
+
+ this.Widgets.Add(lbtoplabel);
+ lbtoplabel.Show();
+ btnok = new Button();
+ btnok.Click += (o, a) =>
+ {
+ this.DialogResult = DialogResult.OK;
+ lines = new ComboBox.ObjectCollection(owner);
+ foreach(var line in rtb_contents.Lines)
+ {
+ lines.Add(line);
+ }
+ this.Close();
+ };
+ btnok.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ btnok.DialogResult = DialogResult.None;
+ btnok.AutoEllipsis = false;
+ btnok.AutoSize = true;
+ btnok.BackColor = Color.FromArgb(240, 240, 240);
+ btnok.FlatStyle = FlatStyle.Standard;
+ btnok.ImageAlign = ContentAlignment.MiddleCenter;
+ btnok.ImageIndex = -1;
+ btnok.ImageKey = "";
+ btnok.ImeMode = ImeMode.Disable;
+ btnok.Text = "OK";
+ btnok.TextAlign = ContentAlignment.MiddleCenter;
+ btnok.TextImageRelation = TextImageRelation.Overlay;
+ btnok.UseCompatibleTextRendering = true;
+ btnok.UseMnemonic = true;
+ btnok.UseVisualStyleBackColor = true;
+ btnok.Alignment = (ContentAlignment)0;
+ btnok.AccessibleDefaultActionDescription = "";
+ btnok.AccessibleDescription = "";
+ btnok.AccessibleName = "";
+ btnok.AccessibleRole = AccessibleRole.Default;
+ btnok.AllowDrop = false;
+ btnok.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ btnok.AutoScrollOffset = new Point(0, 0);
+ btnok.MaximumSize = new Size(0, 0);
+ btnok.MinimumSize = new Size(0, 0);
+ btnok.BackgroundImageLayout = ImageLayout.Tile;
+ btnok.Capture = false;
+ btnok.CausesValidation = true;
+ btnok.ClientSize = new Size(39, 23);
+ btnok.Dock = DockStyle.None;
+ btnok.Enabled = true;
+ btnok.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0);
+ btnok.ForeColor = Color.FromArgb(0, 0, 0);
+ btnok.Height = 23;
+ btnok.IsAccessible = false;
+ btnok.Left = 11;
+ btnok.Location = new Point(11, 355);
+ btnok.Name = "btnok";
+ btnok.RightToLeft = RightToLeft.No;
+ btnok.Size = new Size(39, 23);
+ btnok.TabIndex = 2;
+ btnok.TabStop = true;
+ btnok.Top = 325;
+ btnok.UseWaitCursor = false;
+ btnok.Visible = true;
+ btnok.Width = 39;
+
+ this.Widgets.Add(btnok);
+ btnok.Show();
+
+ }
+ public RichTextBox rtb_contents = null;
+ public Label lbtoplabel = null;
+ public Button btnok = null;
+
+ }
+
+}
diff --git a/source/ShiftUI/Dialogs/ThreadExceptionDialog.cs b/source/ShiftUI/Dialogs/ThreadExceptionDialog.cs
new file mode 100644
index 0000000..9bfc2fb
--- /dev/null
+++ b/source/ShiftUI/Dialogs/ThreadExceptionDialog.cs
@@ -0,0 +1,233 @@
+//
+// ShiftUI.ThreadExceptionDialog.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Authors:
+// Marek Safar [email protected]
+//
+// Copyright (C) Novell Inc., 2004
+
+// COMPLETE - BUT DISABLED TEXTBOX
+
+using System;
+using System.Drawing;
+using System.Text;
+using System.Reflection;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace ShiftUI
+{
+ [ComVisible (true)]
+ [ClassInterface (ClassInterfaceType.AutoDispatch)]
+ public class ThreadExceptionDialog: Form
+ {
+ Exception e;
+ bool details;
+
+ private ShiftUI.Button buttonIgnore;
+ private ShiftUI.Button buttonAbort;
+ private ShiftUI.Button buttonDetails;
+ private ShiftUI.Label labelException;
+ private ShiftUI.Label label1;
+ private ShiftUI.TextBox textBoxDetails;
+ private ShiftUI.Label helpText;
+
+ private void InitializeComponent()
+ {
+ this.helpText = new ShiftUI.Label();
+ this.buttonAbort = new ShiftUI.Button();
+ this.buttonIgnore = new ShiftUI.Button();
+ this.buttonDetails = new ShiftUI.Button();
+ this.labelException = new ShiftUI.Label();
+ this.textBoxDetails = new ShiftUI.TextBox();
+ this.label1 = new ShiftUI.Label();
+ this.SuspendLayout();
+ //
+ // helpText
+ //
+ this.helpText.Location = new System.Drawing.Point(60, 8);
+ this.helpText.Name = "helpText";
+ this.helpText.Size = new System.Drawing.Size(356, 40);
+ this.helpText.TabIndex = 0;
+ this.helpText.Text = "An unhandled exception has occurred in you application. If you click Ignore the a" +
+ "pplication will ignore this error and attempt to continue. If you click Abort, t" +
+ "he application will quit immediately.";
+ //
+ // buttonAbort
+ //
+ this.buttonAbort.DialogResult = ShiftUI.DialogResult.Abort;
+ this.buttonAbort.Location = new System.Drawing.Point(332, 112);
+ this.buttonAbort.Name = "buttonAbort";
+ this.buttonAbort.Size = new System.Drawing.Size(85, 23);
+ this.buttonAbort.TabIndex = 4;
+ this.buttonAbort.Text = "&Abort";
+ this.buttonAbort.Click += new System.EventHandler(this.buttonAbort_Click);
+ //
+ // buttonIgnore
+ //
+ this.buttonIgnore.DialogResult = ShiftUI.DialogResult.Ignore;
+ this.buttonIgnore.Location = new System.Drawing.Point(236, 112);
+ this.buttonIgnore.Name = "buttonIgnore";
+ this.buttonIgnore.Size = new System.Drawing.Size(85, 23);
+ this.buttonIgnore.TabIndex = 3;
+ this.buttonIgnore.Text = "&Ignore";
+ //
+ // buttonDetails
+ //
+ this.buttonDetails.Location = new System.Drawing.Point(140, 112);
+ this.buttonDetails.Name = "buttonDetails";
+ this.buttonDetails.Size = new System.Drawing.Size(85, 23);
+ this.buttonDetails.TabIndex = 2;
+ this.buttonDetails.Text = "Show &Details";
+ this.buttonDetails.Click += new System.EventHandler(this.buttonDetails_Click);
+ //
+ // labelException
+ //
+ this.labelException.Location = new System.Drawing.Point(60, 64);
+ this.labelException.Name = "labelException";
+ this.labelException.Size = new System.Drawing.Size(356, 32);
+ this.labelException.TabIndex = 1;
+ //
+ // textBoxDetails
+ //
+ this.textBoxDetails.Location = new System.Drawing.Point(8, 168);
+ this.textBoxDetails.Multiline = true;
+ this.textBoxDetails.Name = "textBoxDetails";
+ this.textBoxDetails.ReadOnly = true;
+ this.textBoxDetails.ScrollBars = ShiftUI.ScrollBars.Both;
+ this.textBoxDetails.Size = new System.Drawing.Size(408, 196);
+ this.textBoxDetails.TabIndex = 5;
+ this.textBoxDetails.TabStop = false;
+ this.textBoxDetails.Text = "";
+ this.textBoxDetails.WordWrap = false;
+ //
+ // label1
+ //
+ this.label1.Location = new System.Drawing.Point(8, 148);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(100, 16);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Exception details";
+ //
+ // ThreadExceptionDialog
+ //
+ this.AcceptButton = this.buttonIgnore;
+ this.CancelButton = this.buttonAbort;
+ this.ClientSize = new System.Drawing.Size(428, 374);
+ this.Widgets.Add(this.label1);
+ this.Widgets.Add(this.textBoxDetails);
+ this.Widgets.Add(this.labelException);
+ this.Widgets.Add(this.buttonDetails);
+ this.Widgets.Add(this.buttonIgnore);
+ this.Widgets.Add(this.buttonAbort);
+ this.Widgets.Add(this.helpText);
+ this.FormBorderStyle = ShiftUI.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "ThreadExceptionDialog";
+ this.ShowInTaskbar = false;
+ this.StartPosition = ShiftUI.FormStartPosition.CenterScreen;
+ this.TopMost = true;
+ this.Paint += new PaintEventHandler (PaintHandler);
+ this.ResumeLayout(false);
+ }
+
+ public ThreadExceptionDialog (Exception t)
+ {
+ this.e = t;
+ InitializeComponent ();
+
+ this.labelException.Text = t.Message;
+ if (Form.ActiveForm != null)
+ this.Text = Form.ActiveForm.Text;
+ else
+ this.Text = "Mono";
+ this.buttonAbort.Enabled = Application.AllowQuit;
+ RefreshDetails ();
+ FillExceptionDetails ();
+ }
+
+ void buttonDetails_Click(object sender, System.EventArgs e)
+ {
+ details = !details;
+ RefreshDetails ();
+ }
+
+ void FillExceptionDetails ()
+ {
+ StringBuilder sb = new StringBuilder ();
+ sb.Append (e.ToString ());
+ sb.Append (Environment.NewLine + Environment.NewLine);
+ sb.Append ("Loaded assemblies:" + Environment.NewLine + Environment.NewLine);
+
+ foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies ()) {
+ AssemblyName an = a.GetName ();
+ sb.AppendFormat ("Name:\t{0}" + Environment.NewLine, an.Name);
+ sb.AppendFormat ("Version:\t{0}" + Environment.NewLine, an.Version);
+ sb.AppendFormat ("Location:\t{0}" + Environment.NewLine, an.CodeBase);
+ sb.Append (Environment.NewLine);
+ }
+ textBoxDetails.Text = sb.ToString ();
+ }
+
+ void RefreshDetails ()
+ {
+ if (details) {
+ buttonDetails.Text = "Hide &Details";
+ Height = 410;
+ label1.Visible = true;
+ textBoxDetails.Visible = true;
+ return;
+ }
+ buttonDetails.Text = "Show &Details";
+ label1.Visible = false;
+ textBoxDetails.Visible = false;
+ Height = 180;
+ }
+
+ void buttonAbort_Click(object sender, System.EventArgs e)
+ {
+ Application.Exit ();
+ }
+
+ void PaintHandler (object o, PaintEventArgs args)
+ {
+ Graphics g = args.Graphics;
+ g.DrawIcon (SystemIcons.Error, 15, 10);
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ public override bool AutoSize {
+ get { return base.AutoSize; }
+ set { base.AutoSize = value; }
+ }
+
+ [Browsable (false)]
+ [EditorBrowsable (EditorBrowsableState.Never)]
+ public new event EventHandler AutoSizeChanged {
+ add { base.AutoSizeChanged += value; }
+ remove { base.AutoSizeChanged -= value; }
+ }
+ }
+}