Пример #1
0
        public static AnnouncementInfo FromString(string input)
        {
            AnnouncementInfo newInfo = new AnnouncementInfo();

            if (string.IsNullOrEmpty(input))
            {
                newInfo.IsValid = false;
            }
            else
            {
                UpdateFile updateFile = new UpdateFile(input);
                newInfo.Name    = updateFile.GetString("Name");
                newInfo.Address = updateFile.GetUri("URL");
                newInfo.IsValid = true;
            }
            return(newInfo);
        }
Пример #2
0
        private void GetAnnouncementInfo()
        {
            Uri announcementFileUri            = new Uri(Convert.ToString(Settings.Default.AnnouncementAddress));
            DownloadStringCompletedEventArgs e = DownloadString(announcementFileUri);

            if (!e.Cancelled && e.Error == null)
            {
                _currentAnnouncementInfo = AnnouncementInfo.FromString(e.Result);

                if (!string.IsNullOrEmpty(_currentAnnouncementInfo.Name))
                {
                    Settings.Default.LastAnnouncement = _currentAnnouncementInfo.Name;
                }
            }

            GetAnnouncementInfoCompletedEventEvent?.Invoke(this, e);
        }