private void BasicSetupToolStripMenuItem_Click(System.Object sender, System.EventArgs e) { TNCSetup dlgSetup = new TNCSetup(); string strFault = ""; dlgSetup.ShowDialog(); if (dlgSetup.DialogResult == System.Windows.Forms.DialogResult.OK) { ToolStripMenuItem1.Enabled = MCB.RadioControl; if (StopCodec(ref strFault)) { if (!StartCodec(ref strFault)) { Logs.Exception("[BasicSetupDialog] Failure to restart Codec after setup change"); } } else { Logs.Exception("[BasicSetupDialog] Failure to stop Codec after setup change"); } objMod = null; objMod = new EncodeModulate(); } }
private void Main_Load(object sender, System.EventArgs e) { // Create subdirectories as required... if (Directory.Exists(strExecutionDirectory + "Logs") == false) Directory.CreateDirectory(strExecutionDirectory + "Logs"); if (Directory.Exists(strExecutionDirectory + "Wav") == false) Directory.CreateDirectory(strExecutionDirectory + "Wav"); strWavDirectory = strExecutionDirectory + "Wav\\"; // Set inital window position and size... objIniFile = new INIFile(strExecutionDirectory + "ARDOP_Win TNC.ini"); InitializeFromIni(); objMod = new EncodeModulate(); // initializes all the leaders etc. dttLastSoundCardSample = Now; tmrPoll.Start(); string strFault = ""; tmrStartCODEC.Start(); //Dim objPA As New PortAudioVB ' Enable only for testing PortAudio if (blnInTestMode) ShowTestFormToolStripMenuItem.Enabled = true; // This keeps the size of the graphics panels constant to handle cases where font size (in Control Panel, Display is 125% or 150% and recenters the waterfall panel. Drawing.Point dpWaterfallCorner = pnlWaterfall.Location; pnlWaterfall.Left = (dpWaterfallCorner.X + pnlWaterfall.Width / 2) - 105; pnlWaterfall.Height = 63; pnlWaterfall.Width = 210; pnlConstellation.Height = 91; pnlConstellation.Width = 91; Logs.WriteDebug("[ARDOP_Win TNC.Main.Load] Command line =" + Microsoft.VisualBasic.Command().Trim); // nothing in command line so use ini values if (string.IsNullOrEmpty(Microsoft.VisualBasic.Command().Trim)) { // use ini file values for host and port Globals.MCB.TCPAddress = Globals.objIniFile.GetString("ARDOP Win", "TCPIP Address", "127.0.0.1"); MCB.TCPPort = objIniFile.GetInteger("ARDOP Win", "TCPIP Port", 8515); MCB.HostTCPIP = Convert.ToBoolean(objIniFile.GetString("ARDOP_Win TNC", "HostTCPIP", "True")); if (MCB.HostTCPIP) objHI.TCPIPProperties(MCB.TCPAddress, MCB.TCPPort); // MCB.HostSerial = Convert.ToBoolean(objIniFile.GetString("ARDOP_Win TNC", "HostSerial", "False")); MCB.SerCOMPort = objIniFile.GetString("ARDOP Win", "SerialCOMPort", "none"); MCB.SerBaud = objIniFile.GetInteger("ARDOP Win", "SerialBaud", 19200); if (MCB.HostSerial) objHI.SerialProperties(MCB.SerCOMPort, MCB.SerBaud); // MCB.HostBlueTooth = Convert.ToBoolean(objIniFile.GetString("ARDOP_Win TNC", "HostBlueTooth", "False")); MCB.HostPairing = objIniFile.GetString("ARDOP_Win TNC", "Host Pairing", "none"); if (MCB.HostBlueTooth) objHI.BluetoothProperties(MCB.HostPairing); CloseToolStripMenuItem.Enabled = true; } else { // test command line parameters for validity: "TCPIP TCPIPPort# TCPIPAddress", Serial POrt, or "BLUETOOTH BlueToothPairing" string[] strCmds = Microsoft.VisualBasic.Command().Split(Convert.ToChar(" ")); if (strCmds.Length == 3 && (strCmds(0).ToUpper == "TCPIP" & (Information.IsNumeric(strCmds(1).Trim) & (Convert.ToInt32(strCmds(1).Trim) >= 0 & Convert.ToInt32(strCmds(1).Trim) < 65536)))) { // TCPIP parameters OK so use these in place of ini values MCB.HostTCPIP = true; MCB.HostSerial = false; MCB.HostBlueTooth = false; objHI.TCPIPProperties(strCmds(2).Trim, Convert.ToInt32(strCmds(1).Trim)); MCB.TCPPort = Convert.ToInt32(strCmds(1).Trim); MCB.TCPAddress = strCmds(2).Trim; } else if (strCmds.Length == 3 && (strCmds(0).ToUpper == "SERIAL" & Information.IsNumeric(strCmds(1).Trim) & (Convert.ToInt32(strCmds(1).Trim) >= 9600))) { MCB.HostTCPIP = false; MCB.HostSerial = true; MCB.HostBlueTooth = false; objHI.SerialProperties(strCmds(1).Trim.ToUpper, Convert.ToInt32(strCmds(2).Trim)); MCB.SerCOMPort = strCmds(1).Trim.ToUpper; MCB.SerBaud = Convert.ToInt32(strCmds(2).Trim); // Preliminay ....may need work for bluetooth } else if (strCmds.Length == 2 && strCmds(0).ToUpper == "BLUETOOTH") { MCB.HostTCPIP = false; MCB.HostSerial = false; MCB.HostBlueTooth = true; objHI.BluetoothProperties(strCmds(1)); MCB.HostPairing = strCmds(1); } else { Logs.Exception("[Main.Load] Syntax error in command line: " + Microsoft.VisualBasic.Command() + " ... ini file values used."); } CloseToolStripMenuItem.Enabled = false; } objHI.EnableHostLink(); }