Пример #1
0
        public string GetSoundPath(string status)
        {
            var prop = NotificationSettings.GetType().GetProperty(status + "SoundPath");
            var res  = (string)prop.GetValue(NotificationSettings, null);

            return(res);
        }
        public void SetSoundPath(string status, string path)
        {
            PropertyInfo prop = NotificationSettings.GetType().GetProperty(status + "SoundPath");

            prop.SetValue(NotificationSettings, path, null);

            SaveConfiguration();
        }
Пример #3
0
        public void SetSoundPath(string status, string path)
        {
            var prop = NotificationSettings.GetType().GetProperty(status + "SoundPath");
            var obj  = prop.GetValue(NotificationSettings, null);

            //  obj == null, is to allow NOTHING to be set to the status.
            if (obj == null || obj.ToString().CompareTo(path) != 0)
            {
                prop.SetValue(NotificationSettings, path, null);
                SaveConfiguration();
            }
        }
        private void UpdateNotificationSettings()
        {
            var updatedNotificationSettings = new NotificationSettings
            {
                Enabled = IsNotificationEnabled
            };

            var type = updatedNotificationSettings.GetType();
            var updatedNotificationProperties = type.GetProperties();

            foreach (var notificationSetting in NotificationSettings)
            {
                var updatedNotificationSetting = updatedNotificationProperties.FirstOrDefault(n => n.Name == notificationSetting.Name);
                if (updatedNotificationSetting != null)
                {
                    updatedNotificationSetting.SetValue(updatedNotificationSettings, notificationSetting.Value);
                }
            }

            _accountService.UpdateNotificationSettings(updatedNotificationSettings);
        }