Skip to content

Commit

Permalink
Update to 0.4.2.17
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohne authored Oct 3, 2019
1 parent 240e89f commit 59fe72e
Show file tree
Hide file tree
Showing 17 changed files with 5,885 additions and 2,217 deletions.
110 changes: 55 additions & 55 deletions AboutBoxForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion AboutBoxForm.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using System;
using Hipparcos_DB.Properties;
using System;
using System.Reflection;
using System.Windows.Forms;

namespace Hipparcos_DB
{
partial class AboutBoxForm : Form
{
private readonly Settings settings = new Settings();

public AboutBoxForm()
{
InitializeComponent();
Expand All @@ -15,6 +18,12 @@ public AboutBoxForm()
labelCopyright.Text = AssemblyCopyright;
labelCompanyName.Text = AssemblyCompany;
textBoxDescription.Text = AssemblyDescription;
switch (settings.UserStartPosition)
{
case 0: StartPosition = FormStartPosition.CenterParent; break;
case 1: StartPosition = FormStartPosition.CenterScreen; break;
default: StartPosition = FormStartPosition.CenterParent; break;
}
}

private void SetStatusbar(string text)
Expand All @@ -37,6 +46,10 @@ private void SetStatusbar(object sender, EventArgs e)
{
SetStatusbar(text: ((RadioButton)sender).AccessibleDescription);
}
else if (sender is CheckBox)
{
SetStatusbar(text: ((CheckBox)sender).AccessibleDescription);
}
else if (sender is DateTimePicker)
{
SetStatusbar(text: ((DateTimePicker)sender).AccessibleDescription);
Expand Down
38 changes: 25 additions & 13 deletions CatalogChooserForm.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using System;
using Hipparcos_DB.Properties;
using System;
using System.IO;
using System.Windows.Forms;

namespace Hipparcos_DB
{
public partial class CatalogChooserForm : Form
{
private readonly Settings settings = new Settings();

private readonly string[] filesHipparcosCatalog =
{
"h_dm_com.dat.gz",
Expand Down Expand Up @@ -36,6 +39,14 @@ private string RemoveFileExtension(string filename)
public CatalogChooserForm()
{
InitializeComponent();
/*switch (settings.UserStartPosition)
{
case 0: StartPosition = FormStartPosition.CenterParent; break;
case 1: StartPosition = FormStartPosition.CenterScreen; break;
default: StartPosition = FormStartPosition.CenterParent; break;
}
*/
buttonDownloadTychoCatalog.Enabled = buttonOpenTychoCatalog.Enabled = false;
}

private void SetStatusbar(string text)
Expand All @@ -58,6 +69,10 @@ private void SetStatusbar(object sender, EventArgs e)
{
SetStatusbar(text: ((RadioButton)sender).AccessibleDescription);
}
else if (sender is CheckBox)
{
SetStatusbar(text: ((CheckBox)sender).AccessibleDescription);
}
else if (sender is DateTimePicker)
{
SetStatusbar(text: ((DateTimePicker)sender).AccessibleDescription);
Expand Down Expand Up @@ -132,26 +147,20 @@ private void ClearStatusbar()

private void CatalogChooserForm_Load(object sender, EventArgs e)
{
buttonDownloadTychoCatalog.Enabled = buttonOpenTychoCatalog.Enabled = false;
/*
if (!Directory.Exists(path: "catalogs/i239"))
{
buttonOpenHipparcosCatalog.Enabled = false;
buttonOpenTychoCatalog.Enabled = false;
}
*/
ClearStatusbar();
}

#region Click event handlers

private void ButtonOpenTychoCatalog_Click(object sender, EventArgs e)
{
settings.Reload();
throw new NotImplementedException();
}

private void ButtonInfo_Click(object sender, EventArgs e)
{
settings.Reload();
using (AboutBoxForm formAboutBox = new AboutBoxForm())
{
formAboutBox.ShowDialog();
Expand All @@ -160,6 +169,7 @@ private void ButtonInfo_Click(object sender, EventArgs e)

private void ButtonOptions_Click(object sender, EventArgs e)
{
settings.Reload();
using (OptionsForm formOptions = new OptionsForm())
{
formOptions.ShowDialog();
Expand All @@ -173,18 +183,19 @@ private void ButtonExit_Click(object sender, EventArgs e)

private void ButtonDownloadHipparcosCatalog_Click(object sender, EventArgs e)
{
settings.Reload();
using (DownloaderForm downloaderForm = new DownloaderForm())
{
downloaderForm.SetHost(host: "http://cdsarc.u-strasbg.fr/ftp/I/239/");
//downloaderForm.SetHost(host: "http://cdsarc.u-strasbg.fr/viz-bin/nph-Cat/txt.gz?I/239/");
downloaderForm.SetHost(host: settings.UserHostName);
downloaderForm.SetHostUrls(files: filesHipparcosCatalog);
downloaderForm.SetCatalogDirectory(directory: "catalogs/i239/");
downloaderForm.SetCatalogDirectory(directory: settings.UserHipparcosCatalogDirectory);
downloaderForm.ShowDialog();
}
}

private void ButtonDownloadTychoCatalog_Click(object sender, EventArgs e)
{
settings.Reload();
using (DownloaderForm downloaderForm = new DownloaderForm())
{
downloaderForm.ShowDialog();
Expand All @@ -193,12 +204,13 @@ private void ButtonDownloadTychoCatalog_Click(object sender, EventArgs e)

private void ButtonOpenHipparcosCatalog_Click(object sender, EventArgs e)
{
settings.Reload();
bool allFilesFound = true;
foreach (string file in filesHipparcosCatalog)
{
if (allFilesFound)
{
if (File.Exists(path: "catalogs/i239/" + RemoveFileExtension(filename: file)))
if (File.Exists(path: settings.UserHipparcosCatalogDirectory + RemoveFileExtension(filename: file)))
{
allFilesFound = true;
}
Expand Down
Loading

0 comments on commit 59fe72e

Please sign in to comment.