Exemple #1
0
 public TestCtx(ILogContainer log, string hostAaddr, string hostBaddr)
 {
     Trace    = new Trace();
     this.log = log;
     HostA    = new TestNode(this, Host.A, log, hostAaddr);
     HostB    = new TestNode(this, Host.B, log, hostBaddr);
 }
Exemple #2
0
 public TestNode(TestCtx testCtx, Host host, ILogContainer log, string hostName)
 {
     Network      = new NwClient();
     HostName     = hostName;
     this.testCtx = testCtx;
     Host         = host;
     this.log     = log;
 }
        /// <summary>
        /// Creates a new instance of the <see cref="FrmLogWindow"/> window.
        /// </summary>
        /// <param name="logProvider">The <see cref="ILogProvider"/> that sends messages to this window.</param>
        /// <param name="logContainer">The <see cref="ILogContainer"/> that contains the source for <see cref="LogMessage"/>s.</param>
        public FrmLogWindow(ILogProvider logProvider, ILogContainer logContainer)
        {
            InitializeComponent();

            mLogcontainer = logContainer;
            mBookmarks    = new List <LogMessage>();
            InitializeColumns(logProvider);

            if (!logProvider.HasLoggerTree)
            {
                // Remove the synchronize tree menu item if no tree is available.
                cmLogMessage.Items.Remove(cmsSynchronizeTree);
                cmLogMessage.Items.Remove(cmsSeperator);
            }

            ThemeManager.ApplyTo(this);

            if (!string.IsNullOrEmpty(Settings.Default.LogMessagesFontName))
            {
                try
                {
                    dtgLogMessages.DefaultCellStyle.Font = FontCache.GetFontFromIdentifier(
                        Settings.Default.LogMessagesFontName
                        , Settings.Default.LogMessagesFontSize
                        , FontStyle.Regular);
                }
                catch
                {
                    // Reset the font on error.
                    dtgLogMessages.Font = FontCache.GetFontFromIdentifier(
                        DEFAULT_FONT_NAME
                        , DEFAULT_FONT_SIZE
                        , FontStyle.Regular);

                    mRowHeight = dtgLogMessages.RowTemplate.Height;

                    // Save the changed settings as new default.
                    Settings.Default.LogMessagesFontName = DEFAULT_FONT_NAME;
                    Settings.Default.LogMessagesFontSize = DEFAULT_FONT_SIZE;

                    Settings.Default.SaveSettings();
                }
            }

            if (Settings.Default.EnableColorMap)
            {
                tableLayoutPanel1.SetColumnSpan(dtgLogMessages, 1);
                colorMap1.Visible = true;
            }
            else
            {
                colorMap1.Visible = false;
                tableLayoutPanel1.SetColumnSpan(dtgLogMessages, 2);
            }

            // Listening for settings changes.
            Settings.Default.SettingChanging += DefaultSettingChanging;
        }
Exemple #4
0
        public MainWindow(ILogContainer logContainer)
        {
            this.logContainer          = logContainer;
            this.logContainer.Updated += LoggingUpdated;
            InitializeComponent();
            MenuMru.MenuClick += (s, e) => FileOpenCore(e.Filepath);

            ITest selectedTest = null;
            var   testFactory  = new TestFactory();

            foreach (var test in testFactory.GetList())
            {
                tests.Add(test);
                if (test.Name.Equals(Settings.Default.SelectedTest))
                {
                    selectedTest = test;
                }
            }
            CmbTests.DataContext = tests;

            if (selectedTest != null)
            {
                CmbTests.SelectedItem = selectedTest;
                BtnStart.Focus();
            }
            else
            {
                CmbTests.Focus();
                CmbTests.IsDropDownOpen = true;
                BtnStart.IsEnabled      = false;
            }
            var lineSerie = new StairStepSeries()
            {
                Smooth = true, MarkerType = MarkerType.Diamond
            };

            lineSerie.Points.Add(new DataPoint(0.4, 4));
            lineSerie.Points.Add(new DataPoint(10, 13));
            lineSerie.Points.Add(new DataPoint(20, 15));
            lineSerie.Points.Add(new DataPoint(30, 16));
            lineSerie.Points.Add(new DataPoint(40, 12));
            lineSerie.Points.Add(new DataPoint(50, 12));
            var model = new PlotModel();

            model.Series.Add(lineSerie);
            Plot.Model = model;
        }
Exemple #5
0
        private void mnuMainExtrasOptions_Click(object sender, EventArgs e)
        {
            IOptionPanel[] optionPanels =
            {
                new OptionPanelGeneral(),
                new OptionPanelFontColor(),
                new OptionPanelScriptEditor()
            };

            using (FrmOptions optionsDlg = new FrmOptions(optionPanels))
            {
                if (optionsDlg.ShowDialog(this) == DialogResult.OK)
                {
                    using (new WaitCursor(Cursors.Default, Settings.Default.WaitCursorTimeout))
                    {
                        foreach (IOptionPanel optionPanel in optionPanels)
                        {
                            optionPanel.SaveSettings();
                        }

                        foreach (IDockContent dockContent in mainDockPanel.Documents)
                        {
                            ILogContainer currentDocument = dockContent as ILogContainer;

                            if (currentDocument != null)
                            {
                                // Update the UI refresh value for all logging windows.
                                currentDocument.UpdateTimerInterval(
                                    Settings.Default.UiRefreshIntervalMs);
                            }
                        }

                        // Force a repaint of all UI elements.
                        Refresh();
                    }
                }
            }
        }
Exemple #6
0
 internal SocketServer(IServerConfig config, IDeviceContainer deviceContainer = null, ILogContainer logContainer = null)
     : base(config, deviceContainer, logContainer)
 {
 }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Log"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="logContainer">The Show Container.</param>
 public Log(string name, ILogContainer logContainer = null)
 {
     m_Name        = name;
     _logContainer = logContainer;
 }
        public static void LogWithId(this ILogContainer log, string category, string note)
        {
            var id = (System.Web.HttpContext.Current.Items["X-Request-Id"] ?? "").ToString();

            log.Log(id: id, level: "debug", category: category, note: note);
        }
Exemple #9
0
 public IServer CreateServer(IServerConfig config, IDeviceContainer deviceContainer = null, ILogContainer logContainer = null)
 {
     try
     {
         return(new Server(config, deviceContainer, logContainer));
     }
     catch
     {
         throw;
     }
 }
Exemple #10
0
        /// <summary>
        /// Creates a new instance of the <see cref="FrmLogWindow"/> window.
        /// </summary>
        /// <param name="logProvider">The <see cref="ILogProvider"/> that sends messages to this window.</param>
        /// <param name="logContainer">The <see cref="ILogContainer"/> that contains the source for <see cref="LogMessage"/>s.</param>
        public FrmLogWindow(ILogProvider logProvider, ILogContainer logContainer)
        {
            InitializeComponent();

              mLogcontainer = logContainer;
              mBookmarks    = new List<LogMessage>();
              InitializeColumns(logProvider);

              if (!logProvider.HasLoggerTree)
              {
            // Remove the synchronize tree menu item if no tree is available.
            cmLogMessage.Items.Remove(cmsSynchronizeTree);
              }

              ThemeManager.CurrentApplicationTheme.ApplyTo(cmColumns);
              ThemeManager.CurrentApplicationTheme.ApplyTo(cmLogMessage);

              if (!string.IsNullOrEmpty(Settings.Default.LogMessagesFontName))
              {
            try
            {
              dtgLogMessages.DefaultCellStyle.Font = new Font(
              Settings.Default.LogMessagesFontName
            , Settings.Default.LogMessagesFontSize);
            }
            catch
            {
              // Reset the font on error.
              dtgLogMessages.Font = new Font(
              DEFAULT_FONT_NAME
            , DEFAULT_FONT_SIZE);

              mRowHeight = dtgLogMessages.RowTemplate.Height;

              // Save the changed settings as new default.
              Settings.Default.LogMessagesFontName = DEFAULT_FONT_NAME;
              Settings.Default.LogMessagesFontSize = DEFAULT_FONT_SIZE;

              Settings.Default.SaveSettings();
            }
              }

              if (Settings.Default.EnableColorMap)
              {
            tableLayoutPanel1.SetColumnSpan(dtgLogMessages, 1);
            colorMap1.Visible = true;
              }
              else
              {
            colorMap1.Visible = false;
            tableLayoutPanel1.SetColumnSpan(dtgLogMessages, 2);
              }

              // Listening for settings changes.
              Settings.Default.SettingChanging += DefaultSettingChanging;
        }
Exemple #11
0
        internal ServerBase(IServerConfig config, IDeviceContainer deviceContainer = null, ILogContainer logContainer = null)
        {
            if (config == null)
            {
                throw new ArgumentNullException("配制信息", "参数为空");
            }
            ServerConfig = config;

            _deviceContainer = deviceContainer;
            if (_deviceContainer != null)
            {
                _deviceContainer.MouseRightContextMenu += Device_MouseRightContextMenu;
            }

            if (logContainer == null)
            {
                logContainer = new ConsoleContainer();
            }

            Logger = (new LogFactory()).GetLog(ServerName, logContainer);

            _monitorException = new MonitorException();

            ServiceManager      = new ServiceManager(Logger);
            GraphicsShowManager = new GraphicsShowManager(Logger);
            DeviceManager       = new DeviceManager(Logger);
            ChannelManager      = new ChannelManager(Logger);
            ControllerManager   = new ControllerManager(Logger);

            IsDisposed = false;
        }
Exemple #12
0
 /// <summary>
 /// 创建日志实例
 /// </summary>
 /// <param name="name"></param>
 /// <param name="logContainer"></param>
 /// <returns></returns>
 public ILog GetLog(string name, ILogContainer logContainer = null)
 {
     return(new Log(name, logContainer));
 }
Exemple #13
0
        /// <summary>
        /// Creates a new instance of the <see cref="FrmLogScript"/> window.
        /// </summary>
        /// <param name="bookmarkProvider">The <see cref="IBookmarkProvider"/> instance that provides bookmarked <see cref="LogMessage"/>s.</param>
        /// <param name="logContainer">The <see cref="ILogContainer"/> that contains the source for <see cref="LogMessage"/>s.</param>
        public FrmLogScript(IBookmarkProvider bookmarkProvider, ILogContainer logContainer)
        {
            InitializeComponent();

              // Apply the current application theme to the control.
              ThemeManager.CurrentApplicationTheme.ApplyTo(tsCuCommands);
              ThemeManager.CurrentApplicationTheme.ApplyTo(tsOutput);
              ThemeManager.CurrentApplicationTheme.ApplyTo(cmsLuaEdit);

              DockHandler.CloseButton        = false;
              DockHandler.CloseButtonVisible = false;

              mLogContainer     = logContainer;
              mBookmarkProvider = bookmarkProvider;

              if (mBookmarkProvider != null)
              {
            mBookmarkProvider.RegisterBookmarkObserver(this);
              }

              // Intialize the edit control.
              InitializeScintilaCtrl();

              // Prevent the undo of the initial text.
              scintilla.EmptyUndoBuffer();

              // Listening for settings changes.
              Settings.Default.SettingChanging += DefaultSettingChanging;
        }