public DirJunctionViewModel() { Deserialize(); if(_model == null) { _model = new DirJunctionModel() { LinkName = "NewLink", LinkDirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop), TargetPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), OutputReady = false, CmdLineFeedback = "", }; } _folderDialog = new CommonOpenFileDialog() { IsFolderPicker = true, DefaultDirectory = TargetPath, }; CreateSelectTargetCommand(); CreateSelectLinkDirectoryCommand(); CreateCreateJunctionCommand(); CreatePopupClickedCommand(); }
private void Deserialize() { if (File.Exists(_serializationFilePath)) { using (Stream deserializationStream = new FileStream(_serializationFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { XmlSerializer serializer = new XmlSerializer(typeof(DirJunctionModel)); _model = (DirJunctionModel)serializer.Deserialize(deserializationStream); } } }