Exemple #1
0
        private async Task LoadRoot()
        {
            var kingdoms = new List <HierarchyItem>()
            {
                new HierarchyItem {
                    TSN = "202423", TaxonName = "Animalia", RankName = "Kingdom"
                },
                new HierarchyItem {
                    TSN = "202422", TaxonName = "Plantae", RankName = "Kingdom"
                },
                new HierarchyItem {
                    TSN = "555705", TaxonName = "Fungi", RankName = "Kingdom"
                },
                new HierarchyItem {
                    TSN = "630577", TaxonName = "Protozoa", RankName = "Kingdom"
                },
                new HierarchyItem {
                    TSN = "630578", TaxonName = "Chromista", RankName = "Kingdom"
                },
                new HierarchyItem {
                    TSN = "935939", TaxonName = "Archaea", RankName = "Kingdom"
                },
            };

            await DispatcherUtil.Dispatch(() =>
            {
                TheList.SetBinding(ListView.ItemsSourceProperty, new Binding {
                    Source = kingdoms
                });
                TaxonName.Text = "Taxonomica";
                RankName.Text  = "Select a kingdom";
            });
        }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        TheList myList = new TheList();

        for (int i = 0; i < elements.Length; i++)
        {
            myList.addEnd(elements [i]);              //adding elements from the array into the list
        }

        textUI.text += "The source list:\n";
        textUI.text += myList.PrintList();                                                                                      //printing the source list

        myList.Insert(insertionIndex, insertionValue);                                                                          //inserting a value
        textUI.text += string.Format("Inserting the value {0} \ninto the spot indexed {1}:\n", insertionValue, insertionIndex); //printing the message
        textUI.text += myList.PrintList();

        myList.Remove(removalIndex);          //removing a value
        textUI.text += string.Format("Removing the item indexed {0}:\n", removalIndex);
        textUI.text += myList.PrintList();

        int searchInd = myList.SearchValue(searchValue);          //searching by value

        if (searchInd == -1)
        {
            textUI.text += string.Format("An element with value {0} \nwas not found.\n", searchValue);
        }
        else
        {
            textUI.text += string.Format("An element with value {0} \nwas found at index {1}.\n", searchValue, searchInd);
        }
    }
        public async Task <IActionResult> PutTheList(int id, TheList theList)
        {
            if (id != theList.Id)
            {
                return(BadRequest());
            }

            db.Entry(theList).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TheListExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #4
0
        public void _UpdateMovieProfileInList(MovieProfile mProfile)
        {
            ListViewItem lvi = new ListViewItem(new string[] {
                mProfile.FileConnect,
                mProfile.Code,
                mProfile.Country,
                "+" + mProfile.Rating.ToString(),
                mProfile.Type,
                mProfile.Title,
                mProfile.Actress,
                mProfile.Tag
            });

            lvi.Tag = mProfile;
            for (int i = 0; i < TheList.Items.Count; i++)
            {
                if (TheList.Items[i].Tag == mProfile)
                {
                    TheList.BeginUpdate();
                    TheList.Items[i] = lvi;
                    TheList.EndUpdate();
                    break;
                }
            }
        }
Exemple #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Description,CreatedDate")] TheList theList)
        {
            if (id != theList.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(theList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TheListExists(theList.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(theList));
        }
Exemple #6
0
        public async Task <IActionResult> Create([Bind("ID,Description,CreatedDate")] TheList theList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(theList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(theList));
        }
        private void InitTheList()
        {
            var theList = ScatterbrainRepo.GetSubjects().GetAwaiter().GetResult();

            if (theList != null)
            {
                TheList = theList;
            }
            else
            {
                TheList = new TheList();
            }

            TheList.Departments.CollectionChanged += TheListDepsChanged;
        }
        public bool Save(TodoCabo model)
        {
            if (model.Id == Guid.Empty)
            {
                model.Id = Guid.NewGuid();
                TheList.Add(model);
                return(true);
            }
            else
            {
                var substitute = TheList.FirstOrDefault(x => x.Id == model.Id);
                substitute = model;
                return(true);
            }

            return(false);
        }
Exemple #9
0
        public void RefreshMovieList(List <MovieProfile> listMovie, string descMovie)
        {
            TheList.BeginUpdate();
            _ClearMovieList();
            for (int i = 0; i < TheList.Columns.Count; i++)
            {
                TheList.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
            }
            TheList.EndUpdate();
            this.Refresh();
            for (int i = 0; i < TheList.Columns.Count; i++)
            {
                TheList.Columns[i].Tag = TheList.Columns[i].Width;
            }

            TheList.BeginUpdate();
            for (int i = 0; i < listMovie.Count; i++)
            {
                _PutMovieProfileToList(listMovie[i]);
            }
            TheList.Columns["colFileconnect"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            TheList.Columns["colCode"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            TheList.Columns["colCountry"].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
            TheList.Columns["colRating"].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
            TheList.Columns["colType"].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
            TheList.Columns["colTitle"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            TheList.Columns["colActress"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            TheList.Columns["colTag"].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);

            // ReSize ColumnHeaderAgain with Check Header & Content
            for (int i = 0; i < TheList.Columns.Count; i++)
            {
                if (((int)TheList.Columns[i].Tag) > TheList.Columns[i].Width)
                {
                    TheList.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
                }
            }

            TheList.EndUpdate();
            TheStatus.Items[0].Text = "Total " + listMovie.Count.ToString("#,0") + " profile(s)";
            TheStatus.Items[1].Text = descMovie;
            this.Refresh();
        }
Exemple #10
0
 private void TheList_ColumnClick(object sender, ColumnClickEventArgs e)
 {
     if (e.Column == lvwColumnSorter.SortColumn)
     {
         if (lvwColumnSorter.Order == SortOrder.Ascending)
         {
             lvwColumnSorter.Order = SortOrder.Descending;
         }
         else
         {
             lvwColumnSorter.Order = SortOrder.Ascending;
         }
     }
     else
     {
         lvwColumnSorter.SortColumn = e.Column;
         lvwColumnSorter.Order      = SortOrder.Ascending;
     }
     TheList.Sort();
 }
        private void Select_Click(object sender, RoutedEventArgs e)
        {
            //Acts like switch for turn on/off the selected and unselected
            this.IsAllSelected = !this.IsAllSelected;

            //Delete everything from the list
            TheList.Clear();


            if (IsAllSelected) //If we decide that select all
            {
                //If we select all, the "se selected" button should be enabled
                btnUseSelected.IsEnabled = true;

                // Load the list with headers and set the checkboxes to true
                for (int i = 0; i < Headers.Count; i++)
                {
                    BoolStringClass checkboxobject = new BoolStringClass();
                    checkboxobject.IsSelected = true;
                    checkboxobject.TheText    = Headers[i];
                    TheList.Add(checkboxobject);
                    NumberOfColumns++;
                }
            }
            else //If we decide unselect all
            {
                // Disable the select button
                btnUseSelected.IsEnabled = false;

                // Populate the data and unckeck the boxes
                for (int i = 0; i < Headers.Count; i++)
                {
                    BoolStringClass checkboxobject = new BoolStringClass();
                    checkboxobject.IsSelected = false;
                    checkboxobject.TheText    = Headers[i];
                    TheList.Add(checkboxobject);
                    NumberOfColumns++;
                }
            }
        }
Exemple #12
0
 public void RemoveByCard(Card card)
 {
     Console.Clear();
     if (TheList.Contains(card))
     {
         if (NumOfCard[TheList.IndexOf(card)] > 1)
         {
             NumOfCard[TheList.IndexOf(card)] = NumOfCard[TheList.IndexOf(card)] - 1;
             Console.WriteLine("Amount In List " + Name + " Is Now " + NumOfCard[TheList.IndexOf(card)]);
         }
         else
         {
             NumOfCard.RemoveAt(TheList.IndexOf(card));
             TheList.Remove(card);
             Console.WriteLine("Card Removed From List " + Name);
         }
     }
     else
     {
         Console.WriteLine("Card Not In List");
     }
 }
        public async Task <ActionResult <TheListNewVm> > PostTheList(TheListNewVm theList)
        {
            // If a list with the same name exists return bad request.
            var rv = await db
                     .TheLists
                     .FirstOrDefaultAsync(f => f.Name.ToLower() == theList.Name.ToLower());

            if (rv != null)
            {
                return(BadRequest($"A list with the name '{theList.Name}' already exists."));
            }

            var theListRecord = new TheList
            {
                Name        = theList.Name,
                Description = theList.Description
            };

            db.TheLists.Add(theListRecord);
            await db.SaveChangesAsync();

            return(CreatedAtAction("PostTheList", new { id = theList.Id }, theListRecord));
        }
Exemple #14
0
 public LexList(params object[] inputs)
 {
     // A LexList is immutable, once made it cannot be altered.
     foreach (var ob in inputs)
     {
         if (ob != null)
         {
             Type theType = ob.GetType();
             if (LexToken.DirectType(theType))
             {
                 TheList.Add(new LexToken(ob, TheList, TheList.Count));
             }
             else if (theType == typeof(LexList))
             {
                 TheList.AddRange(((LexList)ob).TheList);
             }
             else if (theType == typeof(LexToken))
             {
                 TheList.Add((LexToken)ob);
             }
             else if (theType == typeof(LexToken[]))
             {
                 TheList.AddRange((LexToken[])ob);
             }
             else if (theType == typeof(List <LexToken>))
             {
                 TheList.AddRange((List <LexToken>)ob);
             }
             else if (ob is Type)
             {
                 TheList.Add(new LexToken((Type)ob, TheList, TheList.Count));
             }
             else if (theType == typeof(string))
             {
                 TheList.AddRange(Get((string)ob));
             }
             else if (theType == typeof(string[]))
             {
                 TheList.AddRange(Get((string[])ob));
             }
             else if (theType == typeof(List <string>))
             {
                 TheList.AddRange(Get((List <string>)ob));
             }
             else if (theType == typeof(ReadOnlyCollection <string>))
             {
                 TheList.AddRange(Get((ReadOnlyCollection <string>)ob));
             }
             else if (theType == typeof(IEnumerable <LexList>))
             {
                 foreach (var x in (IEnumerable <LexList>)ob)
                 {
                     TheList.AddRange(x);
                 }
             }
             else if (theType == typeof(List <LexList>))
             {
                 foreach (var x in (List <LexList>)ob)
                 {
                     TheList.AddRange(x);
                 }
             }
             else
             {
                 throw new LexListException("Only LexList, string, string[], List<string>, LexToken, LexToken[] or List<LexToken> or\n" +
                                            "the primitive value types may be used to create a new LexList");
             }
         }
     }
     if (TheList.Count == 0)
     {
         EndToken    = null;
         TheTopCount = 0;
     }
     else
     {
         EndToken    = new LexToken("", LexKind.End, TheList, TheList.Count - 1);
         TheTopCount = TheList.Count;
     }
 }
Exemple #15
0
        public void Add() //NEEDS TO CHECK IF CARD IS ALREADY IN LIST
        {
            string selection;

            while (true)
            {
                Console.Clear();
                Console.WriteLine("Enter Card Datbase ID or Search For Card To Get ID:");
                Console.WriteLine("1 - Enter ID");
                Console.WriteLine("2 - Search");
                Console.WriteLine("3 - Exit");
                selection = Console.ReadLine();
                if (Regex.IsMatch(selection, @"^[1-3]$"))
                {
                    if (Convert.ToInt32(selection) == 1)
                    {
                        string index;
                        while (true)
                        {
                            Console.Clear();
                            Console.WriteLine(" - Enter B To Back Out - ");
                            Console.WriteLine("Enter ID: ");
                            index = Console.ReadLine();
                            if (index.ToLower().Equals("b"))
                            {
                                break;
                            }
                            else if (Regex.IsMatch(index, @"^[0-9]+$") && Convert.ToInt32(index) >= 0 && Convert.ToInt32(index) < ProgFunctions.Allcards.Count)
                            {
                                Card   card = ProgFunctions.Allcards[Convert.ToInt32(index)];
                                string numof;
                                int    numofalready = 0;
                                while (true)
                                {
                                    Console.Clear();
                                    if (TheList.Contains(card))
                                    {
                                        Console.WriteLine(NumOfCard[TheList.IndexOf(card)] + "x " + card.Special_name + " Already In list");
                                        numofalready = NumOfCard[TheList.IndexOf(card)];
                                        Console.WriteLine(" ");
                                    }
                                    Console.WriteLine("Total Of " + card.Amount + " " + card.Special_name + " In Collection");
                                    Console.WriteLine(" ");
                                    Console.WriteLine(" - Enter B To Back Out - ");
                                    Console.WriteLine("Enter Amout Of " + card.Special_name + " To Add:");
                                    numof = Console.ReadLine();
                                    if (Regex.IsMatch(numof, @"^[0-9]+$") && Convert.ToInt32(numof) > 0 && Convert.ToInt32(numof) <= card.Amount && Convert.ToInt32(numof) + numofalready <= card.Amount)
                                    {
                                        NumOfCard.Add(Convert.ToInt32(numof));
                                        TheList.Add(card);
                                        break;
                                    }
                                    else if ("b".Equals(numof.ToLower()))
                                    {
                                        break;
                                    }
                                }

                                if ("b".Equals(numof.ToLower()))
                                {
                                    break;
                                }

                                Console.Clear();
                                Console.WriteLine("Card Added");
                                Console.WriteLine(" ");
                                Console.WriteLine("Enter Any Key To Continue:");
                                Console.ReadLine();
                                break;
                            }
                        }
                    }
                    else if (Convert.ToInt32(selection) == 2)
                    {
                        Console.Clear();
                        Console.WriteLine("Enter Card Name:");
                        CardSearchFunctions.CardSearch(Console.ReadLine());
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
Exemple #16
0
 private void DisplayWithID()
 {
     Console.WriteLine("NAME - SET - PRINTING - AMOUNT IN LIST - LIST ID");
     foreach (Card card in TheList)
     {
         Console.WriteLine(card.Special_name + " " + card.Set + " " + card.Printing + " " + NumOfCard[TheList.IndexOf(card)] + " " + TheList.IndexOf(card));
     }
     Console.WriteLine(" ");
 }
Exemple #17
0
        public void Display()
        {
            Console.Clear();
            Console.WriteLine("NAME - SET - PRINTING - AMOUNT IN LIST - CARD DB ID");
            foreach (Card card in TheList)
            {
                Console.WriteLine(card.Special_name + " " + card.Set + " " + card.Printing + " " + NumOfCard[TheList.IndexOf(card)] + " " + ProgFunctions.Allcards.IndexOf(card));
            }

            Console.WriteLine(" ");
            Console.WriteLine("Enter Any Key To Exit:");
            Console.ReadLine();
        }
Exemple #18
0
 public void AddFromLoad(Card card, int amount)
 {
     TheList.Add(card);
     NumOfCard.Add(amount);
 }
 public void Delete(TodoCabo existing)
 {
     TheList.Remove(existing);
 }
Exemple #20
0
        private async Task LoadTSN(string tsn)
        {
            var hierarchy = await RequestManager.RequestFullHierarchy(tsn);

            var currentTaxonHierarchy = hierarchy.HierarchyList.Where(x => x.TSN.Equals(tsn)).FirstOrDefault();

            var currentTaxon = await RequestManager.RequestFullRecord(tsn);

            var image = await RequestManager.RequestWikispeciesImage(currentTaxonHierarchy.TaxonName);

            var imageSource = image.Query.Pages.FirstOrDefault().Value.Thumbnail?.Source;

            var children  = new List <HierarchyItem>();
            var ascending = new List <HierarchyItem>();

            children  = hierarchy.HierarchyList.Where(hierarchyItem => Rank.NumRankOf(currentTaxonHierarchy.RankName) < Rank.NumRankOf(hierarchyItem.RankName)).ToList();
            ascending = hierarchy.HierarchyList.Where(hierarchyItem => Rank.NumRankOf(currentTaxonHierarchy.RankName) >= Rank.NumRankOf(hierarchyItem.RankName)).ToList();

            await DispatcherUtil.Dispatch(() =>
            {
                TheList.SetBinding(ListView.ItemsSourceProperty, new Binding {
                    Source = children
                });
                if (!children.Any())
                {
                    DescendingGrid.Visibility = Visibility.Collapsed;
                }

                TaxonName.Text  = currentTaxonHierarchy.TaxonName;
                CommonName.Text = currentTaxon.GetCommonName();
                RankName.Text   = currentTaxonHierarchy.RankName;

                if (string.IsNullOrWhiteSpace(currentTaxon.Author.Authorship))
                {
                    AuthorshipLabel.Visibility = Visibility.Collapsed;
                    AuthorshipEntry.Visibility = Visibility.Collapsed;
                }
                else
                {
                    AuthorshipLabel.Visibility = Visibility.Visible;
                    AuthorshipEntry.Visibility = Visibility.Visible;
                    AuthorName.Text            = currentTaxon.Author.Authorship;
                }

                if (imageSource != null)
                {
                    TaxonImage.Source = new BitmapImage(new Uri(imageSource, UriKind.Absolute));
                }

                var synonyms = currentTaxon.SynonymList.Synonyms
                               .Where(x => x != null)
                               .Select(x => new SynonymItem(x));

                var synonymsCollection = new ObservableCollection <SynonymItem>(synonyms);

                if (synonymsCollection.Count == 0)
                {
                    SynonymsList.Visibility   = Visibility.Collapsed;
                    SynonymsButton.Visibility = Visibility.Collapsed;
                }
                else
                {
                    SynonymsList.Visibility   = Visibility.Visible;
                    SynonymsButton.Visibility = Visibility.Visible;
                    SynonymsList.SetBinding(ListBox.ItemsSourceProperty, new Binding {
                        Source = synonymsCollection
                    });
                }

                var pathItems = ascending.OrderBy(x => Rank.Ranks.ToList().IndexOf(x.RankName)).ToList();
                TaxonPath.SetBinding(ListView.ItemsSourceProperty, new Binding {
                    Source = pathItems
                });

                var expertsList = currentTaxon.ExpertList.Experts.Where(x => x != null).ToList();
                Experts.SetBinding(ListView.ItemsSourceProperty, new Binding {
                    Source = expertsList
                });
                if (expertsList.Any())
                {
                    ExpertsLabel.Visibility = Visibility.Visible;
                }

                var otherSourcesList = currentTaxon.OtherSourcesList.OtherSources.Where(x => x != null && !string.IsNullOrEmpty(x.SourceComment) && !string.IsNullOrEmpty(x.Source)).ToList();
                OtherSources.SetBinding(ListView.ItemsSourceProperty, new Binding {
                    Source = otherSourcesList
                });
                if (otherSourcesList.Any())
                {
                    OtherSourcesLabel.Visibility = Visibility.Visible;
                    OtherSources.Visibility      = Visibility.Visible;
                }
            });
        }
 public TodoCabo GetSingle(Guid id)
 {
     return(TheList.SingleOrDefault(x => x.Id == id));
 }
 public IEnumerable <TodoItemDto> GetMany(Guid id)
 {
     return(TheList.Where(x => x.TodoCaboId == id));
 }
Exemple #23
0
 public GameObjectListWindow(GameObjectListViewModel gameObjectListViewModel)
 {
     InitializeComponent();
     DataContext = gameObjectListViewModel;
     TheList.Focus();
 }