public LoginPanelViewModel(Client client)
        {
			this.client = client;
			Notification = Properties.Resources.WelcomeNotification;
			IsLoading = false;
			IsClosing = false;
		}
        public MainWindowViewModel()
        {
            client = new Client();
            ShowWarning = false;
            client.ConnectionBreaks += delegate { ShowWarning = true; };

            ShowLoginPanel();
        }
        public SearchPanelViewModel(Client client)
        {
            this.client = client;
            this.client.PropertyChanged += UsersListChanged;

            UsersList = new ObservableCollection<User>();

            // get users when panel loads
            this.client.GetAllUsers();
        }
		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 User(Client client, string name, bool isOnline)
 {
     this.client = client;
     Name = name;
     IsOnline = isOnline;
 }
 public OutcomeRequest(Client client, string name)
 {
     this.client = client;
     Name = name;
 }
        public RequestsPanelViewModel(Client client)
        {
            this.client = client;
            client.PropertyChanged += ReqsListChanged;

            IncomeReqsList = new ObservableCollection<IncomeRequest>();
            OutcomeReqsList = new ObservableCollection<OutcomeRequest>();

            client.FriendshipAccepted += async delegate (string login, DateTime time)
            {
                await System.Threading.Tasks.Task.Run(() =>
                System.Threading.Thread.Sleep(Properties.Settings.Default.ActionDelayMsec));
                OutcomeReqsList.Remove(OutcomeReqsList.FirstOrDefault(x => x.Name.Equals(login)));
            };
            client.FriendshipRejected += async delegate (string login, DateTime time)
            {
                await System.Threading.Tasks.Task.Run(() =>
                System.Threading.Thread.Sleep(Properties.Settings.Default.ActionDelayMsec));
                OutcomeReqsList.Remove(OutcomeReqsList.FirstOrDefault(x => x.Name.Equals(login)));
            };
            client.NewFriendshipRequest += async delegate (string login, DateTime time)
            {
                await System.Threading.Tasks.Task.Run(() =>
                System.Threading.Thread.Sleep(Properties.Settings.Default.ActionDelayMsec));
                if (IncomeReqsList.FirstOrDefault(x => x.Name.Equals(login)) == null)
                    IncomeReqsList.Add(new IncomeRequest(client, login));
            };
            client.FriendshipRequestCancelled += async delegate (string login, DateTime time)
            {
                await System.Threading.Tasks.Task.Run(() =>
                System.Threading.Thread.Sleep(Properties.Settings.Default.ActionDelayMsec));
                IncomeReqsList.Remove(IncomeReqsList.FirstOrDefault(x => x.Name.Equals(login)));
            };

            // get requests when panel loads
            client.GetIncomeFriendshipRequests();
            client.GetOutcomeFriendshipRequests();
        }
		public FriendsPanelViewModel(Client client)
		{
			this.client = client;
			client.PropertyChanged += FriendsListChanged;
			client.NewReplyComes += NewReply;
			client.OldReplyComes += OldReply;
			client.FriendGoOnline += FriendGoOnline;
			client.FriendGoOffline += FriendGoOffline;
			client.FriendshipAccepted += FriendshipAccepted;
			client.RemovedFromeFriends += RemovedFromeFriends;

			FriendsList = new ObservableCollection<Friend>();
			RepliesList = new ObservableCollection<Reply>();

			IsDialogVisible = false;

			// get friends when panel loads
			client.GetFriends();
		}