示例#1
0
 private int CalculateHelpLabelPosY()
 {
     if (activeView != null && ViewAttribute.HasHelpResourcePath(activeView.GetType()) && !configurationLabel.Visible)
     {
         return(configurationLabel.Top);
     }
     return(configurationLabel.Bottom + configurationLabel.Margin.Bottom + helpLabel.Margin.Top);
 }
示例#2
0
 protected override void OnContentChanged()
 {
     viewContextMenuStrip.Item = Content;
     //change ViewType if view of ViewType can not show content or is null
     if (Content != null)
     {
         if (!ViewCanShowContent(viewType, Content))
         {
             Type defaultViewType = MainFormManager.GetDefaultViewType(Content.GetType());
             if (cachedView != null && cachedView.GetType() == defaultViewType)
             {
                 ActiveView = cachedView;
             }
             else if (defaultViewType != null)
             {
                 ViewType = defaultViewType;
             }
             else if (viewContextMenuStrip.Items.Count > 0) // create first available view if no default view is available
             {
                 ViewType = (Type)viewContextMenuStrip.Items[0].Tag;
             }
             else
             {
                 ViewType   = null;
                 ActiveView = null;
             }
         }
         if (ActiveView != null)
         {
             ActiveView.Content = Content;
         }
     }
     else
     {
         ActiveView = null;
     }
     UpdateLabels();
     UpdateActiveMenuItem();
 }
 public static bool ViewCanViewContent(IContentView view, IContent content)
 {
     return(ContentAttribute.CanViewType(view.GetType(), content.GetType()));
 }