Пример #1
0
        private void AddToListBox(Item item)
        {
            if (listCount % 3 == 0)
            {
                var listBoxItemEmpty = new ListBoxItem()
                {
                    Content = $"Zyklus {((listCount / 3) + 1)}"
                };
                ListHistory.Items.Add(listBoxItemEmpty);
                magsInHistory.Add(GenericCopy <Mag> .DeepCopy(mainMag));
            }

            listCount++;

            var listBoxItem = new ListBoxItem()
            {
                Content = $"   {listCount}) {item}"
            };

            ListHistory.Items.Add(listBoxItem);
        }
Пример #2
0
        private void ListHistory_MouseUp(object sender, MouseButtonEventArgs e)
        {
            var listBox = (ListBox)sender;

            if (listBox.SelectedItems.Count == 1)
            {
                var listBoxItem = (ListBoxItem)listBox.SelectedItem;

                if (listBoxItem.Content.ToString().Contains("Zyklus"))
                {
                    int zyklus = Convert.ToInt32(listBoxItem.Content.ToString().Substring(7));

                    if (MessageBox.Show($"The Mag will be set Back to Zyklus {zyklus}.\nDo you want to set your Mag back?", "Previous Mag", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                    {
                        mainMag = GenericCopy <Mag> .DeepCopy(magsInHistory[zyklus - 1]);

                        ShowMag();
                        CheckHistoryBack(zyklus - 1);
                    }
                }
            }
        }