Exemplo n.º 1
0
 public void SetupCards()
 {
     foreach (var card in ItemList)
     {
         ItemCard newCard = new ItemCard(card);
         //GridList.Children.Add(newCard);
         CardList.Add(newCard);
     }
     CollectionViewSource.GetDefaultView(CardList).Refresh();
     SortCardList("Last Edited", true);
 }
Exemplo n.º 2
0
 public Update(Item item, ItemCard card)
 {
     InitializeComponent();
     _item                = item;
     NameBox.Text         = item.name;
     TypeBox.SelectedItem = item.type == Type.Movie ? TypeBox.Items[0] : TypeBox.Items[1];
     SeasonBox.Text       = item.season.ToString();
     EpisodeBox.Text      = item.episode.ToString();
     ProgressBox.Text     = item.progress;
     Completed.IsChecked  = item.completed;
     _card                = card;
 }
Exemplo n.º 3
0
        public void CreateNewCard(Type type, string Title, int Season, int Episode, string Progress, bool Completed)
        {
            var item = new Item(type, Title);

            item.season     = Season;
            item.episode    = Episode;
            item.progress   = Progress;
            item.completed  = Completed;
            item.LastEdited = (int)DateTime.Now.Subtract(DateTime.MinValue.AddYears(1969)).TotalSeconds;
            ItemList.Add(item);

            ItemCard newCard = new ItemCard(item);

            //GridList.Children.Add(newCard);
            CardList.Add(newCard);
            CollectionViewSource.GetDefaultView(CardList).Refresh();
            Thread thread = new Thread(newCard.SetupImage);

            thread.Start();
            SaveData();
            SetupContextMenu();
            RefreshSort();
        }
Exemplo n.º 4
0
        public void SetupContextMenu()
        {
            List <ItemCard> cardlist = new List <ItemCard>();

            foreach (var card in CardList)
            {
                cardlist.Add(card);
            }
            cardlist.Sort(delegate(ItemCard c1, ItemCard c2) { return(c2.item.LastEdited.CompareTo(c1.item.LastEdited)); });
            ContextMenu cm  = new ContextMenu();
            MenuItem    mi1 = new MenuItem();

            mi1.Header = "Open Window";
            mi1.Click += OpenWindow;
            MenuItem mi2 = new MenuItem();

            mi2.Header = "Create New";
            mi2.Click += button_Click;
            cm.Items.Add(mi1);
            cm.Items.Add(mi2);
            Separator s = new Separator();

            cm.Items.Add(s);
            for (int i = 0; i < Math.Min(3, cardlist.Count); i++)
            {
                ItemCard card = cardlist[i];
                MenuItem mi   = new MenuItem();
                mi.Header = card.item.name;
                mi.Header = card.item.name;
                if (card.item.type == Type.Series)
                {
                    MenuItem season = new MenuItem();
                    season.Header = "Increase Season(" + card.item.season + ") by 1";
                    season.Click += card.IncreaseSeason;
                    MenuItem Episode = new MenuItem();
                    Episode.Header = "Increase Episode(" + card.item.episode + ") by 1";
                    Episode.Click += card.IncreaseEpisode;
                    mi.Items.Add(season);
                    mi.Items.Add(Episode);
                }
                mi.MouseDoubleClick += card.OverlayButton_Click;

                MenuItem Progress = new MenuItem();
                Progress.Header = "Change Progress";
                Progress.Click += card.ChangeProgress;
                MenuItem Completed = new MenuItem();
                Completed.Header = "Toggle Completed";
                Completed.Click += card.ToggleCompleted;
                MenuItem Update = new MenuItem();
                Update.Header = "Edit Item";
                Update.Click += card.OverlayButton_Click;

                s = new Separator();
                mi.Items.Add(Progress);
                mi.Items.Add(Completed);
                mi.Items.Add(s);
                mi.Items.Add(Update);
                cm.Items.Add(mi);
            }
            s = new Separator();
            cm.Items.Add(s);
            MenuItem Exit = new MenuItem();

            Exit.Header = "Exit";
            Exit.Click += ExitWindow;
            cm.Items.Add(Exit);
            tb.ContextMenu = cm;
        }