Esempio n. 1
0
        public ShellViewModel(
            IWindowManager windowManager,
            ISyncthingManager syncthingManager,
            IApplicationState application,
            IConfigurationProvider configurationProvider,
            ConsoleViewModel console,
            ViewerViewModel viewer,
            BarAlertsViewModel barAlerts,
            Func <SettingsViewModel> settingsViewModelFactory,
            Func <AboutViewModel> aboutViewModelFactory,
            Func <ConflictResolutionViewModel> confictResolutionViewModelFactory,
            IProcessStartProvider processStartProvider,
            IDonationManager donationManager)
        {
            this.windowManager         = windowManager;
            this.syncthingManager      = syncthingManager;
            this.application           = application;
            this.configurationProvider = configurationProvider;
            this.Console   = console;
            this.Viewer    = viewer;
            this.BarAlerts = barAlerts;
            this.settingsViewModelFactory          = settingsViewModelFactory;
            this.aboutViewModelFactory             = aboutViewModelFactory;
            this.confictResolutionViewModelFactory = confictResolutionViewModelFactory;
            this.processStartProvider = processStartProvider;
            this.DonationManager      = donationManager;

            var configuration = this.configurationProvider.Load();

            this.Console.ConductWith(this);
            this.Viewer.ConductWith(this);
            this.BarAlerts.ConductWith(this);

            this.syncthingManager.StateChanged           += (o, e) => this.SyncthingState = e.NewState;
            this.syncthingManager.ProcessExitedWithError += (o, e) => this.ShowExitedWithError();

            this.ConsoleHeight = configuration.SyncthingConsoleHeight;
            this.Bind(s => s.ConsoleHeight, (o, e) => this.configurationProvider.AtomicLoadAndSave(c => c.SyncthingConsoleHeight = e.NewValue));

            this.ShowConsole = configuration.SyncthingConsoleHeight > 0;
            this.Bind(s => s.ShowConsole, (o, e) =>
            {
                this.ConsoleHeight = e.NewValue ? Configuration.DefaultSyncthingConsoleHeight : 0.0;
            });

            this.Placement = configuration.WindowPlacement;
            this.Bind(s => s.Placement, (o, e) => this.configurationProvider.AtomicLoadAndSave(c => c.WindowPlacement = e.NewValue));
        }
Esempio n. 2
0
        public ShellViewModel(
            IWindowManager windowManager,
            ISyncthingManager syncthingManager,
            IApplicationState application,
            IConfigurationProvider configurationProvider,
            ConsoleViewModel console,
            ViewerViewModel viewer,
            BarAlertsViewModel barAlerts,
            Func<SettingsViewModel> settingsViewModelFactory,
            Func<AboutViewModel> aboutViewModelFactory,
            Func<ConflictResolutionViewModel> confictResolutionViewModelFactory,
            IProcessStartProvider processStartProvider)
        {
            this.windowManager = windowManager;
            this.syncthingManager = syncthingManager;
            this.application = application;
            this.configurationProvider = configurationProvider;
            this.Console = console;
            this.Viewer = viewer;
            this.BarAlerts = barAlerts;
            this.settingsViewModelFactory = settingsViewModelFactory;
            this.aboutViewModelFactory = aboutViewModelFactory;
            this.confictResolutionViewModelFactory = confictResolutionViewModelFactory;
            this.processStartProvider = processStartProvider;

            var configuration = this.configurationProvider.Load();

            this.Console.ConductWith(this);
            this.Viewer.ConductWith(this);
            this.BarAlerts.ConductWith(this);

            this.syncthingManager.StateChanged += (o, e) => this.SyncthingState = e.NewState;
            this.syncthingManager.ProcessExitedWithError += (o, e) => this.ShowExitedWithError();

            this.ConsoleHeight = configuration.SyncthingConsoleHeight;
            this.Bind(s => s.ConsoleHeight, (o, e) => this.configurationProvider.AtomicLoadAndSave(c => c.SyncthingConsoleHeight = e.NewValue));

            this.ShowConsole = configuration.SyncthingConsoleHeight > 0;
            this.Bind(s => s.ShowConsole, (o, e) =>
            {
                this.ConsoleHeight = e.NewValue ? Configuration.DefaultSyncthingConsoleHeight : 0.0;
            });

            this.Placement = configuration.WindowPlacement;
            this.Bind(s => s.Placement, (o, e) => this.configurationProvider.AtomicLoadAndSave(c => c.WindowPlacement = e.NewValue));
        }