예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        private void LoadFile(string filePath, bool newTab)
        {
            SetProcessingState(false);
            this.cancellationTokenSource = new CancellationTokenSource();

            if (newTab == true)
            {
                ControlLog cl = new ControlLog(this.config)
                {
                    ViewMode = Global.ViewMode.Standard,
                };

                cl.ProgressUpdate       += LogFile_LoadProgress;
                cl.LoadComplete         += LogFile_LoadComplete;
                cl.SearchComplete       += LogFile_SearchComplete;
                cl.ExportInitiated      += LogFile_ExportInitiated;
                cl.ExportComplete       += LogFile_ExportComplete;;
                cl.LoadError            += LogFile_LoadError;
                cl.MultiSearchInitiated += LogFile_MultiSearchInitiated;
                cl.DragEnter            += LogFile_DragEnter;
                cl.Drop += LogFile_Drop;

                TabItem ti = new TabItem
                {
                    Content = cl,
                    Header  = Path.GetFileName(filePath),
                    Tag     = cl.Guid,
                    ToolTip = filePath
                };

                tabMain.Items.Add(ti);
                tabMain.SelectedIndex = tabMain.Items.Count - 1;

                cl.Load(filePath, cancellationTokenSource.Token);
            }
            else
            {
                if (tabMain.SelectedItem == null)
                {
                    MessageBox.Show("Cannot identify current tab", Application.ResourceAssembly.GetName().Name, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                ControlLog cl = (ControlLog)((TabItem)tabMain.SelectedItem).Content;
                ((TabItem)tabMain.SelectedItem).ToolTip = filePath;
                cl.Dispose();
                cl.Load(filePath, cancellationTokenSource.Token);
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MnuFileClose_Click(object sender, RoutedEventArgs e)
        {
            if (tabMain.SelectedItem == null)
            {
                MessageBox.Show("Cannot identify current tab", Application.ResourceAssembly.GetName().Name, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            TabItem ti = (TabItem)tabMain.SelectedItem;

            ti.Header  = "...";
            ti.ToolTip = "";
            ControlLog cl = (ControlLog)ti.Content;

            cl.Dispose();
        }