Beispiel #1
0
        public NewItemSearchViewModel()
        {
            Title = Translater.ProvideValue("Add watch");

            Items = new ObservableCollection <CrossDbItemTypes>();

            LoadCrossDbItemCommand = new Command <string>(async(requestedItems) => await ExecuteLoadCrossDbItemCommand(requestedItems));
        }
        public async Task StartCheckWatchesTimer(string lastRunTime)
        {
            //CrossLocalNotifications.Current.Show("title", lastRunTime);

            DoCheckWatches = true;

            DateTime lastRunTimeDateTime = DateTime.Parse(lastRunTime);
            //lastRunTimeDateTime = lastRunTimeDateTime.AddSeconds(310);
            int delay = Convert.ToInt32(lastRunTimeDateTime.AddSeconds(325).Subtract(DateTime.Now).TotalMilliseconds);


            if (delay > 0)
            {
                await Task.Delay(delay);
            }

            while (DoCheckWatches)
            {
                string notificationString = await Wservice.CheckWatches(Items);

                // Update the UI (because of async/await magic, this is still in the UI thread!)
                if (notificationString != null)
                {
                    CrossLocalNotifications.Current.Show(Translater.ProvideValue("Overbid:"), notificationString);
                }

                if (DoCheckWatches)
                {
                    await Task.Delay(TimeSpan.FromSeconds(310));
                }
            }

            /*Device.StartTimer(TimeSpan.FromSeconds(10), () =>
             * {
             *   Task.Factory.StartNew(async () =>
             *   {
             *       // Do the actual request and wait for it to finish.
             *
             *       if (Wservice.LastUpdateTime != null)
             *           await CheckWatches();
             *       // Switch back to the UI thread to update the UI
             *       Device.BeginInvokeOnMainThread(() =>
             *       {
             *           // Update the UI
             *           // ...
             *           // Now repeat by scheduling a new request
             *           //ScheduleWebRequest();
             *       });
             *   });
             *
             *   // Don't repeat the timer (we will start a new timer when the request is finished)
             *   return false;
             * });*/
        }
 public NewItemSaveViewModel(Item item = null)
 {
     Title         = Translater.ProvideValue("Save watch");
     MarketActions = new List <String>
     {
         "Sell",
         "Buy"
     };
     Item         = item;
     ChooseAction = "Choose action";
     // MarketActionsSelectedIndex = 0;
     // Item.WatchPrice = Item.FormatSellPrice;
 }
Beispiel #4
0
        public CraftingSearchViewModel()
        {
            Title = Translater.ProvideValue("Crafting search results");

            ChooseCategory = Translater.ProvideValue("Choose category");
            ChooseFaction  = Translater.ProvideValue("Choose faction");
            ChooseType     = Translater.ProvideValue("Choose type");
            ChooseRarity   = Translater.ProvideValue("Choose rarity");

            Factions   = new List <CrossDbItemTypes>();
            Categories = new List <CrossDbItemTypes>();

            LoadCrossDbItemCommand = new Command <string>(async(requestedItems) => await ExecuteLoadCrossDbItemCommand(requestedItems));
        }
Beispiel #5
0
        public ItemDetailViewModel(Item item = null)
        {
            Title = Translater.ProvideValue("Update watch");

            Item = new Item
            {
                Id              = item.Id,
                Name            = item.Name,
                TypeName        = item.TypeName,
                Image           = item.Image,
                LastUpdateTime  = item.LastUpdateTime,
                FormatSellPrice = item.FormatSellPrice,
                FormatBuyPrice  = item.FormatBuyPrice,
                WatchAction     = item.WatchAction,
                WatchPrice      = item.WatchPrice
            };
            //Item = item;
            ChooseAction = "Choose action";
            // MarketActionsSelectedIndex = 0;
            // Item.WatchPrice = Item.FormatSellPrice;
        }