private void RadioButtom_Click(object sender, RoutedEventArgs e)
 {
     //MessageBox.Show("RadioButtom_Click: " + sender.ToString());
     //System.Diagnostics.Debug.WriteLine("RadioButton_Click: " + sender.ToString());
     //s_logger.Debug("RadioButton_Click: " + sender.ToString());
     if ((bool)((RadioButton)sender).IsChecked)
     {
         location            = (AddressbookInfo)((RadioButton)sender).DataContext;
         Button_Ok.IsEnabled = true;
     }
 }
Beispiel #2
0
        public async Task <CredentialSet> GetCredentialsAsync(string carddavUrl)
        {
            try
            {
                // if carddavUrl is given directly invoke get credentials with publicId as argument
                if (carddavUrl != null)
                {
                    string[] sa = carddavUrl.Split('/');
                    return(await QueryCredentialSetAsync(sa[8]));
                }

                AddressbookInfo[] r = await QueryAddressbookInfosAsync();

                if (r == null || r.Length == 0)
                {
                    s_logger.Error(String.Format("{0} | No location or addressbook found", UUID));
                    ErrorWindow errorWindow = new ErrorWindow(Globalization.Strings.Localize("LABEL_NO_ADDRESSBOOK_FOUND"));
                    errorWindow.ShowDialog();
                    return(null);
                }

                if (r.Length == 1)
                {
                    return(await QueryCredentialSetAsync(r[0].PublicId));
                }

                LocationSelectorWindow locationSelectorWindow = new LocationSelectorWindow(r);
                locationSelectorWindow.ShowDialog();

                AddressbookInfo location = locationSelectorWindow.GetSelectedLocationInfo();
                if (location != null)
                {
                    return(await QueryCredentialSetAsync(location.PublicId));
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                s_logger.Error(String.Format("{0} | Error while querying API: {1}", UUID, ex.ToString()));
                ErrorWindow errorWindow = new ErrorWindow(errorMessage: Globalization.Strings.Localize("LABEL_UNEXPECTED_ERROR"));
                errorWindow.ShowDialog();
                return(null);
            }
        }
 private void Action_LocationSelectorWindow_Button_Cancel(object sender, RoutedEventArgs e)
 {
     //System.Diagnostics.Debug.WriteLine("Action_LocationSelectorWindow_Button_Cancel: " + sender.ToString());
     location = null;
     Close();
 }