Commit c5319494 authored by HankG's avatar HankG

Change Post view to use a local date time not an Offset

parent e43b5229
......@@ -17,7 +17,7 @@ namespace MySocialPortalDesktop.ViewModels
private static Bitmap DefaultImage = BuildDefaultProfileImage();
private string _body;
private DateTimeOffset _date;
private DateTime _date;
private string _title;
private string _originalSocialMediaSystem;
private Bitmap _profileImage;
......@@ -34,7 +34,7 @@ namespace MySocialPortalDesktop.ViewModels
set => this.RaiseAndSetIfChanged(ref _body, value);
}
public DateTimeOffset Date
public DateTime Date
{
get => _date;
set => _date = this.RaiseAndSetIfChanged(ref _date, value);
......@@ -67,7 +67,7 @@ namespace MySocialPortalDesktop.ViewModels
Title = "Unknown Author";
Body = post.Body;
ProfileImage = DefaultImage;
Date = post.PostDateTime;
Date = post.PostDateTime.LocalDateTime;
var author = RepositoryFactory.Instance.MainPeopleRepository.FindById(post.UserId);
if (author != null)
......@@ -88,22 +88,22 @@ namespace MySocialPortalDesktop.ViewModels
{
return;
}
var lps = ServiceFactory.Instance.LinkPreviewService;
var imagePath = ServiceFactory.Instance.LinkPreviewService.ImageCacheFolderPath;
foreach (var link in Post.Links)
{
try
{
var preview = await lps.GetPreview(link.Url).ConfigureAwait(false);
Links.Add(ExternalLinkViewModel.FromLinkPreview(preview, lps.ImageCacheFolderPath));
var preview = await ServiceFactory.Instance.LinkPreviewService.GetPreview(link.Url).ConfigureAwait(false);
Links.Add(ExternalLinkViewModel.FromLinkPreview(preview, imagePath));
}
catch (Exception e)
{
Console.WriteLine($"Error building VM for link: {link.Url}");
Console.WriteLine(e);
}
}
}
}
protected async void LoadProfileImage(Person author)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment