Esempio n. 1
0
        public ViewModelBase(IIOCProvider iocProvider)
        {
            if (iocProvider == null)
            {
                throw new InvalidOperationException(
                          String.Format(
                              "ViewModelBase constructor requires a IIOCProvider instance in order to work"));
            }

            this.iocProvider = iocProvider;

            if (!ViewModelBase.isInitialised)
            {
                iocProvider.SetupContainer();
                FetchCoreServiceTypes();
            }
        }
Esempio n. 2
0
        public ViewModelBase(IIOCProvider iocProvider)
        {
            if (iocProvider == null)
            {
                throw new InvalidOperationException(
                          String.Format(
                              "ViewModelBase constructor requires a IIOCProvider instance in order to work"));
            }

            this.iocProvider = iocProvider;

            if (!ViewModelBase.isInitialised)
            {
                iocProvider.SetupContainer();
                FetchCoreServiceTypes();
            }

            //Register all decorated methods to the Mediator
            //Register all decorated methods to the Mediator
            Mediator.Instance.Register(this);

            #region Wire up Window/UserControl based Lifetime commands
            activatedCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowActivated()
            };

            deactivatedCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowDeactivated()
            };

            loadedCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowLoaded()
            };

            unloadedCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowUnloaded()
            };

            closeCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnWindowClose()
            };
            #endregion

            #region Wire up Workspace Command

            //This is used for popup control only
            closeWorkSpaceCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => ExecuteCloseWorkSpaceCommand()
            };

            #endregion

            //This is used for popup control only
            closeActivePopUpCommand = new SimpleCommand
            {
                CanExecuteDelegate = x => true,
                ExecuteDelegate    = x => OnCloseActivePopUp(x)
            };
        }