Changeset 2963 for trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2
- Timestamp:
- 03/08/10 11:23:54 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/DockingMainForm.cs
r2790 r2963 69 69 private void dockPanel_ActiveContentChanged(object sender, EventArgs e) { 70 70 DockForm content = this.dockPanel.ActiveContent as DockForm; 71 this.ActiveView = content == null ? null : content.View; 71 if (content != null) 72 this.ActiveView = content.View; 72 73 } 73 74 } -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/MainForm.cs
r2793 r2963 86 86 get { return this.activeView; } 87 87 protected set { 88 if (this.activeView != value && (value != null || this.views.Keys.All(v => !v.IsShown))) {88 if (this.activeView != value) { 89 89 if (InvokeRequired) { 90 90 Action<IView> action = delegate(IView activeView) { this.ActiveView = activeView; }; … … 159 159 } 160 160 161 private void ChildFormClosed(object sender, FormClosedEventArgs e) {162 Form form = (Form)sender;163 IView view = GetView(form);164 165 form.Activated -= new EventHandler(FormActivated);166 form.FormClosed -= new FormClosedEventHandler(ChildFormClosed);167 168 views.Remove(view);169 this.OnViewClosed(view);170 if (ActiveView == view)171 ActiveView = null;172 }173 174 161 private void FormActivated(object sender, EventArgs e) { 175 162 this.ActiveView = GetView((Form)sender); … … 179 166 #region create, get, show, hide, close views 180 167 protected virtual Form CreateForm(IView view) { 181 throw new NotImplementedException("CreateForm must be implemented in subclasses of MainForm Base.");168 throw new NotImplementedException("CreateForm must be implemented in subclasses of MainForm."); 182 169 } 183 170 … … 197 184 if (firstTimeShown) { 198 185 Form form = CreateForm(view); 186 view.Changed += new EventHandler(ViewChanged); 199 187 this.views[view] = form; 200 188 form.Activated += new EventHandler(FormActivated); 201 189 form.FormClosed += new FormClosedEventHandler(ChildFormClosed); 190 202 191 } 203 192 this.Show(view, firstTimeShown); 204 193 this.OnViewShown(view, firstTimeShown); 205 194 } 195 } 196 197 private void ViewChanged(object sender, EventArgs e) { 198 IView view = (IView)sender; 199 if (view == this.ActiveView) 200 this.OnActiveViewChanged(); 206 201 } 207 202 … … 214 209 if (this.views.ContainsKey(view)) { 215 210 this.Hide(view); 216 if (this.activeView == view && views.All(v => !view.IsShown))211 if (this.activeView == view) 217 212 this.ActiveView = null; 218 213 this.OnViewHidden(view); … … 222 217 223 218 protected virtual void Hide(IView view) { 219 } 220 221 private void ChildFormClosed(object sender, FormClosedEventArgs e) { 222 Form form = (Form)sender; 223 IView view = GetView(form); 224 225 view.Changed -= new EventHandler(ViewChanged); 226 form.Activated -= new EventHandler(FormActivated); 227 form.FormClosed -= new FormClosedEventHandler(ChildFormClosed); 228 229 views.Remove(view); 230 this.OnViewClosed(view); 231 if (ActiveView == view) 232 ActiveView = null; 224 233 } 225 234 … … 238 247 else { 239 248 if (this.views.ContainsKey(view)) { 240 ((View)view). closeReason = closeReason;249 ((View)view).CloseReason = closeReason; 241 250 this.CloseView(view); 242 251 }
Note: See TracChangeset
for help on using the changeset viewer.