Example #1
0
        public RSSManager()
        {
            _platformsList = E_Platforms.PC;

            PropertyChanged += MainListChanged;

            Update();

            _firstUpdate = false;

            _timer          = new Timer(RefreshRate * 1000);
            _timer.Elapsed += timer_Elapsed;
            _timer.Start();
            _timerElapses = DateTime.UtcNow.AddSeconds(_refreshRate);

            _oneSecondTimer          = new Timer(1000);
            _oneSecondTimer.Elapsed += timer_Elapses;
            _oneSecondTimer.Start();


            _alertSound = new Uri(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Default_Alert_Alarm.mp3");
            _newSound   = new Uri(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Default_Alert_New.mp3");
            //LoadSoundResource(Properties.Resources.Default_Alert_Alarm, _alertSound);
            //LoadSoundResource(Properties.Resources.Default_Alert_New, _newSound);
        }
Example #2
0
        public List <IActivity> FeedToAlert(List <FeedDTO> feeds, E_Platforms platform)
        {
            bool newAlert = false;

            List <IActivity> lst = new List <IActivity>();

            foreach (FeedDTO f in feeds)
            {
                if (MainActivitiesList.Where(i => i.Type == E_Activities.Alert && i.Id == f.Id).Count() == 0)
                {
                    switch ((E_Activities)System.Enum.Parse(typeof(E_Activities), f.Author, true))
                    {
                    case E_Activities.Alert:
                        //Information to set similar to other activities
                        //It is separated because of the instantiation of different classes
                        newAlert = true;
                        Alert a = new Alert(f.Title);
                        a.Id               = f.Id;
                        a.PublishDate      = f.PublishDate;
                        a.Platform         = platform;
                        a.PropertyChanged += ActivityStatusChanged;     //This is used to ref

                        //Information to set different from other activities
                        a.Description    = f.Description;
                        a.ExpirationDate = f.ExpireDate;
                        a.Faction        = (E_Factions)System.Enum.Parse(typeof(E_Factions), f.Faction.Split('_')[1], true);

                        //Add the activity to the list
                        lst.Add(a);
                        break;

                    case E_Activities.Outbreak:
                        Outbreak o = new Outbreak(f.Title);
                        o.Id               = f.Id;
                        o.PublishDate      = f.PublishDate;
                        o.Platform         = platform;
                        o.PropertyChanged += ActivityStatusChanged;

                        lst.Add(o);
                        break;

                    case E_Activities.Invasion:
                        Invasion i = new Invasion(f.Title);
                        i.Id               = f.Id;
                        i.PublishDate      = f.PublishDate;
                        i.Platform         = platform;
                        i.PropertyChanged += ActivityStatusChanged;

                        lst.Add(i);
                        break;

                    default:
                        break;
                    }
                }
            }
            //if (newAlert && !_firstUpdate)
            //  PlayNew();
            return(lst);
        }
Example #3
0
        private string GetUriPlatform(E_Platforms platform)
        {
            string pp;

            if ((platform & E_Platforms.PS4) == E_Platforms.PS4 || (platform & E_Platforms.XB1) == E_Platforms.XB1)
            {
                pp = Enum.GetName(typeof(E_Platforms), platform).ToLower() + ".";
            }
            else
            {
                pp = "";
            }
            return(_uriLeft + pp + _uriRight);
        }
Example #4
0
        public ManagerActivity()
        {
            _platformsList = E_Platforms.PC;
            _rssmanager    = new ManagerRSS();

            PropertyChanged += MainListChanged;

            Update();

            _firstUpdate = false;

            _timer          = new Timer(RefreshRate * 1000);
            _timer.Elapsed += timer_Elapsed;
            _timer.Start();
            _timerElapses = DateTime.UtcNow.AddSeconds(_refreshRate);

            _oneSecondTimer          = new Timer(1000);
            _oneSecondTimer.Elapsed += timer_Elapses;
            _oneSecondTimer.Start();
        }
Example #5
0
        public List<IActivity> FeedToAlert(List<FeedDTO> feeds, E_Platforms platform)
        {
            bool newAlert = false;

            List<IActivity> lst = new List<IActivity>();
            foreach (FeedDTO f in feeds)
            {
                if (MainActivitiesList.Where(i => i.Type == E_Activities.Alert && i.Id == f.Id).Count() == 0)
                {
                    switch ((E_Activities)System.Enum.Parse(typeof(E_Activities), f.Author, true))
                    {
                        case E_Activities.Alert:
                            //Information to set similar to other activities
                            //It is separated because of the instantiation of different classes
                            newAlert = true;
                            Alert a = new Alert(f.Title);
                            a.Id = f.Id;
                            a.PublishDate = f.PublishDate;
                            a.Platform = platform;
                            a.PropertyChanged += ActivityStatusChanged; //This is used to ref

                            //Information to set different from other activities
                            a.Description = f.Description;
                            a.ExpirationDate = f.ExpireDate;
                            a.Faction = (E_Factions)System.Enum.Parse(typeof(E_Factions), f.Faction.Split('_')[1], true);

                            //Add the activity to the list
                            lst.Add(a);
                            break;
                        case E_Activities.Outbreak:
                            Outbreak o = new Outbreak(f.Title);
                            o.Id = f.Id;
                            o.PublishDate = f.PublishDate;
                            o.Platform = platform;
                            o.PropertyChanged += ActivityStatusChanged;

                            lst.Add(o);
                            break;
                        case E_Activities.Invasion:
                            Invasion i = new Invasion(f.Title);
                            i.Id = f.Id;
                            i.PublishDate = f.PublishDate;
                            i.Platform = platform;
                            i.PropertyChanged += ActivityStatusChanged;

                            lst.Add(i);
                            break;
                        default:
                            break;
                    }
                }
            }
            //if (newAlert && !_firstUpdate)
              //  PlayNew();
            return lst;
        }
Example #6
0
        private string GetUriPlatform(E_Platforms platform)
        {
            string pp;

            if ((platform & E_Platforms.PS4) == E_Platforms.PS4 || (platform & E_Platforms.XB1) == E_Platforms.XB1)
                pp = Enum.GetName(typeof(E_Platforms), platform).ToLower() + ".";
            else
                pp = "";
            return _uriLeft + pp + _uriRight;
        }
Example #7
0
        public ManagerActivity()
        {
            _platformsList = E_Platforms.PC;
            _rssmanager = new ManagerRSS();

            PropertyChanged += MainListChanged;

            Update();

            _firstUpdate = false;

            _timer = new Timer(RefreshRate * 1000);
            _timer.Elapsed += timer_Elapsed;
            _timer.Start();
            _timerElapses = DateTime.UtcNow.AddSeconds(_refreshRate);

            _oneSecondTimer = new Timer(1000);
            _oneSecondTimer.Elapsed += timer_Elapses;
            _oneSecondTimer.Start();
        }
Example #8
0
        public RSSManager()
        {            
            _platformsList = E_Platforms.PC;
            
            PropertyChanged += MainListChanged;
            
            Update();

            _firstUpdate = false;

            _timer = new Timer(RefreshRate * 1000);
            _timer.Elapsed += timer_Elapsed;
            _timer.Start();
            _timerElapses = DateTime.UtcNow.AddSeconds(_refreshRate);

            _oneSecondTimer = new Timer(1000);
            _oneSecondTimer.Elapsed += timer_Elapses;
            _oneSecondTimer.Start();

            
            _alertSound = new Uri(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Default_Alert_Alarm.mp3");
            _newSound = new Uri(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Default_Alert_New.mp3"); 
            //LoadSoundResource(Properties.Resources.Default_Alert_Alarm, _alertSound);
            //LoadSoundResource(Properties.Resources.Default_Alert_New, _newSound);
        }