Beispiel #1
0
 /// <summary>
 /// Handles the Click event of the btnTest control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 private void btnTest_Click(object sender, EventArgs e)
 {
     try
     {
         RepositoryManager.CheckRepository(txtRepositoryUrl.Text);
         ServiceLocator.Instance.IDEHelper.ShowMessage("Success!!");
     }
     catch (Exception ex)
     {
         ServiceLocator.Instance.IDEHelper.ShowMessage(String.Format("Error - {0}", ex.Message));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Handles the Click event of the btnOK control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            _optionsPageControl.CommitChanges();

            try
            {
                Directory.CreateDirectory(_optionsPageControl.OptionsPage.BaseDirectory);
                Directory.CreateDirectory(
                    Path.Combine(_optionsPageControl.OptionsPage.BaseDirectory, RepositoryCategory.Strategies.ToString()));
                Directory.CreateDirectory(
                    Path.Combine(_optionsPageControl.OptionsPage.BaseDirectory,
                                 RepositoryCategory.Configuration.ToString()));
            }
            catch
            {
                ServiceLocator.Instance.IDEHelper.ShowError(
                    String.Format(GuiResources.UnableCreateDirectory, _optionsPageControl.OptionsPage.BaseDirectory));
                return;
            }

            try
            {
                if (_optionsPageControl.OptionsPage.RepositoryEnabled)
                {
                    RepositoryManager.CheckRepository(_optionsPageControl.OptionsPage.RepositoryUrl);
                }
            }
            catch
            {
                ServiceLocator.Instance.IDEHelper.ShowError(
                    String.Format(GuiResources.InvalidUrlRepository, _optionsPageControl.OptionsPage.RepositoryUrl));
                return;
            }

            _optionsPageControl.OptionsPage.SaveSettingsToStorage();
            DialogResult = DialogResult.OK;
        }