public async Task Test_NavigateBackWhile_Disposes_Of_Presenters_For_ViewModel() { Navigator = new Navigator(); Router = new Router(Navigator); var testViewModel = new TestViewModel(); var middleViewModel = new MiddleViewModel(); var otherViewModel = new OtherViewModel(); var middlePresenter = Substitute.For <IPresenter>(); var disposable = new BooleanDisposable(); Resolver.RegisterConstant(testViewModel, typeof(TestViewModel)); Resolver.RegisterConstant(middleViewModel, typeof(MiddleViewModel)); Resolver.RegisterConstant(otherViewModel, typeof(OtherViewModel)); Resolver.RegisterConstant(middlePresenter, typeof(IPresenter)); var routerParams = new RouterBuilder() .When <TestViewModel>(r => r.Navigate()) .When <MiddleViewModel>(r => r.Navigate().Present <IPresenter>()) .When <OtherViewModel>(r => r.NavigateFrom <TestViewModel>()) .Build(); middlePresenter.PresentAsync(middleViewModel, null).Returns(disposable); await Router.InitAsync(routerParams); await Router.ShowAsync <TestViewModel, TestParams>(); await Router.ShowAsync <MiddleViewModel, TestParams>(); disposable.IsDisposed.Should().BeFalse(); await Router.ShowAsync <OtherViewModel, TestParams>(); disposable.IsDisposed.Should().BeTrue(); }
//event listener for when user clicks search button private async void searchBtn_Click(object sender, RoutedEventArgs e) { bool isInternetConnected = NetworkInterface.GetIsNetworkAvailable(); //if user tries to search while not connected to internet, alert them they need a connection if (!isInternetConnected) { checkConnection(); } //convert word to lowercase for api input = inputText.Text.ToLower(); //check input is only alphabet characters var check = IsAllAlphabetic(input); //if check is true, start call to api if (check) { //create new view model based on user input WordModel = new OtherViewModel(input); //update observable collection Bindings.Update(); } //if chars entered are not all alphabet characters, alert user else { var dialog = new MessageDialog("Please only use alphabet characters"); await dialog.ShowAsync(); } check = false; }
private void ApplyChanges() { OtherViewModel.ApplyChanges(); PointingAndSelectingViewModel.ApplyChanges(); SoundsViewModel.ApplyChanges(); VisualsViewModel.ApplyChanges(); }
private void ApplyChanges() { DictionaryViewModel.ApplyChanges(); OtherViewModel.ApplyChanges(); PointingAndSelectingViewModel.ApplyChanges(); SoundsViewModel.ApplyChanges(); VisualsViewModel.ApplyChanges(); WordsViewModel.ApplyChanges(); }
public MainWindowViewModel() { otherVM = new OtherViewModel(); homeVM = new HomeViewModel(); // Setting default: homeViewModela. CurrentViewModel = homeVM; NavigationCommand = new DelegateCommand <string>(OnNavigate); }
public ActionResult ViewOthers() { OtherViewModel OtherVm = new OtherViewModel(); List <Animal> TempList = _service.fetchAllAnimals().Where(a => a.Type == BaseType.Other).ToList(); List <Other> OtherList = TempList.Cast <Other>().ToList(); OtherVm.OtherList = OtherList; return(View(OtherVm)); }
public OtherView() { otherViewModel = new OtherViewModel(); InitializeComponent(); this.DataContext = otherViewModel; otherViewModel.PropertyChanged += Save_PropertyChanged; isFirstPress = true; layer = otherViewModel.Layer; mapView.Children.Add(otherViewModel.Layer); }
protected override void OnStartup(System.Windows.StartupEventArgs e) { IStatusBarViewModel iStatusBarViewModel = new StatusBarViewModel(); MainViewModel mainViewModel = new MainViewModel(iStatusBarViewModel); OtherViewModel otherViewModel = new OtherViewModel(iStatusBarViewModel); MainWindow mainWindow = new MainWindow { StatusBarDp = iStatusBarViewModel, MainContentDp = mainViewModel }; mainWindow.Show(); }
public ManagementViewModel(IAudioService audioService) { //Instantiate child VMs OtherViewModel = new OtherViewModel(); PointingAndSelectingViewModel = new PointingAndSelectingViewModel(); SoundsViewModel = new SoundsViewModel(audioService); VisualsViewModel = new VisualsViewModel(); //Instantiate interaction requests and commands ConfirmationRequest = new InteractionRequest <Confirmation>(); OkCommand = new DelegateCommand <Window>(Ok); //Can always click Ok CancelCommand = new DelegateCommand <Window>(Cancel); //Can always click Cancel }
public ManagementViewModel( IAudioService audioService, IDictionaryService dictionaryService, IWindowManipulationService windowManipulationService) { //Instantiate child VMs DictionaryViewModel = new DictionaryViewModel(dictionaryService); OtherViewModel = new OtherViewModel(); PointingAndSelectingViewModel = new PointingAndSelectingViewModel(); SoundsViewModel = new SoundsViewModel(audioService); VisualsViewModel = new VisualsViewModel(windowManipulationService); FeaturesViewModel = new FeaturesViewModel(); WordsViewModel = new WordsViewModel(dictionaryService); //Instantiate interaction requests and commands ConfirmationRequest = new InteractionRequest <Confirmation>(); OkCommand = new DelegateCommand <Window>(Ok); //Can always click Ok CancelCommand = new DelegateCommand <Window>(Cancel); //Can always click Cancel }
private OtherViewModel _model; // Local reference to the Model this View will use for Binding operations. #endregion #region Public Properties #endregion public OtherView(OtherViewModel model = null) { // Check if a ViewModel was passed to the ctor if (model != null) { //Todo: Todo: Add type checking here to ensure that types of model valid only for this View type are assigend, otherwise create a default model (ExampleViewModel). // Assign a local reference to the model. _model = model; } else { // Create a new instance of the ViewModel for this specific View, as one was not provided to the ctor _model = new OtherViewModel(); } InitializeComponent(); // Bind the controls for this View to their Model's properties. PerformBinding(); }
public OtherCommand(OtherViewModel viewModel) { this.viewModel = viewModel; }
public MainViewModel() { this.MyProp = "Main VM"; this.MyPivot = new PivotViewModel(); this.MyOther = new OtherViewModel(); }
public MainModel() { OtherViewModel = new OtherViewModel(); }
public ShellViewModel(IEventAggregator eventagg, OtherViewModel otherVM) { _eventAggregator = eventagg; _eventAggregator.Subscribe(this); ActivateItem(otherVM); }