public void SaveLayout(Layout_config config) { try { if (!Directory.Exists(LayoutFilePath)) { Directory.CreateDirectory(LayoutFilePath); } string fileName; if (config == Layout_config.Default) { fileName = LayoutFilePath + CommonDefine.DefaultConfigFile; } else { fileName = LayoutFilePath + CommonDefine.CustomConfigFile; } var serializer = new XmlLayoutSerializer(dockingManager); using (var stream = new StreamWriter(fileName)) serializer.Serialize(stream); } catch (System.Exception ex) { Debug.WriteLine(ex.Message); } }
private bool IsFileExist(Layout_config config) { string fileName; if (config == Layout_config.Default) { fileName = LayoutFilePath + CommonDefine.DefaultConfigFile; } else { fileName = LayoutFilePath + CommonDefine.CustomConfigFile; } if (File.Exists(fileName)) { return(true); } else { return(false); } }
public void LoadLayout(Layout_config config) { var currentContentsList = dockingManager.Layout.Descendents().OfType <LayoutContent>().Where(c => c.ContentId != null).ToArray(); try { if (!Directory.Exists(LayoutFilePath)) { Directory.CreateDirectory(LayoutFilePath); } string fileName; if (config == Layout_config.Default) { fileName = LayoutFilePath + CommonDefine.DefaultConfigFile; } else { fileName = LayoutFilePath + CommonDefine.CustomConfigFile; } if (File.Exists(fileName)) { var serializer = new XmlLayoutSerializer(dockingManager); using (var stream = new StreamReader(fileName)) serializer.Deserialize(stream); } } catch (System.Exception ex) { Debug.WriteLine(ex.Message); } finally { AddPanHidingHandler(); UpdatePaneState(); LoadPaneTitle(); } }