Пример #1
0
        private async Task GetAvailableSettings()
        {
            var availableSettings = await WCFService?.GetAvailableSettings(DashboardViewModel.Username);

            lock (settingsLocker)
            {
                foreach (var dto in availableSettings)
                {
                    var setting = GetSettingFromDTO(dto);
                    if (setting != null)
                    {
                        BaseSetting existingSetting =
                            Settings
                            .FirstOrDefault(s => s.Equals(setting));

                        if (existingSetting != null)
                        {
                            existingSetting.Update(setting);
                        }
                        else
                        {
                            Settings.Add(setting);
                            if (!setting.IsReadOnly)
                            {
                                setting.ValueChanged += this.ValueChanged;
                            }
                            ;
                        }
                    }
                }
            }
        }