public void DeSerialzeState(object sender, EventArgs e) { XmlDocument stateDoc = new XmlDocument(); try { stateDoc.Load(String.Format(@"{0}\stickySpacesState.xml", System.Windows.Forms.Application.UserAppDataPath)); StringReader reader = new StringReader(stateDoc.InnerXml); XPathDocument navDoc = new XPathDocument(reader); XPathNavigator nav = navDoc.CreateNavigator(); XPathExpression windowsPath = nav.Compile(@"/StickySpacesWindows/StickyWindow"); XPathNodeIterator windows = nav.Select(windowsPath); if (windows != null) { while (windows.MoveNext()) { StickyWindowModel newSw = new StickyWindowModel(windows.Current.OuterXml); newSw.Owner = this; this.RegisterName(newSw.Name, newSw); } } } catch (Exception ex) { } }
public void CreateStickyWindow(object sender, EventArgs e) { StickyWindowModel stickyWindow = new StickyWindowModel(null); stickyWindow.Owner = this; this.RegisterName(stickyWindow.Name, stickyWindow); }