Пример #1
0
        public async void StartTimer()
        {
            // await Task.Delay(120000); //2 minutes
            await Task.Delay(5000);                           //5 seconds

            //StartActivity(typeof(Activity4));

            //1.inflate the Customlayout
            View content = LayoutInflater.Inflate(Resource.Layout.slider_layout, null);

            loadImages();
            imageView = (ImageView)content.FindViewById(Resource.Id.imageView);
            index     = 0;
            // Set the first image to imageview
            imageView.SetBackgroundResource(images[0]);
            setSlideShow();      // Make the timer to change image
            hideNavigationBar(); // To hide navigation bar

            alertDialog = new Android.App.AlertDialog.Builder(this).Create();

            //4. set the view
            alertDialog.SetView(content);

            //5. show the dialog
            alertDialog.Show(); // This should be called before looking up for elements
        }
Пример #2
0
        public void methodInvokeAlertDialogWithListView()
        {
            dlgAlert = (new Android.App.AlertDialog.Builder(this)).Create();
            dlgAlert.SetTitle("Add Picture");
            var listView = new ListView(this);

            listView.Adapter    = new AlertListViewAdapter(this, _lstDataItem);
            listView.ItemClick += ListView_ItemClick;
            dlgAlert.SetView(listView);
            dlgAlert.Show();
        }
Пример #3
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();
        }
        private static Task<string> PlatformShow(string title, string description, string defaultText, bool usePasswordMode)
        {
            tcs = new TaskCompletionSource<string>();

            Game.Activity.RunOnUiThread(() =>
            {
                alert = new AlertDialog.Builder(Game.Activity).Create();

                alert.SetTitle(title);
                alert.SetMessage(description);

                var input = new EditText(Game.Activity) { Text = defaultText };

                if (defaultText != null)
                    input.SetSelection(defaultText.Length);

                if (usePasswordMode)
                    input.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationPassword;

                alert.SetView(input);

                alert.SetButton((int)DialogButtonType.Positive, "Ok", (sender, args) =>
                {
                    if (!tcs.Task.IsCompleted)
                        tcs.SetResult(input.Text);
                });

                alert.SetButton((int)DialogButtonType.Negative, "Cancel", (sender, args) =>
                {
                    if (!tcs.Task.IsCompleted)
                        tcs.SetResult(null);
                });

                alert.CancelEvent += (sender, args) =>
                {
                    if (!tcs.Task.IsCompleted)
                        tcs.SetResult(null);
                };

                alert.Show();
            });

            return tcs.Task;
        }
Пример #5
0
        void DisplayRequestLoyalty()
        {
            View content_layout = LayoutInflater.Inflate(Resource.Layout.loyalty_layout, null);

            var consultar = (Button)content_layout.FindViewById(Resource.Id.consultar);

            var loyaltyId = (EditText)content_layout.FindViewById(Resource.Id.loyalInput);

            alertDialog = new Android.App.AlertDialog.Builder(this).Create();

            //4. set the view
            alertDialog.SetView(content_layout);

            //5. show the dialog
            alertDialog.Show(); // This should be called before looking up for elements

            loyaltyId.KeyPress += (object sender, View.KeyEventArgs e) => {
                e.Handled = false;
                if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
                {
                    //add your logic here
                    loyalId = loyaltyId.Text;
                    var second = new Intent(this, typeof(Activity2));
                    second.PutExtra("loyalID", loyalId);
                    StartActivity(second);

                    e.Handled = true;
                }
            };

            consultar.Click += delegate
            {
                loyalId = loyaltyId.Text;
                var second = new Intent(this, typeof(Activity2));
                second.PutExtra("loyalID", loyalId);
                StartActivity(second);
            };
        }
        private void FindServers()
        {
            RemoveDiscoveryListener ();
            _serverIps = new List<string> ();
            var builder = new AlertDialog.Builder (this);
            builder.SetTitle ("Pick a server to pair with:");
            _alertDialog = builder.Create ();
            _listServers = new ListView (this);
            _listServers.Adapter = new ArrayAdapter<string> (this, Android.Resource.Layout.SimpleSpinnerItem, _serverIps);
            _listServers.ItemClick += _listServersItemClick;
            _alertDialog.SetView (_listServers);
            _alertDialog.Show ();

            _autoDiscovery = new AutoDiscoveryClient ();
            _autoDiscovery.NewServerFound += _newServerFound;
            _autoDiscovery.Start ();
        }
Пример #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Location_Activity);

            xamEssF = new XamEssentialFeatures(this);

            messages = new Messages(this);

            inflater = LayoutInflater.From(this);

            auth = inflater.Inflate(Resource.Layout.Authentication, null);

            logIn = auth.FindViewById <Button>(Resource.Id.logIn);

            Messages.ToastMessage(message: $"{logIn.Text}");

            allText = new MyTexts(this);

            email = auth.FindViewById <EditText>(Resource.Id.email);

            locationPersonalName = FindViewById <EditText>(Resource.Id.locationPersonalName);

            passeword = auth.FindViewById <EditText>(Resource.Id.passeword);

            dialog = new AlertDialog.Builder(this).Create();

            dialog.SetView(auth);

            db = new DataAccess("location.db3", this);

            locationPersonalName.TextChanged += delegate
            {
                if (string.IsNullOrEmpty(locationPersonalName.Text))
                {
                    locationPersonalName.Background = GetDrawable(Resource.Drawable.EditTextBackground);
                }
                else
                {
                    locationPersonalName.Background = GetDrawable(Resource.Drawable.TextEditing);
                }
            };


            locationDisplayer = FindViewById <TextView>(Resource.Id.locationDisplayer);

            formatedTime = FindViewById <TextView>(Resource.Id.formatedTime);

            btnGetLocation = FindViewById <Button>(Resource.Id.getLocation);

            todayLocations = FindViewById <Button>(Resource.Id.todayLocations);

            mapLauncher = FindViewById <Button>(Resource.Id.mapLauncher);

            saveLocation = FindViewById <Button>(Resource.Id.saveLocation);

            locationLayout = FindViewById <LinearLayout>(Resource.Id.locationLayout);

            progessLayout = FindViewById <LinearLayout>(Resource.Id.progessLayout);


            //Messages.ToastMessage($"{accessData.isConnected}");

            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessCoarseLocation) != 0 || ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) != 0)
            {
                RequestPermissions(new string[] {
                    Manifest.Permission.AccessCoarseLocation,
                    Manifest.Permission.AccessFineLocation
                }, 2);
            }

            saveLocation.Click += (s, e) =>
            {
                LocationsRepository.UpdateTable(locationPersonalName.Text);
            };

            btnGetLocation.Click += (s, e) =>
            {
                btnGetLocation.Enabled = false;
                xamEssF.GetLocation(locationDisplayer, locationLayout, progessLayout, btnGetLocation);
            };

            mapLauncher.Click += delegate
            {
                xamEssF.navigateToMap();
            };
            todayLocations.Click += delegate
            {
                if (LocationsRepository.GetLastLocation() != null)
                {
                    Messages.ToastMessage($"Last location id={LocationsRepository.GetLastLocation()._id}");
                }
                else
                {
                    Messages.ToastMessage("No location in the location table");
                }

                intent = new Intent(this, typeof(locationActivity));

                StartActivity(intent);
            };


            passeword.TextChanged += delegate { passeword.Background = GetDrawable(Resource.Drawable.TextEditing); };
            email.TextChanged     += delegate { email.Background = GetDrawable(Resource.Drawable.TextEditing); };

            logIn.Click += (s, e) => {
                if (db.isLogedIn(email.Text, passeword.Text))
                {
                    dialog.Dismiss();
                    Messages.ToastMessage("LogIn successfully");
                }

                else
                {
                    email.Background     = GetDrawable(Resource.Drawable.ErrorBackground);
                    passeword.Background = GetDrawable(Resource.Drawable.ErrorBackground);
                    Log.Info("info", "LogIn Error");
                    Messages.ToastMessage("Email or passeword incorrect");
                };
            };
        }