initial commit

This commit is contained in:
2021-08-05 16:19:53 +08:00
commit 569c0a733f
71 changed files with 2111 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Gallery.Models;
using Xamarin.Forms;
namespace Gallery.ViewModels
{
[QueryProperty(nameof(ItemId), nameof(ItemId))]
public class ItemDetailViewModel : BaseViewModel
{
private string itemId;
private string text;
private string description;
public string Id { get; set; }
public string Text
{
get => text;
set => SetProperty(ref text, value);
}
public string Description
{
get => description;
set => SetProperty(ref description, value);
}
public string ItemId
{
get
{
return itemId;
}
set
{
itemId = value;
LoadItemId(value);
}
}
public async void LoadItemId(string itemId)
{
try
{
var item = await DataStore.GetItemAsync(itemId);
Id = item.Id;
Text = item.Text;
Description = item.Description;
}
catch (Exception)
{
Debug.WriteLine("Failed to Load Item");
}
}
}
}