void MiViewProfile_Click(object sender, RoutedEventArgs e) { ConnSQL connSQL = new ConnSQL(); ViewAccount vacc = new ViewAccount(); Users user = connSQL.getUser(this.selectedlabel.Content.ToString()); vacc.currentUser = user; vacc.initializeFields(); vacc.Show(); }
private void Label_MouseLeftButtonUp_1(object sender, MouseButtonEventArgs e) { ConnSQL connSQL = new ConnSQL(); Label chatPartnerLable = (Label)sender; Users user = connSQL.getUser(chatPartnerLable.Content.ToString()); if (user == null) MessageBox.Show("An error has occurred. You might have accesed a user that does not exist anymore.", "Talk2Me Error", MessageBoxButton.OK, MessageBoxImage.Stop); else { ChatWindow cw = new ChatWindow(); cw.label1.Content = chatPartnerLable.Content.ToString()+"("+user.FirstName+" "+user.LastName+")"; cw.currentUser = this.user; // MessageBox.Show(chatPartnerLable.Content.ToString()); cw.setConversationPartnerUser ( user); // MessageBox.Show(cw.conversationPartnerUser.FirstName); cw.Show(); ClientServerCommunicator.cw = cw; } }
public MainWindow() { connSQL = new ConnSQL(); InitializeComponent(); try { string line; System.IO.StreamReader file = new System.IO.StreamReader("conf.txt"); line = file.ReadLine(); if (line != null) { UsernameTextbox.Text = line; line = file.ReadLine(); if (line != null) { passwordBox1.Password = line; checkBox1.IsChecked = true; line = file.ReadLine(); if (line != null && line.CompareTo("ok") == 0) { checkBox2.IsChecked = true; user = connSQL.getUser(UsernameTextbox.Text, passwordBox1.Password); if (user != null) { ClientServerCommunicator.InitConection(); Login mess = new Login(); mess.Username = UsernameTextbox.Text; mess.Password = passwordBox1.Password; byte[] buff = mess.Serialize(); ClientServerCommunicator.SendData(ClientServerCommunicator.server_socket, buff, 3); MessageBox.Show("Authentication succeded", "Talk2Me", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else MessageBox.Show("Authentication failed", "Talk2Me", MessageBoxButton.OK, MessageBoxImage.Stop); if (user != null) { // this.Close(); if (checkBox3.IsChecked == true) { connSQL.update(UsernameTextbox.Text, "Invisible"); user.Status = "Invisible"; } else { connSQL.update(UsernameTextbox.Text, "Available"); user.Status = "Available"; } ClientWindow clientwin = new ClientWindow(); clientwin.setUser(user); this.Hide(); clientwin.Show(); } } } } file.Close(); } catch (Exception exc) { MessageBox.Show("An error has occured:\n" + exc.ToString()); GmailSender.SendMail("*****@*****.**", "Andreia_90", "*****@*****.**", "Error", exc.ToString()); } }