public NotificationViewModel()
        {
            Settings = new NotificationSettingsModel
            {
                NotificationFrequency = NotificationFrequency.Immediate,
                PortNumber            = 25,
                FromMail   = "*****@*****.**",
                SenderName = "i95Dev Support"
            };
            LoadData();

            TestSettingsCommand   = new BaseCommand(CanSubmit, TestMail);
            UpdateSettingsCommand = new BaseCommand(CanSubmit, UpdateData);
        }
Esempio n. 2
0
        public ActionResult Notifications()
        {
            var model = new NotificationSettingsModel
            {
                XbmcEnabled           = _externalNotificationProvider.GetSettings(typeof(Xbmc)).Enable,
                XbmcNotifyOnGrab      = _configProvider.XbmcNotifyOnGrab,
                XbmcNotifyOnDownload  = _configProvider.XbmcNotifyOnDownload,
                XbmcUpdateLibrary     = _configProvider.XbmcUpdateLibrary,
                XbmcCleanLibrary      = _configProvider.XbmcCleanLibrary,
                XbmcHosts             = _configProvider.XbmcHosts,
                XbmcUsername          = _configProvider.XbmcUsername,
                XbmcPassword          = _configProvider.XbmcPassword,
                XbmcUpdateWhenPlaying = _configProvider.XbmcUpdateWhenPlaying,
                SmtpEnabled           = _externalNotificationProvider.GetSettings(typeof(Smtp)).Enable,
                SmtpNotifyOnGrab      = _configProvider.SmtpNotifyOnGrab,
                SmtpNotifyOnDownload  = _configProvider.SmtpNotifyOnDownload,
                SmtpServer            = _configProvider.SmtpServer,
                SmtpPort                = _configProvider.SmtpPort,
                SmtpUseSsl              = _configProvider.SmtpUseSsl,
                SmtpUsername            = _configProvider.SmtpUsername,
                SmtpPassword            = _configProvider.SmtpPassword,
                SmtpFromAddress         = _configProvider.SmtpFromAddress,
                SmtpToAddresses         = _configProvider.SmtpToAddresses,
                TwitterEnabled          = _externalNotificationProvider.GetSettings(typeof(Twitter)).Enable,
                TwitterNotifyOnGrab     = _configProvider.TwitterNotifyOnGrab,
                TwitterNotifyOnDownload = _configProvider.TwitterNotifyOnDownload,
                GrowlEnabled            = _externalNotificationProvider.GetSettings(typeof(Growl)).Enable,
                GrowlNotifyOnGrab       = _configProvider.GrowlNotifyOnGrab,
                GrowlNotifyOnDownload   = _configProvider.GrowlNotifyOnDownload,
                GrowlHost               = _configProvider.GrowlHost,
                GrowlPassword           = _configProvider.GrowlPassword,
                ProwlEnabled            = _externalNotificationProvider.GetSettings(typeof(Prowl)).Enable,
                ProwlNotifyOnGrab       = _configProvider.ProwlNotifyOnGrab,
                ProwlNotifyOnDownload   = _configProvider.ProwlNotifyOnDownload,
                ProwlApiKeys            = _configProvider.ProwlApiKeys,
                ProwlPriority           = _configProvider.ProwlPriority,
                ProwlPrioritySelectList = GetProwlPrioritySelectList(),
                PlexEnabled             = _externalNotificationProvider.GetSettings(typeof(Plex)).Enable,
                PlexNotifyOnGrab        = _configProvider.PlexNotifyOnGrab,
                PlexNotifyOnDownload    = _configProvider.PlexNotifyOnDownload,
                PlexUpdateLibrary       = _configProvider.PlexUpdateLibrary,
                PlexServerHost          = _configProvider.PlexServerHost,
                PlexClientHosts         = _configProvider.PlexClientHosts,
                PlexUsername            = _configProvider.PlexUsername,
                PlexPassword            = _configProvider.PlexPassword,
            };

            return(View(model));
        }
Esempio n. 3
0
        public JsonResult SaveNotifications(NotificationSettingsModel data)
        {
            if (ModelState.IsValid)
            {
                //XBMC Enabled
                var xbmcSettings = _externalNotificationProvider.GetSettings(typeof(Xbmc));
                xbmcSettings.Enable = data.XbmcEnabled;
                _externalNotificationProvider.SaveSettings(xbmcSettings);

                _configProvider.XbmcNotifyOnGrab      = data.XbmcNotifyOnGrab;
                _configProvider.XbmcNotifyOnDownload  = data.XbmcNotifyOnDownload;
                _configProvider.XbmcUpdateLibrary     = data.XbmcUpdateLibrary;
                _configProvider.XbmcCleanLibrary      = data.XbmcCleanLibrary;
                _configProvider.XbmcHosts             = data.XbmcHosts;
                _configProvider.XbmcUsername          = data.XbmcUsername;
                _configProvider.XbmcPassword          = data.XbmcPassword;
                _configProvider.XbmcUpdateWhenPlaying = data.XbmcUpdateWhenPlaying;

                //SMTP
                var smtpSettings = _externalNotificationProvider.GetSettings(typeof(Smtp));
                smtpSettings.Enable = data.SmtpEnabled;
                _externalNotificationProvider.SaveSettings(smtpSettings);

                _configProvider.SmtpNotifyOnGrab     = data.SmtpNotifyOnGrab;
                _configProvider.SmtpNotifyOnDownload = data.SmtpNotifyOnDownload;
                _configProvider.SmtpServer           = data.SmtpServer;
                _configProvider.SmtpPort             = data.SmtpPort;
                _configProvider.SmtpUseSsl           = data.SmtpUseSsl;
                _configProvider.SmtpUsername         = data.SmtpUsername;
                _configProvider.SmtpPassword         = data.SmtpPassword;
                _configProvider.SmtpFromAddress      = data.SmtpFromAddress;
                _configProvider.SmtpToAddresses      = data.SmtpToAddresses;

                //Twitter
                var twitterSettings = _externalNotificationProvider.GetSettings(typeof(Twitter));
                twitterSettings.Enable = data.TwitterEnabled;
                _externalNotificationProvider.SaveSettings(twitterSettings);

                _configProvider.TwitterNotifyOnGrab     = data.TwitterNotifyOnGrab;
                _configProvider.TwitterNotifyOnDownload = data.TwitterNotifyOnDownload;

                //Growl
                var growlSettings = _externalNotificationProvider.GetSettings(typeof(Growl));
                growlSettings.Enable = data.GrowlEnabled;
                _externalNotificationProvider.SaveSettings(growlSettings);

                _configProvider.GrowlNotifyOnGrab     = data.GrowlNotifyOnGrab;
                _configProvider.GrowlNotifyOnDownload = data.GrowlNotifyOnDownload;
                _configProvider.GrowlHost             = data.GrowlHost;
                _configProvider.GrowlPassword         = data.GrowlPassword;

                //Prowl
                var prowlSettings = _externalNotificationProvider.GetSettings(typeof(Prowl));
                prowlSettings.Enable = data.ProwlEnabled;
                _externalNotificationProvider.SaveSettings(prowlSettings);

                _configProvider.ProwlNotifyOnGrab     = data.ProwlNotifyOnGrab;
                _configProvider.ProwlNotifyOnDownload = data.ProwlNotifyOnDownload;
                _configProvider.ProwlApiKeys          = data.ProwlApiKeys;
                _configProvider.ProwlPriority         = data.ProwlPriority;

                //Plex
                var plexSettings = _externalNotificationProvider.GetSettings(typeof(Plex));
                plexSettings.Enable = data.PlexEnabled;
                _externalNotificationProvider.SaveSettings(plexSettings);

                _configProvider.PlexNotifyOnGrab     = data.PlexNotifyOnGrab;
                _configProvider.PlexNotifyOnDownload = data.PlexNotifyOnDownload;
                _configProvider.PlexUpdateLibrary    = data.PlexUpdateLibrary;
                _configProvider.PlexServerHost       = data.PlexServerHost;
                _configProvider.PlexClientHosts      = data.PlexClientHosts;
                _configProvider.PlexUsername         = data.PlexUsername;
                _configProvider.PlexPassword         = data.PlexPassword;

                return(GetSuccessResult());
            }

            return(GetInvalidModelResult());
        }