private void UpdateTextBox(LogBox box, params object[] data)
 {
     box.AppendLogEntry(data);
 }
 private void syncFocus(LogBox origin, LogBox copy)
 {
     if (syncingFocus == false)
     {
         syncingFocus = true;
         copy.FocusedItem = copy.Items[origin.FocusedItem.Index];
         syncingFocus = false;
     }
 }
 private void syncSelected(LogBox origin, LogBox copy)
 {
     if (syncingSelected == false)
     {
         syncingSelected = true;
         foreach(int index in copy.SelectedIndices)
         {
             copy.Items[index].Selected = false;
         }
         foreach(int index in origin.SelectedIndices)
         {
             copy.Items[index].Selected = true;
         }
         syncingSelected = false;
     }
 }
        private void TextBoxSave(string fileNameBase, LogBox box)
        {
            saveFileDialog.FileName = fileNameBase + ".txt";

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                Stream myStream = saveFileDialog.OpenFile();
                StreamWriter wText = new StreamWriter(myStream);
                wText.Write(box.ExportAsString());
                wText.Flush();
                myStream.Close();
            }
        }
 private void writeID(LogBox box, params object[] data)
 {
     writeTextBox(box, data);
     focusBox(box);
 }
 private void focusBox(LogBox box)
 {
     try
     {
         if (InvokeRequired)
         {
             BoxDelegate registerBoxTextDelegate = new BoxDelegate(focusBox);
             BeginInvoke(registerBoxTextDelegate, new object[] { box });
         }
         else
         {
             tabControlAll.SelectedTab = (TabPage)box.Parent;
             box.Focus();
         }
     }
     catch
     { }
 }
        private void TextBoxCopy(LogBox box)
        {
            StringBuilder data = new StringBuilder();
            foreach (int item in box.SelectedIndices)
            {
                foreach (ListViewItem.ListViewSubItem subitem in box.Items[item].SubItems)
                {
                    data.Append(subitem.Text);
                    data.Append("\t");

                }
                data.AppendLine();
            }
            Clipboard.SetText(data.ToString());
        }
        private LogBox[] findAllTextBox()
        {
            IList list = new ArrayList();
            LogBox box;

            foreach (Control control in tabControlAll.Controls)
            {
                if (control.Tag != null)
                {
                    box = findControlTextBox(control.Controls);
                    if (box != null) { list.Add(box); }
                }
            }

            LogBox[] result = new LogBox[list.Count];
            list.CopyTo(result, 0);
            return result;
        }
        private LogBox createIDTab(string ID, bool closeable, bool filtering)
        {
            //
            // contextMenuStripID
            //
            System.Windows.Forms.ContextMenuStrip contextMenuStripID = new System.Windows.Forms.ContextMenuStrip();
            contextMenuStripID.Enabled = true;
            contextMenuStripID.GripMargin = new System.Windows.Forms.Padding(2);
            contextMenuStripID.Location = new System.Drawing.Point(25, 59);
            contextMenuStripID.Name = "contextMenuStrip" + ID;
            contextMenuStripID.RightToLeft = System.Windows.Forms.RightToLeft.No;
            contextMenuStripID.Size = new System.Drawing.Size(115, 26);
            contextMenuStripID.Tag = ID;

            //
            // toolStripMenuItemIDSave
            //
            System.Windows.Forms.ToolStripMenuItem toolStripMenuItemIDSave = new System.Windows.Forms.ToolStripMenuItem();
            toolStripMenuItemIDSave.Name = "toolStripMenuItem" + ID + "Save";
            toolStripMenuItemIDSave.Text = "Save as";
            toolStripMenuItemIDSave.Click += new System.EventHandler(this.toolStripMenuItemIDSave_Click);
            toolStripMenuItemIDSave.Tag = ID;
            contextMenuStripID.Items.Add(toolStripMenuItemIDSave);

            //
            // toolStripMenuItemIDSave
            //
            System.Windows.Forms.ToolStripMenuItem toolStripMenuItemIDCopy = new System.Windows.Forms.ToolStripMenuItem();
            toolStripMenuItemIDCopy.Name = "toolStripMenuItem" + ID + "Copy";
            toolStripMenuItemIDCopy.Text = "Copy to Clipboard";
            toolStripMenuItemIDCopy.Click += new System.EventHandler(this.toolStripMenuItemIDCopy_Click);
            toolStripMenuItemIDCopy.Tag = ID;
            contextMenuStripID.Items.Add(toolStripMenuItemIDCopy);

            //
            // toolStripSeparatorID1
            //
            System.Windows.Forms.ToolStripSeparator toolStripSeparatorID1 = new System.Windows.Forms.ToolStripSeparator();
            toolStripSeparatorID1.Name = "toolStripSeparator"+ID+"1";
            contextMenuStripID.Items.Add(toolStripSeparatorID1);

            //
            // toolStripMenuItemIDAdjust
            //
            System.Windows.Forms.ToolStripMenuItem toolStripMenuItemIDAdjust = new System.Windows.Forms.ToolStripMenuItem();
            toolStripMenuItemIDAdjust.Name = "toolStripMenuItem" + ID + "Adjust";
            toolStripMenuItemIDAdjust.Text = "Adjust columns width";
            toolStripMenuItemIDAdjust.Click += new System.EventHandler(this.toolStripMenuItemIDAdjust_Click);
            toolStripMenuItemIDAdjust.Tag = ID;
            contextMenuStripID.Items.Add(toolStripMenuItemIDAdjust);

            //
            // toolStripMenuItemIDClose
            //
            if (closeable)
            {
                System.Windows.Forms.ToolStripMenuItem toolStripMenuItemIDClose = new System.Windows.Forms.ToolStripMenuItem();
                toolStripMenuItemIDClose.Name = "toolStripMenuItem" + ID + "Close";
                toolStripMenuItemIDClose.Text = "Close";
                toolStripMenuItemIDClose.Click += new System.EventHandler(this.toolStripMenuItemIDClose_Click);
                toolStripMenuItemIDClose.Tag = ID;
                contextMenuStripID.Items.Add(toolStripMenuItemIDClose);
            }
            else
            {
                //
                // toolStripMenuItemIDClear
                //
                System.Windows.Forms.ToolStripMenuItem toolStripMenuItemIDClear = new System.Windows.Forms.ToolStripMenuItem();
                toolStripMenuItemIDClear.Name = "toolStripMenuItem" + ID + "Clear";
                toolStripMenuItemIDClear.Text = "Clear";
                toolStripMenuItemIDClear.Click += new System.EventHandler(this.toolStripMenuItemIDClear_Click);
                toolStripMenuItemIDClear.Tag = ID;
                contextMenuStripID.Items.Add(toolStripMenuItemIDClear);
            }

            //
            // tabPageID
            //
            System.Windows.Forms.TabPage tabPageID = new System.Windows.Forms.TabPage();
            tabPageID.ContextMenuStrip = contextMenuStripID;
            tabPageID.Name = "tabPage" + ID;
            tabPageID.Text = ID;
            tabPageID.Tag = ID;
            //tabPageID.Location = new System.Drawing.Point(4, 22);
            //tabPageID.Size = new System.Drawing.Size(576, 339);
            //tabPageID.TabIndex = 0;

            //
            // TextBoxID
            //
            QIT.Common.Controls.LogBox textBoxID = new QIT.Common.Controls.LogBox();
            textBoxID.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            textBoxID.AutoSize = false;
            LoggerWindowedConfiguration configuration = ((LoggerWindowedConfiguration)this.Logger.Configuration);
            ConfigurationItemTextStyle configurationitem = ((ConfigurationItemTextStyle)configuration.findProperty(configuration.idTextStyle));
            textBoxID.Font = configurationitem.Value.Font;
            textBoxID.ForeColor = configurationitem.Value.Foreground;
            textBoxID.BackColor = configurationitem.Value.Background;
            textBoxID.Location = new System.Drawing.Point(0, 0);
            textBoxID.Size = new System.Drawing.Size(tabPageID.ClientRectangle.Width, tabPageID.ClientRectangle.Height);
            textBoxID.ContextMenuStrip = contextMenuStripID;
            textBoxID.Name = "TextBox" + ID;
            textBoxID.Text = "";
            textBoxID.Tag = ID;
            textBoxID.Filtering = filtering;
            //TextBoxID.TabIndex = 0;
            tabPageID.Controls.Add(textBoxID);

            // tabControlAll
            this.tabControlAll.Controls.Add(tabPageID);

            return textBoxID;
        }
示例#10
0
 public void TextBoxClose(LogBox box)
 {
     Control tabPage = (Control)(box.Parent);
     //tabPage.Controls.Remove(box);
     tabControlAll.Controls.Remove(tabPage);
     _hashtable.Remove(box.Tag);
 }
示例#11
0
 //private void writeMulti(string text)
 //{
 //    LogBox[] array = findAllTextBox();
 //    foreach (LogBox box in array)
 //    {
 //        writeID(box, text);
 //    }
 //}
 public void TextBoxClear(LogBox box)
 {
     box.Clear();
 }
示例#12
0
 public void TextBoxAdjust(LogBox box)
 {
     box.AdjustColumnsSizesEqually();
 }