public ItemPreview(int id, string title, string subTitle, TypeOfItems itemType)
 {
     Id       = id;
     Title    = title;
     SubTitle = subTitle;
     ItemType = itemType;
     IconUrl  = IconHelper.GetImageUrl(ItemType);
 }
 public ItemPreview(int id, string title, string subTitle, TypeOfItems itemType, string iconUrl)
 {
     Id       = id;
     Title    = title;
     SubTitle = subTitle;
     ItemType = itemType;
     IconUrl  = iconUrl;
 }
 //constructors
 public BaseItemVM(TypeOfItems itemType)
 {
     //set defaults values in case no parameter passed
     ChangeProps(ItemPageState.Null, "Save", "No data provided", true);
     ItemType            = itemType;
     _goBack             = new Command(GoBackButton);
     _save               = new Command(ChangePageType);
     _displayMoreActions = new Command(DisplayMore);
 }
Esempio n. 4
0
 private async Task ViewSelectedItem(int id, TypeOfItems itemType)
 {
     if (IsInternet())
     {
         //create object
         CreatePage pageToCreate = new CreatePage(ItemPageState.View, id);
         //serialize it
         string pageToCreateString = JsonConvert.SerializeObject(pageToCreate);
         //send it
         await Shell.Current.GoToAsync($"Create{itemType.ToSampleString()}?createPage={pageToCreateString}");
     }
 }
Esempio n. 5
0
        public static string ToSampleString(this TypeOfItems item)
        {
            switch (item)
            {
            case TypeOfItems.Password: return("Password");

            case TypeOfItems.Wifi: return("Wi-Fi");

            case TypeOfItems.Note: return("Note");

            case TypeOfItems.PaymentCard: return("Payment Card");
            }
            return(string.Empty);
        }
Esempio n. 6
0
 public BaseListItemVM(TypeOfItems itemType) : base(itemType.ToPluralString())
 {
     ItemType = itemType;
     SetDefaultValues();
 }
 public static string ItemNotFound(TypeOfItems itemType)
 {
     return($"{itemType.ToSampleString()} not found!");
 }
 public static string InvalidIdMatchingWith(TypeOfItems itemType)
 {
     return($"Id does not match with the {itemType.ToSampleString()} id!");
 }
 public static string ItemDoesNotExist(TypeOfItems itemType)
 {
     return($"{itemType.ToSampleString()} does not exist!");
 }
Esempio n. 10
0
 public static string NoItems(TypeOfItems item)
 {
     return($"You have no {item.ToPluralString()} yet, click on button below to add a new one!");
 }
Esempio n. 11
0
 public static string ItemNotModified(TypeOfItems item)
 {
     return($"Something went wrong and your {item.ToSampleString()} has not been modified, try again!");
 }
Esempio n. 12
0
 public static string CouldNotGetItem(TypeOfItems item)
 {
     return($"Something went wrong and we couldn't get your {item.ToSampleString()}, try again!");
 }
 public static string GetImageUrl(TypeOfItems itemType)
 {
     return($"PassManager-UI.Images.{itemType}.png");
 }
 public CreateItem(TypeOfItems itemType)
 {
     Name    = itemType.ToSampleString();
     IconUrl = IconHelper.GetImageUrl(itemType);
 }
        public static async Task <ItemPreview> GetLatestCreated(HttpClient httpClient, TypeOfItems typeOfItems)
        {
            HttpResponseMessage responseMessage = null;

            try
            {
                responseMessage = await httpClient.GetAsync($"api/{typeOfItems}s?lastCreated=true");
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            if (responseMessage.IsSuccessStatusCode)
            {
                ItemPreview item = await responseMessage.Content.ReadAsAsync <ItemPreview>();

                return(item);
            }
            return(null);
        }