예제 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            MainWindow mainWindow = new MainWindow();

            string url = ConfigurationManager.AppSettings["expenseServiceUrl"];

            ServiceLocator.Current.SetService<IExpenseRepository>(new WcfClientExpenseRepository(url));
            ServiceLocator.Current.SetService<IViewService>(new ViewService());
            ServiceLocator.Current.SetService<INavigationService>(new NavigationService());
            ServiceLocator.Current.SetService<EmployeeViewModel>(new EmployeeViewModel());

            MainWindowViewModel mainViewModel = new MainWindowViewModel();
            mainWindow.DataContext = mainViewModel;

            EventHandler handler = null;
            handler = delegate
            {
                mainViewModel.RequestClose -= handler;
                mainWindow.Close();
            };
            mainViewModel.RequestClose += handler;

            mainViewModel.ViewService.BusyChanged +=
                (_, ea) =>
                {
                    mainWindow.Cursor = (ea.Data) ? Cursors.Wait : Cursors.Arrow;
                };

            mainWindow.Show();
        }
        public LogInControlViewModel(MainWindowViewModel mainViewModel, ICommand logInCommand)
        {
            // TODO: Remove after debugging.
            this.Alias = "rogreen";

            this._mainViewModel = mainViewModel;
            this.LogInCommand = logInCommand;
        }