Changeset 4083 for trunk/sources/HeuristicLab.MainForm.WindowsForms
- Timestamp:
- 07/22/10 16:04:11 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/View.cs
r4068 r4083 146 146 } 147 147 } 148 protected v oid PropagateStateChanges(Control control, Type type, PropertyInfo propertyInfo) {148 protected virtual void PropagateStateChanges(Control control, Type type, PropertyInfo propertyInfo) { 149 149 if (!type.GetProperties().Contains(propertyInfo)) 150 150 throw new ArgumentException("The specified type " + type + "implement the property " + propertyInfo.Name + "."); -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ViewHost.cs
r4068 r4083 25 25 using System.Windows.Forms; 26 26 using HeuristicLab.Common; 27 using System.Reflection; 27 28 28 29 namespace HeuristicLab.MainForm.WindowsForms { … … 175 176 if (activeView != null) { 176 177 UpdateActiveMenuItem(); 178 this.ActiveView.ReadOnly = this.ReadOnly; 179 this.ActiveView.Locked = this.Locked; 177 180 this.ActiveViewControl.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; 178 181 this.ActiveViewControl.Size = new System.Drawing.Size(this.Width - this.viewsLabel.Width - this.viewsLabel.Margin.Left - this.viewsLabel.Margin.Right, this.Height); … … 215 218 216 219 #region forwarding of view events 217 protected override void OnReadOnlyChanged() { 218 this.SuspendRepaint(); 219 base.OnReadOnlyChanged(); 220 foreach (IContentView view in cachedViews.Values) 221 view.ReadOnly = this.ReadOnly; 222 this.ResumeRepaint(true); 223 } 224 protected override void OnLockedChanged() { 225 this.SuspendRepaint(); 226 base.OnLockedChanged(); 227 foreach (IContentView view in cachedViews.Values) 228 view.Locked = this.Locked; 229 this.ResumeRepaint(true); 230 } 220 protected override void PropagateStateChanges(Control control, Type type, System.Reflection.PropertyInfo propertyInfo) { 221 if (!type.GetProperties().Contains(propertyInfo)) 222 throw new ArgumentException("The specified type " + type + "implement the property " + propertyInfo.Name + "."); 223 if (!type.IsAssignableFrom(this.GetType())) 224 throw new ArgumentException("The specified type " + type + "must be the same or a base class / interface of this object."); 225 if (!propertyInfo.CanWrite) 226 throw new ArgumentException("The specified property " + propertyInfo.Name + " must have a setter."); 227 228 if (activeView != null) { 229 Type controlType = activeView.GetType(); 230 PropertyInfo controlPropertyInfo = controlType.GetProperty(propertyInfo.Name, propertyInfo.PropertyType); 231 if (type.IsAssignableFrom(controlType) && controlPropertyInfo != null) { 232 var thisValue = propertyInfo.GetValue(this, null); 233 controlPropertyInfo.SetValue(activeView, thisValue, null); 234 } 235 } 236 } 237 231 238 internal protected override void OnShown(ViewShownEventArgs e) { 232 239 base.OnShown(e);
Note: See TracChangeset
for help on using the changeset viewer.