示例#1
0
        private void EditBtn_Click(object sender, RoutedEventArgs e)
        {
            Airplane selectedPlane = (Airplane)DGAirplane.SelectedItem;

            if (SelectedAirplane(selectedPlane))
            {
                Airplane           oldAirplane = selectedPlane.Clone() as Airplane;
                EditAirplaneWindow eda         = new EditAirplaneWindow(selectedPlane, EditAirplaneWindow.Option.EDIT);
                if (eda.ShowDialog() != true)
                {
                    int index = IndexOfSelectedAirplane(selectedPlane.Pilot);
                    Data.Instance.Airplanes[index] = oldAirplane;
                    view.Refresh();
                }
                else
                {
                    selectedPlane.ChangeAirplane();
                }
            }
            view.Refresh();
        }
示例#2
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            EditAirplaneWindow eda = new EditAirplaneWindow(new Airplane(), EditAirplaneWindow.Option.ADDING);

            eda.ShowDialog();
        }