예제 #1
0
 private void ShowLog <T>(LogGenerator logGenerator, IEnumerable <T> prevLog, Action <LogViewForm> preLoadFunc)
 {
     this.UIThread(delegate
     {
         if (!this.logViews.ContainsKey(logGenerator.Key))
         {
             LogViewForm logViewForm = new LogViewForm();
             if (preLoadFunc != null)
             {
                 preLoadFunc(logViewForm);
             }
             logViewForm.Text = logGenerator.Name;
             logViewForm.Name = logGenerator.Key;
             this.logViews.Add(logGenerator.Key, logViewForm);
             logViewForm.LogGenerator = logGenerator;
             logViewForm.MdiParent    = this;
             logViewForm.Closed      += this.LogViewForm_Closed;
             logViewForm.AddLog <T>(prevLog);
             logViewForm.Show();
             ToolStripItem toolStripItem = this.toolStrip.Items.Add(logGenerator.Name);
             toolStripItem.Name          = logGenerator.Key;
             toolStripItem.Tag           = logViewForm;
             toolStripItem.Click        += this.LogItem_Click;
             logViewForm.Tag             = toolStripItem;
             return;
         }
         this.logViews[logGenerator.Key].Activate();
     });
 }
예제 #2
0
        private void LogViewForm_Closed(object sender, EventArgs e)
        {
            LogViewForm logViewForm = sender as LogViewForm;

            if (logViewForm != null)
            {
                this.logViews.Remove(logViewForm.Name);
                this.toolStrip.Items.Remove(logViewForm.Tag as ToolStripItem);
            }
        }