/// <summary>
        /// Checks that templates are valid for nodes.
        /// </summary>
        /// <param name="nodeTemplateTable">Table of templates.</param>
        public virtual bool IsValid(FrameTemplateReadOnlyDictionary nodeTemplateTable)
        {
            Contract.RequireNotNull(nodeTemplateTable, out FrameTemplateReadOnlyDictionary NodeTemplateTable);

            FrameTemplateDictionary DefaultDictionary = CreateDefaultTemplateDictionary();

            bool IsValid = true;

            foreach (KeyValuePair <Type, IFrameTemplate> Entry in DefaultDictionary)
            {
                IsValid &= NodeTemplateTable.ContainsKey(Entry.Key);
            }

            foreach (KeyValuePair <Type, IFrameTemplate> Entry in NodeTemplateTable)
            {
                Type           NodeType          = Entry.Key;
                IFrameTemplate Template          = Entry.Value;
                int            CommentFrameCount = 0;

                IsValid &= Template.IsValid;
                IsValid &= IsValidNodeType(NodeType, Template.NodeType);
                IsValid &= Template.Root.IsValid(NodeType, NodeTemplateTable, ref CommentFrameCount);
                IsValid &= CommentFrameCount == 1;

                Debug.Assert(IsValid);
            }

            Debug.Assert(IsValid);
            return(IsValid);
        }
Example #2
0
        /// <summary>
        /// Update the reference to the parent frame.
        /// </summary>
        /// <param name="parentTemplate">The parent template.</param>
        /// <param name="parentFrame">The parent frame.</param>
        public override void UpdateParent(IFrameTemplate parentTemplate, IFrameFrame parentFrame)
        {
            base.UpdateParent(parentTemplate, parentFrame);

            Debug.Assert(ParentTemplate == parentTemplate);
            Debug.Assert(ParentFrame == parentFrame);
        }
        /// <summary>
        /// Checks that templates are valid for blocks.
        /// </summary>
        /// <param name="blockTemplateTable">Table of templates.</param>
        /// <param name="nodeTemplateTable">Table of templates with all frames.</param>
        public virtual bool IsBlockValid(FrameTemplateReadOnlyDictionary blockTemplateTable, FrameTemplateReadOnlyDictionary nodeTemplateTable)
        {
            Contract.RequireNotNull(blockTemplateTable, out FrameTemplateReadOnlyDictionary BlockTemplateTable);
            Contract.RequireNotNull(nodeTemplateTable, out FrameTemplateReadOnlyDictionary NodeTemplateTable);

            IList <Type> BlockKeys = NodeHelper.GetNodeKeys();

            FrameTemplateDictionary DefaultDictionary = CreateEmptyTemplateDictionary();

            foreach (Type Key in BlockKeys)
            {
                AddBlockNodeTypes(DefaultDictionary, Key);
            }

            bool IsValid = true;

            foreach (KeyValuePair <Type, IFrameTemplate> Entry in DefaultDictionary)
            {
                IsValid &= BlockTemplateTable.ContainsKey(Entry.Key);
            }

            foreach (KeyValuePair <Type, IFrameTemplate> Entry in BlockTemplateTable)
            {
                Type           NodeType          = Entry.Key;
                IFrameTemplate Template          = Entry.Value;
                int            CommentFrameCount = 0;

                IsValid &= NodeTreeHelper.IsBlockInterfaceType(NodeType);
                IsValid &= Template.IsValid;
                IsValid &= Template.Root.IsValid(NodeType, NodeTemplateTable, ref CommentFrameCount);
            }

            Debug.Assert(IsValid);
            return(IsValid);
        }
        bool IReadOnlyDictionary <Type, IFrameTemplate> .TryGetValue(Type key, out IFrameTemplate value)
        {
            bool Result = TryGetValue(key, out IFocusTemplate Value);

            value = Value;
            return(Result);
        }
Example #5
0
        /// <summary>
        /// Checks that templates are valid for blocks.
        /// </summary>
        /// <param name="blockTemplateTable">Table of templates.</param>
        /// <param name="nodeTemplateTable">Table of templates with all frames.</param>
        public virtual bool IsBlockValid(IFrameTemplateReadOnlyDictionary blockTemplateTable, IFrameTemplateReadOnlyDictionary nodeTemplateTable)
        {
            Debug.Assert(blockTemplateTable != null);

            List <Type> BlockKeys = new List <Type>(NodeHelper.CreateNodeDictionary <object>().Keys);

            IFrameTemplateDictionary DefaultDictionary = CreateEmptyTemplateDictionary();

            foreach (Type Key in BlockKeys)
            {
                AddBlockNodeTypes(DefaultDictionary, Key);
            }

            bool IsValid = true;

            foreach (KeyValuePair <Type, IFrameTemplate> Entry in DefaultDictionary)
            {
                IsValid &= blockTemplateTable.ContainsKey(Entry.Key);
            }

            foreach (KeyValuePair <Type, IFrameTemplate> Entry in blockTemplateTable)
            {
                Type           NodeType          = Entry.Key;
                IFrameTemplate Template          = Entry.Value;
                int            CommentFrameCount = 0;

                IsValid &= NodeTreeHelper.IsBlockType(NodeType);
                IsValid &= Template.IsValid;
                IsValid &= Template.Root.IsValid(NodeType, nodeTemplateTable, ref CommentFrameCount);
            }

            Debug.Assert(IsValid);
            return(IsValid);
        }
Example #6
0
        bool IDictionary <Type, IFrameTemplate> .TryGetValue(Type key, out IFrameTemplate value)
        {
            bool Result = TryGetValue(key, out ILayoutTemplate Value);

            value = Value;
            return(Result);
        }
 private void HandleCustomGetMinSizeEvent(IFrameTemplate frameTemplate)
 {
     PopupForm popupForm = frameTemplate as PopupForm;
     if (popupForm != null)
     {
         popupForm.CustomizeClientSize += new EventHandler<CustomSizeEventArgs>(popupForm_CustomizeClientSize);
     }
 }
        private void Window_TemplateChanged(object sender, EventArgs e)
        {
            IFrameTemplate  template   = Window.Template;
            DocumentManager docManager = ((IDocumentsHostWindow)template).DocumentManager;

            docManager.ViewChanged += docManager_ViewChanged;
            CustomizeDocumentManagerView(docManager.View);
        }
        /// <summary>
        /// Update the reference to the parent frame.
        /// </summary>
        /// <param name="parentTemplate">The parent template.</param>
        /// <param name="parentFrame">The parent frame.</param>
        public override void UpdateParent(IFrameTemplate parentTemplate, IFrameFrame parentFrame)
        {
            base.UpdateParent(parentTemplate, parentFrame);

            foreach (IFrameKeywordFrame Item in Items)
            {
                Item.UpdateParent(parentTemplate, this);
            }
        }
        /// <summary>
        /// Update the reference to the parent frame.
        /// </summary>
        /// <param name="parentTemplate">The parent template.</param>
        /// <param name="parentFrame">The parent frame.</param>
        public virtual void UpdateParent(IFrameTemplate parentTemplate, IFrameFrame parentFrame)
        {
            Contract.RequireNotNull(parentTemplate, out IFrameTemplate ParentTemplate);
            Contract.RequireNotNull(parentFrame, out IFrameFrame ParentFrame);

            Debug.Assert(this.ParentTemplate == null);
            this.ParentTemplate = ParentTemplate;

            Debug.Assert(this.ParentFrame == null);
            this.ParentFrame = ParentFrame;
        }
Example #11
0
        /// <summary>
        /// Update the reference to the parent frame.
        /// </summary>
        /// <param name="parentTemplate">The parent template.</param>
        /// <param name="parentFrame">The parent frame.</param>
        public virtual void UpdateParent(IFrameTemplate parentTemplate, IFrameFrame parentFrame)
        {
            Debug.Assert(parentTemplate != null);
            Debug.Assert(parentFrame != null);

            Debug.Assert(ParentTemplate == null);
            ParentTemplate = parentTemplate;

            Debug.Assert(ParentFrame == null);
            ParentFrame = parentFrame;
        }
        /// <summary>
        /// Update the reference to the parent frame.
        /// </summary>
        /// <param name="parentTemplate">The parent template.</param>
        /// <param name="parentFrame">The parent frame.</param>
        public override void UpdateParent(IFrameTemplate parentTemplate, IFrameFrame parentFrame)
        {
            base.UpdateParent(parentTemplate, parentFrame);

            Debug.Assert(ParentTemplate == parentTemplate);
            Debug.Assert(ParentFrame == parentFrame);

            foreach (IFocusSelectableFrame Item in Items)
            {
                Item.UpdateParent(parentTemplate, this);
            }
        }
Example #13
0
        /// <summary>
        /// Update the reference to the parent frame.
        /// </summary>
        /// <param name="parentTemplate">The parent template.</param>
        /// <param name="parentFrame">The parent frame.</param>
        public virtual void UpdateParent(IFrameTemplate parentTemplate, IFrameFrame parentFrame)
        {
            Debug.Assert(parentTemplate is IFocusTemplate);
            Debug.Assert(parentFrame is IFocusFrame);

            Debug.Assert(ParentTemplate == null);
            ParentTemplate = (IFocusTemplate)parentTemplate;

            Debug.Assert(ParentFrame == null);
            ParentFrame = (IFocusFrame)parentFrame;

            Content.UpdateParent(parentTemplate, this);
        }
Example #14
0
        public override IModelTemplate GetTemplateCustomizationModel(IFrameTemplate template)
        {
            var applicationBase = ((ModelApplicationBase)Model);

            if (applicationBase.Id == "Application")
            {
                var list = new List <ModelApplicationBase>();
                while (applicationBase.LastLayer.Id != "UserDiff" && applicationBase.LastLayer.Id != AfterSetupLayerId && applicationBase.LastLayer.Id != "Unchanged Master Part")
                {
                    list.Add(applicationBase.LastLayer);
                    ModelApplicationHelper.RemoveLayer(applicationBase);
                }
                var modelTemplate = base.GetTemplateCustomizationModel(template);
                foreach (var modelApplicationBase in list)
                {
                    ModelApplicationHelper.AddLayer((ModelApplicationBase)Model, modelApplicationBase);
                }
                return(modelTemplate);
            }
            return(base.GetTemplateCustomizationModel(template));
        }
Example #15
0
 public static IObservable <IWindowsForm> WhenWindowsForm(this IFrameTemplate frameTemplate)
 => frameTemplate.ReturnObservable().Where(_ => frameTemplate != null && frameTemplate.GetType().InheritsFrom("System.Windows.Forms.Form")).WhenNotDefault()
 .Select(template => new WindowsForm(template));
Example #16
0
 public WindowsForm(IFrameTemplate template)
 {
     Template = template;
 }
Example #17
0
 public override IModelTemplate GetTemplateCustomizationModel(IFrameTemplate template) {
     var applicationBase = ((ModelApplicationBase)Model);
     if (applicationBase.Id == "Application") {
         var list = new List<ModelApplicationBase>();
         while (applicationBase.LastLayer.Id != "UserDiff" && applicationBase.LastLayer.Id != AfterSetupLayerId && applicationBase.LastLayer.Id != "Unchanged Master Part") {
             list.Add(applicationBase.LastLayer);
             ModelApplicationHelper.RemoveLayer(applicationBase);
         }
         var modelTemplate = base.GetTemplateCustomizationModel(template);
         foreach (var modelApplicationBase in list) {
             ModelApplicationHelper.AddLayer((ModelApplicationBase)Model, modelApplicationBase);
         }
         return modelTemplate;
     }
     return base.GetTemplateCustomizationModel(template);
 }
Example #18
0
 bool ICollection <IFrameTemplate> .Remove(IFrameTemplate item)
 {
     return(Remove((ILayoutTemplate)item));
 }
 public void UpdateParent(IFrameTemplate parentTemplate, IFrameFrame parentFrame)
 {
 }
Example #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FrameBlockStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="blockState">The block state.</param>
 /// <param name="template">The frame template.</param>
 protected FrameBlockStateView(FrameControllerView controllerView, IFrameBlockState blockState, IFrameTemplate template)
     : base(controllerView, blockState)
 {
     Template = template;
 }
Example #21
0
 void ICollection <IFrameTemplate> .Add(IFrameTemplate item)
 {
     Add((IFocusTemplate)item);
 }
        /// <summary>
        /// Update the reference to the parent frame.
        /// </summary>
        /// <param name="parentTemplate">The parent template.</param>
        /// <param name="parentFrame">The parent frame.</param>
        public override void UpdateParent(IFrameTemplate parentTemplate, IFrameFrame parentFrame)
        {
            base.UpdateParent(parentTemplate, parentFrame);

            UpdateInterfaceType(parentTemplate.NodeType);
        }
Example #23
0
 void ICollection <IFrameTemplate> .Add(IFrameTemplate item)
 {
     Add((ILayoutTemplate)item);
 }
Example #24
0
 bool ICollection <IFrameTemplate> .Contains(IFrameTemplate value)
 {
     return(Contains((ILayoutTemplate)value));
 }
Example #25
0
 void IList <IFrameTemplate> .Insert(int index, IFrameTemplate item)
 {
     Insert(index, (ILayoutTemplate)item);
 }
Example #26
0
 int IList <IFrameTemplate> .IndexOf(IFrameTemplate value)
 {
     return(IndexOf((ILayoutTemplate)value));
 }
 void IDictionary <Type, IFrameTemplate> .Add(Type key, IFrameTemplate value)
 {
     Add(key, (IFocusTemplate)value);
 }
 public static Form ToForm(this IFrameTemplate frameTemplate)
 {
     return((Form)frameTemplate);
 }
Example #29
0
 public override IModelTemplate GetTemplateCustomizationModel(IFrameTemplate template) {
     var list = new List<ModelApplicationBase>();
     while (((ModelApplicationBase)Model).LastLayer.Id != "UserDiff" && ((ModelApplicationBase)Model).LastLayer.Id != AfterSetupLayerId) {
         var modelApplicationBase = ((ModelApplicationBase)Model).LastLayer;
         list.Add(modelApplicationBase);
         ((ModelApplicationBase)Model).RemoveLayer(modelApplicationBase);
     }
     var modelTemplate = base.GetTemplateCustomizationModel(template);
     foreach (var modelApplicationBase in list) {
         ((ModelApplicationBase)Model).AddLayer(modelApplicationBase);
     }
     return modelTemplate;
 }
Example #30
0
 void IList <IFrameTemplate> .Insert(int index, IFrameTemplate item)
 {
     Insert(index, (IFocusTemplate)item);
 }