Interaction logic for PopUpSingleItem.xaml
Inheritance: PopUpWindow
        public static ButtonSelected ShowPopUp(string title, UIElement element)
        {
            PopUpSingleElement window = new PopUpSingleElement(title, element);
            window.ShowDialog();

            return window.Selected == null ? ButtonSelected.Cancel : (ButtonSelected)window.Selected;
        }
Ejemplo n.º 2
0
        private void btnTransfer_Click(object sender, RoutedEventArgs e)
        {
            ComboBox cbAirliners = new ComboBox();

            cbAirliners.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbAirliners.SelectedValuePath   = "Name";
            cbAirliners.DisplayMemberPath   = "Name";
            cbAirliners.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            cbAirliners.Width = 200;

            foreach (FleetAirliner airliner in getTransferAirliners())
            {
                cbAirliners.Items.Add(airliner);
            }

            cbAirliners.SelectedIndex = 0;

            if (PopUpSingleElement.ShowPopUp(Translator.GetInstance().GetString("PopUpAirlinerRoutes", "1001"), cbAirliners) == PopUpSingleElement.ButtonSelected.OK && cbAirliners.SelectedItem != null)
            {
                FleetAirliner transferAirliner = (FleetAirliner)cbAirliners.SelectedItem;

                foreach (Route route in transferAirliner.Routes)
                {
                    foreach (RouteTimeTableEntry entry in route.TimeTable.Entries.FindAll(en => en.Airliner == transferAirliner))
                    {
                        entry.Airliner = this.Airliner;
                    }
                    this.Airliner.addRoute(route);
                }
                transferAirliner.Routes.Clear();

                showFlights();
            }
        }
        public static ButtonSelected ShowPopUp(string title, UIElement element)
        {
            PopUpSingleElement window = new PopUpSingleElement(title, element);

            window.ShowDialog();

            return(window.Selected == null ? ButtonSelected.Cancel : (ButtonSelected)window.Selected);
        }