예제 #1
0
        /// <summary>
        /// Close the resources used for opening and processing the log file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuFileClose_Click(object sender, EventArgs e)
        {
            this.Text = "LogViewer";

            // Clear any existing filters/reset values
            this.listLines.ModelFilter = null;
            this.viewMode = Global.ViewMode.Standard;
            this.searches = new Searches();
            this.filterIds.Clear();

            if (lf != null)
            {
                listLines.ClearObjects();
                lf.ProgressUpdate -= LogFile_LoadProgress;
                lf.LoadComplete   -= LogFile_LoadComplete;
                lf.SearchComplete -= LogFile_SearchComplete;
                lf.ExportComplete -= LogFile_ExportComplete;
                lf.LoadError      -= LogFile_LoadError;
                lf.Dispose();
                lf = null;
            }

            menuFileClose.Enabled = false;
            UpdateStatusLabel("", statusLabelMain);
            UpdateStatusLabel("", statusLabelSearch);
        }
예제 #2
0
        /// <summary>
        /// Show the Searches window to allow the user to enable/disable search terms
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void contextMenuSearchViewTerms_Click(object sender, EventArgs e)
        {
            using (FormSearchTerms f = new FormSearchTerms(this.searches))
            {
                DialogResult dr = f.ShowDialog(this);
                if (dr == DialogResult.Cancel)
                {
                    return;
                }

                this.searches = f.Searches;

                filterIds.Clear();
                foreach (SearchCriteria sc in searches.Items)
                {
                    if (sc.Enabled == false)
                    {
                        continue;
                    }

                    filterIds.Add(sc.Id);
                }

                listLines.Refresh();
            }
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        public FormMain()
        {
            InitializeComponent();

            synchronizationContext           = SynchronizationContext.Current;
            dropdownSearchType.SelectedIndex = 0;
            logs     = new Dictionary <string, LogFile>();
            searches = new Searches();
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        public FormMain()
        {
            InitializeComponent();

            synchronizationContext           = SynchronizationContext.Current;
            dropdownSearchType.SelectedIndex = 0;
            searches  = new Searches();
            filterIds = new List <ushort>();
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        private void LoadFile(string filePath, bool newTab)
        {
            this.processing = true;
            this.hourGlass  = new HourGlass(this);
            SetProcessingState(false);
            statusProgress.Visible             = true;
            this.cancellationTokenSource       = new CancellationTokenSource();
            menuToolsMultiStringSearch.Enabled = true;

            // Clear any existing filters/reset values
            //
            this.searches = new Searches();

            if (newTab == true)
            {
                LogFile lf = new LogFile();
                logs.Add(lf.Guid, lf);

                tabControl.TabPages.Add(lf.Initialise());
                lf.SetContextMenu(contextMenu);
                lf.ViewMode           = Global.ViewMode.Standard;
                lf.ProgressUpdate    += LogFile_LoadProgress;
                lf.LoadComplete      += LogFile_LoadComplete;
                lf.SearchComplete    += LogFile_SearchComplete;
                lf.ExportComplete    += LogFile_ExportComplete;
                lf.LoadError         += LogFile_LoadError;
                lf.List.ItemActivate += new EventHandler(this.listLines_ItemActivate);
                lf.List.DragDrop     += new DragEventHandler(this.listLines_DragDrop);
                lf.List.DragEnter    += new DragEventHandler(this.listLines_DragEnter);
                lf.Load(filePath, synchronizationContext, cancellationTokenSource.Token);
            }
            else
            {
                if (tabControl.SelectedTab == null)
                {
                    UserInterface.DisplayMessageBox(this, "Cannot identify current tab", MessageBoxIcon.Exclamation);
                    return;
                }

                if (!logs.ContainsKey(tabControl.SelectedTab.Tag.ToString()))
                {
                    UserInterface.DisplayMessageBox(this, "Cannot identify current tab", MessageBoxIcon.Exclamation);
                    return;
                }

                // Get the current selected log file and open the file using that object
                LogFile lf = logs[tabControl.SelectedTab.Tag.ToString()];
                lf.Dispose();
                lf.Load(filePath, synchronizationContext, cancellationTokenSource.Token);
            }

            // this.Text = "LogViewer - " + filePath;
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        public FormSearchTerms(Searches searches)
        {
            InitializeComponent();

            this.listSearchTerms.BooleanCheckStateGetter = delegate(Object rowObject) {
                return(((SearchCriteria)rowObject).Enabled);
            };

            this.listSearchTerms.BooleanCheckStatePutter = delegate(Object rowObject, bool newValue) {
                ((SearchCriteria)rowObject).Enabled = newValue;
                return(newValue); // return the value that you want the control to use
            };

            listSearchTerms.SetObjects(searches.Items);
            this.Searches = searches;
        }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        private void LoadFile(string filePath)
        {
            this.processing = true;
            this.hourGlass  = new HourGlass(this);
            SetProcessingState(false);
            statusProgress.Visible             = true;
            this.cancellationTokenSource       = new CancellationTokenSource();
            menuToolsMultiStringSearch.Enabled = true;

            // Clear any existing filters/reset values
            this.listLines.ModelFilter = null;
            this.viewMode = Global.ViewMode.Standard;
            this.searches = new Searches();
            this.filterIds.Clear();

            if (lf != null)
            {
                listLines.ClearObjects();
                lf.ProgressUpdate -= LogFile_LoadProgress;
                lf.LoadComplete   -= LogFile_LoadComplete;
                lf.SearchComplete -= LogFile_SearchComplete;
                lf.ExportComplete -= LogFile_ExportComplete;
                lf.LoadError      -= LogFile_LoadError;
                lf.Dispose();
            }

            this.Text = "LogViewer - " + filePath;

            lf = new LogFile();
            lf.ProgressUpdate += LogFile_LoadProgress;
            lf.LoadComplete   += LogFile_LoadComplete;
            lf.SearchComplete += LogFile_SearchComplete;
            lf.ExportComplete += LogFile_ExportComplete;
            lf.LoadError      += LogFile_LoadError;
            lf.Load(filePath, cancellationTokenSource.Token);
        }
예제 #8
0
 /// <summary>
 ///
 /// </summary>
 public FormSearch(Searches searches)
 {
     InitializeComponent();
     comboType.SelectedIndex = 0;
     this.existingSearches   = searches;
 }