Example #1
0
        private async void Button_RequestCertificate(object sender, RoutedEventArgs e)
        {
            if (ItemViewModel.SelectedItem != null)
            {
                var savedOK = await ValidateAndSave(ItemViewModel.SelectedItem);

                if (!savedOK)
                {
                    return;
                }


                //begin request
                AppViewModel.MainUITabIndex = (int)MainWindow.PrimaryUITabs.CurrentProgress;

                var result = await AppViewModel.BeginCertificateRequest(ItemViewModel.SelectedItem.Id);

                if (result != null)
                {
                    if (result.IsSuccess == false && result.Result is Exception)
                    {
                        var msg = ((Exception)result.Result)?.ToString();
                        Log?.Error($"RequestCertificate: {msg}");

                        // problem communicating or completing the request
                        MessageBox.Show($"A problem occurred completing this request. Please refer to the log file for more details. \r\n {msg}");
                    }
                }

                ItemViewModel.RaisePropertyChangedEvent(nameof(ItemViewModel.SelectedItemLogEntries));
            }
        }