public void Setup() { RxApp.MainThreadScheduler = Scheduler.CurrentThread; this.dialogNavigationService = new Mock <IDialogNavigationService>(); this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>(); this.filterStringService = new Mock <IFilterStringService>(); this.describeMetaData = new Mock <INameMetaData>(); this.describeMetaData.Setup(x => x.Name).Returns("MockedPanelDecorated"); this.panelView = new Test(true); this.panelViewModel = new TestViewModel(); this.panelViewModel2 = new TestViewModel("data source"); this.viewList = new List <IPanelView>(); this.viewList.Add(this.panelView); this.viewList.Add(new TestGrid()); this.viewModelDecoratedList = new List <Lazy <IPanelViewModel, INameMetaData> >(); this.viewModelDecoratedList.Add(new Lazy <IPanelViewModel, INameMetaData>(() => this.panelViewModel2, this.describeMetaData.Object)); this.viewModelList = new List <IPanelViewModel>(); this.viewModelList.Add(this.panelViewModel); this.viewModelList.Add(new TestGridViewModel()); this.dockLayoutViewModel = new DockLayoutViewModel(dialogNavigationService.Object); this.NavigationService = new PanelNavigationService(this.viewList, this.viewModelList, this.viewModelDecoratedList, this.dockLayoutViewModel, this.filterStringService.Object); this.session = new Mock <ISession>(); this.permissionService = new Mock <IPermissionService>(); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); }
public PanelPresenter(IPanelView panelView, Model Model) { this.view = panelView; this.model = Model; this.view.selectedDriveChange += driveChanged; this.view.listViewItemClicked += listViewItemClicked; this.view.arrayClicked += backArrowClicked; }
public MovePanelPresenter(IPanelView panelView, IPhaseProvider phaseProvider, IPanelSelector panelSelector, IMoveLoadRegister moveLoadRegister) { _panelView = panelView; _phaseProvider = phaseProvider; _panelSelector = panelSelector; _moveLoadRegister = moveLoadRegister; }
/// <summary> /// removes the view and view-model from the <see cref="ViewModelViewPairs"/> and send a panel close event /// </summary> /// <param name="panelViewModel"> /// The <see cref="IPanelViewModel"/> that needs to be cleaned up /// </param> /// <param name="panelView"> /// The <see cref="IPanelView"/> that needs to be cleaned up /// </param> private void CleanUpPanelsAndSendCloseEvent(IPanelViewModel panelViewModel, IPanelView panelView) { this.ViewModelViewPairs.Remove(panelViewModel); var closePanelEvent = new NavigationPanelEvent(panelViewModel, panelView, PanelStatus.Closed); CDPMessageBus.Current.SendMessage(closePanelEvent); panelView.DataContext = null; panelViewModel.Dispose(); }
/// <summary> /// Unregisters a panel view from all relevant collections. /// </summary> /// <param name="view">The view to unregister.</param> public void UnregisterFromService(IPanelView view) { if (!(view is IPanelFilterableDataGridView filterableView)) { return; } this.RemoveView(filterableView); }
public PanelPresenter( IPanelView panelView, IStageModel stageModel, IPhaseProvider phaseProvider ) { _panelView = panelView; _stageModel = stageModel; _phaseProvider = phaseProvider; }
/// <summary> /// removes the view and view-model from the <see cref="ViewModelViewPairs"/> and send a panel close event /// </summary> /// <param name="panelViewModel"> /// The <see cref="IPanelViewModel"/> that needs to be cleaned up /// </param> /// <param name="panelView"> /// The <see cref="IPanelView"/> that needs to be cleaned up /// </param> private void CleanUpPanelsAndSendCloseEvent(IPanelViewModel panelViewModel, IPanelView panelView) { this.ViewModelViewPairs.Remove(panelViewModel); var closePanelEvent = new NavigationPanelEvent(panelViewModel, panelView, PanelStatus.Closed); CDPMessageBus.Current.SendMessage(closePanelEvent); panelView.DataContext = null; panelViewModel.Dispose(); // unregister from filter string service this.filterStringService.UnregisterFromService(panelView); }
public void Setup() { RxApp.MainThreadScheduler = Scheduler.CurrentThread; this.dialogNavigationService = new Mock <IDialogNavigationService>(); this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>(); this.filterStringService = new Mock <IFilterStringService>(); this.regionManager = new Mock <IRegionManager>(); this.region = new Mock <IRegion>(); this.metadata = new Mock <IRegionMetaData>(); this.viewsCollection = new Mock <IViewsCollection>(); this.describeMetaData = new Mock <INameMetaData>(); this.describeMetaData.Setup(x => x.Name).Returns("MockedPanelDecorated"); this.regionCollectionSearcher = new Mock <IRegionCollectionSearcher>(); this.regionCollectionSearcher.Setup(x => x.GetRegionsByView(It.IsAny <IRegionCollection>(), It.IsAny <IPanelView>())).Returns(new [] { this.region.Object }); this.regionManager.Setup(x => x.Regions[It.IsAny <string>()]).Returns(this.region.Object); this.region.Setup(x => x.Views).Returns(this.viewsCollection.Object); this.panelView = new Test(true); this.panelViewModel = new TestViewModel(); this.panelViewModel2 = new TestViewModel("data source"); this.viewList = new List <Lazy <IPanelView, IRegionMetaData> >(); this.viewList.Add(new Lazy <IPanelView, IRegionMetaData>(() => this.panelView, this.metadata.Object)); this.viewList.Add(new Lazy <IPanelView, IRegionMetaData>(() => new PropertyGrid(), this.metadata.Object)); this.viewModelDecoratedList = new List <Lazy <IPanelViewModel, INameMetaData> >(); this.viewModelDecoratedList.Add(new Lazy <IPanelViewModel, INameMetaData>(() => this.panelViewModel2, this.describeMetaData.Object)); this.viewModelList = new List <IPanelViewModel>(); this.viewModelList.Add(this.panelViewModel); this.viewModelList.Add(new PropertyGridViewModel()); this.NavigationService = new PanelNavigationService(this.viewList, this.viewModelList, this.regionManager.Object, this.viewModelDecoratedList, this.filterStringService.Object, this.regionCollectionSearcher.Object); this.session = new Mock <ISession>(); this.permissionService = new Mock <IPermissionService>(); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); }
/// <summary> /// Registers a filterable panel view and viewmodel combo to this service. /// </summary> /// <param name="view">The view that is to be registered</param> /// <param name="viewModel">The viewmodel that is to be registered</param> public void RegisterForService(IPanelView view, IPanelViewModel viewModel) { if (!(view is IPanelFilterableDataGridView filterableView)) { // if not filterable view, do not bother registration return; } if (viewModel is IDeprecatableBrowserViewModel deprecatableViewModel) { // deprecatable viewmodel this.AddDeprecatedControl(filterableView, deprecatableViewModel); } if (viewModel is IFavoritesBrowserViewModel favoritableViewModel) { // favoritable viewmodel this.AddFavoritesControl(filterableView, favoritableViewModel); } }
public void SetupPanelViewEvents(IPanelView panelView) { panelView.FocusedItemChanged += DoPanelViewFocusedItemChanged; panelView.FilterTextChanged += DoPanelViewFilterTextChanged; }
/// <summary> /// Initializes a new instance of the <see cref="NavigationPanelEvent"/> class /// </summary> /// <param name="viewModel"> /// The <see cref="IPanelViewModel"/> associated to the panel /// </param> /// <param name="view"> /// The <see cref="IPanelView"/> that is to be opened /// </param> /// <param name="status"> /// The status of the panel /// </param> /// <param name="regionName"> /// The name of the region in which the panel shall be opened /// </param> public NavigationPanelEvent(IPanelViewModel viewModel, IPanelView view, PanelStatus status, string regionName = "") { this.ViewModel = viewModel; this.View = view; this.PanelStatus = status; }
/// <summary> /// Initializes a new instance of the <see cref="NavigationPanelEvent"/> class /// </summary> /// <param name="viewModel"> /// The <see cref="IPanelViewModel"/> associated to the panel /// </param> /// <param name="view"> /// The <see cref="IPanelView"/> that is to be opened /// </param> /// <param name="status"> /// The status of the panel /// </param> /// <param name="regionName"> /// The name of the region in which the panel shall be opened /// </param> public NavigationPanelEvent(IPanelViewModel viewModel, IPanelView view, PanelStatus status) { this.ViewModel = viewModel; this.View = view; this.PanelStatus = status; }
/// <summary> /// Search a <see cref="IRegionCollection"/> for <see cref="IRegion"/>s that contain a specific <see cref="IPanelView"/> /// </summary> /// <param name="regionCollection">The <see cref="IRegionCollection"/> to search</param> /// <param name="view">The <see cref="IPanelView"/> to search for</param> /// <returns>List of <see cref="IRegion"/>s</returns> public IEnumerable <IRegion> GetRegionsByView(IRegionCollection regionCollection, IPanelView view) { return(regionCollection.Where(x => x.Views.Contains(view))); }