コード例 #1
0
        private void LoadReviews(object sender, EventArgs e)
        {
            var listview = new ListView(this);

            listview.Adapter = new ReviewsAdapter(api.Personel_Ratings(Id));
            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();
            alert.SetTitle("Reviews for " + nameText.Text);
            alert.SetView(listview);
            //alert.SetIcon(Resource.Drawable.alert);
            alert.SetButton("OK", (c, ev) =>
            {
                alert.Cancel();
            });
            alert.SetButton2("CANCEL", (c, ev) => { });
            alert.Show();
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SelectionLayout);
            // Create your application here
            imageMechan   = FindViewById <ImageView>(Resource.Id.imageMechan);
            imageBreak    = FindViewById <ImageView>(Resource.Id.imageBreak);
            specialityBox = FindViewById <EditText>(Resource.Id.specialityText);
            button        = FindViewById <Button>(Resource.Id.button);

            api = new ImotorCareWebApi.ImotorCareWebApi();

            imageMechan.Click += delegate
            {
                Intent intent = new Intent(this, typeof(MainActivity));
                intent.PutExtra("type", "mechanic");
                StartActivity(intent);
            };
            imageBreak.Click += delegate
            {
                Intent intent = new Intent(this, typeof(MainActivity));
                intent.PutExtra("type", "breakdown");
                StartActivity(intent);
            };
            button.Click += delegate
            {
                if (!string.IsNullOrEmpty(specialityBox.Text))
                {
                    FilterEvent();
                }
                else
                {
                    Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
                    Android.App.AlertDialog         alert  = dialog.Create();
                    alert.SetTitle("Input Errror");
                    alert.SetMessage("You must place a description");
                    //alert.SetIcon(Resource.Drawable.alert);
                    alert.SetButton("OK", (c, ev) => { alert.Cancel(); });
                    alert.Show();
                }
            };
        }
コード例 #3
0
        public Java.Lang.String UITestBackdoorScan(string param)
        {
            var expectedFormat = BarcodeFormat.QR_CODE;

            Enum.TryParse(param, out expectedFormat);
            var opts = new MobileBarcodeScanningOptions
            {
                PossibleFormats = new List <BarcodeFormat> {
                    expectedFormat
                }
            };
            var barcodeScanner = new MobileBarcodeScanner();

            Console.WriteLine("Scanning " + expectedFormat);

            //Start scanning
            barcodeScanner.Scan(opts).ContinueWith(t =>
            {
                var result = t.Result;

                var format = result?.BarcodeFormat.ToString() ?? string.Empty;
                var value  = result?.Text ?? string.Empty;

                RunOnUiThread(() =>
                {
                    Android.App.AlertDialog dialog = null;
                    dialog = new Android.App.AlertDialog.Builder(this)
                             .SetTitle("Barcode Result")
                             .SetMessage(format + "|" + value)
                             .SetNeutralButton("OK", (sender, e) =>
                    {
                        dialog.Cancel();
                    }).Create();
                    dialog.Show();
                });
            });

            return(new Java.Lang.String());
        }
コード例 #4
0
        private void RatePersonel(object sender, EventArgs e)
        {
            var numOfStars = ratingBar.Rating;
            var response   = api.RatePersonel(Id, commentText.Text, numOfStars.ToString());

            Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this);
            Android.App.AlertDialog         alert  = dialog.Create();
            var title = response.ToLower().Contains("success") ? "Success" : "Error";

            alert.SetTitle(title);
            alert.SetMessage(response);
            //alert.SetIcon(Resource.Drawable.alert);
            alert.SetButton("OK", (c, ev) =>
            {
                alert.Cancel();
                Load(api.GetPersonelByID(Id));
            });
            alert.SetButton2("CANCEL", (c, ev) => { });
            alert.Show();
            ratingBar.Rating = 0;
            commentText.Text = string.Empty;
        }
コード例 #5
0
ファイル: MainActivity.cs プロジェクト: Mousheen/HangManGame
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);                          //sets the content view to the layout

            Button btnPlay   = FindViewById <Button>(Resource.Id.btnPlay); //connects the elements from the layout
            Button btnScores = FindViewById <Button>(Resource.Id.BtnScores);
            Button btnExit   = FindViewById <Button>(Resource.Id.btnExit);

            var db = new SQLiteConnection(dbPath2);                                      //opens a connection to SQLLite

            db.CreateTable <WordsListDatabase>();                                        // creates my table with empty fields

            var table = db.Table <WordsListDatabase>();                                  //connects to the table in the database

            if (table.Count() != 0)                                                      //do nothing if table already has words init
            {
                Toast.MakeText(this, "WORDS DATABASE EXISTS", ToastLength.Short).Show(); //toast message to check if database exists.
            }
            else if (table.Count() == 0)                                                 //add the records if the table is empty
            {
                Toast.MakeText(this, "WORDS DATABASE CREATED", ToastLength.Long).Show(); //toast message when table gets created

                WordsListDatabase word0  = new WordsListDatabase("FERMENT");             //creates an emtry in the table
                WordsListDatabase word1  = new WordsListDatabase("DISTINCTIVE");
                WordsListDatabase word2  = new WordsListDatabase("POTATOES");
                WordsListDatabase word3  = new WordsListDatabase("SMOKY");
                WordsListDatabase word4  = new WordsListDatabase("FRUITY");
                WordsListDatabase word5  = new WordsListDatabase("GRAVY");
                WordsListDatabase word6  = new WordsListDatabase("MATURED");
                WordsListDatabase word7  = new WordsListDatabase("SWEET");
                WordsListDatabase word8  = new WordsListDatabase("SAUSAGE");
                WordsListDatabase word9  = new WordsListDatabase("NUTRITIOUS");
                WordsListDatabase word10 = new WordsListDatabase("CABBAGE");
                WordsListDatabase word11 = new WordsListDatabase("AEDJVLDS");
                WordsListDatabase word12 = new WordsListDatabase("JOKES");
                WordsListDatabase word13 = new WordsListDatabase("REPUTATION");
                WordsListDatabase word14 = new WordsListDatabase("SERVED");
                WordsListDatabase word15 = new WordsListDatabase("POISON");
                WordsListDatabase word16 = new WordsListDatabase("WHISKEY");
                WordsListDatabase word17 = new WordsListDatabase("RAW");
                WordsListDatabase word18 = new WordsListDatabase("POISON");
                WordsListDatabase word19 = new WordsListDatabase("CRUST");
                WordsListDatabase word20 = new WordsListDatabase("TRUST");
                WordsListDatabase word21 = new WordsListDatabase("CULINARY");
                WordsListDatabase word22 = new WordsListDatabase("FRIED");
                WordsListDatabase word23 = new WordsListDatabase("CHEESE");
                WordsListDatabase word24 = new WordsListDatabase("MIXED");

                db.Insert(word0); db.Insert(word1); db.Insert(word2); db.Insert(word3); db.Insert(word4); //inserts the emtry into the table
                db.Insert(word5); db.Insert(word6); db.Insert(word7); db.Insert(word8); db.Insert(word9);
                db.Insert(word10); db.Insert(word11); db.Insert(word12); db.Insert(word13); db.Insert(word14);
                db.Insert(word15); db.Insert(word16); db.Insert(word17); db.Insert(word18); db.Insert(word19);
                db.Insert(word20); db.Insert(word21); db.Insert(word22); db.Insert(word23); db.Insert(word24);
            }

            btnPlay.Click += delegate
            {
                StartActivity(typeof(PlayerActivity));

                var db2 = new SQLiteConnection(dbPath); //connection for the sqllite database
                db2.CreateTable <PlayerDatabase>();     //creates table from the class file
            };

            btnScores.Click += delegate
            {
                StartActivity(typeof(ScoresActivity));  //starts defined activity

                var db2 = new SQLiteConnection(dbPath); //connection for the sqllite database
                db2.CreateTable <PlayerDatabase>();     //creates table from the class file
            };

            btnExit.Click += delegate
            {
                Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(this, Android.App.AlertDialog.ThemeHoloDark);
                Android.App.AlertDialog         alert  = dialog.Create();
                alert.SetCancelable(false);
                alert.SetTitle("EXIT GAME");
                alert.SetMessage("Are You Sure?");

                alert.SetButton("YES", (c, ev) =>
                {
                    Process.KillProcess(Process.MyPid());
                });
                alert.SetButton2("NO", (c, ev) =>
                {
                    alert.Cancel();
                });
                alert.Show();
            };
        }