本文整理汇总了C#中MessageDialog类的典型用法代码示例。如果您正苦于以下问题:C# MessageDialog类的具体用法?C# MessageDialog怎么用?C# MessageDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageDialog类属于命名空间,在下文中一共展示了MessageDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Execute
public async void Execute(object parameter)
{
var result = Task.FromResult(default(IUICommand));
owner.DownloadVisible = false;
owner.ProgressVisible = true;
var folder = await downloader.VerifyFolderCreation();
using (var client = new System.Net.Http.HttpClient())
{
// find all selected episodes.
List<Task> results = new List<Task>();
foreach (var episode in owner.selectedEpisodes)
{
var path = episode.Description;
var writeTask = downloader.SaveUrlAsync(folder, client, path);
results.Add(writeTask);
}
var allTasks = Task.WhenAll(results.ToArray());
owner.ActiveDownload = allTasks;
try
{
await allTasks;
}
catch (Exception)
{
// Umm, some download failed.
var errMsg = new MessageDialog("One or more downloads failed");
result = errMsg.ShowAsync().AsTask();
}
await result;
}
owner.DownloadVisible = true;
owner.ProgressVisible = false;
owner.selectedEpisodes.Clear();
}
开发者ID:BillWagner,项目名称:CSharpAsyncLabs,代码行数:34,代码来源:PodcastSeries.cs
示例2: OnButton1Clicked
protected void OnButton1Clicked(object sender, EventArgs e)
{
int aciertos = 0;
if (this.radb1.Active) {
aciertos += 1;
}
if (this.chPortu.Active) {
aciertos += 1;
}
if (this.chReino.Active) {
aciertos += 1;
}
if (this.chMace.Active) {
aciertos += 1;
}
if (this.spinb1.Text == "31") {
aciertos += 1;
}
if (this.calendar1.GetDate ().ToShortDateString () == "07/05/1945") {
aciertos +=1;
}
MessageDialog ve=new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Código: " + this.entry1.Text
+ "\nNombre: " + this.entry2.Text + "\n" + Convert.ToString(aciertos) + " aciertos.");
ve.Run();
ve.Destroy();
aciertos=0;
}
开发者ID:Rafa-el,项目名称:Practica6,代码行数:34,代码来源:MainWindow.cs
示例3: TestInitialize
public void TestInitialize()
{
var fixture = new Fixture();
factories = Substitute.For<Factories>();
navigator = Substitute.For<Navigator>();
stateProvider = Substitute.For<StateProvider>();
facade = Substitute.For<ReplacementBuilderAndSugarEstimatorFacade>();
clipboard = Substitute.For<Clipboard>();
messageDialog = Substitute.For<MessageDialog>();
navigation = new InsulinEditingViewModel.Navigation();
CreateSut();
insulin = fixture.Create<Insulin>();
insulin.InitializeCircumstances(new List<Guid>());
insulin.SetOwner(factories);
sugar = new Sugar();
sugar.SetOwner(factories);
factories.InsulinCircumstances.Returns(fixture.CreateMany<InsulinCircumstance>().ToList());
factories.CreateSugar().Returns(sugar);
settings = new Settings { MaxBolus = 5 };
factories.Settings.Returns(settings);
meal = fixture.Create<Meal>();
factories.Finder.FindMealByInsulin(insulin).Returns(meal);
factories.Finder.FindInsulinById(insulin.Id).Returns(insulin);
var replacementAndEstimatedSugars = new ReplacementAndEstimatedSugars();
replacementAndEstimatedSugars.EstimatedSugars = new List<Sugar>();
replacementAndEstimatedSugars.Replacement
= new Replacement { InsulinTotal = new Insulin(), Items = new List<ReplacementItem>() };
facade.GetReplacementAndEstimatedSugars(Arg.Any<Meal>(), Arg.Any<Insulin>(), Arg.Any<Sugar>())
.Returns(replacementAndEstimatedSugars);
factories.MealNames.Returns(new List<MealName>());
stateProvider.State.Returns(new Dictionary<string, object>());
}
开发者ID:PawelStroinski,项目名称:Diettr-GPL,代码行数:32,代码来源:InsulinEditingViewModelTests.cs
示例4: OnButton1Clicked
protected void OnButton1Clicked(object sender, EventArgs e)
{
int puntos =0;
if(this.opca.Active)
puntos++;
if(this.spm.Text == "4")
if(this.opa.Active)
puntos++;
if(this.opd.Active)
puntos++;
DateTime fecha = this.calendario.GetDate();
string fechaseleccionada = fecha.ToShortDateString();
if(fechaseleccionada == "16/09/1810"){
puntos++;
}
string a,b;
a= nombre.Text;
b= codigo.Text;
MessageDialog md = new MessageDialog (null,
DialogFlags.Modal,
MessageType.Info,
ButtonsType.None,"Nombre : "+ a +"\n"+ "Codigo: "+b + "\n" +
"Grupo: " +
"Ha obtenido: " + puntos + " aciertos");
md.Show();
}
开发者ID:nallely27,项目名称:practica_7,代码行数:32,代码来源:MainWindow.cs
示例5: OnBtnTerminarClicked
protected void OnBtnTerminarClicked(object sender, EventArgs e)
{
int puntos = 0;
if (this.radiobtnC.Active)
puntos++;
if(this.spinbtn1.Text=="6")
puntos++;
if (this.checkbtnA.Active)
puntos++;
if (this.checkbtnC.Active)
puntos++;
DateTime fecha = this.calIndependencia.GetDate();
string fechaSeleccionada = fecha.ToShortDateString();
if (fechaSeleccionada == "16/09/1810"){
puntos++;
}
MessageDialog md = new MessageDialog (null,
DialogFlags.Modal,
MessageType.Info,
ButtonsType.None, "Estos son los puntos obtenidos: \n" +
"Puntos: " + puntos + "\n");
md.Show();
}
开发者ID:reymond16061992,项目名称:Practica7,代码行数:28,代码来源:MainWindow.cs
示例6: OnAceptaClicked
protected void OnAceptaClicked(object sender, System.EventArgs e)
{
if (password.Text=="123456"&& usuario.Text=="ricardo")
{
MessageDialog hola = new MessageDialog(
null,
DialogFlags.Modal,
MessageType.Info,
ButtonsType.None,
"Hola Bienvenido"
);
hola.Show();
}
else
{
MessageDialog error = new MessageDialog(
null,
DialogFlags.Modal,
MessageType.Info,
ButtonsType.None,
"Error verifique password y/o Usuario"
);
error.Show();
}
}
开发者ID:RickTC,项目名称:PracticaVentanaUsuario,代码行数:27,代码来源:MainWindow.cs
示例7: MainWindow
public MainWindow()
: base(Gtk.WindowType.Toplevel)
{
this.Resize (600, 100);
this.Title = "metafang";
_main = new VBox ();
HBox title = new HBox ();
title.PackStart (new Label ("Login to your Metasploit RPC instance to begin"), true, true, 0);
_main.PackStart (title, true, true, 0);
HBox loginInfo = new HBox ();
loginInfo.PackStart (new Label ("Host:"), false, false, 20);
Entry hostEntry = new Entry ();
loginInfo.PackStart (hostEntry, false, false, 0);
loginInfo.PackStart (new Label ("User:"), false, false, 20);
Entry userEntry = new Entry ();
loginInfo.PackStart (userEntry, false, false, 0);
loginInfo.PackStart (new Label ("Pass:"), false, false, 20);
Entry passEntry = new Entry ();
loginInfo.PackStart (passEntry, false, false, 0);
_main.PackStart (loginInfo, true, true, 0);
Button login = new Button ("Login");
login.Clicked += (object sender, EventArgs e) => {
try {
//Console.WriteLine ("Creating session");
_session = new MetasploitSession (userEntry.Text, passEntry.Text, hostEntry.Text);
//Console.WriteLine ("Creating manager and getting current list of payloads");
_manager = new MetasploitManager (_session);
_payloads = _manager.GetPayloads ();
BuildWorkspace ();
} catch {
MessageDialog md = new MessageDialog (this,
DialogFlags.DestroyWithParent,
MessageType.Error,
ButtonsType.Close, "Authentication failed. Please ensure your credentials and API URL are correct.");
md.Run ();
md.Destroy ();
}
};
HBox loginBox = new HBox ();
loginBox.PackStart (login, false, false, 300);
_main.PackStart (loginBox, true, true, 0);
_main.ShowAll ();
this.Add (_main);
}
开发者ID:subTee,项目名称:metafang2,代码行数:60,代码来源:MainWindow.cs
示例8: RegisterAssembly
/// <summary>
/// Registers the assembly into the Global Assembly Cache
/// </summary>
/// <param name="m_fileName">The File name</param>
public static void RegisterAssembly(string m_fileName)
{
string result = string.Empty;
try
{ // register the assembly
result = RegisterAssemblyCode(m_fileName);
}
catch (Exception ex)
{
result = ex.Message;
}
MessageDialog msgDialog = new MessageDialog();
if (result.ToLower().Contains("success"))
{ // if the success contains into the message then its okay
msgDialog.MessageText = "Successfully added to the Global Assembly Cache.";
}
else
{ // failureMessageDetails
msgDialog.MessageText = "Failed to register the assembly.";
}
msgDialog. = result;
msgDialog.ShowDialog();
}
开发者ID:Nazario-DApote,项目名称:ShellGacUtil,代码行数:30,代码来源:GacManager.cs
示例9: OnBtnokClicked
protected virtual void OnBtnokClicked(object sender, System.EventArgs e)
{
if(txturl.Text==String.Empty||txtname.Text==String.Empty)
{
MessageDialog md = new MessageDialog (this, DialogFlags.DestroyWithParent,MessageType.Error, ButtonsType.Close, "Fields must not be empty");
int result = md.Run ();
md.Destroy();
}
else
{
if(!txturl.Text.Contains("http://"))
{
MessageDialog md = new MessageDialog(this,DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "Please Introduce a valid URL");
int result=md.Run();
md.Destroy();
}
else
{
url=txturl.Text;
path=txtpath.CurrentFolder+"/"+txtname.Text;
Thread down = new Thread(downloadStart);
down.Start();
}
}
}
开发者ID:Manuelinux,项目名称:Yotidescargo,代码行数:27,代码来源:MainWindow.cs
示例10: OnDeleteActionActivated
protected void OnDeleteActionActivated(object sender, EventArgs e)
{
MessageDialog messageDialog = new MessageDialog (
this,
DialogFlags.Modal,
MessageType.Question,
ButtonsType.YesNo,
"¿Quieres eliminar el registro?"
);
messageDialog.Title = Title;
ResponseType response = (ResponseType) messageDialog.Run ();
messageDialog.Destroy ();
if (response != ResponseType.Yes)
return;
TreeIter treeIter;
treeView.Selection.GetSelected (out treeIter);
object id = listStore.GetValue (treeIter, 0);
string deleteSql = string.Format ("delete from categoria where id={0}", id);
IDbCommand dbCommand = dbConnection.CreateCommand ();
dbCommand.CommandText = deleteSql;
dbCommand.ExecuteNonQuery ();
}
开发者ID:rubenramos,项目名称:adRuben,代码行数:25,代码来源:MainWindow.cs
示例11: ShowWarningMessage
public static void ShowWarningMessage(Window window, string message)
{
Dialog dialog = new MessageDialog(window, DialogFlags.DestroyWithParent | DialogFlags.Modal,
MessageType.Warning, ButtonsType.Ok, message);
dialog.Run();
dialog.Hide();
}
开发者ID:hughperkins,项目名称:SpringMapDesigner,代码行数:7,代码来源:DialogHelpers.cs
示例12: OnLoginButtonClicked
//LOGIN
protected void OnLoginButtonClicked(object sender, EventArgs e)
{
try{
string connectionString = "Server=localhost;" + "Database=dbprueba;" +
"User ID=" + userEntry.Text.ToString () + ";" + "Password=" + pwdEntry.Text.ToString ();
App.Instance.DbConnection = new MySqlConnection (connectionString);
App.Instance.DbConnection.Open ();
MainWindow mWin = new MainWindow ();
mWin.ShowAll ();
this.Destroy ();
}
catch (MySqlException){
msgDialog = new MessageDialog (
this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "\t\tConnection Error\t\t\nCannot connect to database");
msgDialog.Title = "SQL DataBase Error";
msgDialog.Run ();
msgDialog.Destroy ();
pwdEntry.Text = "";
}
catch{
Console.WriteLine ("\nError 404 Not Found");
Application.Quit ();
}
}
开发者ID:juankza,项目名称:ad,代码行数:31,代码来源:LoginWindow.cs
示例13: btnEnter_Click
protected void btnEnter_Click(object sender, EventArgs e)
{
TeenvioAPI api = new TeenvioAPI (txtUser.Text, txtPlan.Text, txtPassword.Text);
try{
api.getServerVersion ();
MainWindow win = new MainWindow();
win.Show();
win.setAPI(api);
this.Destroy();
}catch(TeenvioException ex){
MessageDialog msg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, ex.Message);
msg.Title = "Error";
ResponseType response = (ResponseType) msg.Run();
if (response == ResponseType.Close || response == ResponseType.DeleteEvent) {
msg.Destroy();
}
}catch(Exception ex){
MessageDialog msg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, ex.Message);
msg.Title = "Error";
ResponseType response = (ResponseType) msg.Run();
if (response == ResponseType.Close || response == ResponseType.DeleteEvent) {
msg.Destroy();
}
}
}
开发者ID:purpleflameangle,项目名称:POST-API,代码行数:29,代码来源:LoginWindow.cs
示例14: OnExecButtonClicked
protected virtual void OnExecButtonClicked(object sender, System.EventArgs e)
{
resultString = new StringBuilder();
try{
parser.Execute(); // Parse selected file
}
catch(Exception exc){
string errorText = "Ouch! Something bad happened and an exception" +
" was thrown. The error message was: " + Environment.NewLine +
exc.Message + Environment.NewLine + Environment.NewLine +
"Make sure your input file is formatted correctly and try again.";
MessageDialog md = new MessageDialog(this, DialogFlags.Modal,
MessageType.Info, ButtonsType.Ok,
errorText);
ResponseType res = (ResponseType)md.Run();
if(res == ResponseType.Ok){
md.Destroy();
Application.Quit();
}
}
// Append each line
foreach(string str in parser.GetResults()){
resultString.Append(str + Environment.NewLine);
}
resultString.Append(Environment.NewLine);
// Enable View and Save buttons
TextView.Buffer.Text = "File parsed. Press View to view results or Save to save results.";
//TextView.Buffer.Text = "File parsed. Press Save to save the results.";
ViewButton.Sensitive = true;
SaveButton.Sensitive = true;
}
开发者ID:aelinden,项目名称:OruStuff,代码行数:33,代码来源:MainWindow.cs
示例15: OnButton1Clicked
protected void OnButton1Clicked(object sender, EventArgs e)
{
int puntos=0;
if(this.radiobutton3.Active)
puntos++;
if(this.spinbutton1.Text=="4")
puntos++;
if(this.checkbutton1.Active)
puntos++;
if(this.checkbutton2.Active)
puntos++;
DateTime fecha=this.calendar1.GetDate();
string fechaseleccionada=fecha.ToShortDateString();
if(fechaseleccionada=="16/09/1810"){
puntos++;
MessageDialog md = new MessageDialog (null,DialogFlags.Modal,MessageType.Info,
ButtonsType.None, "puntos" +
puntos);
md.Show();
}
}
开发者ID:Eelizabeth,项目名称:PRACTICA-7,代码行数:27,代码来源:MainWindow.cs
示例16: ShowMessageBox
/// <summary>
/// Shows the message box.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="caption">The caption.</param>
/// <param name="button">The button.</param>
/// <param name="icon">The icon.</param>
/// <returns>The message result.</returns>
/// <exception cref="ArgumentException">The <paramref name="message"/> is <c>null</c> or whitespace.</exception>
protected virtual async Task<MessageResult> ShowMessageBox(string message, string caption = "", MessageButton button = MessageButton.OK, MessageImage icon = MessageImage.None)
{
// TODO: Add translations for system
var result = MessageBoxResult.None;
var messageBoxButton = TranslateMessageButton(button);
var messageDialog = new MessageDialog(message, caption);
if (Enum<MessageButton>.Flags.IsFlagSet(button, MessageButton.OK) ||
Enum<MessageButton>.Flags.IsFlagSet(button, MessageButton.OKCancel))
{
messageDialog.Commands.Add(new UICommand("OK", cmd => result = MessageBoxResult.OK));
}
if (Enum<MessageButton>.Flags.IsFlagSet(button, MessageButton.YesNo) ||
Enum<MessageButton>.Flags.IsFlagSet(button, MessageButton.YesNoCancel))
{
messageDialog.Commands.Add(new UICommand("Yes", cmd => result = MessageBoxResult.Yes));
messageDialog.Commands.Add(new UICommand("No", cmd => result = MessageBoxResult.No));
}
if (Enum<MessageButton>.Flags.IsFlagSet(button, MessageButton.OKCancel) ||
Enum<MessageButton>.Flags.IsFlagSet(button, MessageButton.YesNoCancel))
{
messageDialog.Commands.Add(new UICommand("Cancel", cmd => result = MessageBoxResult.Cancel));
messageDialog.CancelCommandIndex = (uint)messageDialog.Commands.Count - 1;
}
await messageDialog.ShowAsync();
return TranslateMessageBoxResult(result);
}
开发者ID:justdude,项目名称:DbExport,代码行数:41,代码来源:MessageService.winrt.cs
示例17: OnButtonLoginClicked
protected void OnButtonLoginClicked(object sender, EventArgs e)
{
try{
string connectionString = "Server=localhost;" + "Database=dbprueba;" +
"User ID=" + entryUser.Text.ToString () + ";" + "Password=" + entryPwd.Text.ToString ();
this.mySqlConnection = new MySqlConnection (connectionString);
this.mySqlConnection.Open ();
this.SetSizeRequest (500, 250);
vboxLogin.Visible = false;
vboxTable.Visible = true;
OnRefreshActionActivated ();
}
catch (MySqlException){
messageDialog = new MessageDialog (
this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "\t\tConnection Error\t\t\nCannot connect to database");
messageDialog.Title = "SQL DataBase Error";
messageDialog.Run ();
messageDialog.Destroy ();
entryUser.Text = "";
entryPwd.Text = "";
}
catch{
Console.WriteLine ("\nError 404 Not Found");
Application.Quit ();
}
}
开发者ID:juankza,项目名称:ad,代码行数:31,代码来源:MainWindow.cs
示例18: OnBtnGenerateClicked
protected void OnBtnGenerateClicked(object sender, EventArgs e)
{
try {
BarcodeLib.Barcode codeBar = new BarcodeLib.Barcode ();
codeBar.Alignment = BarcodeLib.AlignmentPositions.CENTER;
codeBar.IncludeLabel = true;
codeBar.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;
BarcodeLib.TYPE bCodeType = (BarcodeLib.TYPE)Enum.Parse (typeof(BarcodeLib.TYPE), cmbBarCodeType.ActiveText.ToString ());
System.Drawing.Image imgTmpCodeBar = codeBar.Encode (bCodeType, txtData.Text.Trim (), System.Drawing.Color.Black, System.Drawing.Color.White, 300, 300);
MemoryStream memoryStream = new MemoryStream();
imgTmpCodeBar.Save(memoryStream, ImageFormat.Png);
Gdk.Pixbuf pb = new Gdk.Pixbuf (memoryStream.ToArray());
imgCodeBar.Pixbuf = pb;
} catch (Exception err) {
MessageDialog dlg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, string.Format ("Ocurrió un error \n {0}", err.Message));
dlg.Run ();
dlg.Destroy ();
dlg.Dispose ();
dlg = null;
}
}
开发者ID:xmalmorthen,项目名称:monoCodeBarGenerator,代码行数:25,代码来源:MainWindow.cs
示例19: OnBtnAnularClicked
protected virtual void OnBtnAnularClicked(object sender, System.EventArgs e)
{
MessageDialog Mensaje = null;
string Tiquete = "", REF = "", c = "";
REF = txtEfectivo.Text;
c = "UPDATE `cafeteria_transacciones` SET `precio_grabado`= 0.00, `cancelado` = 1 WHERE ID_ticket = '"+REF+"'";
if (MySQL.consultar(c))
{
if( MySQL.Reader.RecordsAffected > 0 )
{
Console.WriteLine("RA:" + MySQL.Reader.RecordsAffected);
Tiquete += Imprimidor.Imprimir("CANCELACION CAFETERIA",1);
Tiquete += Imprimidor.Imprimir("REF: "+REF,1);
Imprimidor.Tiquete(Tiquete, "666");
Mensaje = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Tiquete anulado");
Mensaje.Title="Éxito";
Mensaje.Run();
Mensaje.Destroy();
txtEfectivo.Text = "";
return;
}
}
Mensaje = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Tiquete no pudo ser anulado.");
Mensaje.Title="Error";
Mensaje.Run();
Mensaje.Destroy();
txtEfectivo.GrabFocus();
return;
}
开发者ID:vlad88sv,项目名称:RIFT,代码行数:33,代码来源:MainWindow.cs
示例20: MainWindow
public MainWindow()
: base(Gtk.WindowType.Toplevel)
{
try
{
CheckForUpdatesProgress cfup = new CheckForUpdatesProgress(Assembly.GetExecutingAssembly().GetName().Version);
cfup.Show();
if (cfup.CheckForUpdates() == false)
cfup.Destroy();
}
catch
{
MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
"Communication could not be established to our servers: you must be online to use the LunaLua Module Manager.\n\nPress ok so we can self destruct.");
md.Icon = Image.LoadFromResource("Gtktester.Icons.PNG.256.png").Pixbuf;
md.WindowPosition = WindowPosition.Center;
md.Run();
md.Destroy();
this.Destroy();
Environment.Exit(-5);
}
Build ();
if (Program.ProgramSettings.StartMaximized)
this.Maximize();
this.hpaned2.Position = 170;
this.hpaned1.Position = 170;
OnWindowLoad();
this.notebook1.CurrentPage = 0;
}
开发者ID:Luigifan,项目名称:LuaScriptsManager,代码行数:34,代码来源:MainWindow.cs
注:本文中的MessageDialog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论