コード例 #1
0
ファイル: MainForm.cs プロジェクト: lanicon/EtLast
        public MainForm()
        {
            InitializeComponent();

            Font = new Font(Font.FontFamily, 9, FontStyle.Regular);
            Text = "EtLast Diagnostics";

            _stateManager = new DiagnosticsStateManager("http://+:8642/");
            _stateManager.OnDiagSessionCreated += SessionCreated;

            _sessionTabs = new TabControl()
            {
                Dock     = DockStyle.Fill,
                Parent   = this,
                DrawMode = TabDrawMode.OwnerDrawFixed,
                SizeMode = TabSizeMode.Fixed,
                ItemSize = new Size(96, 24),
            };

            _sessionTabs.DrawItem  += DrawSessionTabHeader;
            _sessionTabs.MouseDown += SessionTabs_MouseDown;

            _timer = new Timer()
            {
                Interval = 500,
                Enabled  = false,
            };
            _timer.Tick += UpdateTimerTick;

            _stateManager.Start();
            _timer.Start();
        }
コード例 #2
0
ファイル: SessionControl.cs プロジェクト: lanicon/EtLast
        public SessionControl(DiagSession session, Control container, DiagnosticsStateManager diagnosticsStateManager)
        {
            Session   = session;
            Container = container;
            DiagnosticsStateManager = diagnosticsStateManager;

            Container.SuspendLayout();
            try
            {
                _tabs = new TabControl()
                {
                    Parent     = container,
                    Anchor     = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
                    Appearance = TabAppearance.FlatButtons,
                };

                var logContainer = new TabPage("LOG")
                {
                    BorderStyle = BorderStyle.None,
                };

                _tabs.TabPages.Add(logContainer);

                var logManager = new LogListControl(logContainer, diagnosticsStateManager, Session);

                var ioCommandContainer = new TabPage("I/O")
                {
                    BorderStyle = BorderStyle.None,
                };

                _tabs.TabPages.Add(ioCommandContainer);

                var ioCommandManager = new SessionIoCommandListControl(ioCommandContainer, diagnosticsStateManager, Session);

                logManager.OnLogDoubleClicked             += OnLogDoubleClicked;
                ioCommandManager.OnIoCommandDoubleClicked += OnIoCommandDoubleClicked;

                diagnosticsStateManager.OnDiagContextCreated += OnDiagContextCreated;

                container.Resize += Container_Resize;
                Container_Resize(null, EventArgs.Empty);
            }
            finally
            {
                Container.ResumeLayout();
            }
        }
コード例 #3
0
        public LogListControl(Control container, DiagnosticsStateManager diagnosticsStateManager, DiagSession session)
        {
            Container = container;
            Session   = session;

            _updater = new ControlUpdater <LogModel>(null, Container)
            {
                ItemFilter = ItemFilter,
            };

            _updater.CreateSearchBox(10, 10);

            ShowDebugLevel = new CheckBox()
            {
                Parent     = container,
                Bounds     = new Rectangle(_updater.SearchBox.Right + 20, _updater.SearchBox.Top, 200, _updater.SearchBox.Height),
                Text       = "Show debug level",
                CheckAlign = ContentAlignment.MiddleLeft,
            };

            ShowDebugLevel.CheckedChanged += (s, a) => _updater.RefreshItems(true);

            _updater.ListView.Anchor        = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
            _updater.ListView.Bounds        = new Rectangle(Container.ClientRectangle.Left, Container.ClientRectangle.Top + 40, Container.ClientRectangle.Width, Container.ClientRectangle.Height - 40);
            _updater.ListView.ItemActivate += ListView_ItemActivate;

            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text                    = "Timestamp",
                AspectGetter            = x => (x as LogModel)?.Timestamp,
                AspectToStringConverter = x => ((DateTime)x).ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture),
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Severity",
                AspectGetter = x => (x as LogModel)?.Event.Severity.ToShortString(),
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Context",
                AspectGetter = x => (x as LogModel)?.Playbook.DiagContext.Name,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Process",
                AspectGetter = x => (x as LogModel)?.Process?.Name,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Kind",
                AspectGetter = x => (x as LogModel)?.Process?.KindToString(),
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Type",
                AspectGetter = x => (x as LogModel)?.Process?.Type,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Topic",
                AspectGetter = x => (x as LogModel)?.Process?.Topic,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Message",
                AspectGetter = x => (x as LogModel)?.Text,
            });

            _updater.Start();

            diagnosticsStateManager.OnDiagContextCreated += ec =>
            {
                if (ec.Session == session)
                {
                    ec.WholePlaybook.OnEventsAdded += OnEventsAdded;
                }
            };
        }
コード例 #4
0
        public SessionIoCommandListControl(Control container, DiagnosticsStateManager diagnosticsStateManager, DiagSession session)
        {
            Container = container;
            Session   = session;

            _updater = new ControlUpdater <IoCommandModel>(null, container)
            {
                ItemFilter = ItemFilter,
            };

            _updater.CreateSearchBox(10, 10);

            ShowDbTransactionKind = new CheckBox()
            {
                Parent     = container,
                Bounds     = new Rectangle(_updater.SearchBox.Right + 20, _updater.SearchBox.Top, 130, _updater.SearchBox.Height),
                Text       = "DB transactions",
                CheckAlign = ContentAlignment.MiddleLeft,
            };

            ShowDbTransactionKind.CheckedChanged += (s, a) => _updater.RefreshItems(true);

            ShowDbConnectionKind = new CheckBox()
            {
                Parent     = container,
                Bounds     = new Rectangle(ShowDbTransactionKind.Right + 20, ShowDbTransactionKind.Top, 130, ShowDbTransactionKind.Height),
                Text       = "DB connections",
                CheckAlign = ContentAlignment.MiddleLeft,
            };

            ShowDbConnectionKind.CheckedChanged += (s, a) => _updater.RefreshItems(true);

            HideVeryFast = new CheckBox()
            {
                Parent     = container,
                Bounds     = new Rectangle(ShowDbConnectionKind.Right + 20, ShowDbTransactionKind.Top, 130, ShowDbTransactionKind.Height),
                Text       = "Hide very fast",
                CheckAlign = ContentAlignment.MiddleLeft,
                Checked    = true,
            };

            HideVeryFast.CheckedChanged += (s, a) => _updater.RefreshItems(true);

            _updater.ListView.Anchor        = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
            _updater.ListView.Bounds        = new Rectangle(Container.ClientRectangle.Left, Container.ClientRectangle.Top + 40, Container.ClientRectangle.Width, Container.ClientRectangle.Height - 40);
            _updater.ListView.ItemActivate += ListView_ItemActivate;

            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "ID",
                AspectGetter = x => (x as IoCommandModel)?.StartEvent.Uid,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text                    = "Timestamp",
                AspectGetter            = x => (x as IoCommandModel)?.Timestamp,
                AspectToStringConverter = x => ((DateTime)x).ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture),
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Context",
                AspectGetter = x => (x as IoCommandModel)?.Playbook.DiagContext.Name,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Process",
                AspectGetter = x => (x as IoCommandModel)?.Process.Name,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Kind",
                AspectGetter = x => (x as IoCommandModel)?.Process.KindToString(),
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Type",
                AspectGetter = x => (x as IoCommandModel)?.Process.Type,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Topic",
                AspectGetter = x => (x as IoCommandModel)?.Process.Topic,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Transaction",
                AspectGetter = x => (x as IoCommandModel)?.StartEvent.TransactionId,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Command kind",
                AspectGetter = x => (x as IoCommandModel)?.StartEvent.Kind.ToString(),
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Location",
                AspectGetter = x => (x as IoCommandModel)?.StartEvent.Location,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text         = "Path",
                AspectGetter = x => (x as IoCommandModel)?.StartEvent.Path,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text            = "Timeout",
                AspectGetter    = x => (x as IoCommandModel)?.StartEvent.TimeoutSeconds,
                TextAlign       = HorizontalAlignment.Right,
                HeaderTextAlign = HorizontalAlignment.Right,
            });
            _updater.ListView.Columns.Add(new OLVColumn()
            {
                Text                    = "Elapsed",
                AspectGetter            = x => (x as IoCommandModel)?.Elapsed,
                AspectToStringConverter = x => x is TimeSpan ts ? FormattingHelpers.RightAlignedTimeSpanToString(ts) : null,
                TextAlign               = HorizontalAlignment.Right,
                HeaderTextAlign         = HorizontalAlignment.Right,
            });