Changeset 17819 for stable/HeuristicLab.MainForm.WindowsForms/3.3/Controls
- Timestamp:
- 01/08/21 13:45:35 (4 years ago)
- Location:
- stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
-
stable/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ViewHost.cs
r17181 r17819 170 170 } 171 171 172 172 173 private void OnViewTypeChanged() { 173 if (viewType != null) {174 175 throw new InvalidOperationException(string.Format("View \"{0}\" cannot display content \"{1}\".",176 viewType, Content.GetType())); 177 178 179 180 181 182 183 184 } 174 if (viewType == null) return; 175 if (!ViewCanShowContent(viewType, Content)) 176 throw new InvalidOperationException(string.Format("View \"{0}\" cannot display content \"{1}\".", viewType, Content.GetType())); 177 178 IContentView view = MainFormManager.CreateView(viewType); 179 view.Locked = Locked; 180 view.ReadOnly = ReadOnly; 181 ActiveView = view; //necessary to allow the views to change the status of the viewhost 182 view.Content = Content; 183 184 UpdateActiveMenuItem(); 185 185 186 } 186 187 … … 188 189 activeView.CaptionChanged += new EventHandler(activeView_CaptionChanged); 189 190 activeView.LockedChanged += new EventHandler(activeView_LockedChanged); 191 activeView.ReadOnlyChanged += new EventHandler(activeView_ReadOnlyChanged); 190 192 activeView.Changed += new EventHandler(activeView_Changed); 191 193 } … … 193 195 activeView.CaptionChanged -= new EventHandler(activeView_CaptionChanged); 194 196 activeView.LockedChanged -= new EventHandler(activeView_LockedChanged); 197 activeView.ReadOnlyChanged -= new EventHandler(activeView_ReadOnlyChanged); 195 198 activeView.Changed -= new EventHandler(activeView_Changed); 196 199 } … … 202 205 configurationLabel.Enabled = !activeView.Locked; 203 206 } 207 private void activeView_ReadOnlyChanged(object sender, EventArgs e) { 208 ReadOnly = activeView.ReadOnly; 209 } 210 204 211 private void activeView_Changed(object sender, EventArgs e) { 205 212 OnChanged(); … … 228 235 229 236 #region forwarding of view events 230 internal protectedoverride void OnShown(ViewShownEventArgs e) {237 protected internal override void OnShown(ViewShownEventArgs e) { 231 238 base.OnShown(e); 232 239 View view = ActiveView as View; … … 234 241 view.OnShown(e); 235 242 } 236 internal protectedoverride void OnHidden(EventArgs e) {243 protected internal override void OnHidden(EventArgs e) { 237 244 base.OnHidden(e); 238 245 View view = ActiveView as View; … … 240 247 view.OnHidden(e); 241 248 } 242 internal protectedoverride void OnClosing(FormClosingEventArgs e) {249 protected internal override void OnClosing(FormClosingEventArgs e) { 243 250 base.OnClosing(e); 244 251 View view = ActiveView as View; … … 246 253 view.OnClosing(e); 247 254 } 248 internal protectedoverride void OnClosed(FormClosedEventArgs e) {255 protected internal override void OnClosed(FormClosedEventArgs e) { 249 256 base.OnClosed(e); 250 257 View view = ActiveView as View;
Note: See TracChangeset
for help on using the changeset viewer.