示例#1
0
        public NotificationSettingsViewModel()
        {
            Notifiers = Modules.Notifiers.Concat(Modules.TextToSpeech.Cast <INamedComponent>())
                        .Select(n => new NotifierViewModel(n, Settings.EnabledNotifications.Contains(n.GetType().GetSimpleName())))
                        .ToArray();

            NotificationsEnabled = Settings.EnableNotifications;

            this.globalNotifications = new MutableLookup <string, NotificationTypeViewModel> ();
            foreach (string notifier in Notifiers.Select(n => n.Notifier.GetType().GetSimpleName()))
            {
                this.globalNotifications.Add(notifier,
                                             Enum.GetValues(typeof(NotificationType))
                                             .Cast <NotificationType>()
                                             .Select(t =>
                                                     new NotificationTypeViewModel(t, Settings.EnabledNotifications[notifier].Contains(t))));
            }

            CurrentNotifier = Notifiers.FirstOrDefault();
        }