/// <summary> /// Lauches the entry form on startup /// </summary> /// <param name="e">Arguments of the startup event</param> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); if (this.useFakes) { this.context = Generation.BuildFakeSession(); } else { //NOTE: If there is not a Microsoft SQL Server Express instance available at .\SQLEXPRESS // you will need to update the "EmployeeEntities" connection string in App.config this.context = new EmployeeEntities(); } IDepartmentRepository departmentRepository = new DepartmentRepository(this.context); IEmployeeRepository employeeRepository = new EmployeeRepository(this.context); IUnitOfWork unit = new UnitOfWork(this.context); MainViewModel main = new MainViewModel(unit, departmentRepository, employeeRepository); MainView window = new View.MainView { DataContext = main }; window.Show(); }
/// <summary> /// 启动时启动输入窗体 /// </summary> /// <param name="e">startup 事件的参数</param> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); if (this.useFakes) { this.context = Generation.BuildFakeSession(); } else { //注意: 如果 .\SQLEXPRESS 中没有 Microsoft SQL Server Express 实例, // 您将需要更新 App.config 中的“EmployeeEntities”连接字符串 this.context = new EmployeeEntities(); } IDepartmentRepository departmentRepository = new DepartmentRepository(this.context); IEmployeeRepository employeeRepository = new EmployeeRepository(this.context); IUnitOfWork unit = new UnitOfWork(this.context); MainViewModel main = new MainViewModel(unit, departmentRepository, employeeRepository); MainView window = new View.MainView { DataContext = main }; window.Show(); }
/// <summary> /// Lauches the entry form on startup /// </summary> /// <param name="e">Arguments of the startup event</param> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); if (this.useFakes) { //this.context = Generation.BuildFakeSession(); } else { //NOTE: If there is not a Microsof-t SQL Server Express instance available at .\SQLEXPRESS // you will need to update the "EmployeeEntities" connection string in App.config this.context = new EmployeeEntities(); //this.context.mapObject.AxMap = new ESRI.ArcGIS.MapControl.AxMapControl(); } //initialize all the services needed for dependency injection //we use the unity framework for dependency injection, but you can choose others ServiceProvider.RegisterServiceLocator(new UnityServiceLocator()); //register the IModalDialog using an instance of the HoodAnalystDialogView //this sets up the view ServiceProvider.Instance.Register <IModalDialog, HoodAnalystDialogView>(); IDepartmentRepository departmentRepository = new DepartmentRepository(this.context); IEmployeeRepository employeeRepository = new EmployeeRepository(this.context); IMapObjectRepository mapRepository = new MapRepository(this.context); IUnitOfWork unit = new UnitOfWork(this.context); MainViewModel main = new MainViewModel(unit, departmentRepository, employeeRepository, mapRepository); MainView window = new View.MainView { DataContext = main }; window.Show(); }