예제 #1
0
        public static void SavePerformanceMonitorParameters()
        {
            StreamWriter writer;

            if (File.Exists(_PerfMonRestoredFilePath))
            {
                if ((File.GetAttributes(_PerfMonRestoredFilePath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                {
                    MessageBox.Show(string.Format("File is read only - Window locations were not saved!\n{0}", _PerfMonRestoredFilePath), "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                writer = new StreamWriter(_PerfMonRestoredFilePath);
            }
            else
            {
                writer = File.CreateText(_PerfMonRestoredFilePath);
            }
            if (writer != null)
            {
                writer.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                writer.WriteLine("<PerformanceMonitor>");
                string str2   = string.Empty;
                string format = string.Empty;
                frmPerformanceMonitor perfmonFormHandle = frmPerformanceMonitor.perfmonFormHandle;
                format = "<Window name=\"{0}\" top=\"{1}\" left=\"{2}\" width=\"{3}\" height=\"{4}\" windowState=\"{5}\" trigger_timeInternal=\"{6}\" timeInterval=\"{7}\" trigger_totalCPU=\"{8}\" totalCPU=\"{9}\" trigger_SiRFLiveCPU=\"{10}\" SiRFLiveCPU=\"{11}\" trigger_physicalMemory=\"{12}\" totalPhysicalMemory=\"{13}\" trigger_SiRFLivelMemory=\"{14}\" SiRFLivePhysicalMemory=\"{15}\" trigger_VirtualMemory=\"{16}\" VirtuallMemory=\"{17}\" >";
                str2   = string.Format(format, new object[] {
                    perfmonFormHandle.Name, perfmonFormHandle.Top.ToString(), perfmonFormHandle.Left.ToString(), perfmonFormHandle.Width.ToString(), perfmonFormHandle.Height.ToString(), perfmonFormHandle.WindowState.ToString(), perfmonFormHandle.PerfTrigger_TimeInterval.ToString(), perfmonFormHandle.TimeInterval, perfmonFormHandle.PerfTrigger_TotalCPUUsage.ToString(), perfmonFormHandle.TotalCPUUsagePercentage, perfmonFormHandle.PerfTRigger_SiRFLiveCPUUsage.ToString(), perfmonFormHandle.SiRFLiveCPUUsagePercentage, perfmonFormHandle.PerfTrigger_TotalPhysMemory.ToString(), perfmonFormHandle.PhysicalMemoryUsagePercentage, perfmonFormHandle.PerfTrigger_SiRFLivePhysMemory.ToString(), perfmonFormHandle.SiRFLivePhysicalMemoryUsagePercentage,
                    perfmonFormHandle.PerfTrigger_VirtualMemoryUsage.ToString(), perfmonFormHandle.VirtualMemoryUsagePercentage
                });
                writer.WriteLine(str2);
                writer.WriteLine("</Window>");
                writer.WriteLine("</PerformanceMonitor>");
                writer.Close();
            }
        }
예제 #2
0
 public frmPerformanceMonitor()
 {
     Application.DoEvents();
     this.InitializeComponent();
     perfmonFormHandle        = this;
     this.currentDirInfo      = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory);
     this.InstalledDirectory  = this.currentDirInfo.Parent.FullName;
     _PerfMonRestoredFilePath = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Config\PerformanceMonitorRestore.xml";
     this.NumberOfProcessors  = Convert.ToInt32(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"));
     if (this.NumberOfProcessors == 0)
     {
         this.NumberOfProcessors = 1;
     }
     this.timer1.Interval = 0x3e8;
     this.timer1.Start();
     this.performanceCounter_TotalCPUUsage   = new PerformanceCounter("Processor", "% Processor Time", "_Total");
     this.performanceCounter_ProcessCPUUsage = new PerformanceCounter("Process", "% Processor Time", "_Total");
 }
예제 #3
0
        private static bool RestorePerformanceMonitorParameters()
        {
            bool        flag     = false;
            XmlDocument document = new XmlDocument();

            if (File.Exists(_PerfMonRestoredFilePath))
            {
                try
                {
                    document.Load(_PerfMonRestoredFilePath);
                    foreach (XmlNode node in document.SelectNodes("/PerformanceMonitor/Window"))
                    {
                        string str2;
                        if (((str2 = node.Attributes["name"].Value.ToString()) != null) && (str2 == "frmPerformanceMonitor"))
                        {
                            frmPerformanceMonitor perfmonFormHandle = frmPerformanceMonitor.perfmonFormHandle;
                            perfmonFormHandle.PerfTrigger_TimeInterval              = Convert.ToBoolean(node.Attributes["trigger_timeInternal"].Value.ToString());
                            perfmonFormHandle.TimeInterval                          = Convert.ToUInt32(node.Attributes["timeInterval"].Value.ToString());
                            perfmonFormHandle.PerfTrigger_TotalCPUUsage             = Convert.ToBoolean(node.Attributes["trigger_totalCPU"].Value.ToString());
                            perfmonFormHandle.TotalCPUUsagePercentage               = Convert.ToDouble(node.Attributes["totalCPU"].Value.ToString());
                            perfmonFormHandle.PerfTRigger_SiRFLiveCPUUsage          = Convert.ToBoolean(node.Attributes["trigger_SiRFLiveCPU"].Value.ToString());
                            perfmonFormHandle.SiRFLiveCPUUsagePercentage            = Convert.ToDouble(node.Attributes["SiRFLiveCPU"].Value.ToString());
                            perfmonFormHandle.PerfTrigger_TotalPhysMemory           = Convert.ToBoolean(node.Attributes["trigger_physicalMemory"].Value.ToString());
                            perfmonFormHandle.PhysicalMemoryUsagePercentage         = Convert.ToDouble(node.Attributes["totalPhysicalMemory"].Value.ToString());
                            perfmonFormHandle.PerfTrigger_SiRFLivePhysMemory        = Convert.ToBoolean(node.Attributes["trigger_SiRFLivelMemory"].Value.ToString());
                            perfmonFormHandle.SiRFLivePhysicalMemoryUsagePercentage = Convert.ToDouble(node.Attributes["SiRFLivePhysicalMemory"].Value.ToString());
                            perfmonFormHandle.PerfTrigger_VirtualMemoryUsage        = Convert.ToBoolean(node.Attributes["trigger_VirtualMemory"].Value.ToString());
                            perfmonFormHandle.VirtualMemoryUsagePercentage          = Convert.ToDouble(node.Attributes["VirtuallMemory"].Value.ToString());
                            loadLocation(frmPerformanceMonitor.perfmonFormHandle, node.Attributes["top"].Value.ToString(), node.Attributes["left"].Value.ToString(), node.Attributes["width"].Value.ToString(), node.Attributes["height"].Value.ToString(), node.Attributes["windowState"].Value.ToString());
                            flag = true;
                        }
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show("frmPerformanceMonitor() + RestorePerformanceMonitorParameters()\r\r" + exception.ToString());
                }
            }
            return(flag);
        }
예제 #4
0
 public frmPerformanceMonitor()
 {
     Application.DoEvents();
     this.InitializeComponent();
     perfmonFormHandle = this;
     this.currentDirInfo = Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory);
     this.InstalledDirectory = this.currentDirInfo.Parent.FullName;
     _PerfMonRestoredFilePath = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Config\PerformanceMonitorRestore.xml";
     this.NumberOfProcessors = Convert.ToInt32(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"));
     if (this.NumberOfProcessors == 0)
     {
         this.NumberOfProcessors = 1;
     }
     this.timer1.Interval = 0x3e8;
     this.timer1.Start();
     this.performanceCounter_TotalCPUUsage = new PerformanceCounter("Processor", "% Processor Time", "_Total");
     this.performanceCounter_ProcessCPUUsage = new PerformanceCounter("Process", "% Processor Time", "_Total");
 }
예제 #5
0
 public frmPerformanceMonitor CreatefrmPerformanceMonitorWindow()
 {
     _objFrmPerfMonitor = new frmPerformanceMonitor();
     _objFrmPerfMonitor.MdiParent = this;
     _objFrmPerfMonitor.Show();
     return _objFrmPerfMonitor;
 }
예제 #6
0
 private object GetContentFromPersistString(string persistString)
 {
     if (persistString == typeof(frmAutomationTests).ToString())
     {
         _objFrmAutoTest = CreateAutomationTestWindow();
         return _objFrmAutoTest;
     }
     if (persistString == typeof(frmPerformanceMonitor).ToString())
     {
         _objFrmPerfMonitor = CreatefrmPerformanceMonitorWindow();
         return _objFrmPerfMonitor;
     }
     if (persistString == typeof(frmPython).ToString())
     {
         _objFrmPython = CreatePythonWindow();
         return _objFrmPython;
     }
     if (persistString == typeof(frmCommInputMessage).ToString())
     {
         if ((_objFrmCommOpen != null) && !_objFrmCommOpen.IsDisposed)
         {
             _objFrmCommInputMessage = new frmCommInputMessage();
             _objFrmCommInputMessage.CommWindow = _objFrmCommOpen.comm;
             _objFrmCommOpen._inputCommands = _objFrmCommInputMessage;
         }
         return _objFrmCommInputMessage;
     }
     if (persistString == typeof(frmCommLocationMap).ToString())
     {
         if ((_objFrmCommOpen != null) && !_objFrmCommOpen.IsDisposed)
         {
             _objFrmCommLocationMap = new frmCommLocationMap();
             _objFrmCommLocationMap.CommWindow = _objFrmCommOpen.comm;
             _objFrmCommOpen._locationViewPanel = _objFrmCommLocationMap;
         }
         return _objFrmCommLocationMap;
     }
     if (persistString == typeof(frmCommSignalView).ToString())
     {
         if ((_objFrmCommOpen != null) && !_objFrmCommOpen.IsDisposed)
         {
             _objFrmCommSignalView = new frmCommSignalView();
             _objFrmCommSignalView.CommWindow = _objFrmCommOpen.comm;
             _objFrmCommOpen._signalStrengthPanel = _objFrmCommSignalView;
         }
         return _objFrmCommSignalView;
     }
     if (persistString == typeof(frmEncryCtrl).ToString())
     {
         if ((_objFrmCommOpen != null) && !_objFrmCommOpen.IsDisposed)
         {
             _objFrmEncryCtrl = new frmEncryCtrl(_objFrmCommOpen.comm);
             _objFrmEncryCtrl.CommWindow = _objFrmCommOpen.comm;
         }
         return _objFrmEncryCtrl;
     }
     if (persistString == typeof(frmRFCaptureCtrl).ToString())
     {
         _objFrmCaptureCtrl = CreateRFReplayCaptureWindow();
         return _objFrmCaptureCtrl;
     }
     if (persistString == typeof(frmRFPlaybackConfig).ToString())
     {
         _objFrmRFPlaybackConfig = CreateRFReplayConfigWindow();
         return _objFrmRFPlaybackConfig;
     }
     if (persistString == typeof(frmRFPlaybackCtrl).ToString())
     {
         _objFrmRFPlaybackCtrl = CreateRFReplayPlaybackWindow();
         return _objFrmRFPlaybackCtrl;
     }
     if (persistString == typeof(frmSimplexCtrl).ToString())
     {
         _objFrmSimplexCtrl = frmSimplexCtrl.GetChildInstance();
         return _objFrmSimplexCtrl;
     }
     if (persistString == typeof(frmSPAzCtrl).ToString())
     {
         _objFrmSPAzCtrl = frmSPAzCtrl.GetChildInstance();
         return _objFrmSPAzCtrl;
     }
     if (persistString == typeof(frmRackCtrl).ToString())
     {
         _objFrmRackCtrl = frmRackCtrl.GetChildInstance();
         return _objFrmRackCtrl;
     }
     if (persistString == typeof(frmE911Report).ToString())
     {
         _objFrmE911Report = frmE911Report.GetChildInstance("E911");
         return _objFrmE911Report;
     }
     if (persistString == typeof(frmNavPerformanceReport).ToString())
     {
         _objFrmNavPerformanceReport = frmNavPerformanceReport.GetChildInstance();
         return _objFrmNavPerformanceReport;
     }
     /*
      * //!
     if (persistString == typeof(frmGPIBCtrl).ToString())
     {
         _objFrmGPIBCtrl = frmGPIBCtrl.GetChildInstance();
         return _objFrmNavPerformanceReport;
     }
      */
     if (persistString.Contains("frmCommOpen"))
     {
         _objFrmCommOpen = new frmCommOpen();
         return _objFrmCommOpen;
     }
     return null;
 }
예제 #7
0
 public frmPerformanceLoggingConditions()
 {
     this.InitializeComponent();
     this.PMF = new frmPerformanceMonitor();
 }
 public frmPerformanceLoggingConditions()
 {
     this.InitializeComponent();
     this.PMF = new frmPerformanceMonitor();
 }