本文整理汇总了C#中MessageDialog类的典型用法代码示例。如果您正苦于以下问题:C# MessageDialog类的具体用法?C# MessageDialog怎么用?C# MessageDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageDialog类属于命名空间,在下文中一共展示了MessageDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
示例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>());
}
示例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();
}
示例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();
}
示例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();
}
}
示例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);
}
示例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();
}
示例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();
}
}
}
示例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 ();
}
示例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();
}
示例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 ();
}
}
示例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();
}
}
}
示例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;
}
示例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();
}
}