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);
                }
            }
        }
Ejemplo n.º 2
0
        public IContentView ShowContent(IContent content, Type viewType)
        {
            if (InvokeRequired)
            {
                return((IContentView)Invoke((Func <IContent, Type, IContentView>)ShowContent, content, viewType));
            }
            else
            {
                if (content == null)
                {
                    throw new ArgumentNullException("Content cannot be null.");
                }
                if (viewType == null)
                {
                    throw new ArgumentNullException("ViewType cannot be null.");
                }

                IContentView view = null;
                if (ShowContentInViewHost)
                {
                    ViewHost viewHost = new ViewHost();
                    viewHost.ViewType = viewType;
                    view = viewHost;
                }
                else
                {
                    view = MainFormManager.CreateView(viewType);
                }

                view.Content = content;
                view.Show();
                return(view);
            }
        }
Ejemplo n.º 3
0
 private void CreateFilterView()
 {
     combinedFilterView = null;
     filterPanel.Controls.Clear();
     if ((Content != null) && (Content.Filters != null))
     {
         CombinedFilter filter = Content.Filters.OfType <CombinedFilter>().Where(x => x.Operation == BooleanOperation.And).FirstOrDefault();
         if (filter != null)
         {
             combinedFilterView         = (CombinedFilterView)MainFormManager.CreateView(typeof(CombinedFilterView));
             combinedFilterView.Content = (CombinedFilter)filter.Clone();
             Control control = (Control)combinedFilterView;
             control.Dock = DockStyle.Fill;
             filterPanel.Controls.Add(control);
         }
     }
 }
Ejemplo n.º 4
0
        private void OnViewTypeChanged()
        {
            if (viewType != null)
            {
                if (!ViewCanShowContent(viewType, Content))
                {
                    throw new InvalidOperationException(string.Format("View \"{0}\" cannot display content \"{1}\".",
                                                                      viewType, Content.GetType()));
                }
                IContentView view = MainFormManager.CreateView(viewType);
                view.Locked   = Locked;
                view.ReadOnly = ReadOnly;
                ActiveView    = view; //necessary to allow the views to change the status of the viewhost
                view.Content  = Content;

                UpdateActiveMenuItem();
            }
        }