System.Windows.Forms.Form.ShowDialog()

Here are the examples of the csharp api System.Windows.Forms.Form.ShowDialog() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

513 Examples 7

19 Source : NavigationTool.cs
with MIT License
from ahm3tcelik

public static void Open(Form currentForm, Form newForm)
        {     
            currentForm.Hide();
            newForm.ShowDialog();
            currentForm.Close();
        }

19 Source : NavigationTool.cs
with MIT License
from ahm3tcelik

public static void OpenNewTab(Form newForm)
        {
            newForm.ShowDialog();
        }

19 Source : Dialog.cs
with GNU General Public License v3.0
from alexgracianoarj

public void ShowDialog(Project project)
		{
			this.project = project;

			UpdateTexts();
            PolulateDotNetVersion();
            PopulateSolutionType();
            PopulateIdGeneratorType();
            PopulateMappingType();
            PopulateSqlToServerType();
			UpdateValues();
			ShowDialog();
			
			if (DialogResult == DialogResult.OK)
				Settings.Default.Save();
			else
				Settings.Default.Reload();
		}

19 Source : MembersDialog.cs
with GNU General Public License v3.0
from alexgracianoarj

public void ShowDialog(CompositeType parent, IEnumerable<IEnreplacedy> enreplacedies)
		{
			if (parent == null)
				return;

			this.parent = parent;
			this.Text = string.Format(Strings.MembersOfType, parent.Name);

            this.enreplacedies = new List<string>();
            this.enreplacedies.Add("(None)");
            this.enreplacedies.AddRange(enreplacedies.Select(ent => ent.Name).ToList());

            cboForeignKey.DataSource = this.enreplacedies;

			LanguageSpecificInitialization(parent.Language);
			FillMembersList();
			if (lstMembers.Items.Count > 0) {
				lstMembers.Items[0].Focused = true;
				lstMembers.Items[0].Selected = true;
			}

			toolNewField.Visible = parent.SupportsFields;
			toolNewConstructor.Visible = parent.SupportsConstuctors;
			toolNewDestructor.Visible = parent.SupportsDestructors;
			toolNewProperty.Visible = parent.SupportsProperties;
			toolNewEvent.Visible = parent.SupportsEvents;
			toolOverrideList.Visible = parent is SingleInharitanceType;
			toolImplementList.Visible = parent is IInterfaceImplementer;
			toolImplementList.Enabled = (parent is IInterfaceImplementer) &&
				((IInterfaceImplementer) parent).ImplementsInterface;
			toolSepAddNew.Visible = parent is SingleInharitanceType ||
				parent is IInterfaceImplementer;

			errorProvider.SetError(txtSyntax, null);
			errorProvider.SetError(txtName, null);
			errorProvider.SetError(cboType, null);
			error = false;

			base.ShowDialog();
		}

19 Source : StatusPanelTestForm.cs
with Apache License 2.0
from AmpScm

public static void TestForm()
        {
            using (Form f = new StatusPanelTestForm())
            {
                f.BackColor = Color.FromArgb(0xFF, 0xFF, 0xFF);
                f.ShowDialog();
            }
        }

19 Source : ScriptErrorForm.cs
with GNU General Public License v3.0
from anotak

public static void ShowError(string text)
        {
            ScriptErrorForm box = new ScriptErrorForm();
            box.acceptButton.Focus();
            box.acceptButton.Select();
            // i hate this, it's ugly, but it's too much of a pain to do it otherwise
            text = text.Replace("\n", Environment.NewLine);
            box.messageTextBox.Clear();
            box.messageTextBox.AppendText(text);

            box.ShowDialog();
        }

19 Source : ScriptMessageForm.cs
with GNU General Public License v3.0
from anotak

public static void ShowMessage(string text)
        {
            ScriptMessageForm box = new ScriptMessageForm();
            box.acceptButton.Focus();
            box.acceptButton.Select();
            // i hate this, it's ugly, but it's too much of a pain to do it otherwise
            text = text.Replace("\n", Environment.NewLine);
            box.messageTextBox.Clear();
            box.messageTextBox.AppendText(text);

            box.ShowDialog();
        }

19 Source : ScriptParamForm.cs
with GNU General Public License v3.0
from anotak

public static Dictionary<string,string> ShowParamsDialog(LuaUIParameters ui_parameters)
        {
            // ano - safer to replacedume data coming from a script is suspect
            if (ui_parameters.keys == null || ui_parameters.labels == null)
            {
                ScriptContext.context.Warn("Keys/labels were nil for taking script parameters. Possibly Lua API bug?");
                return null;
            }
            if (ui_parameters.keys.Count != ui_parameters.labels.Count)
            {
                ScriptContext.context.Warn("# keys must be equal to # labels for parameters dialog. Possibly Lua API bug?");
                return null;
            }

            // ano - really suspect
            if (ui_parameters.keys.Count > 384)
            {
                ScriptContext.context.Warn("# keys for script parameters can't be greater than 384");
                return null;
            }

            if (ui_parameters.defaultvalues == null)
            {
                ui_parameters.defaultvalues = new List<string>();
            }

            while (ui_parameters.defaultvalues.Count < ui_parameters.keys.Count)
            {
                ui_parameters.defaultvalues.Add(null);
            }

            ScriptParamForm form = new ScriptParamForm();
            for (int i = 0; i < ui_parameters.labels.Count; i++)
            {
                if (ui_parameters.defaultvalues[i] == null)
                {
                    form.paramsview.Rows.Add(ui_parameters.labels[i], "");
                }
                else
                {
                    form.paramsview.Rows.Add(ui_parameters.labels[i], ui_parameters.defaultvalues[i]);
                }

                if (ui_parameters.tooltips[i] != null && ui_parameters.tooltips[i].Length > 0)
                {
                    form.paramsview.Rows[i].Cells[0].ToolTipText = ui_parameters.tooltips[i];
                    form.paramsview.Rows[i].Cells[1].ToolTipText = ui_parameters.tooltips[i];
                }
            }

            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                Dictionary<string, string> output = new Dictionary<string, string>(ui_parameters.labels.Count);

                for (int i = 0; i < ui_parameters.labels.Count; i++)
                {
                    output.Add(ui_parameters.keys[i], form.paramsview.Rows[i].Cells[1].Value.ToString());
                }

                return output;
            }
            else
            {
                return null;
            }
        }

19 Source : ScriptTimeoutForm.cs
with GNU General Public License v3.0
from anotak

public static DialogResult ShowTimeout()
        {
            ScriptTimeoutForm form = new ScriptTimeoutForm();
            
            if (ScriptMode.bScriptDone)
            {
                return DialogResult.OK;
            }
            form.time.Start();
            return form.ShowDialog();
        }

19 Source : ScriptWarningForm.cs
with GNU General Public License v3.0
from anotak

public static bool AskUndo(string text)
        {
            ScriptWarningForm box = new ScriptWarningForm();
            box.acceptButton.Focus();
            box.acceptButton.Select();
            // i hate this, it's ugly, but it's too much of a pain to do it otherwise
            text = text.Replace("\n", Environment.NewLine);
            box.warningTextBox.Clear();
            box.warningTextBox.AppendText(text);
            
            return box.ShowDialog() == DialogResult.Cancel;
        }

19 Source : ItemSearchDialog.cs
with MIT License
from arasplm

public void ShowAsDialog(IWin32Window parentWindow = null)
		{
			this.ShowDialog();
		}

19 Source : BuildingInputForm.cs
with GNU General Public License v3.0
from architecture-building-systems

public DialogResult ShowDialog(BuildingInputState state)
        {
            State = state;
            return ShowDialog();
        }

19 Source : EnergySystemsInputForm.cs
with GNU General Public License v3.0
from architecture-building-systems

public DialogResult ShowDialog(EnergySystemsInputViewModel state)
        {
            State = state;
            return ShowDialog();
        }

19 Source : SliderUIAttributes.cs
with MIT License
from arup-group

public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
        {
            RectangleF rec = GrabBound;
            if (rec.Contains(e.CanvasLocation))
            {
                Grreplacedhopper.Kernel.Special.GH_NumberSlider hiddenSlider = new Grreplacedhopper.Kernel.Special.GH_NumberSlider();
                hiddenSlider.Slider.Maximum = (decimal)MaxValue;
                hiddenSlider.Slider.Minimum = (decimal)MinValue;
                hiddenSlider.Slider.DecimalPlaces = noDigits;
                hiddenSlider.Slider.Type = noDigits == 0 ? Grreplacedhopper.GUI.Base.GH_SliderAccuracy.Integer : Grreplacedhopper.GUI.Base.GH_SliderAccuracy.Float;
                hiddenSlider.Name = Owner.Name + " Slider";
                hiddenSlider.Slider.Value = (decimal)CurrentValue;
                Grreplacedhopper.GUI.GH_NumberSliderPopup gH_MenuSliderForm = new Grreplacedhopper.GUI.GH_NumberSliderPopup();
                GH_WindowsFormUtil.CenterFormOnCursor(gH_MenuSliderForm, true);
                gH_MenuSliderForm.Setup(hiddenSlider);
                //hiddenSlider.PopupEditor();
                var res = gH_MenuSliderForm.ShowDialog();
                if (res == DialogResult.OK)
                {
                    first = true;
                    MaxValue = (double)hiddenSlider.Slider.Maximum;
                    MinValue = (double)hiddenSlider.Slider.Minimum;
                    CurrentValue = (double)hiddenSlider.Slider.Value;
                    noDigits = hiddenSlider.Slider.Type == Grreplacedhopper.GUI.Base.GH_SliderAccuracy.Integer ? 0 : hiddenSlider.Slider.DecimalPlaces;
                    ChangeMaxMin(MaxValue, MinValue);
                    Owner.OnDisplayExpired(false);
                    Owner.ExpireSolution(true);
                    return GH_ObjectResponse.Handled;
                }
            }
            return GH_ObjectResponse.Ignore;
        }

19 Source : Configuration.cs
with MIT License
from Ashesh3

public void ShowWindow()
        {
            ConfigMail.Load();
            ConfigCaptcha.Load();

            BsMail.DataSource = ConfigMail.Running;
            BsCaptcha.DataSource = ConfigCaptcha.Running;

            Monitor.Enter(Misc.CaptchaConfigSync);
            Monitor.Enter(Misc.MailBoxConfigSync);
            var dialogResult = this.ShowDialog();
            Monitor.Exit(Misc.CaptchaConfigSync);
            Monitor.Exit(Misc.MailBoxConfigSync);

            if (dialogResult == DialogResult.OK)
            {
                ConfigMail.Save();
                ConfigCaptcha.Save();
            }
        }

19 Source : CaptchaDialog.cs
with MIT License
from Ashesh3

public DialogResult ShowDialog(out CaptchaSolution solution)
        {
            var result = this.ShowDialog();
            solution = this.Solution;
            return result;
        }

19 Source : ReCaptchaDialog.cs
with MIT License
from Ashesh3

public DialogResult ShowDialog(out CaptchaSolution solution)
        {
            btnReload_Click(null, null);

            var result = this.ShowDialog();
            solution = this.Solution;
            return result;
        }

19 Source : DialogBox.cs
with GNU General Public License v3.0
from audiamus

public static DialogResult ShowDialog(Form form)
		{
			CenterWindow centerWindow = new CenterWindow(IntPtr.Zero);
			DialogResult dlgResult = form.ShowDialog();
			centerWindow.Dispose();
			return dlgResult;
		}

19 Source : DialogBox.cs
with GNU General Public License v3.0
from audiamus

public static DialogResult ShowDialog(Form form, IWin32Window owner)
		{
			IntPtr handle = (owner == null) ? IntPtr.Zero: owner.Handle;
			CenterWindow centerWindow = new CenterWindow(handle);
			DialogResult dlgResult = form.ShowDialog();
			centerWindow.Dispose();
			return dlgResult;
		}

19 Source : Prompt.cs
with MIT License
from Autodesk-Forge

public static DialogResult ShowDialog(string label, string caption, string defaultValue, out string text)
    {
      Form prompt = new Form()
      {
        Width = 500,
        Height = 150,
        FormBorderStyle = FormBorderStyle.FixedDialog,
        Text = caption,
        StartPosition = FormStartPosition.CenterScreen
      };
      Label textLabel = new Label() { Left = 50, Top = 20, Text = label };
      TextBox textBox = new TextBox() { Left = 50, Top = 50, Width = 400 , Text =  defaultValue};
      Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK };
      confirmation.Click += (sender, e) => { prompt.Close(); };
      prompt.Controls.Add(textBox);
      prompt.Controls.Add(confirmation);
      prompt.Controls.Add(textLabel);
      prompt.AcceptButton = confirmation;

      DialogResult ret = prompt.ShowDialog();
      text = textBox.Text;
      return ret;
    }

19 Source : WinFormErrorDialog.cs
with GNU Lesser General Public License v2.1
from axiom3d

public void Show(Exception exception)
        {
            this.txtMsg.Text = exception.Message + Environment.NewLine + exception.StackTrace;
            this.cmdClose.Select();
            ShowDialog();
        }

19 Source : WinFormConfigurationDialog.cs
with GNU Lesser General Public License v2.1
from axiom3d

public new virtual DialogResult Show()
        {
            this.cmdOk.Select();
            return ShowDialog() == SWF.DialogResult.OK ? Configuration.DialogResult.Ok : Configuration.DialogResult.Cancel;
        }

19 Source : frmManager.cs
with MIT License
from AyrA

private void PreviewImage(Image I, string Name)
        {
            using (var frm = new Form())
            {
                frm.Text = "Preview of " + Name;
                frm.ShowIcon = frm.ShowInTaskbar = false;
                frm.WindowState = FormWindowState.Maximized;
                frm.BackgroundImageLayout = ImageLayout.Zoom;
                frm.BackgroundImage = I;
                Tools.SetupKeyHandlers(frm);
                frm.ShowDialog();
            }
        }

19 Source : FormSettings.cs
with MIT License
from bartekmotyl

public void ShowSettingsDialog()
        {
            VideoCutterSettings.Instance.LoadSettings();
            SettingsToGUI();
            this.ShowDialog();
        }

19 Source : FormBugReport.cs
with GNU General Public License v3.0
from biheBlockChain

public static void ShowBug(Exception bugInfo)
        {
            new FormBugReport(bugInfo).ShowDialog();
        }

19 Source : Settings.cs
with MIT License
from BizTalkCommunity

public static void updateSettings(out bool k)
        {
            new Settings().ShowDialog();
            k = ok;
            ok = false;
        }

19 Source : Password.cs
with MIT License
from BizTalkCommunity

public static void getPreplacedword(out bool ok_aux,out string preplacedword_aux)
        {
            new Preplacedword().ShowDialog();
            ok_aux = ok;
            ok = false;
            preplacedword_aux = preplacedword;
        }

19 Source : MultiPropertyDialog.cs
with MIT License
from BleuBleu

public void ShowDialogAsync(IWin32Window parent, Action<DialogResult> callback)
        {
            callback(ShowDialog());
        }

19 Source : MainApplicationContext.cs
with BSD 3-Clause "New" or "Revised" License
from Bluegrams

private void onAboutClicked(object sender, EventArgs e)
        {
            var aboutForm = new AboutForm(Resources.PinWinIconBlack.ToBitmap());
            aboutForm.AccentColor = Color.Black;
            aboutForm.UpdateChecker = updateChecker;
            aboutForm.StartPosition = FormStartPosition.CenterScreen;
            aboutForm.ShowDialog();
        }

19 Source : MainForm.cs
with BSD 3-Clause "New" or "Revised" License
from Bluegrams

private void AboutMenuItem_Click(object sender, EventArgs e)
        {
            var resMan = new ResourceManager(this.GetType());
            var img = ((Icon)resMan.GetObject("$this.Icon")).ToBitmap();
            AboutForm aboutForm = new AboutForm(img, showLanguageSelection: false);
            aboutForm.UpdateChecker = updateChecker;
            aboutForm.AccentColor = Color.FromArgb(16, 16, 16);
            aboutForm.TopMost = this.TopMost;
            aboutForm.ShowDialog();
        }

19 Source : DownloadDialog.cs
with MIT License
from BluePointLilac

protected override bool RunDialog(IntPtr hwndOwner)
        {
            using(Process process = Process.GetCurrentProcess())
            using(DownloadForm frm = new DownloadForm())
            {
                frm.Url = this.Url;
                frm.Text = this.Text;
                frm.FilePath = this.FilePath;
                return frm.ShowDialog() == DialogResult.OK;
            }
        }

19 Source : InputDialog.cs
with MIT License
from BluePointLilac

protected override bool RunDialog(IntPtr hwndOwner)
        {
            using(InputBox frm = new InputBox())
            {
                frm.Text = replacedle;
                frm.InputedText = this.Text;
                frm.Size = this.Size;
                Form owner = (Form)Control.FromHandle(hwndOwner);
                if(owner != null) frm.TopMost = owner.TopMost;
                bool flag = frm.ShowDialog() == DialogResult.OK;
                this.Text = flag ? frm.InputedText : null;
                return flag;
            }
        }

19 Source : SelectDialog.cs
with MIT License
from BluePointLilac

protected override bool RunDialog(IntPtr hwndOwner)
        {
            using(SelectForm frm = new SelectForm())
            {
                frm.Text = this.replacedle;
                frm.Items = this.Items;
                if(this.Selected != null) frm.Selected = this.Selected;
                else frm.SelectedIndex = this.SelectedIndex;
                frm.CanEdit = this.CanEdit;
                Form owner = (Form)Control.FromHandle(hwndOwner);
                if(owner != null) frm.TopMost = owner.TopMost;
                bool flag = frm.ShowDialog() == DialogResult.OK;
                if(flag)
                {
                    this.Selected = frm.Selected;
                    this.SelectedIndex = frm.SelectedIndex;
                }
                return flag;
            }
        }

19 Source : ITsiGuidItem.cs
with MIT License
from BluePointLilac

protected override bool RunDialog(IntPtr hwndOwner)
            {
                using(AddGuidDicForm frm = new AddGuidDicForm())
                {
                    frm.ItemText = this.ItemText;
                    frm.ItemIcon = this.ItemIcon;
                    frm.ItemIconPath = this.ItemIconPath;
                    frm.ItemIconIndex = this.ItemIconIndex;
                    frm.TopMost = AppConfig.TopMost;
                    bool flag = frm.ShowDialog() == DialogResult.OK;
                    if(flag)
                    {
                        this.ItemText = frm.ItemText;
                        this.ItemIcon = frm.ItemIcon;
                        this.ItemIconPath = frm.ItemIconPath;
                        this.ItemIconIndex = frm.ItemIconIndex;
                    }
                    this.IsDelete = frm.IsDelete;
                    return flag;
                }
            }

19 Source : LanguagesBox.cs
with MIT License
from BluePointLilac

protected override bool RunDialog(IntPtr hwndOwner)
            {
                using(TranslateForm frm = new TranslateForm())
                {
                    frm.TopMost = AppConfig.TopMost;
                    return frm.ShowDialog() == DialogResult.OK;
                }
            }

19 Source : ShellExecuteDialog.cs
with MIT License
from BluePointLilac

protected override bool RunDialog(IntPtr hwndOwner)
        {
            using(ShellExecuteForm frm = new ShellExecuteForm())
            {
                frm.TopMost = AppConfig.TopMost;
                bool flag = frm.ShowDialog() == DialogResult.OK;
                if(flag)
                {
                    this.Verb = frm.Verb;
                    this.WindowStyle = frm.WindowStyle;
                }
                return flag;
            }
        }

19 Source : DonateBox.cs
with MIT License
from BluePointLilac

protected override bool RunDialog(IntPtr hwndOwner)
            {
                using(DonateListForm frm = new DonateListForm())
                {
                    frm.ShowDonateList(DanateData);
                    MainForm mainForm = (MainForm)FromHandle(hwndOwner);
                    frm.Left = mainForm.Left + (mainForm.Width + mainForm.SideBar.Width - frm.Width) / 2;
                    frm.Top = mainForm.Top + 150.DpiZoom();
                    frm.TopMost = AppConfig.TopMost;
                    frm.ShowDialog();
                }
                return true;
            }

19 Source : ShellStoreDialog.cs
with MIT License
from BluePointLilac

protected override bool RunDialog(IntPtr hwndOwner)
        {
            using(ShellStoreForm frm = new ShellStoreForm(this.ShellPath, this.Filter, this.IsReference))
            {
                frm.TopMost = AppConfig.TopMost;
                bool flag = frm.ShowDialog() == DialogResult.OK;
                if(flag) this.SelectedKeyNames = frm.SelectedKeyNames;
                return flag;
            }
        }

19 Source : UpdateChannel.cs
with GNU General Public License v3.0
from BRH-Media

public static Enums.UpdateChannel ShowChannelSelector()
        {
            var frm = new UpdateChannel();
            frm.ShowDialog();

            //SelectedChannel is updated on RadioButton change
            return frm.SelectedChannel;
        }

19 Source : ImagePreviewer.cs
with GNU General Public License v3.0
from BRH-Media

public static void DisplayPreview(Image preview)
            => new ImagePreviewer { PreviewImage = preview }.ShowDialog();

19 Source : PxzExplorer.cs
with GNU General Public License v3.0
from BRH-Media

public static void ShowPxzExplorer(PxzFile file)
            => new PxzExplorer { Pxz = file }.ShowDialog();

19 Source : PxzExplorer.cs
with GNU General Public License v3.0
from BRH-Media

public static void ShowPxzExplorer()
            => new PxzExplorer().ShowDialog();

19 Source : FrmScreenShot.cs
with MIT License
from cdmxz

public virtual DialogResult Start(IntPtr windowHandle = default)
        {
            this.windowHandle = windowHandle;
            if (windowHandle != IntPtr.Zero)
            {
                // windowHandle不为空,则表示只针对某个窗口截图,而不是全屏截图
                Api.ShowWindowWait(windowHandle, Api.SW_SHOWNORMAL, 500);
                Rectangle rect = Api.GetWindowRectByHandle(windowHandle);
                screenImage = CopyScreen(rect.X, rect.Y, rect.Width, rect.Height);// 截取这个窗口的图片
            }
            else
                screenImage = CopyScreen(); // 截取全屏图片
            return this.ShowDialog();// 显示窗口
        }

19 Source : PnpDeviceForm.cs
with MIT License
from chanket

public CimInstance GetResult()
        {
            ShowDialog();
            return Retval;
        }

19 Source : PrinterService.cs
with GNU General Public License v3.0
from chilesystems

public void Print(string doreplacedentName, string printerName, bool debugMode = false)
        {
            if (string.IsNullOrEmpty(doreplacedentName))
                throw new ArgumentException("El parámetro 'doreplacedentName' no puede ser 'null' o estar vacío", doreplacedentName);

            if (string.IsNullOrEmpty(printerName))
                throw new ArgumentException("El parámetro 'printerName' no puede ser 'null' o estar vacío", printerName);

            if (Work == null)
                throw new ArgumentException("No se puede imprimir si la propiedad 'Work' es null", printerName);

            if (Work.Rows.Count == 0)
                return;

            PrintDoreplacedent pdoc = new PrintDoreplacedent();
            pdoc.DoreplacedentName = doreplacedentName;
            if (!debugMode)
                pdoc.PrintController = new StandardPrintController(); // hides status dialog popup

            pdoc.DefaultPageSettings.PaperSize = new PaperSize("Custom", 100, 200);
            pdoc.DefaultPageSettings.PaperSize.Height = Work.Rows.Count * 24; // Aprox
            pdoc.DefaultPageSettings.PaperSize.Width = 300;
            pdoc.PrintPage += new PrintPageEventHandler(PrintEvent);

            if (!debugMode)
            {
                PrinterSettings ps = new PrinterSettings();
                ps.PrinterName = printerName;
                pdoc.PrinterSettings = ps;
                pdoc.Print();
            }
            else
            {
                PrintPreviewDialog printPrvDlg = new PrintPreviewDialog();
                printPrvDlg.Doreplacedent = pdoc;
                printPrvDlg.Width = 1200;
                printPrvDlg.Height = 800;
                printPrvDlg.ShowDialog();
            }
        }

19 Source : EnterOpenApiSpecDialog.cs
with GNU General Public License v3.0
from christianhelle

public static EnterOpenApiSpecDialogResult GetResult()
        {
            DialogResult dialogResult;
            EnterOpenApiSpecDialogResult result;
            using (var form = new EnterOpenApiSpecDialog())
            {
                dialogResult = form.ShowDialog();
                result = form.Result;
            }

            return dialogResult == DialogResult.OK ? result : null;
        }

19 Source : BugReportForm.cs
with MIT License
from circles-arrows

public static DialogResult Show(Exception e)
        {
            using (var bugReportForm = new BugReportForm())
            {
                bugReportForm.Exception = e;
                return bugReportForm.ShowDialog();
            }
        }

19 Source : ErrorForm.cs
with MIT License
from circles-arrows

public static DialogResult Show(string message)
        {
            using (var errorForm = new ErrorForm())
            {
                errorForm.ErrorMessage = message;
                return errorForm.ShowDialog();
            }
        }

19 Source : CheckUpdate.cs
with GNU General Public License v3.0
from CoderJoeW

private void CheckUpdate_Load() {
            System.Threading.Thread updaterUI = new System.Threading.Thread(() => ShowDialog());
            updaterUI.Start();

            WebClient wc = new WebClient();
            string text = null;
            bool connectionFailed = true;

            while (text == null && connectionFailed) {
                label1.Text = "Connecting To Update Server";
                progressBar1.Value = 15;

                try {
                    System.IO.Stream stream = wc.OpenRead("http://deathcrow.altervista.org/update.php");
                    using (System.IO.StreamReader reader = new System.IO.StreamReader(stream)) {
                        text = reader.ReadToEnd();
                    }
                    connectionFailed = false;
                }
                catch (Exception ne) {
                    connectionFailed = true;
                    string errorMessage = string.Format("There was a problem connecting to the update server : {0}", ne.Message);

                    DialogResult userResponse = MessageBox.Show(errorMessage, "Failed to connect to server", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                    if (userResponse != DialogResult.Retry) {
                        label1.Text = "Update Failed";
                        progressBar1.Value = 0;
                        break;
                    }
                }
            }

            if (connectionFailed) { // Show the main window early and exit once it is closed. Temporary measure.
                Form1 form = new Form1();
                form.ShowDialog();

                updaterUI.Abort();

                Application.Exit();
                Environment.Exit(0);

            }

            string[] texts = text.Split(','); // It would be nice to have something that checks the server did not give a malformed response here

            label1.Text = "Checking For Update";
            progressBar1.Value = 25;

            if (thisVersion != texts[0]) {
                //Update Available
                UpdateAvailable form = new UpdateAvailable();
                form.Show();
            } else {
                //No update Available
                progressBar1.Value = 75;
                label1.Text = "Checking License Key";
                //Check License
                if (thisLicenseKey != texts[1]) {
                    //Invalid License
                    InvalidLicense form = new InvalidLicense();
                    form.Show();
                } else {
                    //Valid License
                    progressBar1.Value = 100;
                    label1.Text = "All up to date.";
                    //Load
                    Form1 form = new Form1();

                    form.ShowDialog();
                    updaterUI.Abort();
                }
            }
        }

19 Source : Program.cs
with MIT License
from codestackdev

[STAThread]
        static void Main(string[] args)
        {
            try
            {
                ParseArguments(args);

                var eDrwCtrl = new EDrawingsHost();

                eDrwCtrl.ControlLoaded += OnEdrawingsControlLoaded;

                var winForm = new Form();
                winForm.Controls.Add(eDrwCtrl);
                eDrwCtrl.Dock = DockStyle.Fill;
                winForm.ShowIcon = false;
                winForm.ShowInTaskbar = false;
                winForm.WindowState = FormWindowState.Minimized;
                winForm.ShowDialog();
            }
            catch (Exception ex)
            {
                PrintError(ex.Message);
            }
        }

See More Examples