public OpenEventLogDialog()
        {
            InitializeComponent();
            Icon = Properties.Resources.SnakeIcon;

            List <string> logfiles = EventLogForm.GetEventLogFiles();

            foreach (string logfile in logfiles)
            {
                _listView.Items.Add(logfile);
                if (logfile == "Application")
                {
                    _listView.SelectedIndices.Add(_listView.Items.Count - 1);
                }
            }
        }
Exemplo n.º 2
0
        private void openEventLogToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenEventLogDialog openEventLogDlg = new OpenEventLogDialog();

            if (openEventLogDlg.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            EventLogForm mdiForm = new EventLogForm();

            mdiForm.MdiParent = this;
            mdiForm.LoadFile(openEventLogDlg.EventLogFile);
            if (!mdiForm.IsDisposed)
            {
                mdiForm.Show();
            }
        }
Exemplo n.º 3
0
        private void openEventLogToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenEventLogDialog openEventLogDlg = new OpenEventLogDialog();
            if (openEventLogDlg.ShowDialog(this) != DialogResult.OK)
                return;

            EventLogForm mdiForm = new EventLogForm();
            mdiForm.MdiParent = this;
            mdiForm.LoadFile(openEventLogDlg.EventLogFile);
            if (!mdiForm.IsDisposed)
                mdiForm.Show();
        }
Exemplo n.º 4
0
        private bool LoadSession(string filepath)
        {
            TailConfig tailConfig = LoadSessionFile(filepath);
            if (tailConfig == null)
                return false;

            _mruMenu.AddFile(filepath);

            if (!tailConfig.MinimizedToTray)
            {
                Size = tailConfig.WindowSize;
                DesktopLocation = tailConfig.WindowPosition;
            }

            UpdateTitle();

            List<string> eventLogFiles = EventLogForm.GetEventLogFiles();

            Application.DoEvents();

            foreach (TailFileConfig tailFile in tailConfig.TailFiles)
            {
                Form mdiForm = null;

                int index = eventLogFiles.FindIndex(delegate(string arrItem) { return arrItem.Equals(tailFile.FilePath); });
                if (index >= 0)
                    mdiForm = new EventLogForm();
                else
                    mdiForm = new TailForm();

                if (mdiForm != null)
                {
                    ITailForm tailForm = mdiForm as ITailForm;
                    string tailConfigPath = Path.GetDirectoryName(filepath);

                    mdiForm.Text = tailFile.Title;
                    if (!tailFile.Modeless)
                    {
                        mdiForm.MdiParent = this;
                        mdiForm.ShowInTaskbar = false;
                        AddMdiChildTab(mdiForm);
                        if (tailForm != null)
                            tailForm.LoadConfig(tailFile, tailConfigPath);
                        if (mdiForm.IsDisposed)
                        {
                            _MDITabControl.TabPages.Remove(mdiForm.Tag as TabPage);
                            continue;
                        }
                    }
                    mdiForm.Show();

                    if (tailConfig.SelectedTab == -1 || tailFile.Modeless)
                    {
                        if (tailFile.WindowState != FormWindowState.Maximized)
                        {
                            mdiForm.DesktopLocation = tailFile.WindowPosition;
                            mdiForm.Size = tailFile.WindowSize;
                        }
                        if (mdiForm.WindowState != tailFile.WindowState)
                            mdiForm.WindowState = tailFile.WindowState;
                    }

                    if (tailFile.Modeless)
                    {
                        if (tailForm != null)
                            tailForm.LoadConfig(tailFile, tailConfigPath);
                    }
                }
                Application.DoEvents();
            }

            if (tailConfig.SelectedTab != -1 && _MDITabControl.TabPages.Count > 0)
            {
                foreach (Form childForm in MdiChildren)
                    childForm.WindowState = FormWindowState.Minimized;

                _MDITabControl.SelectedIndex = tailConfig.SelectedTab;
                _MDITabControl.Visible = true;
                (_MDITabControl.SelectedTab.Tag as Form).WindowState = FormWindowState.Maximized;
            }

            if (tailConfig.MinimizedToTray)
            {
                _trayIcon.Visible = true;
                WindowState = FormWindowState.Minimized;
                Visible = false;
            }
            else if (tailConfig.AlwaysOnTop)
            {
                alwaysOnTopToolStripMenuItem.Checked = true;
                TopMost = true;
            }

            return true;
        }
Exemplo n.º 5
0
        private bool LoadSession(string filepath)
        {
            TailConfig tailConfig = LoadSessionFile(filepath);

            if (tailConfig == null)
            {
                return(false);
            }

            _mruMenu.AddFile(filepath);

            if (!tailConfig.MinimizedToTray)
            {
                Size            = tailConfig.WindowSize;
                DesktopLocation = tailConfig.WindowPosition;
            }

            UpdateTitle();

            List <string> eventLogFiles = EventLogForm.GetEventLogFiles();

            Application.DoEvents();

            foreach (TailFileConfig tailFile in tailConfig.TailFiles)
            {
                Form mdiForm = null;

                int index = eventLogFiles.FindIndex(delegate(string arrItem) { return(arrItem.Equals(tailFile.FilePath)); });
                if (index >= 0)
                {
                    mdiForm = new EventLogForm();
                }
                else
                {
                    mdiForm = new TailForm();
                }

                if (mdiForm != null)
                {
                    ITailForm tailForm       = mdiForm as ITailForm;
                    string    tailConfigPath = Path.GetDirectoryName(filepath);

                    mdiForm.Text = tailFile.Title;
                    if (!tailFile.Modeless)
                    {
                        mdiForm.MdiParent     = this;
                        mdiForm.ShowInTaskbar = false;
                        AddMdiChildTab(mdiForm);
                        if (tailForm != null)
                        {
                            tailForm.LoadConfig(tailFile, tailConfigPath);
                        }
                        if (mdiForm.IsDisposed)
                        {
                            _MDITabControl.TabPages.Remove(mdiForm.Tag as TabPage);
                            continue;
                        }
                    }
                    mdiForm.Show();

                    if (tailConfig.SelectedTab == -1 || tailFile.Modeless)
                    {
                        if (tailFile.WindowState != FormWindowState.Maximized)
                        {
                            mdiForm.DesktopLocation = tailFile.WindowPosition;
                            mdiForm.Size            = tailFile.WindowSize;
                        }
                        if (mdiForm.WindowState != tailFile.WindowState)
                        {
                            mdiForm.WindowState = tailFile.WindowState;
                        }
                    }

                    if (tailFile.Modeless)
                    {
                        if (tailForm != null)
                        {
                            tailForm.LoadConfig(tailFile, tailConfigPath);
                        }
                    }
                }
                Application.DoEvents();
            }

            if (tailConfig.SelectedTab != -1 && _MDITabControl.TabPages.Count > 0)
            {
                foreach (Form childForm in MdiChildren)
                {
                    childForm.WindowState = FormWindowState.Minimized;
                }

                _MDITabControl.SelectedIndex = tailConfig.SelectedTab;
                _MDITabControl.Visible       = true;
                (_MDITabControl.SelectedTab.Tag as Form).WindowState = FormWindowState.Maximized;
            }

            if (tailConfig.MinimizedToTray)
            {
                _trayIcon.Visible = true;
                WindowState       = FormWindowState.Minimized;
                Visible           = false;
            }
            else if (tailConfig.AlwaysOnTop)
            {
                alwaysOnTopToolStripMenuItem.Checked = true;
                TopMost = true;
            }

            return(true);
        }
Exemplo n.º 6
0
        private void switchWindowModeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EventLogForm newform = new EventLogForm();
            TailFileConfig tailConfig = new TailFileConfig();
            SaveConfig(tailConfig);
            if (this.MdiParent == null)
            {
                newform.MdiParent = MainForm.Instance;
                newform.ShowInTaskbar = false;
            }
            else
                newform.ShowInTaskbar = true;

            Close();

            newform.LoadConfig(tailConfig, null);
            newform.Show();
            newform.BringToFront();
        }