private void associateApplyButton_Click(object sender, System.EventArgs e) { messageLabel.Text = ""; string openCmd = Project.GetLongPathName(Application.ExecutablePath) + " \"%1\""; if(associateLocCheckBox.Checked) { try { FileAssociation FA = new FileAssociation(); FA.Extension = "loc"; FA.ContentType = "application/geocaching"; FA.FullName = "Geocaching.com .LOC File"; FA.ProperName = "LOC File"; FA.IconPath = Project.GetMiscPath(Project.PROGRAM_NAME_HUMAN + ".ico"); FA.AddCommand("open", openCmd); FA.Create(); associateLocCheckBox.Enabled = false; associateLocCheckBox.Checked = false; assocLocLabel.Visible = true; messageLabel.Text += "Success "; } catch (Exception ee) { messageLabel.Text += ee.Message + " "; associateLocCheckBox.Checked = false; assocLocLabel.Visible = false; } } if(associateGpxCheckBox.Checked) { try { FileAssociation FA = new FileAssociation(); FA.Extension = "gpx"; FA.ContentType = "application/gps-mapping"; FA.FullName = "GPS eXchange File"; FA.ProperName = "GPX File"; FA.IconPath = Project.GetMiscPath(Project.PROGRAM_NAME_HUMAN + ".ico"); FA.AddCommand("open", openCmd); FA.Create(); associateGpxCheckBox.Enabled = false; associateGpxCheckBox.Checked = false; assocGpxLabel.Visible = true; messageLabel.Text += "Success "; } catch (Exception ee) { messageLabel.Text += ee.Message + " "; associateGpxCheckBox.Checked = false; assocGpxLabel.Visible = false; } } if(associateGpzCheckBox.Checked) { try { FileAssociation FA = new FileAssociation(); FA.Extension = "gpz"; FA.ContentType = "application/gps-photo-collection"; FA.FullName = "QuakeMap.com .GPZ File"; FA.ProperName = "GPZ File"; FA.IconPath = Project.GetMiscPath(Project.PROGRAM_NAME_HUMAN + ".ico"); FA.AddCommand("open", openCmd); FA.Create(); associateGpzCheckBox.Enabled = false; associateGpzCheckBox.Checked = false; assocGpzLabel.Visible = true; messageLabel.Text += "Success"; } catch (Exception ee) { messageLabel.Text += ee.Message; associateGpzCheckBox.Checked = false; assocGpzLabel.Visible = false; } } }
private void checkFileAssociations() { string openCmd = Project.GetLongPathName(Application.ExecutablePath) + " \"%1\""; FileAssociation FA = new FileAssociation(); FA.Extension = "gpx"; FA.AddCommand("open", openCmd); associateGpxCheckBox.Checked = !FA.Test(); associateGpxCheckBox.Enabled = true; assocGpxLabel.Visible = !associateGpxCheckBox.Checked; FA = new FileAssociation(); FA.Extension = "loc"; FA.AddCommand("open", openCmd); associateLocCheckBox.Checked = !FA.Test(); associateLocCheckBox.Enabled = true; assocLocLabel.Visible = !associateLocCheckBox.Checked; FA = new FileAssociation(); FA.Extension = "gpz"; FA.AddCommand("open", openCmd); associateGpzCheckBox.Checked = !FA.Test(); associateGpzCheckBox.Enabled = true; assocGpzLabel.Visible = !associateGpzCheckBox.Checked; }
private void _hideGreeting() { /* if(m_daysSinceInstall >= Project.SPOILER_DAYS_START && !MyLicense.unlocked) { //new DlgExplainSpoiling().Show(); } */ //this.Focus(); //this.BringToFront(); // main form to front TileCache.greetingForm = null; try { if(m_greetingForm != null) { //m_greetingForm.Hide(); m_greetingForm.Close(); m_greetingForm = null; } if(m_greetingThread != null) { Thread.Sleep(500); // let the dialog close before we abort the thread m_greetingThread.Abort(); m_greetingThread = null; } } catch { } this.hintsPanel.Visible = Project.showHelpAtStart && (m_args.Length == 0) && !hintsPanelClicked; try { bool allAssociated; string openCmd = Project.GetLongPathName(Application.ExecutablePath) + " \"%1\""; FileAssociation FA = new FileAssociation(); FA.Extension = "loc"; FA.AddCommand("open", openCmd); allAssociated = FA.Test(); if(allAssociated) { FA = new FileAssociation(); FA.Extension = "gpx"; FA.AddCommand("open", openCmd); allAssociated = FA.Test(); } if(allAssociated) { FA = new FileAssociation(); FA.Extension = "gpz"; FA.AddCommand("open", openCmd); allAssociated = FA.Test(); } this.notAssociatedButton.Visible = !allAssociated; this.notAssociatedLabel.Visible = !allAssociated; } catch {} if(!hasShownUpdateForm && Project.upgradeMessage.Length > 0) { hasShownUpdateForm = true; new DlgUpgradeMessage(Project.upgradeMessage).ShowDialog(); } else { //Thread.Sleep(1000); this.Focus(); this.BringToFront(); // main form to front } }