public CustomGridControl() { DXSerializer.SetLayoutVersion(this, _version.ToString()); ExpressionStyleOptions = new ExpressionStyle(); InitializeComponent(); AddHandler(CopyingToClipboardEvent, (CopyingToClipboardEventHandler)HandleCopyingToClipboard); }
static void SerializeToStream(DependencyObject d, Stream s) { Window window = d as Window; if (window != null) { SerializeWindowToStream(window, s); return; } MethodInfo saveLayoutMethod = d.GetType().GetMethod("SaveLayoutToStream", new Type[] { typeof(Stream) }); object methodParameter = s; if (saveLayoutMethod == null) { saveLayoutMethod = d.GetType().GetMethod("WriteToXML", new Type[] { typeof(XmlWriter) }); methodParameter = XmlWriter.Create(s); } if (saveLayoutMethod != null) { saveLayoutMethod.Invoke(d, new object[] { methodParameter }); if (methodParameter is XmlWriter) { ((XmlWriter)methodParameter).Close(); } return; } DXSerializer.SerializeSingleObject(d, s, string.Empty); }
static void DeserializeFromStream(DependencyObject d, Stream s) { Window window = d as Window; if (window != null) { DeserializeWindowFromStream(window, s); return; } MethodInfo restoreLayoutMethod = d.GetType().GetMethod("RestoreLayoutFromStream", new Type[] { typeof(Stream) }); object methodParameter = s; if (restoreLayoutMethod == null) { restoreLayoutMethod = d.GetType().GetMethod("ReadFromXML", new Type[] { typeof(XmlReader) }); methodParameter = XmlReader.Create(s); } if (restoreLayoutMethod != null) { restoreLayoutMethod.Invoke(d, new object[] { methodParameter }); if (methodParameter is XmlReader) { ((XmlReader)methodParameter).Close(); } return; } DXSerializer.DeserializeSingleObject(d, s, string.Empty); }
public CustomBarManager() { _xmlFileNamesPath = new List <string>(); _layoutsString = new List <string>(); DXSerializer.SetLayoutVersion(this, _version.ToString()); //Не работает в 15.2 //DXSerializer.AddLayoutUpgradeHandler(this, OnLayoutUpgradeHandler); DXSerializer.AddShouldSerializeCollectionItemHandler(this, OnShouldSerializeCollectionItem); DXSerializer.AddAllowPropertyHandler(this, OnAllowProperty); //AddHandler(BarNameScope.ScopeChangedEvent, new ScopeChangedEventHandler(OnScopeChanged)); //Нет в 15.2 //ReuseRemovedItemsDuringDeserialization = false; AddNewItems = false; #region Свойства сохраняющиеся в глобальном файле вида BarItemDisplayMode = BarItemDisplayMode.ContentAndGlyph; UserGlyphAlignment = Dock.Top; //ToolbarGlyphSize = GlyphSize.Default; #endregion Свойства сохраняющиеся в глобальном файле вида //TODO: Необходимо разобраться - зачем LockKeyGestureEventAfterHandling в false. LockKeyGestureEventAfterHandling = false; //HACK: Другой функционал обраюотки горячих клавиш в версии 15.2 KeyGestureWorkingMode = KeyGestureWorkingMode.AllKeyGestureFromRoot; }
public static void SaveControlLayout(string controlName, DependencyObject ctrl) { using (var stream = new MemoryStream()) { DXSerializer.Serialize(ctrl, stream, "Ingress", null); _manager.SaveLayoutAsync(Environment.UserName, "Ingress", controlName, stream); } }
public SaveAndRestoreLayout() { InitializeComponent(); Unloaded += OnUnloaded; DXSerializer.SetSerializationID(this.barManager, "BarManager"); isolatedStorageSettingsGroup.Visibility = Visibility.Collapsed; wManager = WorkspaceManager.GetWorkspaceManager(barManager); wManager.TransitionEffect = TransitionEffect.Ripple; }
public CustomGridControl() { DXSerializer.SetLayoutVersion(this, _version.ToString()); ExpressionStyleOptions = new ExpressionStyle(); InitializeComponent(); CopyingToClipboard += OnCopyingToClipboard; IsEnabledChanged += OnIsEnabledChanged; }
void OnStoreBeforeSave(object sender, SaveLoadLayoutDataEventArgs e) { if (this.element == null || !IsElementLoaded(this.element)) { return; } DXSerializer.SetStoreLayoutMode(this.element, StoreLayoutMode); byte[] data = SerializeElement(); Store.WriteLayoutData(StoreFolder, data, e.Clearing); }
protected override void OnStartSerializing(DependencyObject dObj) { LayoutPanel panel = (LayoutPanel)dObj; using (MemoryStream ms = new MemoryStream()) { DXSerializer.Serialize(panel.Control, ms, "customLayout", new DXOptionsLayout()); ms.Seek(0, SeekOrigin.Begin); panel.Tag = Convert.ToBase64String(ms.ToArray()); } base.OnStartSerializing(dObj); }
void ButtonRestore_Click(object sender, System.Windows.RoutedEventArgs e) { panel2.Prop1 = 0; MyCustomPanel.SetProp2(panel3, 0); DXSerializer.Deserialize(this, LayoutPath, App, new DXOptionsLayout() { AcceptNestedObjects = AcceptNestedObjects.VisualTreeOnly } ); }
private void RestoreView() { var version = GetLayoutVersion(KarotekiGridFlie); if (string.IsNullOrEmpty(version)) { DXSerializer.SetStoreLayoutMode(dgvListaRodzDok, StoreLayoutMode.UI); } dgvListaRodzDok.RestoreLayoutFromXml(KarotekiGridFlie); DXSerializer.SetStoreLayoutMode(dgvListaRodzDok, StoreLayoutMode.All); CanChangeGrid = true; }
private void RestoreView() { var version = GetLayoutVersion(HarmonogramGrFile); if (string.IsNullOrEmpty(version)) { DXSerializer.SetStoreLayoutMode(drvHarmonogram, StoreLayoutMode.UI); } drvHarmonogram.RestoreLayoutFromXml(HarmonogramGrFile); DXSerializer.SetStoreLayoutMode(drvHarmonogram, StoreLayoutMode.All); CanChangeGrid = true; }
private void RestoreViewSch() { if (File.Exists(HarmonogramDziennyGridFile)) { var version = GetLayoutVersion(HarmonogramDzScheuderGrid); if (string.IsNullOrEmpty(version)) { DXSerializer.SetStoreLayoutMode(gridControl, StoreLayoutMode.UI); } gridControl.RestoreLayoutFromXml(HarmonogramDzScheuderGrid); DXSerializer.SetStoreLayoutMode(gridControl, StoreLayoutMode.All); } }
private void RestoreView() { if (File.Exists(Environment.CurrentDirectory + "\\" + OknoUslugaGridFlie)) { var version = GetLayoutVersion(OknoUslugaGridFlie); if (string.IsNullOrEmpty(version)) { DXSerializer.SetStoreLayoutMode(dgvListaPoz, StoreLayoutMode.UI); } dgvListaPoz.RestoreLayoutFromXml(OknoUslugaGridFlie); DXSerializer.SetStoreLayoutMode(dgvListaPoz, StoreLayoutMode.All); } }
private void RestoreView() { if (File.Exists(HarmonogramDziennyGridFile)) { var version = GetLayoutVersion(HarmonogramDziennyGridFile); if (string.IsNullOrEmpty(version)) { DXSerializer.SetStoreLayoutMode(dgvListaPoz, StoreLayoutMode.UI); } dgvListaPoz.RestoreLayoutFromXml(HarmonogramDziennyGridFile); DXSerializer.SetStoreLayoutMode(dgvListaPoz, StoreLayoutMode.All); } }
private void RestoreViewExp() { if (File.Exists(ZamowieniaListaExpFlie)) { var version = GetLayoutVersion(ZamowieniaListaExpFlie); if (string.IsNullOrEmpty(version)) { DXSerializer.SetStoreLayoutMode(dgvListaLxp, StoreLayoutMode.UI); } dgvListaLxp.RestoreLayoutFromXml(ZamowieniaListaExpFlie); DXSerializer.SetStoreLayoutMode(dgvListaLxp, StoreLayoutMode.All); CanChangeGrid = true; } }
public static void RestoreControlLayout(string controlName, DependencyObject ctrl) { var data = _manager.RestoreLayout(Environment.UserName, "Ingress", controlName); if (data == null) { return; } using (var stream = new MemoryStream(data)) { DXSerializer.Deserialize(ctrl, stream, "Ingress", null); } }
protected override void OnEndDeserializing(DependencyObject dObj, string restoredVersion) { base.OnEndDeserializing(dObj, restoredVersion); LayoutPanel panel = (LayoutPanel)dObj; string layout = panel.Tag as string; if (!string.IsNullOrEmpty(layout)) { using (MemoryStream ms = new MemoryStream(Convert.FromBase64String(layout))) { DXSerializer.Deserialize(panel.Control, ms, "customLayout", new DXOptionsLayout()); } } panel.Tag = null; }
private void RestoreView() { if (File.Exists(Environment.CurrentDirectory + "\\" + OknoCennikGridFlie)) { var version = GetLayoutVersion(OknoCennikGridFlie); if (string.IsNullOrEmpty(version)) { DXSerializer.SetStoreLayoutMode(dgvCennik, StoreLayoutMode.UI); } dgvCennik.RestoreLayoutFromXml(OknoCennikGridFlie); DXSerializer.SetStoreLayoutMode(dgvCennik, StoreLayoutMode.All); CanChangeGrid = true; } }
void OnStoreAfterLoad(object sender, SaveLoadLayoutDataEventArgs e) { if (this.element == null) { return; } DXSerializer.SetStoreLayoutMode(this.element, StoreLayoutMode); byte[] dataArray = Store.ReadLayoutData(StoreFolder, e.Clearing); if (dataArray != null) { DeserializeElement(dataArray); } else { DeserializeElement(initialState); } }
string GetCurrentLayoutVersion() => DXSerializer.GetLayoutVersion(BarManager);
private string GetCurrentLayoutVersion() { return(DXSerializer.GetLayoutVersion(BarManager)); }
protected virtual void Dispose(bool disposing) { DXSerializer.RemoveShouldSerializeCollectionItemHandler(this, OnShouldSerializeCollectionItem); DXSerializer.RemoveAllowPropertyHandler(this, OnAllowProperty); }
void ButtonRestore_Click(object sender, System.Windows.RoutedEventArgs e) { DXSerializer.DeserializeSingleObject(targetPanel, LayoutPath, AppName); }