public void LoadLayout() { try { var localStorage = App.Locator.Resolve <IStorage>(); var layout = localStorage.Get <string>(LAYOUT_KEY).Result ?? GetDefaultLayout(); XmlLayoutSerializer seria = new XmlLayoutSerializer(dockManager); seria.LayoutSerializationCallback += LayoutDeserialization; seria.Deserialize(new StringReader(layout)); } catch (Exception ex) { PWTrace.Error("Exception when restoring layout", ex); } }
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { base.OnClosing(e); try { var localStorage = App.Locator.Resolve <IStorage>(); XmlLayoutSerializer serializer = new XmlLayoutSerializer(dockManager); StringWriter writer = new StringWriter(); serializer.Serialize(writer); localStorage.Put(LAYOUT_KEY, writer.ToString()).Wait(); } catch (Exception ex) { PWTrace.Error("Error when saving layout", ex); } }