/// <summary> /// Constructs the MainWindowViewModel instance /// </summary> public MainWindowViewModel() { accountModel = new AccountModel(); Mediator mediator = new Mediator(); PageViewModels = new ObservableCollection <IPageViewModel>(); PageViewModels.Add(new WelcomePageViewModel(mediator)); PageViewModels.Add(new AccountRegisterBalancePageViewModel(accountModel, mediator)); PageViewModels.Add(new DeductionsPageViewModel(accountModel, mediator)); PageViewModels.Add(new CreditsPageViewModel(accountModel, mediator)); PageViewModels.Add(new NewAccountRegisterBalancePageViewModel(accountModel, mediator)); PageViewModels.Add(new StatementEndingBalancePageViewModel(accountModel, mediator)); PageViewModels.Add(new AdditionalDepositsPageViewModel(accountModel, mediator)); PageViewModels.Add(new WithdrawalsPageViewModel(accountModel, mediator)); PageViewModels.Add(new SummaryPageViewModel(accountModel, mediator)); Steps = new ObservableCollection <string>(); Steps.Add("Welcome"); Steps.Add("Account register/checkbook balance"); Steps.Add("Service charges and other deductions"); Steps.Add("Add credits"); Steps.Add("New account register balance"); Steps.Add("Statement ending balance"); Steps.Add("Additional deposits"); Steps.Add("Withdrawals"); Steps.Add("Summary"); CurrentPageIndex = 0; CurrentPageViewModel = PageViewModels[CurrentPageIndex]; mediator.Add("OnGoToNextPage", OnGoToNextPage); mediator.Add("OnGoToPreviousPage", OnGoToPreviousPage); OnMouseDown = new ChangeFocusCommand(); }
public void TestAddNullToken() { var exception = Assert.ThrowsException <ArgumentNullException>(() => mediator.Add(null, (arg) => { })); Assert.AreEqual("token", exception.ParamName); }
public static void AddMediator <T>(Mediator <T> m, GameObject go) where T : MonoBehaviour { m.view = go.GetComponent <T>(); Mediator.Add(m); }