public bool SendEmail(string address, string verification) { cli = new SQLReference.Service1ConsoleClient(); cli.SendEmailCompleted += smtp_Send; cli.SendEmailAsync(txtUsername.Text, txtEmail.Text, "Verification Code", txtUsername.Text + ", your verification code is:" + Environment.NewLine + Environment.NewLine + verification, false); return(true); }
private void finishChangeAvatar(object sender, EventArgs e) { inputForm.Closed -= finishChangeAvatar; if (inputForm.DialogResult == true) { MyMainPage.disableNavigation(); SQLReference.Service1ConsoleClient client = new SQLReference.Service1ConsoleClient(); client.saveImageCompleted += (sender2, e2) => { MyMainPage.enableNavigation(); if (e2.Error == null && !e2.Result.Contains("ERROR")) { if (e2.Result == "Delete") { M.setImage(imgAvatar, "blankavatar.jpg", UriKind.Relative); } else { M.setImage(imgAvatar, e2.Result, UriKind.Absolute); } } else if (e2.Result.Contains("ERROR")) { MessageBox.Show(e2.Result); } else { MessageBox.Show("There was an error in changing your avatar. The server might be down."); } }; client.saveImageAsync(M.myUsernameId.ToString(), true, inputForm.input == null ? "" : inputForm.input); } }
//Executes when the user navigates to this page. protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if (!M.isLoggedIn) { MessageBox.Show("You cannot use this function until you are Logged In."); this.NavigationService.Navigate(new System.Uri("/Home", UriKind.Relative)); return; } mailClient = new SQLReference.Service1ConsoleClient(); mailClient.getAllUsersCompleted += client_getUsersCompleted; mailClient.getAllUsersAsync(); M.CenterCanvas(LayoutRoot, this); M.ScreenResized += delegate { M.CenterCanvas(LayoutRoot, this); }; }
public void sqlFile_Get(object sender, SQLReference.populateSQLCompletedEventArgs e) { M.CardStats = e.Result.ToList <SQLReference.CardDetails>(); SQLReference.Service1ConsoleClient anotherotherCli = new SQLReference.Service1ConsoleClient(); anotherotherCli.InetConnectionCompleted += (s, e2) => { if (e2.Result != null) { M.ParseBanlist(M.ByteArrayToString(e2.Result)); showLogin(); } else { MessageBox.Show("Could not find banlist. Tournament mode will be disabled."); for (int n = 1; n <= M.TotalCards; n++) { M.CardStats[n].Limit = 0; } showLogin(); } }; anotherotherCli.InetConnectionAsync("http://192.227.234.101/admin/banlist/Tournament.txt"); }
private void cmdSend_Click(System.Object sender, System.Windows.RoutedEventArgs e) { if (cmbAddress.SelectionBoxItem == null) { lblNoUser.Visibility = System.Windows.Visibility.Visible; return; } else { lblNoUser.Visibility = System.Windows.Visibility.Collapsed; } if (string.IsNullOrEmpty(txtSubject.Text.Trim())) { lblNoSubject.Visibility = System.Windows.Visibility.Visible; return; } else { lblNoSubject.Visibility = System.Windows.Visibility.Collapsed; } ComboBox cmbBox = default(ComboBox); short numOfRecipients = 0; for (short n = 1; n <= 4; n++) { cmbBox = (ComboBox)LayoutRoot.FindName("cmbAdditional" + n); if (cmbBox.SelectionBoxItem != null) { numOfRecipients += 1; } } for (short n = 1; n <= numOfRecipients; n++) { cmbBox = (ComboBox)LayoutRoot.FindName("cmbAdditional" + n); if (cmbBox.SelectionBoxItem == cmbAddress.SelectionBoxItem) { lblNoDupes.Visibility = System.Windows.Visibility.Visible; return; } } for (short n = 2; n <= numOfRecipients; n++) { cmbBox = (ComboBox)LayoutRoot.FindName("cmbAdditional" + n); if (cmbBox.SelectionBoxItem == cmbAdditional1.SelectionBoxItem) { lblNoDupes.Visibility = System.Windows.Visibility.Visible; return; } } for (int n = 3; n <= numOfRecipients; n++) { cmbBox = (ComboBox)LayoutRoot.FindName("cmbAdditional" + n); if (cmbBox.SelectionBoxItem == cmbAdditional2.SelectionBoxItem) { lblNoDupes.Visibility = System.Windows.Visibility.Visible; return; } } for (int n = 4; n <= numOfRecipients; n++) { cmbBox = (ComboBox)LayoutRoot.FindName("cmbAdditional" + n); if (cmbBox.SelectionBoxItem == cmbAdditional3.SelectionBoxItem) { lblNoDupes.Visibility = System.Windows.Visibility.Visible; return; } } string addresses = cmbAddress.SelectionBoxItem.ToString(); for (int n = 1; n <= numOfRecipients; n++) { cmbBox = (ComboBox)LayoutRoot.FindName("cmbAdditional" + n); addresses += "," + cmbBox.SelectionBoxItem.ToString(); } //addresses = addresses.Replace("Admin", "Seattleite"); mailClient = new SQLReference.Service1ConsoleClient(); mailClient.SendEmailCompleted += mailClient_smtpSent; mailClient.SendEmailAsync(M.username, addresses, txtSubject.Text, txtBody.Text, true); }
//Executes when the user navigates to this page. protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { M.ScreenResized += delegate { M.ScaleCanvas(LayoutRoot, this); }; M.opponent = string.Empty; readyToDuel = false; challengeStack = new List <cldChallenge>(); sqlCli = new SQLReference.Service1ConsoleClient(); sqlCli.loadDeckCompleted += loaded_deck; foreach (string deck in M.listOfMyDecks) { cmbChangeDeck.Items.Add(deck); } if (M.isLoggedIn) { M.defaultDeckName = M.GetCookie("default"); if (!string.IsNullOrEmpty(M.defaultDeckName) && M.listOfMyDecks.Contains(M.defaultDeckName)) { cmbChangeDeck.SelectedItem = M.defaultDeckName; } else { if (M.noInternet) { goto Skip; } if (M.listOfMyDecks.Count > 0) { M.defaultDeckName = M.listOfMyDecks[0]; cmbChangeDeck.SelectedItem = M.defaultDeckName; } else { lstTournamentHost.SelectedIndex = -1; lstTraditionalHost.SelectedIndex = -1; lstTournamentHost.IsEnabled = false; lstTraditionalHost.IsEnabled = false; cmdHost.IsEnabled = false; cmdDuel.IsEnabled = false; } Skip :; } } else { lstTournamentHost.IsEnabled = false; lstTraditionalHost.IsEnabled = false; cmdHost.IsEnabled = false; cmdDuel.IsEnabled = false; } if (M.sock.isConnected) { M.sock.SendMessage(M.socketSerialize("Server", M.username, "", MessageType.LobbyEnter)); } }
private void cmdSendVerification_Click(System.Object sender, System.Windows.RoutedEventArgs e) { if (cmdSendVerification.Content.ToString() == "Resend Verification") { SendEmail(txtEmail.Text, ver); cmdSendVerification.IsEnabled = false; return; } txtUsername.Text = txtUsername.Text.Trim(); txtPassword.Text = txtPassword.Text.Trim(); txtEmail.Text = txtEmail.Text.Trim(); if (string.IsNullOrEmpty(txtUsername.Text)) { lblNeedUsername.Visibility = System.Windows.Visibility.Visible; return; } else { if (txtUsername.Text.Contains("|") || txtPassword.Text.Contains("|") || txtEmail.Text.Contains("|")) { MessageBox.Show("Usernames, passwords and emails cannot contain the Bar | character"); return; } if (txtUsername.Text.Contains("portalguest")) { MessageBox.Show("The word portalguest is a special keyword in the program. Please choose something else."); return; } if (txtUsername.Text == "All") { MessageBox.Show("The word all is a special keyword in the program. Please choose something else."); return; } if (txtUsername.Text == "PUB") { MessageBox.Show("The word PUB is a special keyword in the program. Please choose something else."); return; } if (txtUsername.Text.Contains("&&")) { MessageBox.Show("Usernames cannot contain double ampersand && characters"); return; } if (txtUsername.Text.Contains("_")) { MessageBox.Show("Usernames cannot contain underscore _ characters"); return; } lblNeedUsername.Visibility = System.Windows.Visibility.Collapsed; } if (string.IsNullOrEmpty(txtPassword.Text)) { lblNeedPassword.Visibility = System.Windows.Visibility.Visible; return; } else { lblNeedPassword.Visibility = System.Windows.Visibility.Collapsed; } if (string.IsNullOrEmpty(txtEmail.Text) || txtEmail.Text.Contains("@") == false) { lblNeedEmail.Visibility = System.Windows.Visibility.Visible; return; } else { lblNeedEmail.Visibility = System.Windows.Visibility.Collapsed; } if (txtUsername.Text.Length > 30) { MessageBox.Show("Usernames must be 30 characters or fewer."); return; } if (txtPassword.Text.Length > 30) { MessageBox.Show("Passwords must be 30 characters or fewer."); return; } if (txtEmail.Text.Length > 50) { MessageBox.Show("Emails must be 50 characters or fewer."); return; } if (rdCustom.IsChecked == true && cmbCustom.SelectedValue == null) { lblNeedCustom.Visibility = System.Windows.Visibility.Visible; return; } else { lblNeedCustom.Visibility = System.Windows.Visibility.Collapsed; } ver = GenerateVerification(); string chosenPool = ""; if (rdDefault.IsChecked == true) { chosenPool = "Default"; } else if ((bool)rdCustom.IsChecked) { chosenPool = cmbCustom.SelectionBoxItem.ToString(); } ChangeEditing(false); cli = new SQLReference.Service1ConsoleClient(); cli.createOrVerifyNewUserCompleted += cli_createUserDone; cli.createOrVerifyNewUserAsync(txtUsername.Text, txtPassword.Text, ver, txtEmail.Text, (bool)chkAllowMessaging.IsChecked, false, chosenPool); }