protected override void OnContentChanged() { base.OnContentChanged(); if (Content == null) { panel.Controls.Clear(); } else if (Content.GetType() == contentType && view != null) { view.Content = Content; } else { view = null; contentType = Content.GetType(); panel.Controls.Clear(); var viewType = MainFormManager.GetViewTypes(Content.GetType(), true).FirstOrDefault(t => typeof(DataAnalysisSolutionView).IsAssignableFrom(t)); if (viewType != null) { view = (DataAnalysisSolutionView)MainFormManager.CreateView(viewType); view.Locked = Locked; view.ReadOnly = ReadOnly; view.Dock = DockStyle.Fill; view.Content = Content; panel.Controls.Add(view); } } }
private void RefreshMenuItems() { if (InvokeRequired) { Invoke((Action)RefreshMenuItems); } else { foreach (ToolStripMenuItem m in menuItems.Values) { m.Dispose(); } this.Items.Clear(); this.menuItems.Clear(); if (this.item != null) { ToolStripMenuItem menuItem; IEnumerable <Type> types = MainFormManager.GetViewTypes(item.GetType(), true); foreach (Type t in types.Except(IgnoredViewTypes)) { menuItem = new ToolStripMenuItem(); menuItem.Tag = t; menuItem.Text = ViewAttribute.GetViewName(t); this.menuItems.Add(t, menuItem); this.Items.Add(menuItem); } } } }
protected virtual void AddEvaluationViewTypes() { if (Content != null && !Content.ProblemData.IsEmpty) { var viewTypes = MainFormManager.GetViewTypes(Content.GetType(), true) .Where(t => typeof(IDataAnalysisSolutionEvaluationView).IsAssignableFrom(t)); foreach (var viewType in viewTypes) { AddViewListViewItem(viewType, ((IDataAnalysisSolutionEvaluationView)Activator.CreateInstance(viewType)).ViewImage); } } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); var viewTypes = MainFormManager.GetViewTypes(typeof(RunCollection), true); foreach (Type viewType in viewTypes.OrderBy(x => ViewAttribute.GetViewName(x))) { if ((viewType != typeof(ItemCollectionView <IRun>)) && (viewType != typeof(ViewHost))) { ToolStripMenuItem menuItem = new ToolStripMenuItem(); menuItem.Text = ViewAttribute.GetViewName(viewType); menuItem.Tag = viewType; menuItem.Click += new EventHandler(menuItem_Click); analyzeRunsToolStripDropDownButton.DropDownItems.Add(menuItem); } } }
protected void FeatureCorrelationButton_Click(object sender, System.EventArgs e) { Type viewType = MainFormManager.GetViewTypes(this.Content.GetType(), true).FirstOrDefault(t => typeof(FeatureCorrelationView).IsAssignableFrom(t)); MainFormManager.MainForm.ShowContent(Content, viewType); }