当前位置: 首页>>代码示例>>C#>>正文


C# System.ShowDialog方法代码示例

本文整理汇总了C#中System.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# System.ShowDialog方法的具体用法?C# System.ShowDialog怎么用?C# System.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Login

        private void Login(System.Windows.Window loginView)
        {
            //  ログイン画面が閉じられた時にアプリケーションが終了しないよう、OnExplicitShutdownを設定しておく
            Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var isLoggedin = loginView.ShowDialog() ?? false;
            var isAuthenticated = Thread.CurrentPrincipal.Identity.IsAuthenticated;

            if (isLoggedin && isAuthenticated)
            {
                //  MainWindowが閉じられた時にアプリケーションが終了するように変更
                Current.ShutdownMode = ShutdownMode.OnMainWindowClose;

                var vm = new LoggedinViewModel();
                vm.UserName = Thread.CurrentPrincipal.Identity.Name;

                var loggedinView = new LoggedinView();
                loggedinView.DataContext = vm;

                Current.MainWindow = loggedinView;
                loggedinView.ShowDialog();
            }
            else
            {
                //  OnExplicitShutdownの場合、明示的なShutdown()呼び出しが必要
                Current.Shutdown(-1);
            }
        }
开发者ID:Grandge,项目名称:CSharp-Sample,代码行数:28,代码来源:App.xaml.cs

示例2: CreateDialogForm

 public static bool CreateDialogForm(System.Windows.Forms.Form childForm)
 {
     try
     {
         if (childForm.Tag != null)
         {
             if (Services.Security.checkForm(childForm.Tag.ToString().ToUpper(), Variables.UserInfo))
             {
                 childForm.ShowInTaskbar = false;
                 childForm.ShowDialog();
                 return true;
             }
             else
             {
                 MessageBox.Show("Уучлаарай! Та хандах эрхгүй байна.", "Анхааруулга", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return false;
             }
         }
         else
         {
             MessageBox.Show("Уучлаарай! Энд хандах боломжгүй байна.", "Анхааруулга", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return false;
         }
     }
     catch (Exception Err)
     {
         MessageBox.Show("Дараахи алдаа гарлаа : " + Err.Message.ToString(), "Алдаа", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
     }
 }
开发者ID:Chuluunsukh,项目名称:VS_tabi,代码行数:30,代码来源:Function.cs

示例3: DimAndShowDialog

 public static System.Windows.Forms.DialogResult DimAndShowDialog(this System.Windows.Forms.Form parentForm, System.Windows.Forms.Form dlg)
 {
     System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.None;
     var dimForm = new System.Windows.Forms.Form()
     {
         Text = "",
         ControlBox = false,
         FormBorderStyle = System.Windows.Forms.FormBorderStyle.None,
         Size = parentForm.Size,
         Location = parentForm.Location,
         BackColor = System.Drawing.Color.Black,
         ShowInTaskbar = false,
         Opacity = .5
     };
     dlg.FormClosing += (oSender, oE) =>
     {
         dimForm.Close();
         dimForm = null;
     };
     dimForm.Shown += (oSender, oE) =>
     {
         dimForm.Location = parentForm.Location;
         result = dlg.ShowDialog();
         parentForm.Focus();
     };
     dimForm.ShowDialog();
     return result;
 }
开发者ID:nguyendung622,项目名称:GymFitnessOlympic,代码行数:28,代码来源:DialogUtils.cs

示例4: ReadData

        public static List<List<double>> ReadData(System.Windows.Forms.OpenFileDialog openFileDialog1)
        {
            //получи результат в объект data
            List<List<double>> data = new List<List<double>>();
            data.Add(new List<double>());
            data.Add(new List<double>());
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                StreamReader ds = new StreamReader(openFileDialog1.FileName);
                string TextFile = ds.ReadToEnd();
                string[] split = TextFile.Split(new Char[] { '\n' });
                for (int i = 0; i < split.Length; i++)
                {
                    if (split[i].Length == 0)
                        break;
                    string[] tmpMass = split[i].Split(new Char[] {','});

                    data[0].Add(Convert.ToDouble(tmpMass[0]));
                    data[1].Add(Convert.ToDouble(tmpMass[1]));
                }
                if (data[0].Count != data[1].Count)
                {
                    data[0].RemoveAt(data[0].Count - 1);
                }
                ds.Close();
               
            return data;
        }
    }
开发者ID:okek,项目名称:YASP2012,代码行数:29,代码来源:Reader.cs

示例5: retornaFila

        public DataRow retornaFila()
        {
            Formas.fCatalogo f = new SOPORTEC.Formas.fCatalogo(dt,"Nombre del Catalogo",2, );
                f.ShowDialog();
                rw = f.fila;
                f.Close();
                f.Dispose();

            return rw;
        }
开发者ID:mchevez,项目名称:pruebagithub,代码行数:10,代码来源:cCatalogoSimple.cs

示例6: SaveGame

        /// <summary>
        /// Function to save the game.
        /// </summary>
        /// <param name="sfd">Object class SaveFileDialog.</param>
        /// <param name="d">Object class Debra.</param>
        /// <param name="g">Object of the Game class.</param>
        /// <param name="ai">Object class Squad (detachment of the computer).</param>
        /// <param name="pl">Object class Squad (squad players).</param>
        public void SaveGame(System.Windows.Forms.SaveFileDialog sfd, Debra d, Game g, Squad ai, Squad pl)
        {
            if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            using (Stream save = File.Open(sfd.FileName, FileMode.Create))
            using (var sw = new StreamWriter(save))
            {
                // TODO: Нормально реализовать данный функционал, а не как было.
            }
        }
开发者ID:7BF794B0,项目名称:GFZ,代码行数:18,代码来源:Memento.cs

示例7: LoadGame

        /// <summary>
        /// Function to loading games.
        /// </summary>
        /// <param name="ofd">Object class OpenFileDialog.</param>
        /// <param name="d">Object class Debra.</param>
        /// <param name="g">Object of the Game class.</param>
        /// <param name="ai">Object class Squad (detachment of the computer).</param>
        /// <param name="pl">Object class Squad (squad players).</param>
        public void LoadGame(System.Windows.Forms.OpenFileDialog ofd, Debra d, Game g, Squad ai, Squad pl)
        {
            if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            using (Stream save = File.Open(ofd.FileName, FileMode.Open))
            using (var sr = new StreamReader(save))
            {
                // TODO: Нормально реализовать данный функционал, а не как было.
            }
        }
开发者ID:7BF794B0,项目名称:GFZ,代码行数:18,代码来源:Memento.cs

示例8: BrowseFile

 public static string[] BrowseFile(System.Windows.Forms.FileDialog openFileDialog)
 {
     string[] fileNames = new string[1];
     DialogResult dlgRes = openFileDialog.ShowDialog();
     if (dlgRes == DialogResult.OK)
     {
         // store the selected filename on the currentFile
         fileNames = openFileDialog.FileNames;
     }
     else
     {
         fileNames = null;
     }
     return fileNames;
 }
开发者ID:majedline,项目名称:net-scrum-scrumqueue,代码行数:15,代码来源:Common.cs

示例9: InternalShowModalWindow

		internal bool? InternalShowModalWindow(System.Windows.Window w)
		{
			if (null == w)
				throw new ArgumentNullException("w");

			w.Owner = TopmostModalWindow;
			_modalWindows.Push(w);
			try
			{
				return w.ShowDialog();
			}
			finally
			{
				_modalWindows.Pop();
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:16,代码来源:GuiFactoryServiceWpfWin.cs

示例10: ShowDialogWithModel

 public bool? ShowDialogWithModel(System.Windows.Window view, DialogType dialogType, DialogViewModel viewModel)
 {
     if (view == null)
     {
         throw new ArgumentNullException("view");
     }
     view.Owner = this.Window;
     view.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     view.ShowInTaskbar = false;
     if (viewModel != null)
     {
         viewModel.Init();
         view.DataContext = viewModel;
     }
     if (dialogType == DialogType.Modal)
     {
         return view.ShowDialog();
     }
     view.Show();
     return null;
 }
开发者ID:netonjm,项目名称:WindowsPhone,代码行数:21,代码来源:WindowAdapter.cs

示例11: ShowPrintDialog

		private static void ShowPrintDialog(System.Windows.Forms.PrintDialog dlg)
		{
			if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
			{
				try
				{
					dlg.Document.Print();
				}
				catch (Win32Exception)
				{
					//Printing was canceled
				}
			}
		}
开发者ID:Patagames,项目名称:Pdf.Wpf,代码行数:14,代码来源:PdfToolBarMain.cs

示例12: typeof

 DialogResult IWindowsFormsEditorService.ShowDialog(System.Windows.Forms.Form dialog)
 {
     IUIService service = (IUIService)((IServiceProvider)this).GetService(
         typeof(IUIService));
     if (service != null)
     {
         return service.ShowDialog(dialog);
     }
     return dialog.ShowDialog(this._designer.Component as IWin32Window);
 }
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:10,代码来源:EditorServiceContext.cs

示例13: ShowDialog

 public static System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.Form newForm, System.Windows.Forms.Form currentForm)
 {
     string title = currentForm.Text;
     currentForm.Text = "";
     System.Windows.Forms.DialogResult result = newForm.ShowDialog();
     currentForm.Text = title;
     currentForm.Show();
     currentForm.BringToFront();
     return result;
 }
开发者ID:abmantis,项目名称:Location-Scheduler,代码行数:10,代码来源:Globals.cs

示例14: ShowSemiModal

 /// <summary>
 /// Show a windows form that is modal in the sense that this function does not return until
 /// the form is closed, but also allows for interaction with other elements of the Rhino
 /// user interface.
 /// </summary>
 /// <param name="form">
 /// The form must have buttons that are assigned to the "AcceptButton" and "CancelButton".
 /// </param>
 /// <returns>One of the System.Windows.Forms.DialogResult values.</returns>
 public static System.Windows.Forms.DialogResult ShowSemiModal(System.Windows.Forms.Form form)
 {
   SemiModalFormMessenger semihelper = new SemiModalFormMessenger(form);
   return form.ShowDialog(RhinoApp.MainWindow());
 }
开发者ID:musamorena,项目名称:rhinocommon,代码行数:14,代码来源:Dialogs.cs

示例15: btGetMove4_Click

 private void btGetMove4_Click(object sender, EventArgs e)
 {
     if (ComboPok閙on.Text != "")
     {
         FormPopupMouvementSelection fp = new FormPopupMouvementSelection(txtCapacit� ComboPok閙on.SelectedIndex);
         fp.ShowDialog();
     }
     else
         MessageBox.Show("Choisi un pok閙on d'abord!");
 }
开发者ID:xamtheone,项目名称:URA-pokemon,代码行数:10,代码来源:FormAccouplement.cs


注:本文中的System.ShowDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。