private void SelectDeviceForm_VisibleChanged(object sender, EventArgs e) { if (!this.Visible) { if (_garminmsDev != null) { _garminmsDev.Dispose(); _garminmsDev = null; } } }
public SelectDeviceForm() { InitializeComponent(); this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE); this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SELECTDEVICE); this.label4.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_GPXVERSION); this.button1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_OK); this.checkBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SEPFILEPERGEOCACHE); this.checkBox2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADDCHILDWAYPOINTS); this.checkBox3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_USENAME); this.checkBox4.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADDWPTTODESCR); this.checkBox5.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_USEHINTSDESCR); this.checkBox6.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_USEDATABASENAME); this.checkBox7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CREATEGGZFILE); this.checkBox8.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_INCLNOTES); this.checkBox9.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADDIMAGES); this.label8.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MAXNAMELENGTH); this.label7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MINSTARTNAME); this.label10.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_EXTRACOORDNAMEPREFIX); this.label12.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MAXLOGS); this.checkBox10.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_EXTRAINFO); numericUpDown1.Value = PluginSettings.Instance.MaxGeocacheNameLength; numericUpDown2.Value = PluginSettings.Instance.MinStartOfGeocacheName; numericUpDown3.Value = PluginSettings.Instance.MaximumNumberOfLogs; checkBox1.Checked = PluginSettings.Instance.SeperateFilePerGeocache; checkBox2.Checked = PluginSettings.Instance.AddChildWaypoints; checkBox3.Checked = PluginSettings.Instance.UseNameAndNotCode; checkBox4.Checked = PluginSettings.Instance.AddWaypointsToDescription; checkBox5.Checked = PluginSettings.Instance.UseHintsForDescription; checkBox6.Checked = PluginSettings.Instance.UseDatabaseNameForFileName; checkBox6.Enabled = !checkBox1.Checked; checkBox7.Checked = PluginSettings.Instance.CreateGGZFile; checkBox1.Enabled = !checkBox7.Checked; checkBox8.Checked = PluginSettings.Instance.AddFieldNotesToDescription; textBox1.Text = PluginSettings.Instance.CorrectedNamePrefix ?? ""; checkBox9.Checked = PluginSettings.Instance.AddImages; checkBox10.Checked = PluginSettings.Instance.AddExtraInfoToDescription; comboBox2.Items.Add(Utils.GPXGenerator.V100); comboBox2.Items.Add(Utils.GPXGenerator.V101); comboBox2.Items.Add(Utils.GPXGenerator.V102); if (!string.IsNullOrEmpty(PluginSettings.Instance.GPXVersionStr)) { comboBox2.SelectedItem = Version.Parse(PluginSettings.Instance.GPXVersionStr); } else { comboBox2.SelectedIndex = 0; } _garminmsDev = new Utils.Devices.GarminMassStorage(); _garminmsDev.DeviceAddedEvent += new EventHandler <Utils.Devices.GarminMassStorage.DeviceInfoEventArgs>(Instance_DeviceAddedEvent); _garminmsDev.DeviceRemovedEvent += new EventHandler <Utils.Devices.GarminMassStorage.DeviceInfoEventArgs>(Instance_DeviceRemovedEvent); _garminmsDev.ScanForDevices(); var dev = _garminmsDev.ConnectedDevices; if (dev != null) { comboBox1.Items.AddRange(dev.ToArray()); } if (comboBox1.Items.Count > 0) { comboBox1.SelectedIndex = 0; } }
public SelectDeviceForm() { InitializeComponent(); this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE); this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SELECTDEVICE); this.label4.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_GPXVERSION); this.button1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_OK); this.checkBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SEPFILEPERGEOCACHE); this.checkBox2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADDCHILDWAYPOINTS); this.checkBox3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_USENAME); this.checkBox4.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADDWPTTODESCR); this.checkBox5.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_USEHINTSDESCR); this.checkBox6.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_USEDATABASENAME); this.checkBox7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_CREATEGGZFILE); this.checkBox8.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_INCLNOTES); this.checkBox9.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADDIMAGES); this.label8.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MAXNAMELENGTH); this.label7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MINSTARTNAME); this.label10.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_EXTRACOORDNAMEPREFIX); numericUpDown1.Value = Properties.Settings.Default.MaxGeocacheNameLength; numericUpDown2.Value = Properties.Settings.Default.MinStartOfGeocacheName; checkBox1.Checked = Properties.Settings.Default.SeperateFilePerGeocache; checkBox2.Checked = Properties.Settings.Default.AddChildWaypoints; checkBox3.Checked = Properties.Settings.Default.UseNameAndNotCode; checkBox4.Checked = Properties.Settings.Default.AddWaypointsToDescription; checkBox5.Checked = Properties.Settings.Default.UseHintsForDescription; checkBox6.Checked = Properties.Settings.Default.UseDatabaseNameForFileName; checkBox6.Enabled = !checkBox1.Checked; checkBox7.Checked = Properties.Settings.Default.CreateGGZFile; checkBox1.Enabled = !checkBox7.Checked; checkBox8.Checked = Properties.Settings.Default.AddFieldNotesToDescription; textBox1.Text = Properties.Settings.Default.CorrectedNamePrefix ?? ""; checkBox9.Checked = Properties.Settings.Default.AddImages; comboBox2.Items.Add(Utils.GPXGenerator.V100); comboBox2.Items.Add(Utils.GPXGenerator.V101); comboBox2.Items.Add(Utils.GPXGenerator.V102); if (!string.IsNullOrEmpty(Properties.Settings.Default.GPXVersionStr)) { comboBox2.SelectedItem = Version.Parse(Properties.Settings.Default.GPXVersionStr); } else { comboBox2.SelectedIndex = 0; } _garminmsDev = new Utils.Devices.GarminMassStorage(); _garminmsDev.DeviceAddedEvent += new EventHandler<Utils.Devices.GarminMassStorage.DeviceInfoEventArgs>(Instance_DeviceAddedEvent); _garminmsDev.DeviceRemovedEvent += new EventHandler<Utils.Devices.GarminMassStorage.DeviceInfoEventArgs>(Instance_DeviceRemovedEvent); _garminmsDev.ScanForDevices(); var dev = _garminmsDev.ConnectedDevices; if (dev != null) { comboBox1.Items.AddRange(dev.ToArray()); } if (comboBox1.Items.Count > 0) { comboBox1.SelectedIndex = 0; } }