Пример #1
0
        public override void SetDatabaseObject(IActivateItems activator, ExternalDatabaseServer databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);

            if (_navigationTrack == null)
            {
                //what happens when user clicks back/forward
                _navigationTrack = new NavigationTrack <LogViewerFilter>(f => true, f =>
                {
                    if (f.LoggingTable != LoggingTables.None)
                    {
                        var cmd = new ExecuteCommandViewLoggedData(activator, f);
                        cmd.Execute();
                    }
                });

                //set the initial filter
                _navigationTrack.Append(Filter);
                _back = new ToolStripButton("Back", FamFamFamIcons.Back, (s, e) => _navigationTrack.Back(true))
                {
                    DisplayStyle = ToolStripItemDisplayStyle.Image
                };
            }

            CommonFunctionality.Add(_back);

            CommonFunctionality.Add(label1);
            CommonFunctionality.Add(tbContentFilter);

            CommonFunctionality.Add(label2);
            CommonFunctionality.Add(tbTop);

            CommonFunctionality.Add(cbPreferNewer);


            if (!databaseObject.DiscoverExistence(DataAccessContext.Logging, out string reason))
            {
                activator.KillForm(ParentForm, "Database " + databaseObject + " did not exist:" + reason);
                return;
            }

            LogManager = new LogManager(databaseObject);
            FetchDataTable();
        }
Пример #2
0
        private void logViewerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var cmd = new ExecuteCommandViewLoggedData(Activator, new LogViewerFilter(LoggingTables.DataLoadTask));

            cmd.Execute();
        }
Пример #3
0
        private void DataGridView1OnCellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }

            if (e.Button == MouseButtons.Right)
            {
                var menu = new ContextMenuStrip();

                foreach (ExecuteCommandViewLoggedData cmd in GetCommands(e.RowIndex))
                {
                    ExecuteCommandViewLoggedData cmd1 = cmd;
                    var mi = new ToolStripMenuItem(cmd.GetCommandName(), null, (s, x) => cmd1.Execute());
                    menu.Items.Add(mi);
                }

                if (menu.Items.Count != 0)
                {
                    menu.Items.Add(new ToolStripSeparator());
                }

                menu.Items.Add("View as text", null, (s, ex) => WideMessageBox.Show("Full Text", dataGridView1.Rows[e.RowIndex]));

                menu.Show(Cursor.Position.X, Cursor.Position.Y);
            }
        }