Beispiel #1
0
 public static void SaveLayoutExToXml(this LayoutControl layoutControl, string filePath)
 {
     try
     {
         ObjectInfoCollection objects = new ObjectInfoCollection();
         foreach (Control ctrl in layoutControl.Controls)
         {
             if (layoutControl.GetItemByControl(ctrl) != null)
             {
                 objects.Collection.Add(new ObjectInfo(ctrl));
             }
         }
         string filePathForControls = filePath.Replace(".xml", "Controls.xml");
         layoutControl.SaveLayoutToXml(filePath);
         serializer.SerializeObject(objects, filePathForControls, appName);
     }
     catch (Exception exc)
     {
         XtraMessageBox.Show(exc.Message);
     }
 }
Beispiel #2
0
        private static void SaveConditions(TreeList treeList, string fileName)
        {
            XmlXtraSerializer serializer = new XmlXtraSerializer();

            using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate))
            {
                try
                {
                    TreeListFormatConditions collection = new TreeListFormatConditions(treeList.FormatConditions);
                    serializer.SerializeObject(collection, stream, "FormatConditions");
                }
                finally { stream.Close(); }
            }
        }
        protected void ASPxPivotGrid1_AfterPerformCallback(object sender, EventArgs e)
        {
            ASPxPivotGrid pivot = sender as ASPxPivotGrid;

            XmlXtraSerializer s = new XmlXtraSerializer();

            using (MemoryStream stream = new MemoryStream()) {
                s.SerializeObject(pivot, stream, "PivotGrid");
                Session["Layout"] = stream.ToArray();
            }

            using (MemoryStream collapsed = new MemoryStream()) {
                pivot.Data.SaveCollapsedStateToStream(collapsed);
                Session["CollapsedState"] = collapsed.ToArray();
            }
        }
        public static void SaveLayoutToStream(RibbonControl control, Stream stream)
        {
            RunTimeRibbonTreeView tree = new RunTimeRibbonTreeView()
            {
                Ribbon = control
            };

            tree.CreateTree();
            RibbonCustomizationModel model = ResultModelCreator.Instance.Create(tree, control);

            try
            {
                XmlXtraSerializer serializer = new XmlXtraSerializer();
                GetApplicationName(model);
                serializer.SerializeObject(model, stream, GetApplicationName(model));
            }
            catch (Exception e)
            {
            }
        }
Beispiel #5
0
 public void SerializeToXMLFile(string fileName)
 {
     XmlXtraSerializer serializer = new XmlXtraSerializer();
     serializer.SerializeObject(this, fileName, this.GetType().Name);
 }