public static PhoneData GetFromXml(XElement elem) { string phone = elem.Element("number").Value; string name = elem.Element("name").Value; string countryCode = elem.Element("code").Value; return(PhoneData.Create(phone, name, countryCode)); }
private void SaveTask() { if (_editorMode == EditorMode.Edit) { PhoneData foundPhone = PhonesRepo.Instance.Phones.Where(x => x.ID == Selection.ID).ToList()[0]; foundPhone.Name = _viewModel.Name; foundPhone.Number = _viewModel.PhoneNumber; foundPhone.CountryCode = _viewModel.CountryCode; } else if (_editorMode == EditorMode.New) { PhonesRepo.Instance.Phones.Add(PhoneData.Create(_viewModel.PhoneNumber, _viewModel.Name, _viewModel.CountryCode)); } }
public void Configure(EditorMode editorMode) { _editorMode = editorMode; InitializeComponent(); _viewModel = new PhoneEditWindowViewModel(); this.DataContext = _viewModel; if (_editorMode == EditorMode.Edit) { Selection = PhonesRepo.Instance.SelectedPhone; } else if (_editorMode == EditorMode.New) { Selection = PhoneData.Create(); } _viewModel.PhoneNumber = Selection.Number; _viewModel.Name = Selection.Name; _viewModel.CountryCode = Selection.CountryCode; }