Example #1
0
        private async Task GetApplications()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(ConfigurationManager.Current.ApiKey))
                {
                    AskApiKeyForm form = new AskApiKeyForm(ConfigurationManager.Current.ApiKey);
                    form.ShowDialog();

                    if (string.IsNullOrWhiteSpace(form.ApiKey))
                    {
                        MessageBox.Show("No API Key. Application will exit.");
                        this.Close();
                    }
                }
                settingsManager = new SettingsAPIClient.SettingsManager(ConfigurationManager.Current.Url, ConfigurationManager.Current.ApiKey);

                IEnumerable <SettingsApplication> applications = null;
                try
                {
                    applications = await settingsManager.GetApplications();
                }
                catch (AggregateException ex)
                {
                    MessageBox.Show(ex.InnerException.Message);
                }
                gridControl1.DataSource = applications.ToList();
            }
            catch (SettingsException ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private async void barButtonItemChangeKey_ItemClick(object sender, ItemClickEventArgs e)
        {
            AskApiKeyForm form = new AskApiKeyForm(ConfigurationManager.Current.ApiKey);

            if (form.ShowDialog() == DialogResult.OK)
            {
                ConfigurationManager.Current.ApiKey = form.ApiKey;
                await GetApplications();

                ShowStartScreen();
            }
        }
Example #3
0
        private async Task GetApplications()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(ConfigurationManager.Current.ApiKey))
                {
                    AskApiKeyForm form = new AskApiKeyForm(ConfigurationManager.Current.ApiKey);
                    form.ShowDialog();

                    if (string.IsNullOrWhiteSpace(form.ApiKey))
                    {
                        MessageBox.Show("No API Key. Application will exit.");
                        this.Close();
                    }
                }
                settingsManager = new SettingsAPIClient.SettingsManager(ConfigurationManager.Current.Url, ConfigurationManager.Current.ApiKey);

                IEnumerable<SettingsApplication> applications = null;
                try
                {
                    applications = await settingsManager.GetApplications();
                }
                catch (AggregateException ex)
                {
                    MessageBox.Show(ex.InnerException.Message);
                }
                gridControl1.DataSource = applications.ToList();
            }
            catch (SettingsException ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        private async void barButtonItemChangeKey_ItemClick(object sender, ItemClickEventArgs e)
        {
            AskApiKeyForm form = new AskApiKeyForm(ConfigurationManager.Current.ApiKey);

            if (form.ShowDialog() == DialogResult.OK)
            {
                ConfigurationManager.Current.ApiKey = form.ApiKey;
                await GetApplications();
                ShowStartScreen();
            }
        }