Exemplo n.º 1
0
        public ApplicationController(CompositionContainer container, IPresentationService presentationService,
            IMessageService messageService, ShellService shellService, ProxyController proxyController, DataController dataController)
        {
            InitializeCultures();
            presentationService.InitializeCultures();

            this.container = container;
            this.dataController = dataController;
            this.proxyController = proxyController;
            this.messageService = messageService;

            this.dataService = container.GetExportedValue<IDataService>();

            this.floatingViewModel = container.GetExportedValue<FloatingViewModel>();
            this.mainViewModel = container.GetExportedValue<MainViewModel>();
            this.userBugsViewModel = container.GetExportedValue<UserBugsViewModel>();
            this.teamBugsViewModel = container.GetExportedValue<TeamBugsViewModel>();

            shellService.MainView = mainViewModel.View;
            shellService.UserBugsView = userBugsViewModel.View;
            shellService.TeamBugsView = teamBugsViewModel.View;

            this.floatingViewModel.Closing += FloatingViewModelClosing;

            this.showMainWindowCommand = new DelegateCommand(ShowMainWindowCommandExcute);
            this.englishCommand = new DelegateCommand(() => SelectLanguage(new CultureInfo("en-US")));
            this.chineseCommand = new DelegateCommand(() => SelectLanguage(new CultureInfo("zh-CN")));
            this.settingCommand = new DelegateCommand(SettingDialogCommandExcute, CanSettingDialogCommandExcute);
            this.aboutCommand = new DelegateCommand(AboutDialogCommandExcute);
            this.exitCommand = new DelegateCommand(ExitCommandExcute);
        }
Exemplo n.º 2
0
        public void SetViewTest()
        {
            ShellService shellService = new ShellService();
            object mockView = new object();

            AssertHelper.PropertyChangedEvent(shellService, x => x.MainView, () =>
                shellService.MainView = mockView);
            Assert.AreEqual(mockView, shellService.MainView);

            AssertHelper.PropertyChangedEvent(shellService, x => x.UserBugsView, () =>
                shellService.UserBugsView = mockView);
            Assert.AreEqual(mockView, shellService.UserBugsView);

            AssertHelper.PropertyChangedEvent(shellService, x => x.TeamBugsView, () =>
                shellService.TeamBugsView = mockView);
            Assert.AreEqual(mockView, shellService.TeamBugsView);
        }