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(); } }
private static void RestoreConditions(TreeList treeList, string fileName) { if (!File.Exists(fileName)) { return; } XmlXtraSerializer serializer = new XmlXtraSerializer(); using (FileStream stream = new FileStream(fileName, FileMode.Open)) { try { TreeListFormatConditions collection = new TreeListFormatConditions(); serializer.DeserializeObject(collection, stream, "FormatConditions"); collection.Conditions.CopyToStyleFormats(treeList.FormatConditions); treeList.Refresh(); } finally { stream.Close(); } } }
public static void LoadLayoutFromStream(MyRibbonControl control, MemoryStream stream) { RibbonCustomizationModel model = null; try { model = new RibbonCustomizationModel(control); XmlXtraSerializer serializer = new XmlXtraSerializer(); serializer.DeserializeObject(model, stream, GetApplicationName(model)); } catch (Exception e) { } if (model == null || !model.IsModelValid(control)) { return; } typeof(RibbonControl).GetMethod("ApplyCustomizationSettings", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(control, new object[] { model }); }
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) { } }
public static void RestoreLayoutFromXmlEx(this ColumnView view, FilterNameProvider provider, string filePath) { XmlXtraSerializer serializer = new XmlXtraSerializer(); serializer.DeserializeObjects(new XtraObjectInfo[] { new XtraObjectInfo("View", view), new XtraObjectInfo("Filters", provider) }, filePath, "DXSample"); }
public void SerializeToXMLFile(string fileName) { XmlXtraSerializer serializer = new XmlXtraSerializer(); serializer.SerializeObject(this, fileName, this.GetType().Name); }