public NotifyIconViewModel(
            IWindowManager windowManager,
            IFocusWindowProvider focusWindowProvider,
            ISyncthingManager syncthingManager,
            Func <SettingsViewModel> settingsViewModelFactory,
            IProcessStartProvider processStartProvider,
            IAlertsManager alertsManager,
            FileTransfersTrayViewModel fileTransfersViewModel,
            IConfigurationProvider configurationProvider)
        {
            this.windowManager            = windowManager;
            this.focusWindowProvider      = focusWindowProvider;
            this.syncthingManager         = syncthingManager;
            this.settingsViewModelFactory = settingsViewModelFactory;
            this.processStartProvider     = processStartProvider;
            this.alertsManager            = alertsManager;
            this.FileTransfersViewModel   = fileTransfersViewModel;
            this.configurationProvider    = configurationProvider;

            this.syncthingManager.StateChanged += this.StateChanged;
            this.SyncthingState = this.syncthingManager.State;

            this.syncthingManager.TotalConnectionStatsChanged += this.TotalConnectionStatsChanged;
            this.syncthingManager.Folders.FoldersChanged      += this.FoldersChanged;
            this.syncthingManager.Folders.SyncStateChanged    += this.FolderSyncStateChanged;


            this.alertsManager.AlertsStateChanged += this.AlertsStateChanged;

            this.configurationProvider.ConfigurationChanged += this.ConfigurationChanged;
            this.iconAnimationmode = this.configurationProvider.Load().IconAnimationMode;
        }
Beispiel #2
0
 public Configuration(Configuration other)
 {
     this.ShowTrayIconOnlyOnClose = other.ShowTrayIconOnlyOnClose;
     this.MinimizeToTray          = other.MinimizeToTray;
     this.CloseToTray             = other.CloseToTray;
     this.ShowSynchronizedBalloonEvenIfNothingDownloaded = other.ShowSynchronizedBalloonEvenIfNothingDownloaded;
     this.ShowDeviceConnectivityBalloons     = other.ShowDeviceConnectivityBalloons;
     this.ShowDeviceOrFolderRejectedBalloons = other.ShowDeviceOrFolderRejectedBalloons;
     this.SyncthingAddress                = other.SyncthingAddress;
     this.StartSyncthingAutomatically     = other.StartSyncthingAutomatically;
     this.SyncthingApiKey                 = other.SyncthingApiKey;
     this.SyncthingCommandLineFlags       = other.SyncthingCommandLineFlags;
     this.SyncthingEnvironmentalVariables = other.SyncthingEnvironmentalVariables;
     this.SyncthingDenyUpgrade            = other.SyncthingDenyUpgrade;
     this.SyncthingPriorityLevel          = other.SyncthingPriorityLevel;
     this.Folders                             = other.Folders.Select(x => new FolderConfiguration(x)).ToList();
     this.NotifyOfNewVersions                 = other.NotifyOfNewVersions;
     this.ObfuscateDeviceIDs                  = other.ObfuscateDeviceIDs;
     this.LatestNotifiedVersion               = other.LatestNotifiedVersion;
     this.UseComputerCulture                  = other.UseComputerCulture;
     this.SyncthingConsoleHeight              = other.SyncthingConsoleHeight;
     this.WindowPlacement                     = other.WindowPlacement;
     this.SyncthingWebBrowserZoomLevel        = other.SyncthingWebBrowserZoomLevel;
     this.LastSeenInstallCount                = other.LastSeenInstallCount;
     this.SyncthingCustomPath                 = other.SyncthingCustomPath;
     this.SyncthingCustomHomePath             = other.SyncthingCustomHomePath;
     this.DisableHardwareRendering            = other.DisableHardwareRendering;
     this.EnableFailedTransferAlerts          = other.EnableFailedTransferAlerts;
     this.EnableConflictFileMonitoring        = other.EnableConflictFileMonitoring;
     this.SyncthingDebugFacilities            = other.SyncthingDebugFacilities;
     this.ConflictResolverDeletesToRecycleBin = other.ConflictResolverDeletesToRecycleBin;
     this.PauseDevicesOnMeteredNetworks       = other.PauseDevicesOnMeteredNetworks;
     this.HaveDonated                         = other.HaveDonated;
     this.IconAnimationMode                   = other.IconAnimationMode;
 }
Beispiel #3
0
        public Configuration()
        {
            // Default configuration is for a portable setup.

            this.ShowTrayIconOnlyOnClose = false;
            this.MinimizeToTray          = false;
            this.CloseToTray             = true;
            this.ShowSynchronizedBalloonEvenIfNothingDownloaded = false;
            this.ShowDeviceConnectivityBalloons     = true;
            this.ShowDeviceOrFolderRejectedBalloons = true;
            this.SyncthingAddress                = "localhost:8384";
            this.StartSyncthingAutomatically     = true;
            this.SyncthingApiKey                 = null;
            this.SyncthingCommandLineFlags       = new List <string>();
            this.SyncthingEnvironmentalVariables = new EnvironmentalVariableCollection();
            this.SyncthingUseCustomHome          = true;
            this.SyncthingDenyUpgrade            = false;
            this.SyncthingPriorityLevel          = SyncthingPriorityLevel.Normal;
            this.Folders                             = new List <FolderConfiguration>();
            this.NotifyOfNewVersions                 = true;
            this.ObfuscateDeviceIDs                  = true;
            this.LatestNotifiedVersion               = null;
            this.UseComputerCulture                  = true;
            this.SyncthingConsoleHeight              = Configuration.DefaultSyncthingConsoleHeight;
            this.WindowPlacement                     = null;
            this.SyncthingWebBrowserZoomLevel        = 0;
            this.LastSeenInstallCount                = 0;
            this.SyncthingPath                       = @"%EXEPATH%\data\syncthing.exe";
            this.SyncthingCustomHomePath             = @"%EXEPATH%\data\syncthing";
            this.DisableHardwareRendering            = false;
            this.EnableFailedTransferAlerts          = true;
            this.EnableConflictFileMonitoring        = true;
            this.SyncthingDebugFacilities            = new List <string>();
            this.ConflictResolverDeletesToRecycleBin = true;
            this.PauseDevicesOnMeteredNetworks       = true;
            this.HaveDonated                         = false;
            this.IconAnimationMode                   = IconAnimationMode.DataTransferring;
        }
 private void ConfigurationChanged(object sender, ConfigurationChangedEventArgs e)
 {
     this.iconAnimationmode = e.NewConfiguration.IconAnimationMode;
     // Reset, just in case
     this.SyncthingSyncing = false;
 }