Пример #1
0
        /// <summary>
        /// Raised, when the activity is created.
        /// </summary>
        /// <param name="bundle">Bundle with cartridge and restore flag.</param>
        protected override void OnCreate(Bundle bundle)
        {
            // Set color schema for activity
            Main.SetTheme(this);

            base.OnCreate(bundle);

            // Load content of activity
            SetContentView(Resource.Layout.GameControllerScreen);

            // Get main layout to replace with fragments
            var layoutMain = FindViewById <LinearLayout> (Resource.Id.layoutMain);

            // Get data from intent
            Intent intent = this.Intent;

            string cartFilename = intent.GetStringExtra("cartridge");

            cartRestore = intent.GetBooleanExtra("restore", false);

            // Check, if cartridge files exists, and if yes, create a new cartridge object
            if (File.Exists(cartFilename))
            {
                cartridge = new Cartridge(cartFilename);
            }

            // If cartridge object don't exist, than close activity
            if (cartridge == null)
            {
                Finish();
            }

            audioManager = (AudioManager)GetSystemService(Context.AudioService);
            vibrator     = (Vibrator)GetSystemService(Context.VibratorService);

            // Create CheckLocation
            GameCheckLocation checkLocation = new GameCheckLocation();

            // Show CheckLocation
            var ft = SupportFragmentManager.BeginTransaction();

            ft.SetBreadCrumbTitle(cartridge.Name);
            ft.SetTransition(global::Android.Support.V4.App.FragmentTransaction.TransitNone);
            ft.Replace(Resource.Id.fragment, checkLocation);
            ft.Commit();
        }
		/// <summary>
		/// Raised, when the activity is created.
		/// </summary>
		/// <param name="bundle">Bundle with cartridge and restore flag.</param>
		protected override void OnCreate (Bundle bundle)
		{
			// Set color schema for activity
			Main.SetTheme(this);

			base.OnCreate (bundle);

			// Load content of activity
			SetContentView (Resource.Layout.GameControllerScreen);

			// Get main layout to replace with fragments
			var layoutMain = FindViewById<LinearLayout> (Resource.Id.layoutMain);

			// Get data from intent
			Intent intent = this.Intent;

			string cartFilename = intent.GetStringExtra ("cartridge");
			cartRestore = intent.GetBooleanExtra ("restore", false);

			// Check, if cartridge files exists, and if yes, create a new cartridge object
			if (File.Exists (cartFilename)) {
				cartridge = new Cartridge(cartFilename);
			}

			// If cartridge object don't exist, than close activity
			if (cartridge == null)
				Finish ();

			audioManager = (AudioManager)GetSystemService(Context.AudioService);
			vibrator = (Vibrator)GetSystemService(Context.VibratorService);

			// Create CheckLocation
			GameCheckLocation checkLocation = new GameCheckLocation();

			// Show CheckLocation
			var ft = SupportFragmentManager.BeginTransaction ();
			ft.SetBreadCrumbTitle (cartridge.Name);
			ft.SetTransition (global::Android.Support.V4.App.FragmentTransaction.TransitNone);
			ft.Replace (Resource.Id.fragment, checkLocation);
			ft.Commit ();
		}