/// <summary>Defines the method to be called when the command is invoked.</summary> /// <param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to null.</param> public async void Execute(object parameter) { if (!(parameter is string) || string.IsNullOrEmpty((string)parameter)) { return; } var question = string.Format("Are you sure you want to stop this build '{0}'?", buildAdapter.RunningBuildNumber); var answer = MessageBox.Show(question, "WPF.BuildMonitor", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel); if (answer == MessageBoxResult.Cancel) { return; } isStopping = true; OnCanExecuteChanged(); var buildResult = await buildExplorer.StopBuild(buildInformation, (string)parameter); var tfsUri = string.Concat(buildInformation.BuildDetailUrl, buildResult.TfsUri); ToastNotifications.CreateToastNotification(buildResult, false, (o, e) => Process.Start(tfsUri)); isStopping = false; OnCanExecuteChanged(); }
public void Execute(object parameter) { var result = new BuildResult { Name = "Product-Main", Status = BuildStatus.Failed, RequestedBy = "Some user" }; ToastNotifications.CreateToastNotification(result, false, (o, e) => MessageBox.Show("Toast notification clicked")); }
public void CreateToastNotificationErrorDesignTest() { var result = new BuildResult { Name = "Product-Main", Status = BuildStatus.Failed, RequestedBy = "Some user" }; ToastNotifications.CreateToastNotification(result, false, null); Thread.Sleep(TimeSpan.FromSeconds(5)); }
/// <summary>Defines the method to be called when the command is invoked.</summary> /// <param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to null.</param> public async void Execute(object parameter) { var question = string.Format("Are you sure you want to request a new build '{0}'?", buildAdapter.Name); var answer = MessageBox.Show(question, "WPF.BuildMonitor", MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.Cancel); if (answer == MessageBoxResult.Cancel) { return; } isRequesting = true; OnCanExecuteChanged(); var buildResult = await buildExplorer.RequestBuild(buildInformation); var tfsUri = string.Concat(buildInformation.BuildDetailUrl, buildResult.TfsUri); ToastNotifications.CreateToastNotification(buildResult, false, (o, e) => Process.Start(tfsUri)); isRequesting = false; OnCanExecuteChanged(); }
/// <summary> /// /// </summary> /// <param name="title"></param> /// <param name="body"></param> /// <param name="duration"></param> /// <param name="animation"></param> /// <param name="direction"></param> /// <param name="url"></param> public Notification(string title, string body, int duration, ToastNotifications.FormAnimator.AnimationMethod animation, ToastNotifications.FormAnimator.AnimationDirection direction, string url="", string image="", string type="") { this.Visible = false; InitializeComponent(); if (duration < 0) duration = int.MaxValue; else duration = duration * 1000; this.lifeTimer.Interval = duration; this.labelTitle.Text = title; this.labelBody.Text = body; this.animator = new ToastNotifications.FormAnimator(this, animation, direction, 500); // fore color if (type == "error") { labelTitle.ForeColor = System.Drawing.Color.Gold; labelBody.ForeColor = System.Drawing.Color.Gold; } // twitter and facebook sharing if (url != "") { pictureBox1.Visible = true; pictureBox2.Visible = true; lurl = url; } // open picture if (image != "" && File.Exists(image)) { if (url == "") pictureBox3.Location = new Point(335, 2); pictureBox3.Visible = true; limage = image; } }