Ejemplo n.º 1
0
        //add a computer and give it to student with the serialnumber
        private void bAddGivePC_Click(object sender, RoutedEventArgs e)
        {
            var window = new AddComputer();

            window.ShowDialog();


            if (window.s != "")
            {
                MyItem m = (MyItem)listView.SelectedItem;
                sql.assignComputerToPupil(window.s, m.P.Id);

                m.C = sql.getComputerSerial(window.s);
                m.P = sql.getPupil(m.P.Id);

                ICollectionView view = CollectionViewSource.GetDefaultView(listView.ItemsSource);
                view.Refresh();
                listView.UpdateLayout();

                bGivePC.IsEnabled    = false;
                bAddGivePC.IsEnabled = false;
                bRemovePC.IsEnabled  = true;
                UpdateTextBoxes(m);

                listView.SelectedIndex = -1;
                listView.SelectedItem  = m;
            }


            Console.WriteLine("Serial added:" + window.s);
        }
Ejemplo n.º 2
0
        private void ADD_Button_Click(object sender, RoutedEventArgs e)
        {
            var window = new AddComputer();

            window.ShowDialog();

            listView.ItemsSource = MainWindow.sql.getUnAssignedComputerList("");
            ICollectionView view = CollectionViewSource.GetDefaultView(listView.ItemsSource);

            view.Refresh();
        }