コード例 #1
0
        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);
        }
コード例 #2
0
        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}");
            }
        }
コード例 #3
0
        private void btnFilezilla_Click(object sender, EventArgs e)
        {
            if (_currentApp == null)
            {
                return;
            }

            var fileZillaLocation = AcmSettings.Load().FileZillaLocation;

            Process.Start(fileZillaLocation, _currentApp.FtpSettings.FilezillaArgument);
        }
コード例 #4
0
 private void Settings_Load(object sender, EventArgs e)
 {
     LoadSettings(AcmSettings.Load());
 }