コード例 #1
0
        public object SwitchToFirstView()
        {
            ViewModelBase viewModel = null;

            if (_firstView is WebAlbumListView)
            {
                viewModel = Resolve <WebAlbumListViewModel>();
            }
            if (_firstView is SelectAudioFilesView)
            {
                viewModel = Resolve <SelectAudioFilesViewModel>();
            }
            SwitchToViewRequested.Invoke(_firstView, viewModel);
            return(viewModel);
        }
コード例 #2
0
        public TViewModel SwitchToView <TView, TViewModel>() where TView : UserControl where TViewModel : ViewModelBase
        {
            TView      viewToSwitchTo;
            TViewModel viewModel = Resolve <TViewModel>();

            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                viewToSwitchTo = Resolve <TView>();

                if (viewToSwitchTo is WebAlbumListView || viewToSwitchTo is SelectAudioFilesView)
                {
                    _firstView = viewToSwitchTo;
                }

                viewToSwitchTo.DataContext = viewModel;
                SwitchToViewRequested.Invoke(viewToSwitchTo, viewModel);
            });

            return(viewModel);
        }