示例#1
0
        public void SaveExecute()
        {
            if (SolutionFileName == null)
            {
                SaveAsExecute();
            }
            else
            {
                Saving(this, new EventArgs());

                // Grab the layout blob from the layout Manager so we can restore to this layout
                string      layoutBlob = layoutManager.Value.SaveLayout();
                FieldLayout layout     = new FieldLayout(string.Empty);
                if (FieldLayout.CheckSyntax(layoutBlob))
                {
                    layout = new FieldLayout(layoutBlob);
                }

                // save to existing (or new) file
                using (Stream dest = File.Create(SolutionFileName))
                {
                    byte[] byteArray = Encoding.Unicode.GetBytes(rootSolutionItem.Solution.SetLayout(layout).ToXml());
                    using (MemoryStream src = new MemoryStream(byteArray))
                    {
                        Compress(src, dest);
                        dirty = m_requireSaving.Count > 0;
                    }
                }
            }
        }
示例#2
0
 public NodeSolution SetLayout(FieldLayout Layout)
 {
     if (Layout == null)
     {
         throw new ArgumentNullException(m_LayoutName);
     }
     return(new NodeSolution(this.SetField(new FieldIdentifier(m_LayoutName), Layout), ChildCollection));
 }
示例#3
0
        public static NodeSolution BuildWith(FieldSolutionName SolutionName, FieldLayout Layout)
        {
            //build fields
            Dictionary <FieldIdentifier, FieldBase> mutableFields =
                new Dictionary <FieldIdentifier, FieldBase>();

            mutableFields.Add(new FieldIdentifier(m_SolutionNameName), SolutionName);
            mutableFields.Add(new FieldIdentifier(m_LayoutName), Layout);

            //build children
            KeyedNodeCollection <NodeBase> mutableChildren =
                new KeyedNodeCollection <NodeBase>();
            //Add Children here: mutableChildren.Add(SomeChild);

            //build node
            NodeSolution Builder = new NodeSolution(
                new ReadOnlyDictionary <FieldIdentifier, FieldBase>(mutableFields),
                new ReadOnlyCollection <NodeBase>(mutableChildren));

            return(Builder);
        }
示例#4
0
        public static NodeSolution BuildWith(FieldSolutionName SolutionName, FieldLayout Layout)
        {
            //build fields
            Dictionary<FieldIdentifier, FieldBase> mutableFields =
                new Dictionary<FieldIdentifier, FieldBase>();
            mutableFields.Add(new FieldIdentifier(m_SolutionNameName), SolutionName);
            mutableFields.Add(new FieldIdentifier(m_LayoutName), Layout);

            //build children
            KeyedNodeCollection<NodeBase> mutableChildren =
                new KeyedNodeCollection<NodeBase>();
            //Add Children here: mutableChildren.Add(SomeChild);

            //build node
            NodeSolution Builder = new NodeSolution(
                new ReadOnlyDictionary<FieldIdentifier, FieldBase>(mutableFields),
                new ReadOnlyCollection<NodeBase>(mutableChildren));

            return Builder;
        }
示例#5
0
 public NodeSolution SetLayout(FieldLayout Layout)
 {
     if (Layout == null)
     {
         throw new ArgumentNullException(m_LayoutName);
     }
     return new NodeSolution(this.SetField(new FieldIdentifier(m_LayoutName), Layout), ChildCollection);
 }