Пример #1
0
 /// <summary>
 /// General > API Providers > Add.
 /// Displays the API provider configuration.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddAPIServer_Click(object sender, EventArgs e)
 {
     SerializableAPIProvider newProvider = new SerializableAPIProvider();
     using (APISettingsForm apiForm = new APISettingsForm(m_settings.APIProviders, newProvider))
     {
         DialogResult result = apiForm.ShowDialog();
         if (result == DialogResult.OK)
         {
             m_settings.APIProviders.CustomProviders.Add(newProvider);
             InitialiseAPIProvidersDropDown();
             cbAPIServer.SelectedIndex = cbAPIServer.Items.Count - 1;
         }
     }
 }
Пример #2
0
 public APISettingsForm(APIProvidersSettings providers, SerializableAPIProvider newProvider)
 {
     InitializeComponent();
     m_providers = providers;
     m_provider = newProvider;
 }
Пример #3
0
        /// <summary>
        /// General > API Providers > Add.
        /// Displays the API provider configuration.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddAPIServer_Click(object sender, EventArgs e)
        {
            SerializableAPIProvider newProvider = new SerializableAPIProvider();
            newProvider.Methods.AddRange(APIMethod.CreateDefaultSet().Select(
                apiMethod => new SerializableAPIMethod
                {
                    MethodName = apiMethod.Method.ToString(),
                    Path = apiMethod.Path
                }));

            using (APISettingsForm apiForm = new APISettingsForm(m_settings.APIProviders, newProvider))
            {
                DialogResult result = apiForm.ShowDialog();
                if (result != DialogResult.OK)
                    return;

                m_settings.APIProviders.CustomProviders.Add(newProvider);
                InitializeAPIProvidersDropDown();
                cbAPIServer.SelectedIndex = cbAPIServer.Items.Count - 1;
            }
        }