コード例 #1
0
        //-- Properties
        #endregion
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemMainNavigationViewModel class.
        /// </summary>
        public FhemObjectNavigationViewModel(IFhemService a_fhemService, IRegionManager a_regionManager)
            : base(a_fhemService)
        {
            //-- Initialize fields
            m_regionManager = a_regionManager;
            m_attributesMenuItemViewModel = new MenuItemViewModel(

                "Attributes",
                new DelegateCommand(() => a_regionManager.RequestNavigate("ContentRegion", new Uri("FhemObjectAttributesView", UriKind.Relative)))
                );
            m_internalsMenuItemViewModel = new MenuItemViewModel(

                "Internals",
                new DelegateCommand(() => a_regionManager.RequestNavigate("ContentRegion", new Uri("FhemObjectInternalsView", UriKind.Relative)))
                );
            m_possibleSetsMenuItemViewModel = new MenuItemViewModel(

                "Possible Sets",
                new DelegateCommand(() => a_regionManager.RequestNavigate("ContentRegion", new Uri("FhemObjectPossibleSetsView", UriKind.Relative)))
                );
            m_readingsMenuItemViewModel = new MenuItemViewModel(

                "Readings",
                new DelegateCommand(() => a_regionManager.RequestNavigate("ContentRegion", new Uri("FhemObjectReadingsView", UriKind.Relative)))
                );

            //-- Add all navigation view models to our list
            this.MenuEntriesViewModels.Add(m_attributesMenuItemViewModel);
            this.MenuEntriesViewModels.Add(m_internalsMenuItemViewModel);
            this.MenuEntriesViewModels.Add(m_possibleSetsMenuItemViewModel);
            this.MenuEntriesViewModels.Add(m_readingsMenuItemViewModel);
        }
コード例 #2
0
        //-- Properties
        #endregion
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemObjectAttributesViewModel class.
        /// </summary>
        /// <param name="a_fhemService"></param>
        public FhemObjectAttributesViewModel(IFhemService a_fhemService)
            : base(a_fhemService)
        {
            //-- Register to events
            a_fhemService.SelectedFhemObjectViewModelChanged += (sender, e) => this.Initialize();

            //-- For the case that there exists already a selected Fhem object view model
            this.Initialize();
        }
コード例 #3
0
        //-- Properties
        #endregion
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemObjectAttributesViewModel class.
        /// </summary>
        /// <param name="a_fhemService"></param>
        public FhemObjectTitleViewModel(IFhemService a_fhemService, IRegionManager a_regionManager)
            : base(a_fhemService)
        {
            //-- Initialize fields
            m_regionManager = a_regionManager;

            //-- Initialize commands
            this.NavigateBackCommand = new DelegateCommand(this.NavigateBackCommandAction);
        }
コード例 #4
0
        //-- Event Handling
        #endregion
        //---------------------------------------------------------------------
        #region Behavior Members

        protected override void OnAttached()
        {
            base.OnAttached();

            //-- Determine the Fhem service
            m_fhemService = (IFhemService)ServiceLocator.Current.GetService(typeof(IFhemService));

            //-- Register to events
            m_fhemService.FhemObjectNameEditingEnd   += FhemService_FhemObjectNameEditingEnd;
            m_fhemService.FhemObjectNameEditingStart += FhemService_FhemObjectNameEditingStart;
        }
コード例 #5
0
        //-- Properties
        #endregion
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemServerSettingsViewModel
        /// class.
        /// </summary>
        public FhemServerSettingsViewModel(IFhemService a_fhemService)
        {
            //-- Initialize fields
            m_fhemService = a_fhemService;

            //-- Register to events
            m_fhemService.FhemClient.IsConnectedChanged += FhemClient_IsConnectedChanged;

            //-- Initialize commands
            this.ConnectCommand = new DelegateCommand(() => this.ConnectCommandAction());
        }
コード例 #6
0
        //-- Event Handlers
        #endregion
        //---------------------------------------------------------------------
        #region Methods

        private void HandleNewFhemObject(FhemObject a_fhemObject, IFhemService a_fhemService, IRegionManager a_regionManager)
        {
            //-- First of all create a view model for the Fhem object
            var fhemObjectViewModel = new FhemObjectViewModel(a_fhemObject, a_fhemService, a_regionManager, m_applicationService);

            //-- Add the view model to the public collection
            m_fhemObjectsCollection.Add(fhemObjectViewModel);

            //-- Add a link between the Fhem object and its view model to the private index
            m_fhemObjectViewModelsByFhemObjects.Add(a_fhemObject, fhemObjectViewModel);
        }
コード例 #7
0
        //-- Properties
        #endregion
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemObjectsRepositoryViewModel
        /// class.
        /// </summary>
        public FhemObjectsRepositoryViewModel(IFhemService a_fhemService, IRegionManager a_regionManager, IApplicationService a_applicationService)
            : base(a_fhemService)
        {
            //-- Initialize fields
            m_applicationService = a_applicationService;
            m_regionManager      = a_regionManager;

            //-- Initialize properties
            this.FhemObjectsCollectionView = CollectionViewSource.GetDefaultView(m_fhemObjectsCollection);

            //-- Register to events
            this.FhemService.FhemClient.IsConnectedChanged += FhemClient_IsConnectedChanged;
        }
コード例 #8
0
        //-- Properties
        #endregion
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemObjectsViewModel class.
        /// </summary>
        /// <param name="a_fhemObject">
        /// The <see cref="FhemObject"/> that is represented by this view model.
        /// </param>
        /// <param name="a_fhemService"></param>
        /// <param name="a_regionManager"></param>
        /// <param name="a_applicationService"></param>
        public FhemObjectViewModel(FhemObject a_fhemObject, IFhemService a_fhemService, IRegionManager a_regionManager, IApplicationService a_applicationService)
            : base(a_fhemService)
        {
            //-- Initialize fields
            m_applicationService = a_applicationService;
            m_regionManager      = a_regionManager;

            //-- Initialize properties
            this.FhemObject = a_fhemObject;
            this.Name       = this.FhemObject.Name;

            //-- Initialize commands
            this.AbortFhemObjectRenamingCommand = new DelegateCommand(this.AbortFhemObjectRenamingCommandAction);
            this.EditFhemObjectNameCommand      = new DelegateCommand(this.EditFhemObjectNameCommandAction);
            this.OpenFhemObjectDetailsCommand   = new DelegateCommand(this.OpenFhemObjectDetailsCommandAction);
            this.RenameFhemObjectNameCommand    = new DelegateCommand(this.RenameFhemObjectNameCommandAction);
        }
コード例 #9
0
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemObjectInternalsViewModel
        /// class.
        /// </summary>
        /// <param name="a_fhemService"></param>
        public FhemObjectInternalsViewModel(IFhemService a_fhemService)
            : base(a_fhemService)
        {
        }
コード例 #10
0
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemObjectPossibleSetsViewModel
        /// class.
        /// </summary>
        /// <param name="a_fhemService"></param>
        public FhemObjectPossibleSetsViewModel(IFhemService a_fhemService)
            : base(a_fhemService)
        {
        }
コード例 #11
0
        //-- Properties
        #endregion
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemNativeCommandViewModel class.
        /// </summary>
        /// <param name="a_fhemService"></param>
        public FhemNativeCommandViewModel(IFhemService a_fhemService)
            : base(a_fhemService)
        {
            //-- Initialize commands
            this.SendNativeCommandStringCommand = new DelegateCommand(() => this.SendNativeCommandStringCommandAction());
        }
コード例 #12
0
ファイル: FhemViewModelBase.cs プロジェクト: SandHive/Fhem
        //-- Properties
        #endregion
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemContentViewModel class.
        /// </summary>
        public FhemViewModelBase(IFhemService a_fhemService)
        {
            //-- Initialize properties
            this.FhemService = a_fhemService;
        }
コード例 #13
0
        //---------------------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the FhemObjectReadingsViewModel
        /// class.
        /// </summary>
        /// <param name="a_fhemService"></param>
        public FhemObjectReadingsViewModel(IFhemService a_fhemService)
            : base(a_fhemService)
        {
        }