public UpdateAvailableViewModel(Update update)
        {
            Debug.Assert(update != null);

            _downloadCommand = new RelayCommand(Download);
            _closeCommand = new RelayCommand(Close);

            _update = update;
        }
        public UpdateAvailableViewModel(Update update)
        {
            Contract.Requires(update != null);

            _downloadCommand = new RelayCommand(Download);
            _closeCommand = new RelayCommand(Close);

            _update = update;
        }
Пример #3
0
        public static Update FromSyndicationItem(SyndicationItem item)
        {
            Debug.Assert(item != null);

            var update = new Update();
            Version version;

            if (Version.TryParse(item.Title.Text, out version))
            {
                update.Version = version;
            }

            update.LastUpdatedTime = item.LastUpdatedTime;

            var link = item.Links.FirstOrDefault(
                l => String.IsNullOrWhiteSpace(l.RelationshipType)
                    || l.RelationshipType.Equals("alternate", StringComparison.OrdinalIgnoreCase));

            if (link != null)
            {
                update.Url = link.GetAbsoluteUri();
            }

            update.ReleaseStatus
                = item.Categories.Aggregate(
                    ReleaseStatus.None,
                    (rs, c) =>
                    {
                        ReleaseStatus releaseStatus;

                        if (Enum.TryParse<ReleaseStatus>(c.Name, true, out releaseStatus))
                        {
                            rs |= releaseStatus;
                        }

                        return rs;
                    });

            return update;
        }