Exemple #1
0
 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);
     }
 }
Exemple #2
0
        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);
            }
        }