예제 #1
0
        public SimpleMainForm()
        {
            InitializeComponent();

            m_objRFE = new RFECommunicator();
            m_objRFE.PortClosedEvent += new EventHandler(OnRFE_PortClosed);
            m_objRFE.ReportInfoAddedEvent += new EventHandler(OnRFE_ReportLog);
            m_objRFE.ReceivedConfigurationDataEvent += new EventHandler(OnRFE_ReceivedConfigData);
            m_objRFE.UpdateDataEvent += new EventHandler(OnRFE_UpdateData);
        }
예제 #2
0
        public MainForm(string sFile)
        {
#if CALLSTACK
            Console.WriteLine("CALLSTACK:MainForm");
#endif

            try
            {
                if (!String.IsNullOrEmpty(sFile))
                    m_sStartFile = sFile;

                SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
                SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                SetStyle(ControlStyles.UserPaint, true);
                InitializeComponent();

                InitializeRFGenTab();

                m_GraphSpectrumAnalyzer = new ZedGraph.ZedGraphControl();
                m_WaterfallSweepMaxHold = new RFESweepDataCollection(100, false);
                m_Markers = new MarkerCollection();
                m_Markers.Initialize();
                CreateMarkerMenu();

                m_objRFEAnalyzer = new RFECommunicator();
                m_objRFEAnalyzer.PortClosedEvent += new EventHandler(OnAnalyzerPortClosed);
                m_objRFEAnalyzer.PortConnectedEvent += new EventHandler(OnAnalyzerPortConnected);
                m_objRFEAnalyzer.ReportInfoAddedEvent += new EventHandler(OnAnalyzerReportLog);
                m_objRFEAnalyzer.ReceivedConfigurationDataEvent += new EventHandler(OnAnalyzerReceivedConfigData);
                m_objRFEAnalyzer.UpdateDataEvent += new EventHandler(OnAnalyzerUpdateData);
                m_objRFEAnalyzer.UpdateRemoteScreenEvent += new EventHandler(OnAnalyzerUpdateRemoteScreen);
                m_objRFEAnalyzer.ReceivedDeviceModelEvent += new EventHandler(OnAnalyzerReceivedDeviceModel);
                m_objRFEAnalyzer.UpdateDataTrakingNormalizationEvent += new EventHandler(OnAnalyzerUpdateDataTrakingNormalization);
                m_objRFEAnalyzer.UpdateDataTrakingEvent += new EventHandler(OnAnalyzerUpdateTrackingData);
                m_objRFEAnalyzer.ShowDetailedCOMPortInfo = false;

                m_groupCOMPortAnalyzer = new ToolGroupCOMPort();
                m_groupCOMPortAnalyzer.RFExplorer = m_objRFEAnalyzer;
                m_groupCOMPortAnalyzer.PortClosed += new EventHandler(OnAnalyzerButtons_PortClosed);
                m_groupCOMPortAnalyzer.PortConnected += new EventHandler(OnAnalyzerButtons_PortConnected);
                m_groupCOMPortAnalyzer.GroupBoxTitle = "COM Port Spectrum Analyzer";

                m_objRFEGenerator = new RFECommunicator();
                m_objRFEGenerator.PortClosedEvent += new EventHandler(OnGeneratorPortClosed);
                m_objRFEGenerator.PortConnectedEvent += new EventHandler(OnGeneratorPortConnected);
                m_objRFEGenerator.ReportInfoAddedEvent += new EventHandler(OnGeneratorReportLog);
                m_objRFEGenerator.ReceivedConfigurationDataEvent += new EventHandler(OnGeneratorReceivedConfigData);
                //m_objRFEGen.UpdateData += new EventHandler(OnRFE_UpdateData);
                m_objRFEGenerator.UpdateRemoteScreenEvent += new EventHandler(OnAnalyzerUpdateRemoteScreen);
                m_objRFEGenerator.ReceivedDeviceModelEvent += new EventHandler(OnGeneratorReceivedDeviceModel);
                m_objRFEGenerator.ShowDetailedCOMPortInfo = false;

                m_groupCOMPortGenerator = new ToolGroupCOMPort();
                m_groupCOMPortGenerator.RFExplorer = m_objRFEGenerator;
                //m_groupCOMPortGenerator.PortClosed += new EventHandler(OnGeneratorButtons_PortClosed);
                //m_groupCOMPortGenerator.PortConnected += new EventHandler(OnGeneratorButtons_PortConnected);
                m_groupCOMPortGenerator.GroupBoxTitle = "COM Port Signal Generator";

                printMainDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument_PrintPage);
                printMainDocument.DocumentName = "RF Explorer";
            }
            catch (Exception obEx)
            {
                string sReportFile = Environment.GetEnvironmentVariable("APPDATA") + "\\rfexplorer_crash.log";
                using (StreamWriter sr = new StreamWriter(sReportFile, true))
                {
                    sr.WriteLine(Environment.NewLine + Environment.NewLine +
                        "------------------------------------------------------------" + Environment.NewLine +
                        "Report log date " + DateTime.Now.ToString() + Environment.NewLine);
                    sr.WriteLine("Exception: " + obEx.ToString());
                    sr.Flush();
                }
            }
        }