Beispiel #1
0
        private async void ViewSpecificProfile()
        {
            try
            {
                var dlg = new IDInputWindow(IDInputWindowViewModel.Type.Profile);
                dlg.Owner = window;
                dlg.ShowDialog();

                string username = dlg.InputValue;

                if (!string.IsNullOrEmpty(username))
                {
                    bool valid = await api.IsValidUser(username);

                    if (valid)
                    {
                        ViewProfile(username);
                    }
                    else
                    {
                        throw new Exception(username + " does not exist.");
                    }
                }
            }
            catch (Exception e)
            {
                MessageBoxFactory.ShowError(e);
            }
        }
        private async void AddUser()
        {
            if (string.IsNullOrEmpty(UserToFollow))
            {
                return;
            }
            else if (users.Contains(UserToFollow))
            {
                UserToFollow = null;
                return;
            }

            bool valid = await api.IsValidUser(UserToFollow);

            if (valid)
            {
                users.Add(UserToFollow);
                UserToFollow = null;
            }
            else
            {
                MessageBoxFactory.ShowError(UserToFollow + " does not exist.");
            }
        }