Exemplo n.º 1
0
        void AddToItemTypeCache(StoreItem item)
        {
            switch (item.StoreItemType)
            {
            case ItemTypeID.Train:
                TrainItem trainItem = (TrainItem)item;
                if (trainItem.EndDate.AddDays(45) >= DateTime.Today)
                {
                    TrainItems.Add((TrainItem)item);
                }
                break;

            case ItemTypeID.ProductGroup:
                ProductGroupItems.Add((ProductGroupItem)item);
                break;

            case ItemTypeID.Persona:
                PersonaItems.Add((PersonaItem)item);
                break;

            case ItemTypeID.PlannerBug:
                PlannerBugItems.Add((PlannerBugItem)item);
                break;

            case ItemTypeID.GroupMember:
                GroupMemberItems.Add((GroupMemberItem)item);
                break;
            }
        }
        private void controllerCombo_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            TrainItem item = selectedItem;

            if (item != null)
            {
                item.controller = (TrainController)controllerCombo.SelectedItem;
            }
        }
        private TreeNode createNode(TrainItem item)
        {
            DDTreeNode n = new DDTreeNode(item.name);

            n.Tag           = item;
            n.canAcceptDrop = (item is TrainGroup);
            n.ImageIndex    = n.SelectedImageIndex = (item is Train) ? 2 : 0;
            return(n);
        }
        private void onItemDropped(TreeNode node, TreeNode newParent)
        {
            // move this train under a new group.
            node.Remove();
            newParent.Nodes.Add(node);

            TrainItem  item     = (TrainItem)node.Tag;
            TrainGroup newGroup = (TrainGroup)newParent.Tag;

            item.moveUnder(newGroup);
        }
Exemplo n.º 5
0
 private async Task GetTrainInfo(TrainItem trainInfo)
 {
     LoadingIndicator.IsVisible = true;
     LoadingIndicator.IsRunning = true;
     try
     {
         await SetContextAsync(trainInfo);
     }
     catch
     {
         await DisplayAlert("Errore", "Servizio non disponibile", "Ok");
     }
     LoadingIndicator.IsVisible = false;
     LoadingIndicator.IsRunning = false;
 }
        public async Task <TrainItem[]> GenerateTrainWritting(int group, int count)
        {
            TrainItem[] data = new TrainItem[count];

            Word word;

            for (int i = 0; i < count; i++)
            {
                word = await GetRandomWordByGroup(group);

                data[i] = new TrainItem(word);
            }

            return(data);
        }
        public async Task <TrainItem[]> GenerateTrainOptions(int group, int count)
        {
            TrainItem[] data = new TrainItem[count];

            Word word;

            string[] translationOptions;
            for (int i = 0; i < count; i++)
            {
                word = await GetRandomWordByGroup(group);

                translationOptions = await GetRandomTranslations(word, ConfigConstants.FlashcardsOptionsCount);

                data[i] = new TrainItem(word, translationOptions);
            }

            return(data);
        }
Exemplo n.º 8
0
        private async Task SetContextAsync(TrainItem trainInfo)
        {
            TrainItem trainItem = new TrainItem();

            trainItem.TrainNumber = trainInfo.TrainNumber;
            trainItem.Time        = trainInfo.Time;

            Parsing parsing      = new Parsing();
            var     trainDetails = await parsing.GetTrainDetailsAsync(trainInfo.DetailLink);

            trainItem.Status      = trainDetails.Item1;
            trainItem.Destination = trainDetails.Item3;

            List <StopItem> stops = await parsing.GetTrainStopsAsync(trainDetails.Item2);

            StopsListView.ItemsSource = stops;

            BindingContext = trainItem;
        }
Exemplo n.º 9
0
        //private bool _isRefreshing = false;

        //public bool IsRefreshing
        //{
        //    get { return _isRefreshing; }
        //    set
        //    {
        //        _isRefreshing = value;
        //        OnPropertyChanged(nameof(IsRefreshing));
        //    }
        //}

        //public ICommand RefreshCommand
        //{
        //    get
        //    {
        //        return new Command(async () =>
        //        {
        //            IsRefreshing = true;
        //            try
        //            {
        //                //await GetTrains("stazione", Title);
        //            }
        //            catch
        //            {
        //                await DisplayAlert("Errore", "Servizio non disponibile", "Ok");
        //            }
        //            IsRefreshing = false;
        //        });
        //    }
        //}


        public TrainPage(TrainItem trainInfo)
        {
            InitializeComponent();

            GetTrainInfo(trainInfo);
        }
Exemplo n.º 10
0
        public ActionResult DeleteTrain(TrainItem trainItem)
        {
            var trains = _trainRepository.GetTrains().Skip(1).ToList();

            return(Json(trains));
        }