Exemple #1
0
        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 BackgroundViewModel(TrayApp trayApp, PresetFilters presets, Configs configs, OrganisationSyncer organisationSyncer,
                                   BackgroundOrganiser bgOrganiser)
        {
            _trayApp            = trayApp;
            _configs            = configs;
            _presets            = presets;
            _organisationSyncer = organisationSyncer;
            _bgOrganiser        = bgOrganiser;

            OnInitialise();
        }