public static Page1ViewModel Load(Stream stream, BinaryFormatter formatter) { var loaded = (Page1ViewModel)formatter.Deserialize(stream); _instance = loaded; loaded.GenderOtherTextEnabled = false; return(_instance); }
protected bool Equals(Page1ViewModel other) { return(Equals(_sessionDate.Equals(other._sessionDate) && _reviewDate.Equals(other._reviewDate) && _clientDOB.Equals(other._clientDOB) && _nextTapeDueDate.Equals(other._nextTapeDueDate) && string.Equals(_staffName, other._staffName) && string.Equals(_reviewName, other._reviewName) && string.Equals(_caseloadNumber, other._caseloadNumber) && string.Equals(_clientName, other._clientName) && string.Equals(_sessionLength, other._sessionLength) && string.Equals(_clientSID, other._clientSID) && string.Equals(_genderOtherText, other._genderOtherText) && string.Equals(_race, other._race) && string.Equals(_checkInScore, other._checkInScore) && string.Equals(_reviewScore, other._reviewScore) && string.Equals(_interventionScore, other._interventionScore) && string.Equals(_homeworkScore, other._homeworkScore) && string.Equals(_behavioralScore, other._behavioralScore) && string.Equals(_globalScore, other._globalScore) && string.Equals(_overallScore, other._overallScore) && string.Equals(_topStaffStrengths, other._topStaffStrengths) && string.Equals(_topStaffImprovements, other._topStaffImprovements) && string.Equals(_percentHighEpics, other._percentHighEpics) && string.Equals(_percentLowEpics, other._percentLowEpics) && string.Equals(_completedEpics, other._completedEpics) && string.Equals(_totalEpics, other._totalEpics) && string.Equals(_percentEpicsCompleted, other._percentEpicsCompleted) && string.Equals(_additionalCommentsText, other._additionalCommentsText) && _genderMale == other._genderMale && _genderFemale == other._genderFemale && _genderOther == other._genderOther && _firstMeetingYes == other._firstMeetingYes && _firstMeetingNo == other._firstMeetingNo && _firstMeetingNA == other._firstMeetingNA && _clientHomelessYes == other._clientHomelessYes && _clientHomelessNo == other._clientHomelessNo && _clientHomelessNA == other._clientHomelessNA && _clientAgressiveYes == other._clientAgressiveYes && _clientAgressiveNo == other._clientAgressiveNo && _clientAgressiveNA == other._clientAgressiveNA && _genderOtherTextEnabled == other._genderOtherTextEnabled)); }
private void LoadMenuItem_OnClick(object sender, RoutedEventArgs e) { OpenFileDialog loadDialog = new OpenFileDialog(); loadDialog.Title = "Load EPIC form"; loadDialog.Filter = "EPIC forms (*.ef)|*.ef|All Files (*.*)|*.*"; if (loadDialog.ShowDialog() != true) { return; } try { using (FileStream stream = File.OpenRead(loadDialog.FileName)) { BinaryFormatter formatter = new BinaryFormatter(); // get the type bool wasAlternate = _isAlternate; _isAlternate = (bool)formatter.Deserialize(stream); ((Page1)Pages[0]).SetViewModel(Page1ViewModel.Load(stream, formatter)); ((Page2)Pages[1]).SetViewModel(Page2ViewModel.Load(stream, formatter)); if (_isAlternate) // alternate page { if (!wasAlternate) // change page 3 to alternate { Pages[2] = new Page3Alternate(); } ((Page3Alternate)Pages[2]).SetViewModel(Page3ViewModelAlternate.Load(stream, formatter)); } else // Normal page now { if (wasAlternate) // change page 3 to the normal page { Pages[2] = new Page3(); } ((Page3)Pages[2]).SetViewModel(Page3ViewModel.Load(stream, formatter)); } ((Page4)Pages[3]).SetViewModel(Page4ViewModel.Load(stream, formatter)); ((Page5)Pages[4]).SetViewModel(Page5ViewModel.Load(stream, formatter)); if (_isAlternate) // alternate page { if (!wasAlternate) // change page 6 to alternate { Pages[5] = new Page6Alternate(); } ((Page6Alternate)Pages[5]).SetViewModel(Page6ViewModelAlternate.Load(stream, formatter)); } else // Normal page now { if (wasAlternate) // change page 6 to the normal page { Pages[5] = new Page6(); } ((Page6)Pages[5]).SetViewModel(Page6ViewModel.Load(stream, formatter)); } ((Page7)Pages[6]).SetViewModel(Page7ViewModel.Load(stream, formatter)); logic.Pages[0] = ((IPageInterface)Pages[0]).ViewModel; logic.Pages[1] = ((IPageInterface)Pages[1]).ViewModel; logic.Pages[2] = ((IPageInterface)Pages[2]).ViewModel; logic.Pages[3] = ((IPageInterface)Pages[3]).ViewModel; logic.Pages[4] = ((IPageInterface)Pages[4]).ViewModel; logic.Pages[5] = ((IPageInterface)Pages[5]).ViewModel; logic.Pages[6] = ((IPageInterface)Pages[6]).ViewModel; } CurrentPage = _currentPage; MessageBox.Show("Loading complete."); } catch (Exception exception) { MessageBox.Show("There was an issue opening the file: " + exception.Message, "ERROR"); } }
public Page1ViewModel() { GenderOtherTextEnabled = false; _instance = this; }