Example #1
0
        private void SaveActiveSection(int index)
        {
            if (index < 0 || outsideTabControl.TabPages.Count - 1 < index)
            {
                return;
            }
            OutsideTabPage tabpage = (OutsideTabPage)outsideTabControl.TabPages[index];

            if (tabpage != null)
            {
                SetStatusToBar("Saving log data...");
                Model.IO.FileStream fs = new Model.IO.FileStream(tabpage.Section);
                fs.SaveFiles();
                SetStatusToBar("[Finish] Save");
            }
        }
Example #2
0
        private void CreateOutTabPageOnReading(string[] fileNames)
        {
            SetStatusToBar("Reading log data...");
            ProgressDialog dialog = new ProgressDialog("ファイルを読込中...");

            dialog.Maximum = fileNames.Length;
            dialog.Show(this);

            foreach (string fileName in fileNames)
            {
                if (outsideTabControl.isOpen(fileName))
                {
                    outsideTabControl.SelectedIndex = outsideTabControl.GetIndexForFileName(fileName);
                    continue;
                }

                Section             section        = Section.CreateReadSection(fileName);
                Model.IO.FileStream readFileStream = new Model.IO.FileStream(section);
                string[]            readedData     = readFileStream.AccessFile();
                if (readedData == null)
                {
                    continue;
                }

                outsideTabControl.AddTabPage(section, _mode, isReceived: false);
                OutsideTabPage tabpage = (OutsideTabPage)outsideTabControl.TabPages[outsideTabControl.SelectedIndex];

                List <string> LogData = new List <string>();
                for (int readIndex = 0; readIndex < readedData.Length - 1; ++readIndex)
                {
                    LogData.Add(readedData[readIndex]);
                }
                tabpage.RecordRowData(LogData.ToArray());
                tabpage.RecordMemo(readedData[readedData.Length - 1]);

                ++dialog.Value;
            }

            SetStatusToBar("[Finish] Read");
            dialog.Close();
        }
Example #3
0
        protected override void OnSelectedIndexChanged(EventArgs e)
        {
            base.OnSelectedIndexChanged(e);

            if (notIsDeletedTabPage)
            {
                preIndex = nextIndex;
                int nowIndex = this.SelectedIndex;

                if (preIndex > 0 && preIndex < this.TabPages.Count)
                {
                    OutsideTabPage      tabPage = (OutsideTabPage)this.TabPages[preIndex];
                    Model.IO.FileStream fs      = new Model.IO.FileStream(tabPage.Section);
                    fs.SaveFiles();
                }

                if (!this.DesignMode && this.SelectedIndex > -1 &&
                    this.DisplayStyleProvider.ShowTabCloser &&
                    this.GetTabCloserRect(this.SelectedIndex).Contains(this.MousePosition))
                {
                    if (preIndex > nowIndex)
                    {
                        nextIndex = preIndex - 1;
                    }
                }
                else
                {
                    nextIndex = nowIndex > 0 ? nowIndex : 0;
                }
            }
            else
            {
                int nowIndex = nextIndex;
                if (preIndex > nowIndex)
                {
                    --preIndex;
                }
                nextIndex = preIndex;
            }
        }
Example #4
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            int  index = this.ActiveIndex;
            bool isNecessaryPostProcessing = false;

            if (!this.DesignMode && index > -1 &&
                this.DisplayStyleProvider.ShowTabCloser &&
                this.GetTabCloserRect(index).Contains(this.MousePosition))
            {
                TabPage tab = this.ActiveTab;
                TabControlCancelEventArgs args = new TabControlCancelEventArgs(tab, index, false, TabControlAction.Deselecting);
                this.OnTabClosing(args);

                if (!args.Cancel)
                {
                    notIsDeletedTabPage = false;

                    OutsideTabPage      tabPage = (OutsideTabPage)this.TabPages[index];
                    Model.IO.FileStream fs      = new Model.IO.FileStream(tabPage.Section);
                    fs.SaveFiles();

                    fileNames.Remove(fileNames[index]);
                }
                isNecessaryPostProcessing = true;
            }

            base.OnMouseClick(e);

            notIsDeletedTabPage = true;
            if (isNecessaryPostProcessing)
            {
                nextIndex          = nextIndex > this.TabPages.Count - 1 ? nextIndex - 1 : nextIndex;
                this.SelectedIndex = nextIndex;
                int width = (this.Width - 50) / this.TabCount + 1;
                width         = width > 140 ? 140 : width;
                this.ItemSize = new Size(width, 20);
            }
        }