Esempio n. 1
0
        public void NotEqualLabeledValuesOfDifferentTypes()
        {
            var lbv1 = new LabelledValue<int>("test", 5);
            var lbv2 = new LabelledValue<double>("test", 5.0);

            Assert.False(lbv1.Equals(lbv2));
        }
Esempio n. 2
0
        public void GetHashCodeSameForIdenticalLabelledValues()
        {
            var lbv1 = new LabelledValue<int>("int", 5);
            var lbv2 = new LabelledValue<int>("int", 5);

            Assert.AreEqual(lbv1.GetHashCode(), lbv2.GetHashCode());
        }
Esempio n. 3
0
 void FetchComponents()
 {
     animator     = gameObject.GetComponent <Animator>();
     vMessage     = gameObject.transform.Find("Message").GetComponent <Text>();
     vStats       = gameObject.transform.Find("Stats").gameObject;
     vDeathCount  = vStats.transform.Find("Death Count").GetComponent <LabelledValue>();
     vTurnCount   = vStats.transform.Find("Turn Count").GetComponent <LabelledValue>();
     vTimeElapsed = vStats.transform.Find("Time Elapsed").GetComponent <LabelledValue>();
 }
Esempio n. 4
0
        public void EqualsIdenticalLabelledValues()
        {
            var lbv1 = new LabelledValue<int>("int", 5);
            var lbv2 = new LabelledValue<int>("int", 5);

            // Test both variants
            Assert.That(lbv1.Equals(lbv2));
            Assert.That(lbv1.Equals((object)lbv2));
        }
Esempio n. 5
0
        public DialogViewModel()
        {
            this.DisplayName = "ShowDialog and DialogResult";

            this.DesiredResult = new BindableCollection<LabelledValue<bool>>()
            {
                new LabelledValue<bool>("True", true),
                new LabelledValue<bool>("False", false),
            };
            this.SelectedDesiredResult = this.DesiredResult[0];
        }
Esempio n. 6
0
        public DialogViewModel()
        {
            this.DisplayName = "ShowDialog and DialogResult";

            this.DesiredResult = new BindableCollection <LabelledValue <bool> >()
            {
                new LabelledValue <bool>("True", true),
                new LabelledValue <bool>("False", false),
            };
            this.SelectedDesiredResult = this.DesiredResult[0];
        }
Esempio n. 7
0
        public void SettingLabelAndValueRaisePropertyChangedNotifications()
        {
            var lbv = new LabelledValue<float>();

            lbv.PropertyChangedDispatcher = a => a();
            var changedProperties = new List<string>();
            lbv.PropertyChanged += (o, e) => changedProperties.Add(e.PropertyName);

            lbv.Label = "hello";
            lbv.Value = 2.2f;

            Assert.That(changedProperties, Is.EquivalentTo(new[] { "Label", "Value" }));
        }
Esempio n. 8
0
        protected override void OnInitialActivate()
        {
            base.OnInitialActivate();
            this.Conditions = new BindableCollection <LabelledValue <EnumConditions> >()
            {
                LabelledValue.Create(_("égale"), EnumConditions.egale),
                LabelledValue.Create(_("ressemble"), EnumConditions.ressemble),
                LabelledValue.Create(_("déffirent de"), EnumConditions.déffirent),
                LabelledValue.Create(_("inférieur à"), EnumConditions.inférieur),
                LabelledValue.Create(_("supérieur à"), EnumConditions.supérieur),
            };

            this.ConditionsSelected = this.Conditions[1];
        }
Esempio n. 9
0
        public VolumeViewModel(
            Logger logger,
            IWindowManager windowManager,
            Ec2Connection connection,
            ICreateSnapshotDetailsViewModelFactory createSnapshotDetailsViewModelFactory,
            IScriptDetailsViewModelFactory scriptDetailsViewModelFactory)
        {
            this.Logger        = logger;
            this.windowManager = windowManager;
            this.connection    = connection;
            this.createSnapshotDetailsViewModelFactory = createSnapshotDetailsViewModelFactory;
            this.scriptDetailsViewModelFactory         = scriptDetailsViewModelFactory;

            this.SelectedScript = this.Scripts[0];
        }
Esempio n. 10
0
        private void Configure()
        {
            this.Text        = _messageBoxText;
            this.DisplayName = _caption;
            this.Icon        = _icon;

            _buttonList     = new BindableCollection <LabelledValue <MessageBoxResult> >();
            this.ButtonList = _buttonList;
            foreach (var val in ButtonToResults[_buttons])
            {
                if (_buttonLabels == null || !_buttonLabels.TryGetValue(val, out var label))
                {
                    label = ButtonLabels[val];
                }

                var lbv = new LabelledValue <MessageBoxResult>(label, val);
                _buttonList.Add(lbv);
                if (val == _defaultResult)
                {
                    this.DefaultButton = lbv;
                }
                else if (val == _cancelResult)
                {
                    this.CancelButton = lbv;
                }
                else
                {
                    this.DefaultButton = lbv;
                }
            }
            // If they didn't specify a button which we showed, then pick a default, if we can
            SetButtons();

            this.FlowDirection = _flowDirection ?? DefaultFlowDirection;
            this.TextAlignment = _textAlignment ?? DefaultTextAlignment;
        }
Esempio n. 11
0
        /// <summary>
        /// Setup the MessageBoxViewModel with the information it needs
        /// </summary>
        /// <param name="messageBoxText">A <see cref="string"/> that specifies the text to display.</param>
        /// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
        /// <param name="buttons">A <see cref="System.Windows.MessageBoxButton"/> value that specifies which button or buttons to display.</param>
        /// <param name="icon">A <see cref="System.Windows.MessageBoxImage"/> value that specifies the icon to display.</param>
        /// <param name="defaultResult">A <see cref="System.Windows.MessageBoxResult"/> value that specifies the default result of the message box.</param>
        /// <param name="cancelResult">A <see cref="System.Windows.MessageBoxResult"/> value that specifies the cancel result of the message box</param>
        /// <param name="buttonLabels">A dictionary specifying the button labels, if desirable</param>
        /// <param name="flowDirection">The <see cref="System.Windows.FlowDirection"/> to use, overrides the <see cref="MessageBoxViewModel.DefaultFlowDirection"/></param>
        /// <param name="textAlignment">The <see cref="System.Windows.TextAlignment"/> to use, overrides the <see cref="MessageBoxViewModel.DefaultTextAlignment"/></param>
        public void Setup(
            string messageBoxText,
            string caption                 = null,
            MessageBoxButton buttons       = MessageBoxButton.OK,
            MessageBoxImage icon           = MessageBoxImage.None,
            MessageBoxResult defaultResult = MessageBoxResult.None,
            MessageBoxResult cancelResult  = MessageBoxResult.None,
            IDictionary <MessageBoxResult, string> buttonLabels = null,
            FlowDirection?flowDirection = null,
            TextAlignment?textAlignment = null)
        {
            this.Text        = _languageService.ReplaceKeyToEntry(messageBoxText);
            this.DisplayName = _languageService.ReplaceKeyToEntry(caption);
            this.Icon        = icon;

            var buttonList = new BindableCollection <LabelledValue <MessageBoxResult> >();

            this.ButtonList = buttonList;
            foreach (var val in ButtonToResults[buttons])
            {
                if (buttonLabels == null || !buttonLabels.TryGetValue(val, out string label))
                {
                    label = ButtonLabels[val];
                }

                var lbv = new LabelledValue <MessageBoxResult>(label, val);
                buttonList.Add(lbv);
                if (val == defaultResult)
                {
                    this.DefaultButton = lbv;
                }
                else if (val == cancelResult)
                {
                    this.CancelButton = lbv;
                }
            }
            // If they didn't specify a button which we showed, then pick a default, if we can
            if (this.DefaultButton == null)
            {
                if (defaultResult == MessageBoxResult.None && this.ButtonList.Any())
                {
                    this.DefaultButton = buttonList[0];
                }
                else
                {
                    throw new ArgumentException("DefaultButton set to a button which doesn't appear in Buttons");
                }
            }
            if (this.CancelButton == null)
            {
                if (cancelResult == MessageBoxResult.None && this.ButtonList.Any())
                {
                    this.CancelButton = buttonList.Last();
                }
                else
                {
                    throw new ArgumentException("CancelButton set to a button which doesn't appear in Buttons");
                }
            }

            this.FlowDirection = flowDirection ?? DefaultFlowDirection;
            this.TextAlignment = textAlignment ?? DefaultTextAlignment;
        }
Esempio n. 12
0
        public VolumeViewModel(
            Logger logger,
            IWindowManager windowManager,
            Ec2Connection connection,
            ICreateSnapshotDetailsViewModelFactory createSnapshotDetailsViewModelFactory,
            IScriptDetailsViewModelFactory scriptDetailsViewModelFactory)
        {
            this.Logger = logger;
            this.windowManager = windowManager;
            this.connection = connection;
            this.createSnapshotDetailsViewModelFactory = createSnapshotDetailsViewModelFactory;
            this.scriptDetailsViewModelFactory = scriptDetailsViewModelFactory;

            this.SelectedScript = this.Scripts[0];
        }
Esempio n. 13
0
        public async void RefreshRunningInstances()
        {
            if (!this.CanRefreshRunningInstances)
            {
                var runningInstances = new[] { new LabelledValue<Ec2Instance>("Can't load. Try refreshing", null) };
                this.ActiveRunningInstance = runningInstances[0];
                this.RunningInstances = runningInstances;
                return;
            }

            try
            {
                var runningInstances = (await this.connection.ListInstancesAsync()).Select(x => new LabelledValue<Ec2Instance>(x.Name, x)).ToArray();
                if (runningInstances.Length == 0)
                {
                    runningInstances = new[] { new LabelledValue<Ec2Instance>("No Running Instances", null) };
                }
                this.ActiveRunningInstance = runningInstances[0];
                this.RunningInstances = runningInstances;
            }
            catch (Exception)
            {
                this.ActiveRunningInstance = new LabelledValue<Ec2Instance>("Error loading. Bad credentials?", null);
                this.RunningInstances = new[] { this.ActiveRunningInstance };
            }
        }
Esempio n. 14
0
        public SettingsViewModel(
            IConfigurationProvider configurationProvider,
            IAutostartProvider autostartProvider,
            IWindowManager windowManager,
            IProcessStartProvider processStartProvider,
            IAssemblyProvider assemblyProvider,
            IApplicationState applicationState,
            IApplicationPathsProvider applicationPathsProvider,
            ISyncthingManager syncthingManager,
            IMeteredNetworkManager meteredNetworkManager)
        {
            this.configurationProvider    = configurationProvider;
            this.autostartProvider        = autostartProvider;
            this.windowManager            = windowManager;
            this.processStartProvider     = processStartProvider;
            this.assemblyProvider         = assemblyProvider;
            this.applicationState         = applicationState;
            this.applicationPathsProvider = applicationPathsProvider;
            this.syncthingManager         = syncthingManager;

            this.MinimizeToTray      = this.CreateBasicSettingItem(x => x.MinimizeToTray);
            this.NotifyOfNewVersions = this.CreateBasicSettingItem(x => x.NotifyOfNewVersions);
            this.CloseToTray         = this.CreateBasicSettingItem(x => x.CloseToTray);
            this.ObfuscateDeviceIDs  = this.CreateBasicSettingItem(x => x.ObfuscateDeviceIDs);
            this.UseComputerCulture  = this.CreateBasicSettingItem(x => x.UseComputerCulture);
            this.UseComputerCulture.RequiresSyncTrayzorRestart = true;
            this.DisableHardwareRendering = this.CreateBasicSettingItem(x => x.DisableHardwareRendering);
            this.DisableHardwareRendering.RequiresSyncTrayzorRestart = true;
            this.EnableConflictFileMonitoring = this.CreateBasicSettingItem(x => x.EnableConflictFileMonitoring);
            this.EnableFailedTransferAlerts   = this.CreateBasicSettingItem(x => x.EnableFailedTransferAlerts);

            this.PauseDevicesOnMeteredNetworks          = this.CreateBasicSettingItem(x => x.PauseDevicesOnMeteredNetworks);
            this.PauseDevicesOnMeteredNetworksSupported = meteredNetworkManager.IsSupportedByWindows;

            this.ShowTrayIconOnlyOnClose = this.CreateBasicSettingItem(x => x.ShowTrayIconOnlyOnClose);
            this.ShowSynchronizedBalloonEvenIfNothingDownloaded = this.CreateBasicSettingItem(x => x.ShowSynchronizedBalloonEvenIfNothingDownloaded);
            this.ShowDeviceConnectivityBalloons     = this.CreateBasicSettingItem(x => x.ShowDeviceConnectivityBalloons);
            this.ShowDeviceOrFolderRejectedBalloons = this.CreateBasicSettingItem(x => x.ShowDeviceOrFolderRejectedBalloons);

            this.IconAnimationModes = new BindableCollection <LabelledValue <IconAnimationMode> >()
            {
                LabelledValue.Create(Resources.SettingsView_TrayIconAnimation_DataTransferring, Services.Config.IconAnimationMode.DataTransferring),
                LabelledValue.Create(Resources.SettingsView_TrayIconAnimation_Syncing, Services.Config.IconAnimationMode.Syncing),
                LabelledValue.Create(Resources.SettingsView_TrayIconAnimation_Disabled, Services.Config.IconAnimationMode.Disabled),
            };
            this.IconAnimationMode = this.CreateBasicSettingItem(x => x.IconAnimationMode);

            this.StartSyncthingAutomatically = this.CreateBasicSettingItem(x => x.StartSyncthingAutomatically);
            this.SyncthingPriorityLevel      = this.CreateBasicSettingItem(x => x.SyncthingPriorityLevel);
            this.SyncthingPriorityLevel.RequiresSyncthingRestart = true;
            this.SyncthingAddress = this.CreateBasicSettingItem(x => x.SyncthingAddress, new SyncthingAddressValidator());
            this.SyncthingAddress.RequiresSyncthingRestart = true;

            this.CanReadAutostart  = this.autostartProvider.CanRead;
            this.CanWriteAutostart = this.autostartProvider.CanWrite;
            if (this.autostartProvider.CanRead)
            {
                var currentSetup = this.autostartProvider.GetCurrentSetup();
                this.StartOnLogon   = currentSetup.AutoStart;
                this.StartMinimized = currentSetup.StartMinimized;
            }

            this.SyncthingCommandLineFlags = this.CreateBasicSettingItem(
                x => String.Join(" ", x.SyncthingCommandLineFlags),
                (x, v) =>
            {
                KeyValueStringParser.TryParse(v, out var envVars, mustHaveValue: false);
                x.SyncthingCommandLineFlags = envVars.Select(item => KeyValueStringParser.FormatItem(item.Key, item.Value)).ToList();
            }, new SyncthingCommandLineFlagsValidator());
Esempio n. 15
0
 public void CreateCreatesLabelledValue()
 {
     var lbv = LabelledValue.Create("test", 2.2f);
     Assert.AreEqual(new LabelledValue<float>("test", 2.2f), lbv);
 }
Esempio n. 16
0
        /// <summary>
        /// Setup the MessageBoxViewModel with the information it needs
        /// </summary>
        /// <param name="messageBoxText">A System.String that specifies the text to display.</param>
        /// <param name="caption">A System.String that specifies the title bar caption to display.</param>
        /// <param name="buttons">A System.Windows.MessageBoxButton value that specifies which button or buttons to display.</param>
        /// <param name="icon">A System.Windows.MessageBoxImage value that specifies the icon to display.</param>
        /// <param name="defaultResult">A System.Windows.MessageBoxResult value that specifies the default result of the message box.</param>
        /// <param name="cancelResult">A System.Windows.MessageBoxResult value that specifies the cancel result of the message box</param>
        /// <param name="options">A System.Windows.MessageBoxOptions value object that specifies the options.</param>
        /// <param name="buttonLabels">A dictionary specifying the button labels, if desirable</param>
        public void Setup(
            string messageBoxText,
            string caption = null,
            MessageBoxButton buttons = MessageBoxButton.OK,
            MessageBoxImage icon = MessageBoxImage.None,
            MessageBoxResult defaultResult = MessageBoxResult.None,
            MessageBoxResult cancelResult = MessageBoxResult.None,
            MessageBoxOptions options = MessageBoxOptions.None,
            IDictionary<MessageBoxResult, string> buttonLabels = null)
        {
            this.Text = messageBoxText;
            this.DisplayName = caption;
            this.Icon = icon;

            var buttonList = new BindableCollection<LabelledValue<MessageBoxResult>>();
            this.ButtonList = buttonList;
            foreach (var val in ButtonToResults[buttons])
            {
                string label;
                if (buttonLabels == null || !buttonLabels.TryGetValue(val, out label))
                    label = ButtonLabels[val];
                    
                var lbv = new LabelledValue<MessageBoxResult>(label, val);
                buttonList.Add(lbv);
                if (val == defaultResult)
                    this.DefaultButton = lbv;
                else if (val == cancelResult)
                    this.CancelButton = lbv;
            }
            // If they didn't specify a button which we showed, then pick a default, if we can
            if (this.DefaultButton == null)
            {
                if (defaultResult == MessageBoxResult.None && this.ButtonList.Any())
                    this.DefaultButton = buttonList[0];
                else
                    throw new ArgumentException("DefaultButton set to a button which doesn't appear in Buttons");
            }
            if (this.CancelButton == null)
            {
                if (cancelResult == MessageBoxResult.None && this.ButtonList.Any())
                    this.CancelButton = buttonList.Last();
                else
                    throw new ArgumentException("CancelButton set to a button which doesn't appear in Buttons");
            }

            this.FlowDirection = options.HasFlag(MessageBoxOptions.RtlReading) ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
            this.TextAlignment = (options.HasFlag(MessageBoxOptions.RightAlign) == options.HasFlag(MessageBoxOptions.RtlReading)) ? TextAlignment.Left : TextAlignment.Right;
        }
Esempio n. 17
0
 public void NotEqualDifferentValues()
 {
     var lbv1 = new LabelledValue<int>("test", 5);
     var lbv2 = new LabelledValue<int>("test", 6);
     Assert.IsFalse(lbv1.Equals(lbv2));
 }
Esempio n. 18
0
 public void NotEqualNull()
 {
     var lbv = new LabelledValue<int>("test", 5);
     Assert.False(lbv.Equals(null));
 }
Esempio n. 19
0
 public void StoresLabelAndValue()
 {
     var lbv = new LabelledValue<int>("an int", 5);
     Assert.AreEqual("an int", lbv.Label);
     Assert.AreEqual(5, lbv.Value);
 }
Esempio n. 20
0
        public SettingsViewModel(
            IConfigurationProvider configurationProvider,
            IAutostartProvider autostartProvider,
            IWindowManager windowManager,
            IProcessStartProvider processStartProvider,
            IAssemblyProvider assemblyProvider,
            IApplicationState applicationState,
            ISyncThingManager syncThingManager)
        {
            this.configurationProvider = configurationProvider;
            this.autostartProvider     = autostartProvider;
            this.windowManager         = windowManager;
            this.processStartProvider  = processStartProvider;
            this.assemblyProvider      = assemblyProvider;
            this.applicationState      = applicationState;
            this.syncThingManager      = syncThingManager;

            this.MinimizeToTray      = this.CreateBasicSettingItem(x => x.MinimizeToTray);
            this.NotifyOfNewVersions = this.CreateBasicSettingItem(x => x.NotifyOfNewVersions);
            this.CloseToTray         = this.CreateBasicSettingItem(x => x.CloseToTray);
            this.ObfuscateDeviceIDs  = this.CreateBasicSettingItem(x => x.ObfuscateDeviceIDs);
            this.UseComputerCulture  = this.CreateBasicSettingItem(x => x.UseComputerCulture);
            this.UseComputerCulture.RequiresSyncTrayzorRestart = true;
            this.DisableHardwareRendering = this.CreateBasicSettingItem(x => x.DisableHardwareRendering);
            this.DisableHardwareRendering.RequiresSyncTrayzorRestart = true;

            this.ShowTrayIconOnlyOnClose = this.CreateBasicSettingItem(x => x.ShowTrayIconOnlyOnClose);
            this.ShowSynchronizedBalloonEvenIfNothingDownloaded = this.CreateBasicSettingItem(x => x.ShowSynchronizedBalloonEvenIfNothingDownloaded);
            this.ShowDeviceConnectivityBalloons = this.CreateBasicSettingItem(x => x.ShowDeviceConnectivityBalloons);

            this.StartSyncThingAutomatically = this.CreateBasicSettingItem(x => x.StartSyncthingAutomatically);
            this.SyncthingPriorityLevel      = this.CreateBasicSettingItem(x => x.SyncthingPriorityLevel);
            this.SyncthingPriorityLevel.RequiresSyncthingRestart = true;
            this.SyncthingUseDefaultHome = this.CreateBasicSettingItem(x => !x.SyncthingUseCustomHome, (x, v) => x.SyncthingUseCustomHome = !v);
            this.SyncthingUseDefaultHome.RequiresSyncthingRestart = true;
            this.SyncThingAddress = this.CreateBasicSettingItem(x => x.SyncthingAddress, new SyncThingAddressValidator());
            this.SyncThingAddress.RequiresSyncthingRestart = true;
            this.SyncThingApiKey = this.CreateBasicSettingItem(x => x.SyncthingApiKey, new SyncThingApiKeyValidator());
            this.SyncThingApiKey.RequiresSyncthingRestart = true;

            this.CanReadAutostart  = this.autostartProvider.CanRead;
            this.CanWriteAutostart = this.autostartProvider.CanWrite;
            if (this.autostartProvider.CanRead)
            {
                var currentSetup = this.autostartProvider.GetCurrentSetup();
                this.StartOnLogon   = currentSetup.AutoStart;
                this.StartMinimized = currentSetup.StartMinimized;
            }

            this.SyncThingCommandLineFlags = this.CreateBasicSettingItem(
                x => String.Join(" ", x.SyncthingCommandLineFlags),
                (x, v) =>
            {
                IEnumerable <KeyValuePair <string, string> > envVars;
                KeyValueStringParser.TryParse(v, out envVars, mustHaveValue: false);
                x.SyncthingCommandLineFlags = envVars.Select(item => KeyValueStringParser.FormatItem(item.Key, item.Value)).ToList();
            }, new SyncThingCommandLineFlagsValidator());
            this.SyncThingCommandLineFlags.RequiresSyncthingRestart = true;


            this.SyncThingEnvironmentalVariables = this.CreateBasicSettingItem(
                x => KeyValueStringParser.Format(x.SyncthingEnvironmentalVariables),
                (x, v) =>
            {
                IEnumerable <KeyValuePair <string, string> > envVars;
                KeyValueStringParser.TryParse(v, out envVars);
                x.SyncthingEnvironmentalVariables = new EnvironmentalVariableCollection(envVars);
            }, new SyncThingEnvironmentalVariablesValidator());
            this.SyncThingEnvironmentalVariables.RequiresSyncthingRestart = true;

            this.SyncthingDenyUpgrade = this.CreateBasicSettingItem(x => x.SyncthingDenyUpgrade);
            this.SyncthingDenyUpgrade.RequiresSyncthingRestart = true;

            var configuration = this.configurationProvider.Load();

            foreach (var settingItem in this.settings)
            {
                settingItem.LoadValue(configuration);
            }

            this.FolderSettings = new BindableCollection <FolderSettings>();
            if (syncThingManager.State == SyncThingState.Running)
            {
                this.FolderSettings.AddRange(configuration.Folders.OrderByDescending(x => x.ID).Select(x => new FolderSettings()
                {
                    FolderName = x.ID,
                    IsWatched  = x.IsWatched,
                    IsNotified = x.NotificationsEnabled,
                }));
            }

            foreach (var folderSetting in this.FolderSettings)
            {
                folderSetting.Bind(s => s.IsWatched, (o, e) => this.UpdateAreAllFoldersWatched());
                folderSetting.Bind(s => s.IsNotified, (o, e) => this.UpdateAreAllFoldersNotified());
            }

            this.PriorityLevels = new BindableCollection <LabelledValue <SyncThingPriorityLevel> >()
            {
                LabelledValue.Create(Resources.SettingsView_Syncthing_ProcessPriority_AboveNormal, SyncThingPriorityLevel.AboveNormal),
                LabelledValue.Create(Resources.SettingsView_Syncthing_ProcessPriority_Normal, SyncThingPriorityLevel.Normal),
                LabelledValue.Create(Resources.SettingsView_Syncthing_ProcessPriority_BelowNormal, SyncThingPriorityLevel.BelowNormal),
                LabelledValue.Create(Resources.SettingsView_Syncthing_ProcessPriority_Idle, SyncThingPriorityLevel.Idle),
            };

            this.Bind(s => s.AreAllFoldersNotified, (o, e) =>
            {
                if (this.updatingFolderSettings)
                {
                    return;
                }

                this.updatingFolderSettings = true;

                foreach (var folderSetting in this.FolderSettings)
                {
                    folderSetting.IsNotified = e.NewValue.GetValueOrDefault(false);
                }

                this.updatingFolderSettings = false;
            });

            this.Bind(s => s.AreAllFoldersWatched, (o, e) =>
            {
                if (this.updatingFolderSettings)
                {
                    return;
                }

                this.updatingFolderSettings = true;

                foreach (var folderSetting in this.FolderSettings)
                {
                    folderSetting.IsWatched = e.NewValue.GetValueOrDefault(false);
                }

                this.updatingFolderSettings = false;
            });

            this.UpdateAreAllFoldersWatched();
            this.UpdateAreAllFoldersNotified();
        }
Esempio n. 21
0
 public void ToStringReturnsLabel()
 {
     var lbv = new LabelledValue<int>("label", 3);
     Assert.AreEqual("label", lbv.ToString());
 }