private void btnOK_Click(object sender, EventArgs e) { if (!Directory.Exists(tbxOccultPath.Text)) { MessageBox.Show(string.Format("Path '{0}' does not exist", tbxOccultPath.Text)); tbxOccultPath.SelectAll(); tbxOccultPath.Focus(); return; } if (!File.Exists(Path.Combine(tbxOccultPath.Text, "OccultUtilities.dll"))) { MessageBox.Show(string.Format("Cannot find Occult4 installation in '{0}'", tbxOccultPath.Text)); tbxOccultPath.SelectAll(); tbxOccultPath.Focus(); return; } m_Settings.OccultLocation = tbxOccultPath.Text; string errorMessage = m_OccultWrapper.HasSupportedVersionOfOccult(m_Settings.OccultLocation); if (errorMessage != null) { MessageBox.Show(errorMessage); tbxOccultPath.SelectAll(); tbxOccultPath.Focus(); return; } m_Settings.Save(); DialogResult = DialogResult.OK; Close(); }
public void Execute() { if (m_AOTAFormVisible) { ShowErrorMessage("AOTA is already running."); return; } ILightCurveDataProvider dataProvider = m_TangraHost.GetLightCurveDataProvider(); if (!Directory.Exists(m_Settings.OccultLocation)) { string locationFromOW = OccultWatcherHelper.GetConfiguredOccultLocation(); if (Directory.Exists(locationFromOW)) { m_Settings.OccultLocation = locationFromOW; m_Settings.Save(); } else { m_Addin.Configure(); } } string errorMessage = m_OccultWrapper.HasSupportedVersionOfOccult(m_Settings.OccultLocation); if (errorMessage != null) { ShowErrorMessage(errorMessage); m_Addin.Configure(); } if (dataProvider != null) { errorMessage = m_OccultWrapper.HasSupportedVersionOfOccult(m_Settings.OccultLocation); if (errorMessage == null) { if (m_OccultWrapper.RunAOTA(dataProvider, m_TangraHost.ParentWindow)) { m_AOTAFormVisible = true; } } else { ShowErrorMessage(errorMessage); } } }