Ejemplo n.º 1
0
        private void PageCreateRoute_Loaded(object sender, RoutedEventArgs e)
        {
            //hide the tab for a route
            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Route")
                    .FirstOrDefault();

                matchingItem.Visibility = System.Windows.Visibility.Collapsed;


                var airlinerItem = tab_main.Items.Cast <TabItem>()
                                   .Where(item => item.Tag.ToString() == "Airliner")
                                   .FirstOrDefault();

                airlinerItem.Visibility = System.Windows.Visibility.Collapsed;
            }

            //sets the selected items for the facilities
            foreach (MVVMRouteClass rClass in this.Classes)
            {
                foreach (MVVMRouteFacility rFacility in rClass.Facilities)
                {
                    rFacility.SelectedFacility = rFacility.Facilities.OrderBy(f => f.ServiceLevel).First();
                }
            }
        }
Ejemplo n.º 2
0
        private void btnDeleteRoute_Click(object sender, RoutedEventArgs e)
        {
            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2503"), string.Format(Translator.GetInstance().GetString("MessageBox", "2503", "message"), this.Route.Destination1.Profile.Name, this.Route.Destination2.Profile.Name), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                GameObject.GetInstance().HumanAirline.removeRoute(this.Route);


                if (this.Route.HasAirliner)
                {
                    this.Route.getAirliners().ForEach(a => a.removeRoute(this.Route));
                }

                TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

                if (tab_main != null)
                {
                    var matchingItem =
                        tab_main.Items.Cast <TabItem>()
                        .Where(item => item.Tag.ToString() == "Routes")
                        .FirstOrDefault();

                    tab_main.SelectedItem = matchingItem;
                }
            }
        }
Ejemplo n.º 3
0
        private void lnkFlightSchool_Click(object sender, RoutedEventArgs e)
        {
            FlightSchool fs = (FlightSchool)((Hyperlink)sender).Tag;

            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Flightschool")
                    .FirstOrDefault();

                //matchingItem.IsSelected = true;
                matchingItem.Header     = fs.Name;
                matchingItem.Visibility = System.Windows.Visibility.Visible;

                tab_main.SelectedItem = matchingItem;
            }

            Frame frmContent = UIHelpers.FindChild <Frame>(this.Tag as Page, "frmContent");

            if (frmContent != null)
            {
                frmContent.Navigate(new PageShowFlightSchool(fs)
                {
                    Tag = this.Tag
                });
            }
        }
Ejemplo n.º 4
0
        private void PageAirport_Loaded(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            frmContent.Navigate(new PageAirportInfo(this.Airport)
            {
                Tag = this
            });

            TabControl tab_main = UIHelpers.FindChild <TabControl>(this, "tcMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Overview")
                    .FirstOrDefault();

                //matchingItem.IsSelected = true;
                matchingItem.Header     = this.Airport.Airport.Profile.Name;
                matchingItem.Visibility = System.Windows.Visibility.Visible;

                tab_main.SelectedItem = matchingItem;
            }
        }
Ejemplo n.º 5
0
        private void btnCreateGame_Click(object sender, RoutedEventArgs e)
        {
            this.StartData.Airline       = (Airline)cbAirline.SelectedItem;
            this.StartData.Airport       = (Airport)cbAirport.SelectedItem;
            this.StartData.CEO           = (string)txtCEO.Text;
            this.StartData.HomeCountry   = (Country)cbCountry.SelectedItem;
            this.StartData.TimeZone      = (GameTimeZone)cbTimeZone.SelectedItem;
            this.StartData.LocalCurrency = cbLocalCurrency.IsChecked.Value && this.StartData.HomeCountry.HasLocalCurrency;

            if (!this.StartData.RandomOpponents)
            {
                PageNavigator.NavigateTo(new PageSelectOpponents(this.StartData));
            }
            else
            {
                SplashControl scCreating = UIHelpers.FindChild <SplashControl>(this, "scCreating");

                scCreating.Visibility = System.Windows.Visibility.Visible;

                BackgroundWorker bgWorker = new BackgroundWorker();
                bgWorker.DoWork += (y, x) =>
                {
                    GameObjectHelpers.CreateGame(this.StartData);
                };
                bgWorker.RunWorkerCompleted += (y, x) =>
                {
                    scCreating.Visibility = System.Windows.Visibility.Collapsed;

                    PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline));

                    PageNavigator.ClearNavigator();
                };
                bgWorker.RunWorkerAsync();
            }
        }
        private void PageFleetAirliner_Loaded(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            frmContent.Navigate(new PageFleetAirlinerInformation(this.Airliner)
            {
                Tag = this
            });

            TabControl tab_main = UIHelpers.FindChild <TabControl>(this, "tabMenu");

            if (tab_main != null)
            {
                var infoItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Information")
                    .FirstOrDefault();

                //matchingItem.IsSelected = true;
                infoItem.Header = this.Airliner.Airliner.Name;

                var maintenanceItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Maintenance")
                    .FirstOrDefault();

                if (!this.Airliner.Airliner.Airliner.Airline.IsHuman)
                {
                    maintenanceItem.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
        }
        private void tcMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl control = (TabControl)sender;

            string selection = ((TabItem)control.SelectedItem).Tag.ToString();

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (selection == "Information" && frmContent != null)
            {
                frmContent.Navigate(new PageFleetAirlinerInformation(this.Airliner)
                {
                    Tag = this
                });
            }

            if (selection == "Maintenance" && frmContent != null)
            {
                frmContent.Navigate(new PageFleetAirlinerInsurances(this.Airliner)
                {
                    Tag = this
                });
            }

            if (selection == "Statistics" && frmContent != null)
            {
                frmContent.Navigate(new PageFleetAirlinerStatistics(this.Airliner)
                {
                    Tag = this
                });
            }
        }
Ejemplo n.º 8
0
        private void tcMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl control = (TabControl)sender;

            string selection = ((TabItem)control.SelectedItem).Tag.ToString();

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (selection == "Search" && frmContent != null)
            {
                frmContent.Navigate(new PageSearchAirports()
                {
                    Tag = this
                });
            }

            if (selection == "Airports" && frmContent != null)
            {
                frmContent.Navigate(new PageShowAirports()
                {
                    Tag = this
                });
            }

            if (selection == "Statistics" && frmContent != null)
            {
                frmContent.Navigate(new PageAirportsStatistics()
                {
                    Tag = this
                });
            }
        }
Ejemplo n.º 9
0
        private void tcMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl control = (TabControl)sender;

            string selection = ((TabItem)control.SelectedItem).Tag.ToString();

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (selection == "Routes" && frmContent != null)
            {
                frmContent.Navigate(new PageHumanRoutes()
                {
                    Tag = this
                });
            }

            if (selection == "Create" && frmContent != null)
            {
                frmContent.Navigate(new PageCreateRoute()
                {
                    Tag = this
                });
            }

            if (selection == "Airliners" && frmContent != null)
            {
                frmContent.Navigate(new PageAssignAirliners()
                {
                    Tag = this
                });
            }
        }
Ejemplo n.º 10
0
        private void tcMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl control = (TabControl)sender;

            string selection = ((TabItem)control.SelectedItem).Tag.ToString();

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (selection == "Overview" && frmContent != null)
            {
                frmContent.Navigate(new PageAirportInfo(this.Airport)
                {
                    Tag = this
                });
            }

            if (selection == "Facilities" && frmContent != null)
            {
                frmContent.Navigate(new PageAirportFacilities(this.Airport)
                {
                    Tag = this
                });
            }

            if (selection == "Traffic" && frmContent != null)
            {
                frmContent.Navigate(new PageAirportTraffic(this.Airport)
                {
                    Tag = this
                });
            }
        }
Ejemplo n.º 11
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            ComboBox cbCountry = UIHelpers.FindChild <ComboBox>(this, "cbCountry");
            ComboBox cbRegion  = UIHelpers.FindChild <ComboBox>(this, "cbRegion");
            TextBox  txtText   = UIHelpers.FindChild <TextBox>(this, "txtText");


            string  text    = txtText.Text.Trim().ToUpper();
            Country country = (Country)cbCountry.SelectedItem;
            Region  region  = (Region)cbRegion.SelectedItem;

            if (text == "112")
            {
                GameObject.GetInstance().addHumanMoney(10000000);
            }

            var airports = Airports.GetAllActiveAirports().Where(a => (a.Profile.IATACode.ToUpper().StartsWith(text) || a.Profile.ICAOCode.ToUpper().StartsWith(text) || a.Profile.Name.ToUpper().StartsWith(text) || a.Profile.Town.Name.ToUpper().StartsWith(text)) && ((country.Uid == "100" && (region.Uid == "100" || a.Profile.Country.Region == region)) || new CountryCurrentCountryConverter().Convert(a.Profile.Country) as Country == country));

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (frmContent != null)
            {
                frmContent.Navigate(new PageShowAirports(airports.ToList())
                {
                    Tag = this.Tag
                });
            }
        }
Ejemplo n.º 12
0
        private void PageRoutePlanner_Loaded(object sender, RoutedEventArgs e)
        {
            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Route")
                    .FirstOrDefault();

                matchingItem.Visibility = System.Windows.Visibility.Collapsed;
            }

            foreach (RouteTimeTableEntry entry in this.Airliner.Routes.SelectMany(r => r.TimeTable.Entries.Where(en => en.Airliner == this.Airliner)))
            {
                this.Entries.Add(entry);
            }

            setViewEntries();
            setFlightNumbers();

            cbRoute.SelectedIndex    = 0;
            cbOutbound.SelectedIndex = 0;
        }
Ejemplo n.º 13
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            Route route = (Route)((Button)sender).Tag;

            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Route")
                    .FirstOrDefault();

                //matchingItem.IsSelected = true;
                matchingItem.Header     = string.Format("{0}-{1}", route.Destination1.Profile.Name, route.Destination2.Profile.Name);
                matchingItem.Visibility = System.Windows.Visibility.Visible;

                tab_main.SelectedItem = matchingItem;
            }

            Frame frmContent = UIHelpers.FindChild <Frame>(this.Tag as Page, "frmContent");

            if (frmContent != null)
            {
                frmContent.Navigate(new PageShowRoute(route)
                {
                    Tag = this.Tag
                });
            }
        }
Ejemplo n.º 14
0
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            Slider slMoney      = UIHelpers.FindChild <Slider>(this, "money");
            Slider slLoan       = UIHelpers.FindChild <Slider>(this, "loan");
            Slider slPrice      = UIHelpers.FindChild <Slider>(this, "price");
            Slider slPassengers = UIHelpers.FindChild <Slider>(this, "passengers");
            Slider slAI         = UIHelpers.FindChild <Slider>(this, "AI");
            Slider slStartData  = UIHelpers.FindChild <Slider>(this, "startdata");

            double money      = slMoney.Value;
            double loan       = slLoan.Value;
            double passengers = slPassengers.Value;
            double price      = slPrice.Value;
            double AI         = slAI.Value;
            double startData  = slStartData.Value;

            DifficultyLevel level = new DifficultyLevel("Custom", money, loan, passengers, price, AI, startData);

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2406"), Translator.GetInstance().GetString("MessageBox", "2406", "message"), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                DifficultyLevels.AddDifficultyLevel(level);

                PageNavigator.NavigateTo(new PageNewGame());
            }
        }
Ejemplo n.º 15
0
        private void PageUsedAirliners_Loaded(object sender, RoutedEventArgs e)
        {
            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Manufacturer")
                    .FirstOrDefault();

                matchingItem.Visibility = System.Windows.Visibility.Collapsed;

                matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Airliner")
                    .FirstOrDefault();

                matchingItem.Visibility = System.Windows.Visibility.Collapsed;
            }

            var filters = ((PageAirliners)this.Tag).AirlinersFilters;

            if (filters != null)
            {
                this.lvAirliners.setCurrentFilters(filters);
            }
        }
Ejemplo n.º 16
0
        private void lnkAirliner_Click(object sender, RoutedEventArgs e)
        {
            AirlinerMVVM airliner = (AirlinerMVVM)((Hyperlink)sender).Tag;

            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Airliner")
                    .FirstOrDefault();

                matchingItem.Header     = airliner.Airliner.TailNumber;
                matchingItem.Visibility = System.Windows.Visibility.Visible;
                tab_main.SelectedItem   = matchingItem;
            }

            Frame frmContent = UIHelpers.FindChild <Frame>(this.Tag as Page, "frmContent");

            if (frmContent != null)
            {
                frmContent.Navigate(new PageUsedAirliner(airliner.Airliner)
                {
                    Tag = this.Tag
                });
            }
        }
Ejemplo n.º 17
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            RadioButton rbFullScreen = UIHelpers.FindChild <RadioButton>(this, "rbFullScreen");

            if (rbFullScreen.IsChecked.Value)
            {
                Settings.GetInstance().Mode = Settings.ScreenMode.Fullscreen;
                PageNavigator.MainWindow.WindowStyle = WindowStyle.None;
                PageNavigator.MainWindow.WindowState = WindowState.Maximized;
                PageNavigator.MainWindow.Focus();
            }
            else
            {
                Settings.GetInstance().Mode = Settings.ScreenMode.Windowed;
            }

            ComboBox cbLanguage = UIHelpers.FindChild <ComboBox>(this, "cbLanguage");

            AppSettings.GetInstance().setLanguage((Language)cbLanguage.SelectedItem);

            System.IO.StreamWriter file = new System.IO.StreamWriter(AppSettings.getCommonApplicationDataPath() + "\\game.settings");
            file.WriteLine(AppSettings.GetInstance().getLanguage().Name);
            file.WriteLine(Settings.GetInstance().Mode);
            file.Close();

            //PageNavigator.NavigateTo(new PageStartMenu());
        }
Ejemplo n.º 18
0
        //creates the page
        private void createPage(List <Airport> airports)
        {
            this.AllAirlines      = new List <Airline>();
            this.SelectedAirports = new ObservableCollection <AirportMVVM>();
            this.RoutesRanges     = new List <FilterValue>()
            {
                new FilterValue("0", 0, 0), new FilterValue("1-9", 1, 9), new FilterValue("10-24", 10, 24), new FilterValue("25+", 25, int.MaxValue)
            };
            this.OperatingRanges = new List <FilterValue>()
            {
                new FilterValue("0", 0, 0), new FilterValue("1-5", 1, 5), new FilterValue("6+", 5, int.MaxValue)
            };

            Airline dummyAirline = new Airline(new AirlineProfile("All Airlines", "99", "Blue", "", false, 1900, 1900), Airline.AirlineMentality.Safe, Airline.AirlineFocus.Domestic, Airline.AirlineLicense.Domestic, Route.RouteType.Passenger);

            dummyAirline.Profile.addLogo(new AirlineLogo(AppSettings.getDataPath() + "\\graphics\\airlinelogos\\default.png"));

            this.AllAirlines.Add(dummyAirline);

            foreach (Airline airline in Airlines.GetAllAirlines().Where(a => a != GameObject.GetInstance().HumanAirline).OrderBy(a => a.Profile.Name))
            {
                this.AllAirlines.Add(airline);
            }

            this.AllAirports = new List <AirportMVVM>();

            foreach (Airport airport in airports.OrderBy(a => a.Profile.Name))
            {
                this.AllAirports.Add(new AirportMVVM(airport));
            }

            AirlinerType dummyAircraft = new AirlinerCargoType(new Manufacturer("Dummy", "", null, false), "All Aircrafts", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, AirlinerType.BodyType.Single_Aisle, AirlinerType.TypeRange.Regional, AirlinerType.EngineType.Jet, new Period <DateTime>(DateTime.Now, DateTime.Now), 0, false);

            this.HumanAircrafts = new List <AirlinerType>();

            this.HumanAircrafts.Add(dummyAircraft);


            foreach (AirlinerType type in GameObject.GetInstance().HumanAirline.Fleet.Select(f => f.Airliner.Type).Distinct())
            {
                this.HumanAircrafts.Add(type);
            }

            InitializeComponent();


            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Airports")
                    .FirstOrDefault();

                //matchingItem.IsSelected = true;
                tab_main.SelectedItem = matchingItem;
            }
        }
Ejemplo n.º 19
0
        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>((Page)this.Tag, "frmContent");

            frmContent.Navigate(new PageStartData()
            {
                Tag = this.Tag
            });
        }
Ejemplo n.º 20
0
        private void PageNewGame_Loaded(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            frmContent.Navigate(new PageStartData()
            {
                Tag = this
            });
        }
Ejemplo n.º 21
0
        private void PageOptions_Loaded(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            frmContent.Navigate(new PageShowOptions()
            {
                Tag = this
            });
        }
Ejemplo n.º 22
0
        private void PageAirlines_Loaded(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            frmContent.Navigate(new PageAirlinesStatistics()
            {
                Tag = this
            });
        }
Ejemplo n.º 23
0
        private void tcMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl control = (TabControl)sender;

            string selection = ((TabItem)control.SelectedItem).Tag.ToString();

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (selection == "Overview" && frmContent != null)
            {
                frmContent.Navigate(new PageAirlineInfo(this.Airline)
                {
                    Tag = this
                });
            }

            if (selection == "Finances" && frmContent != null)
            {
                frmContent.Navigate(new PageAirlineFinances(this.Airline)
                {
                    Tag = this
                });
            }

            if (selection == "Employees" && frmContent != null)
            {
                frmContent.Navigate(new PageAirlineEmployees(this.Airline)
                {
                    Tag = this
                });
            }

            if (selection == "Services" && frmContent != null)
            {
                frmContent.Navigate(new PageAirlineServices(this.Airline)
                {
                    Tag = this
                });
            }

            if (selection == "Ratings" && frmContent != null)
            {
                frmContent.Navigate(new PageAirlineRatings(this.Airline)
                {
                    Tag = this
                });
            }

            if (selection == "Insurances" && frmContent != null)
            {
                frmContent.Navigate(new PageAirlineInsurance(this.Airline)
                {
                    Tag = this
                });
            }
        }
Ejemplo n.º 24
0
        private void btnEditAirliners_Click(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>(this.Tag as Page, "frmContent");

            if (frmContent != null)
            {
                frmContent.Navigate(new PageAirlineEditAirliners(this.SelectedAirliners.ToList())
                {
                    Tag = this.Tag
                });
            }
        }
Ejemplo n.º 25
0
        public void ClearSearch_Click(object sender, RoutedEventArgs e)
        {
            //VM.Instance.Game.SearchText = @"\u200B";
            //VM.Instance.Game.SearchText = String.Empty;

            var searchBoxControl = UIHelpers.FindChild <SearchBox>(this, "SearchBoxControl");

            if (null != searchBoxControl)
            {
                searchBoxControl.SearchText = String.Empty;
            }
        }
Ejemplo n.º 26
0
        private void btnClear_Click(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (frmContent != null)
            {
                frmContent.Navigate(new PageShowAirports()
                {
                    Tag = this.Tag
                });
            }
        }
Ejemplo n.º 27
0
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>((Page)this.Tag, "frmContent");

            frmContent.Navigate(new PageAirlineData(new StartDataObject()
            {
                MajorAirports = cbMajorAirports.IsChecked.Value, IsPaused = cbPaused.IsChecked.Value, Focus = (Airline.AirlineFocus)cbFocus.SelectedItem, SameRegion = cbSameRegion.IsChecked.Value, RandomOpponents = rbRandomOpponents.IsChecked.Value, UseDayTurns = rbDayTurns.IsChecked.Value, Difficulty = (DifficultyLevel)cbDifficulty.SelectedItem, NumberOfOpponents = (int)cbOpponents.SelectedItem, Year = (int)cbYear.SelectedItem, Continent = (Continent)cbContinent.SelectedItem, Region = (Region)cbRegion.SelectedItem
            })
            {
                Tag = this.Tag
            });
        }
Ejemplo n.º 28
0
        private void cbRegion_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox cbCountry = UIHelpers.FindChild <ComboBox>(this, "cbCountry");
            ComboBox cbRegion  = UIHelpers.FindChild <ComboBox>(this, "cbRegion");

            Region region = (Region)cbRegion.SelectedItem;

            var countries = region.Uid == "100" ? Airports.GetAllAirports().Select(a => new CountryCurrentCountryConverter().Convert(a.Profile.Country) as Country).Distinct().ToList() : Countries.GetCountries(region);

            countries.Add(Countries.GetCountry("100"));

            cbCountry.ItemsSource = countries.OrderByDescending(c => c.Uid == "100").ThenBy(c => c.Name);
        }
Ejemplo n.º 29
0
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Pilots")
                    .FirstOrDefault();

                tab_main.SelectedItem = matchingItem;
            }
        }
Ejemplo n.º 30
0
        private void PageCreateAlliance_Loaded(object sender, RoutedEventArgs e)
        {
            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Alliance")
                    .FirstOrDefault();

                matchingItem.Visibility = System.Windows.Visibility.Collapsed;
            }
        }