From 399fa8989dc7a56820c477afb84f4dd8d136712a Mon Sep 17 00:00:00 2001 From: Bruno Soares Date: Thu, 22 Feb 2018 22:07:04 -0300 Subject: [PATCH 1/2] Set the "Add Bookmark" as default button --- src/BuildCast/Views/Player.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BuildCast/Views/Player.xaml b/src/BuildCast/Views/Player.xaml index c8b0a00..2bc6879 100644 --- a/src/BuildCast/Views/Player.xaml +++ b/src/BuildCast/Views/Player.xaml @@ -148,6 +148,7 @@ Background="{ThemeResource AppBarBackgroundThemeBrush}" BorderThickness="0,0,0,0" CloseButtonText="Cancel" + DefaultButton="Primary" PrimaryButtonCommand="{x:Bind AddBookmarkCommand}" PrimaryButtonText="Add bookmark"> From cb036b77ba95c6cba0080a45b85b7d03860e5e92 Mon Sep 17 00:00:00 2001 From: Bruno Soares Date: Tue, 24 Jul 2018 00:09:31 -0300 Subject: [PATCH 2/2] Properties in Episode.cs DataModel replaced with auto-implemented properties, like in other DataModels --- src/BuildCast/DataModel/Episode.cs | 61 +++++++++--------------------- 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/src/BuildCast/DataModel/Episode.cs b/src/BuildCast/DataModel/Episode.cs index c73e080..6f6bd5b 100644 --- a/src/BuildCast/DataModel/Episode.cs +++ b/src/BuildCast/DataModel/Episode.cs @@ -15,22 +15,13 @@ using System.Threading.Tasks; using BuildCast.Helpers; using Windows.Foundation.Collections; -using System.Diagnostics; namespace BuildCast.DataModel { public class Episode { private string _uri; - private string _localFilename; - private string _title; - private string _description; - private string _subtitle; - private string _itemThumbnail; private Feed _feed; - private DateTimeOffset _publishDate; - private string _formattedPublishDate; - private TimeSpan _duration; /// /// Initializes a new instance of the class. @@ -54,12 +45,12 @@ public Episode( this.Id = Guid.NewGuid(); this.Key = key; this.LocalFileName = BackgroundDownloadHelper.SafeHashUri(new Uri(this.Key)); - this._title = title; - this._description = description; - this._itemThumbnail = itemThumbnail; + this.Title = title; + this.Description = description; + this.ItemThumbnail = itemThumbnail; - this._publishDate = publishDate; - this._duration = duration; + this.PublishDate = publishDate; + this.Duration = duration; this.Subtitle = subtitle; if (feed != null) @@ -89,10 +80,7 @@ public Episode(string key, string title, string description, string itemThumbnai public string Key { - get - { - return _uri; - } + get => _uri; set { @@ -106,52 +94,39 @@ public string Key } } - public string LocalFileName { get => _localFilename; set => _localFilename = value; } + public string LocalFileName { get; set; } - public string Title { get => _title; set => _title = value; } + public string Title { get; set; } - public string Description { get => _description; set => _description = value; } + public string Description { get; set; } - public string ItemThumbnail { get => _itemThumbnail; set => _itemThumbnail = value; } + public string ItemThumbnail { get; set; } public bool IsDownloaded { get; set; } - public string FeedId - { - get; set; - } + public string FeedId { get; set; } [System.ComponentModel.DataAnnotations.Schema.NotMapped] public Feed Feed { - get - { - if (_feed == null) - { - _feed = GetFeed(); - } - - return _feed; - } - + get => _feed ?? GetFeed(); set => _feed = value; } - public DateTimeOffset PublishDate { get => _publishDate; set => _publishDate = value; } - - public string FormatPublishDate (Episode e) + public DateTimeOffset PublishDate { get; set; } + + public string FormatPublishDate(Episode e) { string formattedDate = e.PublishDate.Month.ToString() + "/" + e.PublishDate.Day.ToString() + "/" + e.PublishDate.Year.ToString(); return formattedDate; } - public TimeSpan Duration { get => _duration; set => _duration = value; } - - public string Subtitle { get => _subtitle; set => _subtitle = value; } + public TimeSpan Duration { get; set; } + public string Subtitle { get; set; } public override string ToString() { - return _title ?? string.Empty; + return Title ?? string.Empty; } public async Task SetDownloaded()