示例#1
0
 public MainWindow()
 {
     InitializeComponent();
     cardEditor = new CardEditor();
     typeEditor = new TypeEditor();
     types      = new Types();
     preview    = new Preview();
     NavigateCardEditor();
     DisplayCardButtons();
     DisplayTypeButtons();
     DeleteOnStartup();
 }
        private void MainWindow_CreateCard_Button_Click(object sender, RoutedEventArgs e)
        {
            CardEditor cardEditor = new CardEditor(false, null);

            cardEditor.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            cardEditor.ShowDialog();
            cards       = ReadDatabase.getListOfCards();
            cardsToView = cards.ToList();
            cardTypes   = ReadDatabase.getListOfCardTypes();
            MainWindow_FilterBy_Type_ListBox.ItemsSource = cardTypes;
            MainWindow_Cards_ListView.ItemsSource        = cards;
            RefreshListView();
        }
        private void MainWindow_LoadCard_Button_Click(object sender, RoutedEventArgs e)
        {
            Card selectedCard = (Card)MainWindow_Cards_ListView.SelectedItem;

            if (selectedCard != null)
            {
                CardEditor editCard = new CardEditor(true, selectedCard);
                editCard.ShowDialog();
                cards       = ReadDatabase.getListOfCards();
                cardsToView = cards.ToList();
                cardTypes   = ReadDatabase.getListOfCardTypes();
                MainWindow_FilterBy_Type_ListBox.ItemsSource = cardTypes;
                MainWindow_Cards_ListView.ItemsSource        = cards;
                RefreshListView();
            }
        }
        private void MainWindow_Cards_ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Card selectedCard = (Card)MainWindow_Cards_ListView.SelectedItem;

            if (selectedCard != null)
            {
                CardEditor editCard = new CardEditor(true, selectedCard);
                editCard.Left = this.Left;
                editCard.Top  = this.Top;
                editCard.ShowDialog();
                cards     = ReadDatabase.getListOfCards();
                cardTypes = ReadDatabase.getListOfCardTypes();
                MainWindow_FilterBy_Type_ListBox.ItemsSource = cardTypes;
                MainWindow_Cards_ListView.ItemsSource        = cards;
                RefreshListView();
            }
        }