public static async Task SendEmail(string clientEmail, string subject, string body) { String result = ""; try { CompanyRepository companyRepository = new(); var credentials = companyRepository.Get(); using (MailMessage letter = new MailMessage(CompanyName + "<" + credentials.email + ">", clientEmail)) { letter.Subject = subject; letter.Body = body; letter.IsBodyHtml = true; using (SmtpClient sc = new SmtpClient(HOST, PORT)) { sc.EnableSsl = true; sc.DeliveryMethod = SmtpDeliveryMethod.Network; sc.UseDefaultCredentials = false; sc.Credentials = new NetworkCredential(credentials.email, credentials.password); await sc.SendMailAsync(letter); result = "Письмо успешно отправлено клиенту."; InfoWindow infoWindow = new InfoWindow("Успех!", result); infoWindow.ShowDialog(); } } } catch (Exception e) { result = String.Format("Ошибка отправки письма: {0}", e.Message); InfoWindow infoWindow = new InfoWindow("Ошибка!", result); infoWindow.ShowDialog(); } }
public void OpenInfoWindow(MainWindow frmMain) { InfoWindow frmInfo = new InfoWindow(); frmInfo.Owner = frmMain; frmInfo.WindowStartupLocation = WindowStartupLocation.CenterOwner; frmInfo.ShowDialog(); }
/// <summary> /// Opens help window. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonHelp_Click(object sender, System.EventArgs e) { String message = "Left click to +1, right click to -1. \r\nMade by Sławomir Palewski."; InfoWindow infoWindow = new InfoWindow("Help", message); infoWindow.ShowDialog(); }
/// <summary> /// Show Help window in a dialog /// </summary> internal static void InfoDialogWindow() { if (InfoWindow == null) { InfoWindow = new InfoWindow { Owner = GetMainWindow }; } else { if (InfoWindow.Visibility == Visibility.Visible) { InfoWindow.Focus(); } else { InfoWindow.Visibility = Visibility.Visible; InfoWindow.ShowDialog(); } } InfoWindow.Show(); #if DEBUG Trace.WriteLine("HelpWindow loaded "); #endif }
private void InfoPhone() { PhoneMediator.Phone = (SelectedPhone.Clone()) as Phone; InfoWindow infoWindow = new InfoWindow(); infoWindow.ShowDialog(); PhoneMediator.Phone = null; }
private void BtnInfo_Click(object sender, RoutedEventArgs e) { InfoWindow info = new InfoWindow(); info.Owner = Application.Current.MainWindow; info.WindowStartupLocation = WindowStartupLocation.CenterOwner; info.ShowDialog(); }
private void btnInfo_Click(object sender, RoutedEventArgs e) { infoW = new InfoWindow(pd.Purchaser.InfoField); infoW.btnSave.IsEnabled = false; infoW.tbInfo.Focusable = false; infoW.ShowDialog(); //pd.Purchaser.InfoField = infoW.tbInfo.Text; }
/// <summary> /// Restore settings to its latest saved values /// </summary> private void _btRestore_Click(object sender, RoutedEventArgs e) { MainWindow.settings.loadSettingsFromFile(); settingsForm.updateFormFromSettings(); InfoWindow iw = new InfoWindow("Success!", "Settings restored to default"); iw.ShowDialog(); }
private void btnInfo_Click(object sender, RoutedEventArgs e) { infoW = new InfoWindow(purData.Purchaser.InfoField); infoW.ShowDialog(); if (infoW.changed) { purData.Purchaser.InfoField = infoW.tbInfo.Text; } }
private void CheckGameFolder(string mainPath) { var files = Directory.GetFiles(mainPath); if (files.Contains(mainPath + "\\start.exe")) { Directory.CreateDirectory(mainPath + "\\mods"); } else { ResourceManager rm = new ResourceManager(typeof(Resources)); InfoWindow infoWindow = new InfoWindow(rm.GetString("noExe")); infoWindow.ShowDialog(); Environment.Exit(0); } }
/// <summary> /// Load settings from a path chosen by the user /// </summary> private void _btLoad_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "XML Files|*.xml"; openFileDialog1.Title = "Select a XML settings file"; if (openFileDialog1.ShowDialog() == true) { MainWindow.settings.loadSettingsFromFile(openFileDialog1.FileName); settingsForm.updateFormFromSettings(); InfoWindow iw = new InfoWindow("Success!", "Settings loaded successfuly"); iw.ShowDialog(); } }
/// <summary> /// Save settings to a path chosen by the user /// </summary> private void _btSaveAs_Click(object sender, RoutedEventArgs e) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "XML Files|*.xml"; saveFileDialog1.Title = "Save a XML settings File"; saveFileDialog1.ShowDialog(); if (saveFileDialog1.FileName != "") { settingsForm.updateSettingsFromForm(); MainWindow.settings.saveSettingsToFile(saveFileDialog1.FileName); InfoWindow iw = new InfoWindow("Success!", "Settings saved successfuly"); iw.ShowDialog(); } }
/// <summary> /// Show Help window in a dialog /// </summary> internal static void InfoDialogWindow() { if (InfoWindow == null) { InfoWindow = new InfoWindow { Owner = GetMainWindow, Opacity = 0 }; } else { if (InfoWindow.Visibility == Visibility.Visible) { InfoWindow.Focus(); } } InfoWindow.Width = GetMainWindow.ActualWidth; InfoWindow.Height = GetMainWindow.ActualHeight; InfoWindow.Left = GetMainWindow.Left + (GetMainWindow.Width - InfoWindow.Width) / 2; InfoWindow.Top = GetMainWindow.Top + (GetMainWindow.Height - InfoWindow.Height) / 2; GetMainWindow.Effect = new BlurEffect { RenderingBias = RenderingBias.Quality, KernelType = KernelType.Gaussian, Radius = 9 }; InfoWindow.BeginAnimation(Window.OpacityProperty, new DoubleAnimation { From = 0, To = 1, Duration = TimeSpan.FromSeconds(.3) }); InfoWindow.ShowDialog(); #if DEBUG Trace.WriteLine("HelpWindow loaded "); #endif }
void _nzbDrive_EventLog(NZBDriveDLL.LogLevelType lvl, string msg) { this.Dispatcher.BeginInvoke((Action)(() => { try { NZBDriveView.Model.Log.Add(new LogEntry() { Time = DateTime.Now, LogLevel = lvl, Message = msg }); if (lvl == NZBDriveDLL.LogLevelType.PopupError) { var dialog = new ErrorWindow(msg); dialog.Owner = Window.GetWindow(this); dialog.ShowDialog(); // MessageBox.Show(this, msg, "NZBDrive Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } else if (lvl == NZBDriveDLL.LogLevelType.PopupInfo) { var dialog = new InfoWindow(msg); dialog.Owner = Window.GetWindow(this); dialog.ShowDialog(); // MessageBox.Show(this, msg, "NZBDrive Info", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); if (msg.StartsWith("Trial license timeout")) { Application.Current.Shutdown(); } } } catch (ObjectDisposedException) { // Can happen when application is shutting down. } catch (InvalidOperationException) { // Can happen when application is shutting down. } catch (Exception e) { MessageBox.Show("_nzbDrive_OnEventLog Failed: " + e.Message); } })); }
public void GetInfoWindow() { try { if (CurrentVente.Client != null && CurrentVente.Agent != null && CurrentVente.Offre.Client != null) { InfoWindow win = new InfoWindow(CurrentVente.Client, CurrentVente.Agent, CurrentVente.Offre.Client); win.Owner = Application.Current.MainWindow; win.ShowDialog(); } else { MessageBox.Show("D'abord choisissez une Vente", "Avertissement", MessageBoxButton.OK, MessageBoxImage.Error); } } catch { MessageBox.Show("D'abord choisissez une Vente", "Avertissement", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// Save settings to the default path /// </summary> private void _btSave_Click(object sender, RoutedEventArgs e) { settingsForm.updateSettingsFromForm(); MainWindow.settings.saveSettingsToFile(); MainWindow.updateButtonList(); // Updates the buttons from the sidebar that will be shown for (int i = 0; i < MainWindow.buttonList.Count; i++) { if (MainWindow.buttonListCollapsed[i] == false) { MainWindow.buttonList[i].Visibility = Visibility.Collapsed; } else { MainWindow.buttonList[i].Visibility = Visibility.Visible; } } MainWindow.updateScreenSize(); InfoWindow iw = new InfoWindow("Success!", "Settings saved successfuly"); iw.ShowDialog(); }
private void OnInfoClick(object sender, System.Windows.RoutedEventArgs e) { InfoWindow info = new InfoWindow(); info.ShowDialog(); }
public void Notify() { if (CommonFunctions.UserSettings.ReceiveNotifications) { if (CommonFunctions.UserSettings.EmailNotifications) { GetEmailHtml(); if (!string.IsNullOrWhiteSpace(this.emailHtml)) { bool htmlUpdated = FillHtml(); if (htmlUpdated) { UserCredential credentials = GetGmailCredentials(); if (credentials != null) { SendEmail(credentials); } else { //Purge token so they can try authenticating again PurgeUserToken(); StringBuilder message = new StringBuilder(); message.AppendLine("Unable to get Gmail credentials."); message.AppendLine("Your user token has now been reset.\n"); message.AppendLine("Please try again."); InfoWindow badCredentialsWindow = new InfoWindow("Error Sending Email", message.ToString()); if (badCredentialsWindow.ShowDialog() == true) { } } } else { CommonFunctions.Log.Warn("Unable to update email html"); } } else { CommonFunctions.Log.Warn("Unable to create email html"); } } if (CommonFunctions.UserSettings.TextNotifications) { UserCredential credentials = GetGmailCredentials(); if (credentials != null) { SendText(credentials); } else { //Purge token so they can try authenticating again PurgeUserToken(); StringBuilder message = new StringBuilder(); message.AppendLine("Unable to get Gmail credentials."); message.AppendLine("Your user token has now been reset.\n"); message.AppendLine("Please try again."); InfoWindow badCredentialsWindow = new InfoWindow("Error Sending Text Message", message.ToString()); if (badCredentialsWindow.ShowDialog() == true) { } } } if (CommonFunctions.UserSettings.PopupNotifications) { OpenPopup(); } //Finally, change the last notified date UpdateLastNotifiedDate(); } }
private bool VerifyValidSettings() { bool valid = true; try { bool emailEnabled = email_chbx.IsChecked ?? false; bool textEnabled = textMessages_chbx.IsChecked ?? false; bool isEmailAddressEntered = !string.IsNullOrWhiteSpace(email_txtbx.Text); //Email enabled but there is no email address inputted if (emailEnabled && !isEmailAddressEntered) { valid = false; StringBuilder message = new StringBuilder(); message.AppendLine("Email notifications are enabled but no email address has been entered.\n"); message.AppendLine("Please enter your email address in the email address textbox."); InfoWindow emailInfo = new InfoWindow("Email Address Error", message.ToString()); if (emailInfo.ShowDialog() == true) { //close window } } bool isPhoneNumberEntered = !string.IsNullOrWhiteSpace(phoneNumber_txtbx.Text); bool isCarrierSelectedEntered = carrier_cmbobox.SelectedIndex != 0; //Text messages enabled but there is no phone number and/or carrier selected if ((textEnabled && !isPhoneNumberEntered) || textEnabled && !isCarrierSelectedEntered) { if (!isPhoneNumberEntered && isCarrierSelectedEntered) { StringBuilder message = new StringBuilder(); message.AppendLine("Text notifications are enabled but no phone number has been entered.\n"); message.AppendLine("Please enter your phone number in the phone number textbox."); InfoWindow textInfo = new InfoWindow("Text Message Phone Number Error", message.ToString()); if (textInfo.ShowDialog() == true) { //close window } } else if (isPhoneNumberEntered && !isCarrierSelectedEntered) { StringBuilder message = new StringBuilder(); message.AppendLine("Text notifications are enabled but no carrier has been selected.\n"); message.AppendLine("Please select your carrier from the carrier drop down."); InfoWindow textInfo = new InfoWindow("Text Message Carrier Error", message.ToString()); if (textInfo.ShowDialog() == true) { //close window } } else //both are left blank { StringBuilder message = new StringBuilder(); message.AppendLine("Text notifications are enabled but no phone number has been entered and the carrier is left blank.\n"); message.AppendLine("Please enter your phone number in the phone number textbox and select your carrier from the carrier drop down."); InfoWindow textInfo = new InfoWindow("Text Message Error", message.ToString()); if (textInfo.ShowDialog() == true) { //close window } } valid = false; } } catch (Exception ex) { CommonFunctions.Log.Error("Error validating settings", ex); valid = false; } return(valid); }
public void ShowInfoWindow(string info) { InfoWindow infoWindow = new InfoWindow(info); infoWindow.ShowDialog(); }
public static void ShowInfoWindow(string windowHeaderText, string articleHeaderText, string mainText) { InfoWindow.DataContext = new SudokuMaker.ViewModel.InfoModel(windowHeaderText, articleHeaderText, mainText); InfoWindow.ShowDialog(); InfoWindow = null; }
/// <summary> /// Executes the show about. /// </summary> private void ExecuteShowAbout() { InfoWindow infoWindow = new InfoWindow(); infoWindow.ShowDialog(); }