protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.Properties["bgStartup"] = false; if (e != null && e.Args.Count() > 0) { if (e.Args[0] == "-bg") { this.Properties["bgStartup"] = true; } } Configs configs = new Configs(); PresetFilters presets = new PresetFilters(); OrganisationSyncer organisationSyncer = new OrganisationSyncer(); TrayApp trayApp = new TrayApp(organisationSyncer, configs); Logger logger = new Logger(); BackgroundOrganiser backgroundOrganiser = new BackgroundOrganiser(new DirectoryModel()); ForegroundOrganiser foregroundOrganiser = new ForegroundOrganiser(new DirectoryModel()); BackgroundView backgroundView = new BackgroundView(); ForegroundView foregroundView = new ForegroundView(); DependencyFactory.Container.RegisterInstance <Configs>("configs", configs); DependencyFactory.Container.RegisterInstance <PresetFilters>("presets", presets); DependencyFactory.Container.RegisterInstance <OrganisationSyncer>("organisationSyncer", organisationSyncer); DependencyFactory.Container.RegisterInstance <BackgroundOrganiser>("backgroundOrganiser", backgroundOrganiser); DependencyFactory.Container.RegisterInstance <ForegroundOrganiser>("foregroundOrganiser", foregroundOrganiser); DependencyFactory.Container.RegisterType <BackgroundView>(); DependencyFactory.Container.RegisterType <ForegroundView>(); DependencyFactory.Container.RegisterType <PresetsView>(); DependencyFactory.Container.RegisterInstance <TrayApp>("trayApp", trayApp); DependencyFactory.Container.RegisterInstance <Logger>("logger", logger); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.Properties["bgStartup"] = false; if (e != null && e.Args.Count() > 0) { if (e.Args[0] == "-bg") { this.Properties["bgStartup"] = true; } } Configs configs = new Configs(); PresetFilters presets = new PresetFilters(); OrganisationSyncer organisationSyncer = new OrganisationSyncer(); TrayApp trayApp = new TrayApp(organisationSyncer, configs); Logger logger = new Logger(); BackgroundOrganiser backgroundOrganiser = new BackgroundOrganiser(new DirectoryModel()); ForegroundOrganiser foregroundOrganiser = new ForegroundOrganiser(new DirectoryModel()); BackgroundView backgroundView = new BackgroundView(); ForegroundView foregroundView = new ForegroundView(); DependencyFactory.Container.RegisterInstance<Configs>("configs", configs); DependencyFactory.Container.RegisterInstance<PresetFilters>("presets", presets); DependencyFactory.Container.RegisterInstance<OrganisationSyncer>("organisationSyncer", organisationSyncer); DependencyFactory.Container.RegisterInstance<BackgroundOrganiser>("backgroundOrganiser", backgroundOrganiser); DependencyFactory.Container.RegisterInstance<ForegroundOrganiser>("foregroundOrganiser", foregroundOrganiser); DependencyFactory.Container.RegisterType<BackgroundView>(); DependencyFactory.Container.RegisterType<ForegroundView>(); DependencyFactory.Container.RegisterType<PresetsView>(); DependencyFactory.Container.RegisterInstance<TrayApp>("trayApp", trayApp); DependencyFactory.Container.RegisterInstance<Logger>("logger", logger); }
public MainWindow() { this.InitializeComponent(); _configs = (Configs)DependencyFactory.Container.Resolve(typeof(Configs), "configs"); _trayApp = (TrayApp)DependencyFactory.Container.Resolve(typeof(TrayApp), "trayApp"); MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(_trayApp, (OrganisationSyncer)DependencyFactory.Container.Resolve(typeof(OrganisationSyncer), "organisationSyncer")); this.DataContext = mainWindowViewModel; }