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 View Source File : NavigationTool.cs
License : MIT License
Project Creator : ahm3tcelik

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

19 View Source File : NavigationTool.cs
License : MIT License
Project Creator : ahm3tcelik

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

19 View Source File : Dialog.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : MembersDialog.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : StatusPanelTestForm.cs
License : Apache License 2.0
Project Creator : AmpScm

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

19 View Source File : ScriptErrorForm.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : ScriptMessageForm.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : ScriptParamForm.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : ScriptTimeoutForm.cs
License : GNU General Public License v3.0
Project Creator : anotak

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

19 View Source File : ScriptWarningForm.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : ItemSearchDialog.cs
License : MIT License
Project Creator : arasplm

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

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

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

19 View Source File : SliderUIAttributes.cs
License : MIT License
Project Creator : 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 View Source File : Configuration.cs
License : MIT License
Project Creator : 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 View Source File : CaptchaDialog.cs
License : MIT License
Project Creator : Ashesh3

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

19 View Source File : ReCaptchaDialog.cs
License : MIT License
Project Creator : Ashesh3

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

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

19 View Source File : DialogBox.cs
License : GNU General Public License v3.0
Project Creator : audiamus

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

19 View Source File : DialogBox.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : Prompt.cs
License : MIT License
Project Creator : 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 View Source File : WinFormErrorDialog.cs
License : GNU Lesser General Public License v2.1
Project Creator : axiom3d

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

19 View Source File : WinFormConfigurationDialog.cs
License : GNU Lesser General Public License v2.1
Project Creator : axiom3d

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

19 View Source File : frmManager.cs
License : MIT License
Project Creator : 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 View Source File : FormSettings.cs
License : MIT License
Project Creator : bartekmotyl

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

19 View Source File : FormBugReport.cs
License : GNU General Public License v3.0
Project Creator : biheBlockChain

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

19 View Source File : Settings.cs
License : MIT License
Project Creator : BizTalkCommunity

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

19 View Source File : Password.cs
License : MIT License
Project Creator : 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 View Source File : MultiPropertyDialog.cs
License : MIT License
Project Creator : BleuBleu

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

19 View Source File : MainApplicationContext.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : 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 View Source File : MainForm.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : 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 View Source File : DownloadDialog.cs
License : MIT License
Project Creator : 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 View Source File : InputDialog.cs
License : MIT License
Project Creator : 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 View Source File : SelectDialog.cs
License : MIT License
Project Creator : 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 View Source File : ITsiGuidItem.cs
License : MIT License
Project Creator : 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 View Source File : LanguagesBox.cs
License : MIT License
Project Creator : BluePointLilac

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

19 View Source File : ShellExecuteDialog.cs
License : MIT License
Project Creator : 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 View Source File : DonateBox.cs
License : MIT License
Project Creator : 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 View Source File : ShellStoreDialog.cs
License : MIT License
Project Creator : 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 View Source File : UpdateChannel.cs
License : GNU General Public License v3.0
Project Creator : BRH-Media

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

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

19 View Source File : ImagePreviewer.cs
License : GNU General Public License v3.0
Project Creator : BRH-Media

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

19 View Source File : PxzExplorer.cs
License : GNU General Public License v3.0
Project Creator : BRH-Media

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

19 View Source File : PxzExplorer.cs
License : GNU General Public License v3.0
Project Creator : BRH-Media

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

19 View Source File : FrmScreenShot.cs
License : MIT License
Project Creator : 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 View Source File : PnpDeviceForm.cs
License : MIT License
Project Creator : chanket

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

19 View Source File : PrinterService.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : EnterOpenApiSpecDialog.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : BugReportForm.cs
License : MIT License
Project Creator : circles-arrows

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

19 View Source File : ErrorForm.cs
License : MIT License
Project Creator : circles-arrows

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

19 View Source File : CheckUpdate.cs
License : GNU General Public License v3.0
Project Creator : 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 View Source File : Program.cs
License : MIT License
Project Creator : 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