private void btnCreateGame_Click(object sender, RoutedEventArgs e)
        {
            List <Airline> airlines = new List <Airline>();

            foreach (Airline airline in this.SelectedAirlines)
            {
                airlines.Add(airline);
            }

            this.StartData.Opponents = airlines;


            BackgroundWorker bgWorker = new BackgroundWorker();

            bgWorker.DoWork += (y, x) =>
            {
                GameObjectHelpers.CreateGame(this.StartData);
            };
            bgWorker.RunWorkerCompleted += (y, x) =>
            {
                PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline));

                PageNavigator.ClearNavigator();
            };
            bgWorker.RunWorkerAsync();
        }
Пример #2
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();
            }
        }
Пример #3
0
        private void btnCreateGame_Click(object sender, RoutedEventArgs e)
        {
            List <Airline> airlines = new List <Airline>();

            foreach (Airline airline in this.SelectedAirlines)
            {
                airlines.Add(airline);
            }

            this.StartData.Opponents = airlines;

            StandardMasterPage smp = this.Content as StandardMasterPage;

            // SplashControl scCreating = UIHelpers.FindChild<SplashControl>(smp, "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();
        }