private static string GetAuthorizationHeader() { var config = AcmSettings.Load(); AuthenticationResult result = null; var context = new AuthenticationContext(string.Format( config.Login, config.TenantId)); var thread = new Thread(() => { result = context.AcquireToken( config.ApiEndpoint, config.ClientId, new Uri(config.RedirectUri)); }); thread.SetApartmentState(ApartmentState.STA); thread.Name = "AquireTokenThread"; thread.Start(); thread.Join(); if (result == null) { throw new InvalidOperationException("Failed to obtain the JWT token"); } return(result.AccessToken); }
private void LoadSubscriptions() { var config = AcmSettings.Load(); comboSubscription.Items.Clear(); foreach (var sub in config.Subscriptions.OrderBy(s => s.Value)) { comboSubscription.Items.Add($"{sub.Value}={sub.Key}"); } }
private void btnFilezilla_Click(object sender, EventArgs e) { if (_currentApp == null) { return; } var fileZillaLocation = AcmSettings.Load().FileZillaLocation; Process.Start(fileZillaLocation, _currentApp.FtpSettings.FilezillaArgument); }
private void Settings_Load(object sender, EventArgs e) { LoadSettings(AcmSettings.Load()); }