Added ability to order the execution of dictionary adapter behaviors.
[castle.git] / Experiments / Attic / Generator / Castle.ActiveRecord.Generator / Parts / OutputView.cs
blob773c6829edaeddf8b6c3a67d9c6db0bb4abb9413
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.ActiveRecord.Generator.Parts
17 using System;
18 using System.Drawing;
19 using System.Collections;
20 using System.ComponentModel;
21 using System.Windows.Forms;
22 using WeifenLuo.WinFormsUI;
23 using Castle.ActiveRecord.Generator.Components;
26 /// <summary>
27 /// Summary description for OutputView.
28 /// </summary>
29 public class OutputView : DockContent, ILogger, ISubWorkspace
31 private System.Windows.Forms.TextBox textBox1;
32 private long _start;
33 private long _end;
35 /// <summary>
36 /// Required designer variable.
37 /// </summary>
38 private System.ComponentModel.Container components = null;
40 private IWorkspace _parentWs;
42 public OutputView()
45 // Required for Windows Form Designer support
47 InitializeComponent();
49 ServiceRegistry.Instance.Kernel.AddComponentInstance("logger", typeof (ILogger), this);
52 public OutputView(Model model) : this()
56 /// <summary>
57 /// Clean up any resources being used.
58 /// </summary>
59 protected override void Dispose(bool disposing)
61 if (disposing)
63 if (components != null)
65 components.Dispose();
68 base.Dispose(disposing);
71 #region Windows Form Designer generated code
73 /// <summary>
74 /// Required method for Designer support - do not modify
75 /// the contents of this method with the code editor.
76 /// </summary>
77 private void InitializeComponent()
79 this.textBox1 = new System.Windows.Forms.TextBox();
80 this.SuspendLayout();
81 //
82 // textBox1
83 //
84 this.textBox1.BackColor = System.Drawing.Color.White;
85 this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
86 this.textBox1.Location = new System.Drawing.Point(0, 2);
87 this.textBox1.Multiline = true;
88 this.textBox1.Name = "textBox1";
89 this.textBox1.ReadOnly = true;
90 this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
91 this.textBox1.Size = new System.Drawing.Size(255, 361);
92 this.textBox1.TabIndex = 1;
93 this.textBox1.Text = "";
94 this.textBox1.WordWrap = false;
95 //
96 // OutputView
97 //
98 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
99 this.ClientSize = new System.Drawing.Size(255, 365);
100 this.Controls.Add(this.textBox1);
101 this.DockableAreas = ((WeifenLuo.WinFormsUI.DockAreas)(((((WeifenLuo.WinFormsUI.DockAreas.Float | WeifenLuo.WinFormsUI.DockAreas.DockLeft)
102 | WeifenLuo.WinFormsUI.DockAreas.DockRight)
103 | WeifenLuo.WinFormsUI.DockAreas.DockTop)
104 | WeifenLuo.WinFormsUI.DockAreas.DockBottom)));
105 this.DockPadding.Bottom = 2;
106 this.DockPadding.Top = 2;
107 this.HideOnClose = true;
108 this.Name = "OutputView";
109 this.ShowHint = WeifenLuo.WinFormsUI.DockState.DockBottomAutoHide;
110 this.Text = "OutputView";
111 this.ResumeLayout(false);
115 #endregion
117 public void Info(String message)
119 EnsureVisible();
121 textBox1.Text += message + "\r\n";
124 public void Start()
126 textBox1.Text = "--------------------- Starting ---------------------\r\n\r\n";
127 _start = DateTime.Now.Ticks;
130 public void End()
132 textBox1.Text += "\r\n--------------------- Finished ---------------------";
133 _end = DateTime.Now.Ticks;
135 TimeSpan diff = new TimeSpan(_end - _start);
137 textBox1.Text += "\r\n\r\nCompleted in " + diff.TotalSeconds + " seconds";
140 private void EnsureVisible()
142 this.Show( _parentWs.MainDockManager );
145 #region ISubWorkspace Members
147 public IWorkspace ParentWorkspace
149 get { return _parentWs; }
150 set { _parentWs = value; }
153 #endregion
155 #region IWorkspace Members
157 public IWin32Window ActiveWindow
159 get { return this; }
162 public MainMenu MainMenu
164 get { return null; }
167 public ToolBar MainToolBar
169 get { return null; }
172 public StatusBar MainStatusBar
174 get { return null; }
177 public DockPanel MainDockManager
179 get { return null; }
182 #endregion