コード例 #1
0
ファイル: MainForm.cs プロジェクト: RFExplorer/rfexplorer-1
 private void OnAbout_Click(object sender, EventArgs e)
 {
     using (About_RFExplorer myAbout = new About_RFExplorer())
     {
         myAbout.ShowDialog();
     }
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: RFExplorer/rfexplorer-1
        private void MainForm_Load(object sender, EventArgs e)
        {
#if CALLSTACK
            Console.WriteLine("CALLSTACK:MainForm_Load");
#endif
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                //Check OpenGL and disable Waterfall if not supported
                if (m_controlWaterfall.OpenGL_Supported == false)
                {
                    ReportLog(m_controlWaterfall.InitializationError, true);
                    ReportLog("ERROR: OpenGL 3D graphics are not supported in this system. Please check with your Graphics Card vendor. " + Environment.NewLine +
                        "Waterfall graphics require OpenGL. Waterfall graphics are disabled", false);
                    m_panelWaterfall.Visible = false;
                    m_panelWaterfall.Enabled = false;
                    System.Windows.Forms.Label warningLabel = new System.Windows.Forms.Label();
                    warningLabel.Text = "Invalid graphics mode - 3D OpenGL not supported - check your video card";
                    warningLabel.Location = m_panelWaterfall.Location;
                    warningLabel.AutoSize = true;
                    m_tabWaterfall.Controls.Add(warningLabel);
                }
                else
                {
                    ReportLog("OpenGL 3D mode: " + m_controlWaterfall.InternalOpenGLControl.RenderContextType +
                                  " - version: " + m_controlWaterfall.InternalOpenGLControl.OpenGL.Version +
                                  " - vendor:" + m_controlWaterfall.InternalOpenGLControl.OpenGL.Vendor +
                                  " - renderer:" + m_controlWaterfall.InternalOpenGLControl.OpenGL.Renderer
                             , false);
                    //ReportLog("OpenGL supported extensions: " + controlWaterfall.InternalOpenGLControl.OpenGL.Extensions, true);
                }

                menuUseAmplitudeCorrection.Enabled = false; //disable this boy till a valid file is loaded

#if SUPPORT_EXPERIMENTAL
            m_arrRAWSnifferData     = new string[m_nTotalBufferSize];
            m_nRAWSnifferIndex      = 0;
            m_nMaxRAWSnifferIndex   = 0;
            numSampleDecoder.Maximum = m_nTotalBufferSize;
            numSampleDecoder.Minimum = 0;
            numSampleDecoder.Value  = 0;
#endif
                toolStripMemory.Maximum = RFESweepDataCollection.MAX_ELEMENTS;
                toolStripMemory.Step = RFESweepDataCollection.MAX_ELEMENTS / 25;

                numericSampleSA.Minimum = 0;
                numericSampleSA.Value = 0;
                UpdateSweepNumericControls();

                numScreenIndex.Minimum = 0;
                numScreenIndex.Maximum = 0;
                numScreenIndex.Value = 0;

                numericIterations.Maximum = 10000;
                numericIterations.Value = 10;

                m_PenDarkBlue = new Pen(Color.DarkBlue, 1);
                m_PenRed = new Pen(Color.Red, 1);
                m_BrushDarkBlue = new SolidBrush(Color.DarkBlue);

                m_bIsWinXP = (Environment.OSVersion.Version.Major <= 5);

                btnLoadSettings.Left = menuComboSavedOptions.Control.Right + 5;
                btnSaveSettings.Left = btnLoadSettings.Right + 5;
                btnDelSettings.Left = btnSaveSettings.Right + 5;

                m_groupCOMPortAnalyzer.GetConnectedPorts();
                m_groupCOMPortGenerator.GetConnectedPorts();
                LoadProperties();

                InitializeSpectrumAnalyzerGraph();
                DefineGraphColors();
                //make sure vertical size is limited as otherwise sometimes the editor may screw up things
                m_groupControl_DataFeed.MaximumSize = new Size(m_groupControl_DataFeed.Width, 116);
                m_groupControl_Commands.MaximumSize = new Size(m_groupControl_Commands.Width, 116);
                m_groupControl_FreqSettings.MaximumSize = new Size(m_groupControl_FreqSettings.Width, 116);
                m_groupControl_RemoteScreen.MaximumSize = new Size(m_groupControl_RemoteScreen.Width, 116);
                m_groupCOMPortGenerator.MaximumSize = new Size(m_groupCOMPortGenerator.Width, 116);
                m_groupControl_RFEGen_CW.MaximumSize = new Size(m_groupControl_RFEGen_CW.Width, 116);
                m_groupControl_RFEGen_FrequencySweep.MaximumSize = new Size(m_groupControl_RFEGen_FrequencySweep.Width, 116);
                m_groupCOMPortAnalyzer.MaximumSize = new Size(m_groupCOMPortAnalyzer.Width, 116);
                m_groupControl_RFEGen_Tracking.MaximumSize = new Size(m_groupControl_RFEGen_Tracking.Width, 116);

                SetupSpectrumAnalyzerAxis();

#if SUPPORT_EXPERIMENTAL
                InitializeRAWDecoderGraph();
#endif
                UpdateButtonStatus();
                m_bLayoutInitialized = true;
                DisplayGroups();

                try
                {
                    m_SoundPlayer.SoundLocation = m_sAppDataFolder + "\\notify.wav";
                    m_SoundPlayer.LoadAsync();
                }
                catch (Exception obSoundException)
                {
                    ReportLog("Error accessing sound alarm file " + m_SoundPlayer.SoundLocation, false);
                    ReportLog(obSoundException.ToString(), true);
                }

                chkHoldMode.Checked = !chkRunMode.Checked;
                chkHoldDecoder.Checked = !chkRunDecoder.Checked;
#if DEBUG
                menuDebug.Visible = true;
                menuDebug.Enabled = true;
#endif

                if (!String.IsNullOrEmpty(m_sStartFile))
                {
                    if (RFECommunicator.IsFileExtensionType(m_sStartFile, RFECommunicator._RFL_File_Extension))
                    {
                        m_sFilenameRFE = m_sStartFile;
                        LoadFileRFE(m_sFilenameRFE);
                    }
                    else if (RFECommunicator.IsFileExtensionType(m_sStartFile, RFECommunicator._RFS_File_Extension))
                    {
                        m_sFilenameRFS = m_sStartFile;
                        LoadFileRFS(m_sFilenameRFS);
                        m_MainTab.SelectedTab = m_tabRemoteScreen;
                    }
                }
                else
                {
                    //try to reconnect analyzer
                    m_groupCOMPortAnalyzer.ConnectPort();
                    if (!m_objRFEAnalyzer.PortConnected)
                    {
                        //To guarantee all markers are properly hidden when first load with no connection or data
                        DisplaySpectrumAnalyzerData();
                    }
                }
                m_timer_receive.Enabled = true;
            }
            catch (Exception obEx)
            {
                ReportLog("Error in MainForm_Load: " + obEx.ToString(), true);
            }

            if ((m_winAboutModeless != null) && (m_winAboutModeless.IsDisposed == false))
            {
                Thread.Sleep(500);
                m_winAboutModeless.Close();
                m_winAboutModeless.Dispose();
                m_winAboutModeless = null;
            }

            Cursor.Current = Cursors.Default;
        }