public UpdateInformation(ZolaService.User user) { InitializeComponent(); this._curUser = user; this.txtUsername.Text = user.Username; this.txtName.Text = user.Name; if (_curUser.IsMale == true) { cbMale.IsChecked = true; } if (_curUser.IsMale == false) { cbFemale.IsChecked = true; } string avatarPath = AvatarHelper.GetAvatarPath(user.Username); if (avatarPath != null) { imgAvatar.Source = new BitmapImage(new Uri(avatarPath, UriKind.Absolute)); } openFile.Filter = "Image Files (*.png, *.jpg, *.jpeg)|*.png;*.jpg;*.jpeg"; openFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); openFile.Multiselect = false; btnUpdateImage.IsEnabled = false; }
public FindStranger(ZolaService.User curUser) { InitializeComponent(); this._curUser = curUser; lvStrangers.ItemsSource = _displayUsers; txtStrangerUsername.Focus(); }
public void Init(ZolaService.User user) { this._curUser = user; InitUser(); InitFriends(); InitFriendsAvatar(); InitMessages(); }
private void btnAccept_Click(object sender, RoutedEventArgs e) { ZolaService.User bar = _curUser; ZolaService.User foo = new User() { Username = txtblRequestUsername.Text, Name = txtblRequestName.Text }; App.Proxy.AcceptFriendRequest(foo, bar); }
public void FriendOffline(User offlineFriend) { ZolaService.User friend = _friends.Find(x => x.Username == offlineFriend.Username); friend.IsOnline = true; ListViewItem item = _displayFriends.ToList().Find(x => (x.Content as DisplayUser).Username == offlineFriend.Username); item.ContentTemplate = (DataTemplate)this.FindResource("OfflineTemplate"); //MessageBox.Show("complete online change"); NotificationHelper.NotifyInfo(offlineFriend.Name + " is offline"); }
private void Window_Closed(object sender, EventArgs e) { this._curUser = null; if (_friends != null) { this._friends.Clear(); } this._friends = null; if (_displayFriends != null) { this._displayFriends.Clear(); } this._displayFriends = null; }
private void btnLogin_Click(object sender, RoutedEventArgs e) { MainWindow chatWindow = null; try { chatWindow = new MainWindow(); App.Connect(chatWindow); string username = txtUsername.Text; string password = txtPassword.Password; if (App.Proxy.Login(username, password)) { //MessageBox.Show("Login Success"); NotificationHelper.NotifyInfo("Login Success"); ZolaService.User user = App.Proxy.GetUserInformation(username); chatWindow.Init(user); this.Hide(); chatWindow.ShowDialog(); App.Proxy.Logout(user); } else { //MessageBox.Show("Login Fail"); NotificationHelper.NotifyError("Login Fail"); } } catch (Exception ex) { //MessageBox.Show(ex.Message); NotificationHelper.NotifyError(ex.Message); } finally { App.Disconnect(); if (chatWindow != null) { chatWindow.Hide(); chatWindow.Close(); } this.Show(); } }