/// <summary> /// Initializes the form. /// </summary> private void InitializeForm() { _data = InstantAccessData.Create(); if (_data.IsDataAvailable) { ShowTaskDescriptions(); } else { HideTaskDescriptions(); } ShowCurrentActivity(); }
/// <summary> /// Creates an instance of the InstantAccessData class. /// </summary> /// <returns>A valid instance of the InstantAccessData class.</returns> public static InstantAccessData Create() { InstantAccessData target = new InstantAccessData(); DirectoryInfo dataFolder = new DirectoryInfo(System.Windows.Forms.Application.UserAppDataPath); string path = Path.Combine(dataFolder.FullName, InstantAccessDataFileName); if (File.Exists(path)) { using (Stream s = new FileStream(path, FileMode.OpenOrCreate)) { XmlSerializer serializer = new XmlSerializer(typeof(InstantAccessData)); target = (InstantAccessData)serializer.Deserialize(s); target._isDataAvailable = true; } } return(target); }
/// <summary> /// Initializes a new instance of the <see cref="InstantAccessDialog"/> class. /// </summary> public InstantAccessDialog() { InitializeComponent(); this._nodeRoot = this._treeViewActions.Nodes["_nodeRoot"]; this._nodePinned = this._nodeRoot.Nodes["_nodePinned"]; this._nodeMru = this._nodeRoot.Nodes["_nodeMru"]; this._nodeMfu = this._nodeRoot.Nodes["_nodeMfu"]; this._nodeRoot.Expand(); this._nodePinned.Expand(); this._nodeMru.Expand(); this._nodeMfu.Expand(); this._data = InstantAccessData.Create(); BuildTree(); BuildCurrentActivity(); }
/// <summary> /// Creates an instance of the InstantAccessData class. /// </summary> /// <returns>A valid instance of the InstantAccessData class.</returns> public static InstantAccessData Create() { InstantAccessData target = new InstantAccessData(); DirectoryInfo dataFolder = new DirectoryInfo(System.Windows.Forms.Application.UserAppDataPath); string path = Path.Combine(dataFolder.FullName, InstantAccessDataFileName); if (File.Exists(path)) { using (Stream s = new FileStream(path, FileMode.OpenOrCreate)) { XmlSerializer serializer = new XmlSerializer(typeof (InstantAccessData)); target = (InstantAccessData) serializer.Deserialize(s); target._isDataAvailable = true; } } return target; }