예제 #1
0
        public async void Initialize()
        {
            ClassLocator.Register <IDisplayController>(() => new DisplayController());
            ClassLocator.Register <IBottomBarModel>(() => new BottomBarModel());
            _displayController = ClassLocator.GetInstance <IDisplayController>();
            _bottomBarModel    = ClassLocator.GetInstance <IBottomBarModel>();
            Debug.Assert(_displayController != null, "IDisplayController not found for BackEndSimulator");
            Debug.Assert(_bottomBarModel != null, "IBottomBarModel not found for BackEndSimulator");

            ClassLocator.Register <IMenuModel>(() => new MenuModel());
            ClassLocator.Register <IAboutModel>(() => new AboutModel());
            ClassLocator.Register <IConfigurationModel>(() => new ConfigurationModel());

            Initialized?.Invoke(this, new InitializedEventArgs());

            await Task.Run(() =>
            {
                Thread.Sleep(10000);
                _bottomBarModel.UpdateUserMessage("10 seconds have passed", MessageTypeEnum.Warning);
                // _displayController.ChangeDisplay(typeof(IAboutViewModel), true);
            });
        }
예제 #2
0
        public MainViewModel()
        {
            PrimaryViewModel = new SplashScreenViewModel {
                DisposeOfAfterUse = true
            };

            if (this.IsInDesignMode)
            {
                _bottomBarModel    = new BottomBarModelSimulator();
                _displayController = new DisplayControllerSimulator();
            }
            else
            {
                _displayController = ClassLocator.GetInstance <IDisplayController>();
                Debug.Assert(_displayController != null, nameof(IDisplayController) + " not found for " + GetType().Name);
                _displayController.ChangeDisplayEvent += DisplayChangeEventHandler;
                _bottomBarModel = ClassLocator.GetInstance <IBottomBarModel>();
                Debug.Assert(_bottomBarModel != null, nameof(IBottomBarModel) + " not found for " + GetType().Name);
                _bottomBarModel.UpdateEvent += UpdateUserMessageEventHandler;
            }
            UserMessage = _bottomBarModel.UserMessage;
            MessageType = _bottomBarModel.MessageType;
        }