Archived
1
0

Development 6

This commit is contained in:
Michael Gordeev
2018-07-19 17:36:49 +03:00
parent 9b13f8b95b
commit 57c90f4037
12 changed files with 520 additions and 636 deletions
+39 -5
View File
@@ -26,26 +26,30 @@ namespace FoxTube.Background
public NotificationType Type { get; set; }
public string Avatar { get; set; }
public string Thumbnail { get; set; }
public string Id { get; set; }
public Notification(NotificationType type,
public Notification(string type, string id,
string channelName, string content, DateTime date,
string thumbnailUrl, string avatarUrl = "ms-appx:///Assets/Icons/Profile.png")
{
Channel = channelName;
Content = content;
TimeStamp = date;
Type = type;
Type = TypeConversion(type);
Avatar = avatarUrl;
Thumbnail = thumbnailUrl;
}
public string GetXml()
{
return string.Empty;
return $@"<item time='{TimeStamp.ToString("YYYY-MM-DDThh:mm:ss")}' type='{TypeConversion(Type)}' id='{Id}'>
<images thumbnail='{Thumbnail}' avatar='{Avatar}'/>
<channelName>{Channel}</channelName>
<content>{Content}</content>
</item>";
}
public UIElement GetNotification()
public Button GetNotification()
{
StackPanel stackPanel = new StackPanel() { Margin = new Thickness(10, 0, 0, 0) };
@@ -231,5 +235,35 @@ namespace FoxTube.Background
return new ToastNotification(template);
}
private string TypeConversion(NotificationType type)
{
switch(type)
{
case NotificationType.Comment:
return "comment";
case NotificationType.Post:
return "post";
case NotificationType.Video:
return "video";
default:
return "internal";
}
}
private NotificationType TypeConversion(string type)
{
switch (type)
{
case "comment":
return NotificationType.Comment;
case "post":
return NotificationType.Post;
case "video":
return NotificationType.Video;
default:
return NotificationType.Internal;
}
}
}
}