public static vmTaxonomy OpenSoa(vmTaxonomy viewModel) { utilities util = utilities.GetInstance(); mSoa soaToOpen = new mSoa(); util.dictDlgResults = OpenFileDialogBox(util.userPath, util.dictDlgResults); if (util.dictDlgResults["result"] != "False") { string s = File.ReadAllText(util.dictDlgResults["path"]); util.activeFilePath = util.dictDlgResults["path"]; vmTaxonomy tempVm = DeserializeXml(s, viewModel); viewModel.vmSoa.Clear(); viewModel.vmSoa.Add(tempVm.vmSoa[2]); viewModel.vmSoa.Add(tempVm.vmSoa[3]); viewModel.vmClient = tempVm.vmClient; } return(viewModel); }
public editSoa() { InitializeComponent(); this.DataContext = null; viewModel = new vmTaxonomy(); if (util.editSelected == true) { viewModel = utilities.OpenSoa(viewModel); } if (util.editSelected == false) { util.activeFilePath = null; } utilities.CreateCleanJson(viewModel); this.DataContext = viewModel; //Application.Current.MainWindow.Closing += CheckForEdits; }
private static vmTaxonomy DeserializeXml(string s, vmTaxonomy viewModel) { ObservableCollection <mSoa> tempMSoa = new ObservableCollection <mSoa>(); vmTaxonomy tempVm = new vmTaxonomy(); tempVm.vmSoa.Clear(); XmlRootAttribute root = new XmlRootAttribute(); root.ElementName = "vmTaxonomy"; root.IsNullable = true; var serializer = new XmlSerializer(typeof(vmTaxonomy), root); using (var reader = new StringReader(s)) { tempVm = (vmTaxonomy)serializer.Deserialize(reader); } return(tempVm); }
public vmTaxonomy ViewmodelProvider() { vmTaxonomy vm = viewModel; return(vm); }