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 TrayApp(OrganisationSyncer organisationSyncer, Configs configs) { _organisationSyncer = organisationSyncer; _configs = configs; OnInitialise(); InitializeComponent(); }
public void BGDirectoryExistsTest() { Configs target = new Configs(); // TODO: Initialize to an appropriate value target.BGDirectory = null; Assert.IsFalse(target.BGDirectoryExists); target.BGDirectory = "Mock"; Assert.IsFalse(target.BGDirectoryExists); }
public BackgroundViewModel(TrayApp trayApp, PresetFilters presets, Configs configs, OrganisationSyncer organisationSyncer, BackgroundOrganiser bgOrganiser) { _trayApp = trayApp; _configs = configs; _presets = presets; _organisationSyncer = organisationSyncer; _bgOrganiser = bgOrganiser; OnInitialise(); }
private void OnInitialise() { _configs = (Configs) DependencyFactory.Container.Resolve(typeof(Configs), "configs"); RootDirectory.Path = _configs.BGDirectory; OrganiseSubDirectories = _configs.OrganiseSubDirectories; if (!DesignerProperties.GetIsInDesignMode(new DependencyObject())) { if ((bool)Application.Current.Properties["bgStartup"]) { CanWork = _configs.BGDirectoryExists; } } }