- Timestamp:
- 01/11/11 12:00:36 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs
r5237 r5270 260 260 if (listView.SelectedItems.Count == 1) { 261 261 T item = (T)listView.SelectedItems[0].Tag; 262 IContentView view; 263 view = MainFormManager.MainForm.Views.OfType<IContentView>().Where(x => (x.Content != null) && (x.Content == item)).FirstOrDefault(); 264 if (view != null) { 265 view.Show(); 266 } else { 267 view = MainFormManager.MainForm.ShowContent(item); 268 if (view != null) { 269 view.ReadOnly = this.ReadOnly; 270 } 271 } 262 IContentView view = MainFormManager.MainForm.ShowContent(item, true); 272 263 } 273 264 } -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForm.cs
r5237 r5270 21 21 22 22 using System; 23 using System.Collections;24 23 using System.Collections.Generic; 25 24 using System.Linq; … … 220 219 221 220 public IContentView ShowContent(IContent content) { 222 if (content == null) 223 throw new ArgumentNullException("Content cannot be null."); 221 if (content == null) throw new ArgumentNullException("Content cannot be null."); 224 222 Type viewType = MainFormManager.GetDefaultViewType(content.GetType()); 225 if (viewType != null) 226 return ShowContent(content, viewType); 223 if (viewType != null) return ShowContent(content, viewType); 227 224 return null; 225 } 226 227 public IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class,IContent { 228 if (content == null) throw new ArgumentNullException("Content cannot be null."); 229 if (!reuseExistingView) return ShowContent(content); 230 231 IContentView view = null; 232 if (comparer == null) view = Views.OfType<IContentView>().Where(v => (v.Content as T) == content).FirstOrDefault(); 233 else view = Views.OfType<IContentView>().Where(v => comparer.Equals((v.Content as T), content)).FirstOrDefault(); 234 235 if (view == null) view = ShowContent(content); 236 else view.Show(); 237 238 return view; 228 239 } 229 240 … … 231 242 if (InvokeRequired) return (IContentView)Invoke((Func<IContent, Type, IContentView>)ShowContent, content, viewType); 232 243 else { 233 if (content == null) 234 throw new ArgumentNullException("Content cannot be null."); 235 if (viewType == null) 236 throw new ArgumentNullException("ViewType cannot be null."); 237 238 IContentView view; 239 if (this.ShowContentInViewHost) { 244 if (content == null) throw new ArgumentNullException("Content cannot be null."); 245 if (viewType == null) throw new ArgumentNullException("ViewType cannot be null."); 246 247 IContentView view = null; 248 if (ShowContentInViewHost) { 240 249 ViewHost viewHost = new ViewHost(); 241 250 viewHost.ViewType = viewType; 242 251 view = viewHost; 243 } else 244 252 253 } else view = MainFormManager.CreateView(viewType); 245 254 246 255 view.Content = content; -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ViewHost.cs
r5012 r5270 108 108 get { return viewType; } 109 109 set { 110 if (viewType != value ) {110 if (viewType != value && value.GetType() != typeof(ViewHost)) { 111 111 if (value != null && Content != null && !ViewCanShowContent(value, Content)) 112 112 throw new ArgumentException(string.Format("View \"{0}\" cannot display content \"{1}\".", -
trunk/sources/HeuristicLab.MainForm/3.3/Interfaces/IMainForm.cs
r4068 r5270 39 39 40 40 IContentView ShowContent(IContent content); 41 IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class,IContent; 41 42 IContentView ShowContent(IContent content, Type viewType); 42 43
Note: See TracChangeset
for help on using the changeset viewer.