本文整理汇总了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);
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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: Нормально реализовать данный функционал, а не как было.
}
}
示例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: Нормально реализовать данный функционал, а не как было.
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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
}
}
}
示例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);
}
示例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;
}
示例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());
}
示例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!");
}