예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            FindViewById <ImageView>(Resource.Id.imageView1).SetImageResource(Resource.Drawable.Logo_Decale);
            FindViewById <ImageView>(Resource.Id.imageView1).LayoutParameters.Width = FindViewById <LinearLayout>(Resource.Id.linearLayout1).Width / 2;

            #region Initialisation des boutons
            FindViewById <Button>(Resource.Id.Bouton_Jouer).Click       += this.Jouer;
            FindViewById <Button>(Resource.Id.Bouton_Inscription).Click += this.Inscription;
            FindViewById <Button>(Resource.Id.Bouton_Info).Click        += this.Info;
            FindViewById <Button>(Resource.Id.Bouton_Parametre).Click   += this.Parametre;
            FindViewById <Button>(Resource.Id.Bouton_Score).Click       += this.Score;
            FindViewById <Button>(Resource.Id.Bouton_Quitter).Click     += this.Quitter;
            #endregion

            //Création de la Db
            //DB_Manager.Delete_DB();
            DB_Manager.Start_DB();

            if (Variables.Play_With_Bluetooth == true)
            {
                Bluetooth_Manager.Start_Bluetooth();
            }
        }
예제 #2
0
        private void Menu(object sender, System.EventArgs e)
        {
            Intent intent = new Intent(this, typeof(MainActivity));

            intent.AddFlags(ActivityFlags.ClearTask);
            intent.AddFlags(ActivityFlags.ClearTop);
            intent.AddFlags(ActivityFlags.NewTask);
            Bluetooth_Manager.Disconnect();
            Variables.Bluetooth_Connected = false;


            StartActivity(intent);
            Finish();
        }
예제 #3
0
 void Jouer(object sender, System.EventArgs e)
 {
     if (Variables.Bluetooth_Connected == false && Variables.Play_With_Bluetooth == true)
     {
         Thread.Sleep(2000);
         if (Bluetooth_Manager.Connect() == true)
         {
             Variables.Bluetooth_Connected = true;
             StartActivity(new Intent(this, typeof(Options_Jeu)));
         }
         else
         {
             Variables.Bluetooth_Connected = false;
             Toast.MakeText(this, "Appareil bluetooth introuvable", ToastLength.Long).Show();
         }
     }
     else
     {
         StartActivity(new Intent(this, typeof(Options_Jeu)));
     }
 }
예제 #4
0
 private void Demarer(object sender, EventArgs e)
 {
     if (Variables.Play_With_Bluetooth == true)
     {
         Bluetooth_Manager.Write(1);
         Thread.Sleep(150);
         int reponse = Bluetooth_Manager.Read();
         if (reponse == 1 || reponse == 2)
         {
             StartActivity(new Intent(this, typeof(interface_questions)));
             this.Finish();
         }
         else
         {
             Toast.MakeText(Application.Context, "Allo", ToastLength.Long);
         }
     }
     else
     {
         StartActivity(new Intent(this, typeof(interface_questions)));
         this.Finish();
     }
 }