Пример #1
0
        /// <summary>
        /// Comment on a specific rant using the RantSelector
        /// </summary>
        private async void ViewSpecificRant()
        {
            var rantSelector = new IDInputWindow(IDInputWindowViewModel.Type.Rant);

            rantSelector.Owner = window;

            rantSelector.ShowDialog();

            if (!string.IsNullOrEmpty(rantSelector.InputValue))
            {
                try
                {
                    Dtos.Rant rant = await api.GetRant(Convert.ToInt64(rantSelector.InputValue));

                    var dlg = new RantViewerWindow(new ViewModels.Rant(rant), api);
                    dlg.Owner = window;

                    dlg.ShowDialog();
                }
                catch (Exception e)
                {
                    MessageBoxFactory.ShowError(e);
                }
            }
        }
Пример #2
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);
            }
        }