private void ShowNotification(string title, string msg) { NotifyData data = new NotifyData(); data.Title = title; data.Content = msg; NotificationDialog dialog = new NotificationDialog();//new 一个通知 dialog.Closed += Dialog_Closed; dialog.TopFrom = GetTopFrom(); _notificationDialogs.Add(dialog); dialog.DataContext = data;//设置通知里要显示的数据 dialog.ShowActivated = false; dialog.Show(); }
public void TestDialog() { //Test Default Button foreach (MessageBoxButtons buttons in Enum.GetValues(typeof(MessageBoxButtons))) { foreach (MessageBoxIcon icon in Enum.GetValues(typeof(MessageBoxIcon))) //foreach (MessageBoxDefaultButton defaultButton in Enum.GetValues(typeof(MessageBoxDefaultButton))) { NotificationDialogResult result = NotificationDialog.Show( sampleText, sampleCaption, buttons, "Don't Show This Again", icon); //MessageBox.Show(result.ToString()); MessageBox.Show(sampleText, sampleCaption, buttons, icon); Debug.Print(result.ToString()); } } }