Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new <see cref="MappingViewModel"/>
        /// </summary>
        /// <param name="dstController">The <see cref="IDstController"/></param>
        /// <param name="hubController">The <see cref="IHubController"/>"/></param>
        public MappingViewModel(IDstController dstController, IHubController hubController,
                                IDstObjectBrowserViewModel dstVariablesControlViewModel)
        {
            this.dstController = dstController;

            this.InitializeObservables();
        }
        public HubObjectBrowserViewModel(IDstController dstController, IDstHubService dstHubService,
                                         IHubController hubController, IObjectBrowserTreeSelectorService objectBrowserTreeSelectorService) : base(hubController, objectBrowserTreeSelectorService)
        {
            this.dstHubService = dstHubService;

            this.InitializesCommandsAndObservableSubscriptions();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DstBrowserHeaderViewModel"/>
        /// </summary>
        /// <param name="dstController">The <see cref="IDstController"/></param>
        /// <param name="statusBarControlViewModel">The <see cref="IStatusBarControlViewModel"/></param>
        /// <param name="navigationService">The <see cref="INavigationService"/></param>
        public DstBrowserHeaderViewModel(IDstController dstController, IStatusBarControlViewModel statusBarControlViewModel,
                                         INavigationService navigationService)
        {
            this.dstController             = dstController;
            this.statusBarControlViewModel = statusBarControlViewModel;
            this.navigationService         = navigationService;

            this.WhenAnyValue(x => x.dstController.IsSessionOpen)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => this.UpdateProperties());

            CDPMessageBus.Current.Listen <OpcVariableChangedEvent>().Where(x => Equals(x.Id, this.currentServerTimeNodeId.Identifier))
            .Subscribe(e => this.CurrentServerTime = (DateTime)e.Value);

            this.WhenAnyValue(x => x.SelectedStepping, x => x.SelectedStopStep)
            .Subscribe(_ => this.UpdateCanRunExperiment());

            this.CallRunMethodCommand = ReactiveCommand.Create(
                this.WhenAnyValue(x => x.CanRunExperiment));

            this.CallRunMethodCommand.Subscribe(_ => this.RunExperiment());

            this.CallResetMethodCommand = ReactiveCommand.Create(
                this.WhenAnyValue(vm => vm.dstController.IsSessionOpen));

            this.CallResetMethodCommand.Subscribe(_ => this.Reset());

            this.WhenAny(x => x.ExperimentTime,
                         x => x.dstController.IsSessionOpen,
                         (time, isConnected)
                         => Math.Abs(time.Value) <= 0 && isConnected.Value)
            .Subscribe(x => this.AreTimeStepAnStepTimeEditable = x);
        }
 /// <summary>
 /// Initializes a new <see cref="DstDataSourceViewModel"/>
 /// </summary>
 /// <param name="navigationService">The <see cref="INavigationService"/></param>
 /// <param name="dstController">The <see cref="IDstController"/></param>
 /// <param name="dstBrowserHeader">The <see cref="IHubBrowserHeaderViewModel"/></param>
 /// <param name="dstVariablesViewModel">The <see cref="IDstVariablesControlViewModel"/></param>
 /// <param name="hubController">The <see cref="IHubController"/></param>
 public DstDataSourceViewModel(INavigationService navigationService, IDstController dstController,
                               IDstBrowserHeaderViewModel dstBrowserHeader, IDstVariablesControlViewModel dstVariablesViewModel, IHubController hubController) : base(navigationService)
 {
     this.dstController         = dstController;
     this.hubController         = hubController;
     this.DstVariablesViewModel = dstVariablesViewModel;
     this.DstBrowserHeader      = dstBrowserHeader;
     this.InitializeCommands();
 }
        /// <summary>
        /// Initializes a new <see cref="DstNetChangePreviewViewModel"/>
        /// </summary>
        /// <param name="dstController">The <see cref="IDstController"/></param>
        /// <param name="navigationService">The <see cref="INavigationService"/></param>
        /// <param name="hubController">The <see cref="IHubController"/></param>
        /// <param name="statusBar">The <see cref="IStatusBarControlViewModel"/></param>
        public DstNetChangePreviewViewModel(IDstController dstController, INavigationService navigationService,
                                            IHubController hubController, IStatusBarControlViewModel statusBar) : base(dstController, navigationService, hubController, statusBar)
        {
            CDPMessageBus.Current.Listen <UpdateDstVariableTreeEvent>()
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(x => this.UpdateTree(x.Reset));

            CDPMessageBus.Current.Listen <UpdateDstPreviewBasedOnSelectionEvent>()
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(x => this.UpdateTreeBasedOnSelectionHandler(x.Selection.ToList()));
        }
        /// <summary>
        /// Initializes a new <see cref="HubDataSourceViewModel"/>
        /// </summary>
        /// <param name="navigationService">The <see cref="INavigationService"/></param>
        /// <param name="hubController">The <see cref="IHubController"/></param>
        /// <param name="objectBrowser">The <see cref="IObjectBrowserViewModel"/></param>
        /// <param name="publicationBrowser">The <see cref="IPublicationBrowserViewModel"/></param>
        /// <param name="treeSelectorService">The <see cref="IObjectBrowserTreeSelectorService"/></param>
        /// <param name="hubBrowserHeader">The <see cref="IHubBrowserHeaderViewModel"/></param>
        /// <param name="dstController">The <see cref="IDstController"/></param>
        /// <param name="statusBar">The <see cref="IStatusBarControlViewModel"/></param>
        /// <param name="sessionControl">The <see cref="IHubSessionControlViewModel"/></param>
        public HubDataSourceViewModel(INavigationService navigationService, IHubController hubController, IObjectBrowserViewModel objectBrowser,
                                      IPublicationBrowserViewModel publicationBrowser, IObjectBrowserTreeSelectorService treeSelectorService,
                                      IHubBrowserHeaderViewModel hubBrowserHeader, IDstController dstController,
                                      IHubSessionControlViewModel sessionControl) : base(navigationService)
        {
            this.hubController       = hubController;
            this.treeSelectorService = treeSelectorService;
            this.dstController       = dstController;
            this.SessionControl      = sessionControl;
            this.ObjectBrowser       = objectBrowser;
            this.PublicationBrowser  = publicationBrowser;
            this.HubBrowserHeader    = hubBrowserHeader;

            this.InitializeCommands();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:DEHPCommon.UserInterfaces.ViewModels.ObjectBrowserViewModel" /> class.
        /// </summary>
        /// <param name="hubController">The <see cref="T:DEHPCommon.HubController.Interfaces.IHubController" /></param>
        /// <param name="objectBrowserTreeSelectorService">The <see cref="T:DEHPCommon.Services.ObjectBrowserTreeSelectorService.IObjectBrowserTreeSelectorService" /></param>
        /// <param name="dstController">The <see cref="IDstController"/></param>
        public HubNetChangePreviewViewModel(IHubController hubController, IObjectBrowserTreeSelectorService objectBrowserTreeSelectorService, IDstController dstController) : base(hubController, objectBrowserTreeSelectorService)
        {
            this.dstController = dstController;

            CDPMessageBus.Current.Listen <UpdateHubPreviewBasedOnSelectionEvent>()
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(x => this.UpdateTreeBasedOnSelectionHandler(x.Selection.ToList()));

            CDPMessageBus.Current.Listen <SessionEvent>(this.HubController.Session)
            .Where(x => x.Status == SessionStatus.EndUpdate)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(x =>
            {
                this.UpdateTreeBasedOnSelectionHandler(this.previousSelection);
            });
        }
        /// <summary>
        /// Initializes a new <see cref="MainWindowViewModel"/>
        /// </summary>
        /// <param name="hubHubDataSourceViewModelViewModel">A <see cref="IHubDataSourceViewModel"/></param>
        /// <param name="dstSourceViewModelViewModel">A <see cref="IHubDataSourceViewModel"/></param>
        /// <param name="dstController">The <see cref="IDstController"/></param>
        /// <param name="hubNetChangePreviewViewModel">The <see cref="IHubNetChangePreviewViewModel"/></param>
        /// <param name="mappingViewModel">The <see cref="IMappingViewModel"/></param>
        /// <param name="transferControlViewModel">The <see cref="ITransferControlViewModel"/></param>
        /// <param name="statusBarControlViewModel">The <see cref="IStatusBarControlViewModel"/></param>
        /// <param name="navigationService">The <see cref="INavigationService"/></param>
        public MainWindowViewModel(IHubDataSourceViewModel hubHubDataSourceViewModelViewModel,
                                   IDstDataSourceViewModel dstSourceViewModelViewModel,
                                   IDstController dstController,
                                   IHubNetChangePreviewViewModel hubNetChangePreviewViewModel,
                                   ITransferControlViewModel transferControlViewModel,
                                   IMappingViewModel mappingViewModel,
                                   IStatusBarControlViewModel statusBarControlViewModel,
                                   INavigationService navigationService
                                   )
        {
            this.dstController                = dstController;
            this.HubDataSourceViewModel       = hubHubDataSourceViewModelViewModel;
            this.DstSourceViewModel           = dstSourceViewModelViewModel;
            this.HubNetChangePreviewViewModel = hubNetChangePreviewViewModel;
            this.MappingViewModel             = mappingViewModel;
            this.TransferControlViewModel     = transferControlViewModel;
            this.StatusBarControlViewModel    = statusBarControlViewModel;
            this.navigationService            = navigationService;

            this.InitializeCommands();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new <see cref="MappingViewModel"/>
        /// </summary>
        /// <param name="dstController">The <see cref="IDstController"/></param>
        /// <param name="hubController">The <see cref="IHubController"/>"/></param>
        /// <param name="dstVariablesControlViewModel">The <see cref="IDstVariablesControlViewModel"/></param>
        public MappingViewModel(IDstController dstController, IHubController hubController, IDstVariablesControlViewModel dstVariablesControlViewModel)
        {
            this.dstController = dstController;
            this.hubController = hubController;

            this.dstVariablesControlViewModel = dstVariablesControlViewModel;

            this.dstController.DstMapResult.ItemsAdded.Subscribe(this.UpdateMappedThings);

            this.dstController.DstMapResult.IsEmptyChanged.Where(x => x).Subscribe(_ =>
                                                                                   this.MappingRows.RemoveAll(this.MappingRows
                                                                                                              .Where(x => x.Direction == MappingDirection.FromDstToHub).ToList()));

            this.dstController.HubMapResult.ItemsAdded.Subscribe(this.UpdateMappedThings);

            this.dstController.HubMapResult.IsEmptyChanged.Where(x => x).Subscribe(_ =>
                                                                                   this.MappingRows.RemoveAll(this.MappingRows
                                                                                                              .Where(x => x.Direction == MappingDirection.FromHubToDst).ToList()));

            this.WhenAnyValue(x => x.dstController.MappingDirection)
            .Subscribe(this.UpdateMappingRowsDirection);
        }