public void ShowSiteProperties() { DialogSitePropertiesViewModel vm = new DialogSitePropertiesViewModel(); UserInterfaceFactory.GetUiSystem().DisplayForm(AvailableForms.SiteProperties, vm); if (vm.IsCallsignAndGridSquareValid() == false) { UserInterfaceFactory.GetUiSystem().DisplayModalError( "Paclink must have a valid configuration to continue...", "Error"); Environment.Exit(-1); } }
public PrimaryThread() { // // Initializes the program on startup... // int intIndex = Globals.Settings.Get("Properties", "Default Local IP Address Index", 0); if (intIndex < 0) { intIndex = 0; } if (Globals.strLocalIPAddresses.Length - 1 >= intIndex) { Globals.strLocalIPAddress = Globals.strLocalIPAddresses[intIndex]; } Globals.SiteCallsign = Globals.Settings.Get("Properties", "Site Callsign", ""); Globals.SiteGridSquare = Globals.Settings.Get("Properties", "Grid Square", ""); Globals.intSMTPPortNumber = Globals.Settings.Get("Properties", "SMTP Port Number", 25); Globals.intPOP3PortNumber = Globals.Settings.Get("Properties", "POP3 Port Number", 110); Globals.blnLAN = Globals.Settings.Get("Properties", "LAN Connection", true); Globals.blnEnableRadar = Globals.Settings.Get("Properties", "Enable Radar", false); Globals.strServiceCodes = Globals.Settings.Get("Properties", "ServiceCodes", ""); if (string.IsNullOrEmpty(Globals.strServiceCodes)) { if (Globals.IsMARSCallsign(Globals.SiteCallsign)) { Globals.strServiceCodes = Globals.strMARSServiceCode; } else { Globals.strServiceCodes = Globals.strHamServiceCode; } Globals.Settings.Save("Properties", "ServiceCodes", Globals.strServiceCodes); } string strSitePassword = Globals.Settings.Get("Properties", "Site Password", ""); Globals.POP3Password = Globals.Settings.Get("Properties", "EMail Password", strSitePassword); Globals.Settings.Save("Properties", "EMail Password", Globals.POP3Password); Globals.Settings.Save("Properties", "Site Password", ""); Globals.SecureLoginPassword = Globals.Settings.Get("Properties", "Secure Login Password", ""); Channels.FillChannelCollection(); try { Globals.PollingData.LoadParameters(); } catch (Exception ex) { _log.Error("[Main.Startup C] " + ex.Message); } try { // Open the properties dialog box if no initial configuration has been set... DialogSitePropertiesViewModel vm = new DialogSitePropertiesViewModel(); if (vm.IsCallsignAndGridSquareValid() == false) { UserInterfaceFactory.GetUiSystem().DisplayForm(AvailableForms.SiteProperties, vm); if (vm.IsCallsignAndGridSquareValid() == false) { MessageBox.Show("Paclink must have a valid initial configuration to continue...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); MyApplication.Forms.Main.CloseWindow(); return; } } } catch (Exception ex) { _log.Error("[Main.Startup F] " + ex.Message); } try { Accounts.RefreshAccountsList(); } catch (Exception ex) { _log.Error("[Main.Startup G] " + ex.Message); } try { MyApplication.Forms.Main.UpdateChannelList(); } catch (Exception ex) { _log.Error("[Main.Startup G] " + ex.Message); } MyApplication.Forms.Main.UpdateSiteCallsign(Globals.SiteCallsign); if (Globals.UseRMSRelay()) { Globals.queChannelDisplay.Enqueue("G*** Paclink is set to connect to RMS Relay."); } if (Globals.blnForceHFRouting) { Globals.queChannelDisplay.Enqueue("G*** Paclink is set to send messages via radio-only forwarding."); } Globals.queChannelDisplay.Enqueue("G*** Paclink " + Application.ProductVersion + " ready..."); MyApplication.Forms.Main.EnableMainWindowInterface(); if (thrSMTP != null) { _abortSMTPThread = true; thrSMTP.Join(); thrSMTP = null; } thrSMTP = new Thread(SMTPThread); thrSMTP.Name = "SMTP"; thrSMTP.Start(); if (thrChannel != null) { _abortChannelThread = true; thrChannel.Join(); thrChannel = null; } thrChannel = new Thread(ChannelThread); thrChannel.Name = "Channel"; thrChannel.Start(); }