private void SwitchToFriends() { RequestsButtonSelected = false; FriendsButtonSelected = true; SearchButtonSelected = false; WindowPanel = new FriendsPanelViewModel(client); }
public MainPanelViewModel(Client client) { this.client = client; client.Listen(); Notification = Properties.Resources.NotificationListPlaceholder; NotificationList = new ObservableCollection<NotificationItem>(); IsNotificationOpen = false; UnreadNotificationCount = 0; Login = client.Name; IsOnline = true; // client's notification events client.FriendshipAccepted += async delegate (string login, DateTime time) { string notification = login + " " + Properties.Resources.FriendshipAcceptedNotificationText; await addNotification(notification, time); }; client.FriendshipRejected += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.FriendshipRejectedNotificationText; await addNotification(notification, time); }; client.NewFriendshipRequest += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.NewFriendshipRequestNotificationText; await addNotification(notification, time); }; client.FriendshipRequestCancelled += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.FriendshipRequestCancelledNotificationText; await addNotification(notification, time); }; client.RemovedFromeFriends += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.FriendRemovedNotificationText; await addNotification(notification, time); }; client.ConnectionBreaks += delegate { IsOnline = false; }; RequestsButtonSelected = false; FriendsButtonSelected = true; SearchButtonSelected = false; WindowPanel = new FriendsPanelViewModel(client); // get notifications when view loads client.GetNotifications(); }
public MainPanelViewModel(Client client) { this.client = client; client.Listen(); Notification = Properties.Resources.NotificationListPlaceholder; NotificationList = new ObservableCollection <NotificationItem>(); IsNotificationOpen = false; UnreadNotificationCount = 0; Login = client.Name; IsOnline = true; // client's notification events client.FriendshipAccepted += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.FriendshipAcceptedNotificationText; await addNotification(notification, time); }; client.FriendshipRejected += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.FriendshipRejectedNotificationText; await addNotification(notification, time); }; client.NewFriendshipRequest += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.NewFriendshipRequestNotificationText; await addNotification(notification, time); }; client.FriendshipRequestCancelled += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.FriendshipRequestCancelledNotificationText; await addNotification(notification, time); }; client.RemovedFromeFriends += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.FriendRemovedNotificationText; await addNotification(notification, time); }; client.MessageSended += async delegate(string login, DateTime time) { string notification = login + " " + Properties.Resources.MessageSendedNotificationText; await addNotification(notification, time); }; client.ConnectionBreaks += delegate { IsOnline = false; }; RequestsButtonSelected = false; FriendsButtonSelected = true; SearchButtonSelected = false; WindowPanel = new FriendsPanelViewModel(client); // get notifications when view loads client.GetNotifications(); }