Exemple #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            DispatcherHelper.Initialize();
            //This one need to be registered immediately so that the
            ClassLocator.Register <IDisplayController>(() => new DisplayController());
            ClassLocator.Register <IBottomBarModel>(() => new BottomBarModel());

            _controllerStartUp              = new StartUp();
            _controllerStartUp.Initialized += (sender, args) =>
            {
            };
            _controllerStartUp.Initialize();
        }
        public static UiViewModelBase ViewModel(this ChangeDisplayEventArgs changeDisplayEventArgs)
        {
            UiViewModelBase viewModel;
            var             viewModelInterface = changeDisplayEventArgs.ViewModelInterface;
            var             dictionary         = ChangeDisplayEventArgs.InterfaceTypeDictionary;

            if (changeDisplayEventArgs.CreateNew)
            {
                viewModel = CreateViewModel(changeDisplayEventArgs, dictionary, viewModelInterface);
            }
            else if (ClassLocator.ContainsCreated(changeDisplayEventArgs.ViewModelInterface))
            {
                viewModel = (UiViewModelBase)ClassLocator.GetInstance(changeDisplayEventArgs.ViewModelInterface);
            }
            else
            {
                viewModel = CreateViewModel(changeDisplayEventArgs, dictionary, viewModelInterface);
                ClassLocator.Register(() => viewModel);
            }
            return(viewModel);
        }
Exemple #3
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);
            });
        }