コード例 #1
0
        private async void LoadAll()
        {
            try
            {
                //FindViewById<CardView>(Resource.Id.ReloadTest).Visibility = Android.Views.ViewStates.Gone;
                Tickets = await new AnsweredService().GetIncorrectTicketAsync(GetTicketBy.All);

                var meneger = new LinearLayoutManager(this)
                {
                    Orientation = LinearLayoutManager.Vertical
                };
                Recycler.SetLayoutManager(meneger);

                Recycler.SetAdapter(new EndUiAdapter(Tickets));
            }
            catch (SQLite.SQLiteException)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("სტატისტიკა");
                alert.SetMessage("ჯერ გაიარე ტესტი");

                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
コード例 #2
0
        private async void Load(GetStatisticsBy by)
        {
            try
            {
                var statistic = await GetStatisticsService.GetStatisticAsync(by);

                Statistic = statistic.Select(o => new Entry(o.Correct)
                {
                    Color      = SKColor.Parse("#FF0000"),
                    Label      = string.Format("{0}.{1}.{2} {3}:{4}", o.Time.Day, o.Time.Month, o.Time.Year, o.Time.Hour, o.Time.Minute),
                    ValueLabel = (o.Correct + o.Incorrect).ToString()
                }).ToList();

                Chart.Chart = new LineChart {
                    Entries = Statistic, BackgroundColor = SKColor.Parse("#000000")
                };
            }
            catch (SQLite.SQLiteException)
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("სტატისტიკა");
                alert.SetMessage("ჯერ გაიარე ტესტი");

                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
コード例 #3
0
        protected override void OnResume()
        {
            base.OnResume();
            Task startupWork = new Task(() =>
            {
                Thread.Sleep(SplashTimeOut);
            });

            startupWork.ContinueWith(t =>
            {
                if (IsConnecting() == true)
                {
                    var prefs          = Application.Context.GetSharedPreferences("WeClip", FileCreationMode.Private);
                    string UserName    = prefs.GetString("LoginUserName", null);
                    string Password    = prefs.GetString("Password", null);
                    string tokenValue  = prefs.GetString("Access_Token", null);
                    string userID      = prefs.GetString("UserID", null);
                    bool RegisterEmail = prefs.GetBoolean("RegisterEmail", false);
                    bool RegisterPhone = prefs.GetBoolean("RegisterPhone", false);

                    if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password))
                    {
                        if (RegisterEmail == true)
                        {
                            StartActivity(new Intent(Application.Context, typeof(AddUserName)));
                            return;
                        }
                        else
                        if (RegisterEmail == true)
                        {
                            StartActivity(new Intent(Application.Context, typeof(AddUserName)));
                            return;
                        }
                        else
                        {
                            new LogInWeClip(UserName, Password, this).Execute();
                        }
                    }
                    else
                    {
                        StartActivity(new Intent(Application.Context, typeof(LoginActivity)));
                    }
                }
                else
                {
                    Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                    alert.SetInverseBackgroundForced(true);
                    alert.SetTitle("No Internet connection");
                    alert.SetMessage("Check your Internet connection");
                    alert.SetPositiveButton("CLOSE", (senderAlert, args) =>
                    {
                        alert.Dispose();
                        this.Finish();
                    });
                    Android.App.Dialog dialog = alert.Create();
                    dialog.Show();
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
            startupWork.Start();
        }
コード例 #4
0
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			var root = inflater.Inflate (Resource.Layout.fragment_friends, container, false);
           

			var friendGrid = root.FindViewById<GridView> (Resource.Id.grid);
			friendGrid.ItemClick += FriendClicked;
			friendGrid.Adapter = new FriendAdapter (Activity, viewModel);

			friendGrid.LongClickable = true;
			friendGrid.ItemLongClick += (sender, e) => 
			{

				var friend = viewModel.Friends[e.Position];
				viewModel.ExecuteFlagFriendCommand(friend.FriendId, friend.Name);
			};

			var fab = root.FindViewById<FloatingActionButton> (Resource.Id.fab);
			fab.AttachToListView (friendGrid);
			fab.Click += (sender, e) => {
				var builder = new Android.Support.V7.App.AlertDialog.Builder (Activity);
				builder.SetTitle (Resource.String.add_friend)
					.SetItems (new [] {
					Resources.GetString (Resource.String.add_by_email),
					Resources.GetString (Resource.String.pick_contact)
				}, this);
				builder.Create ().Show ();
			};

			refresher = root.FindViewById<SwipeRefreshLayout> (Resource.Id.refresher);
			refresher.Refresh += (sender, e) => viewModel.ExecuteLoadFriendsCommand ();


			return root;
		}
コード例 #5
0
        private void MAdapter_ItemClick1(object sender, int e)
        {
            // alert dialog for ItemClick event
            Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this);
            // using this disable array of menu options - good for Ok/Cancel version
            builder.SetMessage(GetString(Resource.String.mainActivity_mAdapterItemClick_message));

            builder.SetPositiveButton(GetString(Resource.String.mainActivity_mAdapterItemClick_positiveButton), (sender2, e2) =>
            {
                // call Property in UserAlertActivity to pass data across (newsObject)
                UserAlertsActivity.SelectedNewsObject_PassedFrom_MainActivity = (newsObjectDisplayList[e]);

                // call intent to start next activity
                Intent intent = new Intent(this, typeof(UserAlertsActivity));
                StartActivity(intent);
            });

            builder.SetNegativeButton(GetString(Resource.String.mainActivity_mAdapterItemClick_negativeButton), (sender2, e2) =>
            {
                Log.Debug("DEBUG", "Cancel clicked");
            });

            var alert = builder.Create();

            alert.Show();
        }
コード例 #6
0
        private void AppearDateDialog()
        {
            DatePickerDialog datePickerDialog = new DatePickerDialog(this);

            Android.Support.V7.App.AlertDialog         datePickerAlertDialog = null;
            Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this)
                                                                 .SetTitle("Invalid Date")
                                                                 .SetMessage("Too early to create an account. Please select an earlier date under 30 days.")
                                                                 .SetPositiveButton("Ok", (object s, Android.Content.DialogClickEventArgs dialogClickEventArgs) =>
            {
                datePickerAlertDialog.Show();
            });

            datePickerAlertDialog = builder.Create();

            datePickerDialog.DateSet += (s, e) =>
            {
                if (e.Date > DateTime.Now.AddDays(30))
                {
                    datePickerAlertDialog.Show();
                }
                else
                {
                    ViewModel.ServiceStartDate = e.Date;
                    DateButton.Text            = e.Date.ToShortDateString();
                }
            };

            datePickerDialog.Show();
        }
コード例 #7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Company);
            ParseAndReturnAsync();
            LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this);
            View           popup = layoutInflaterAndroid.Inflate(Resource.Layout.HistoryWindowU, null);

            Android.Support.V7.App.AlertDialog.Builder alertDialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertDialogbuilder.SetView(popup);

            var userContent = popup.FindViewById <EditText>(Resource.Id.History_description);

            alertDialogbuilder.SetCancelable(false)
            .SetPositiveButton("Dodaj", delegate
            {
                Toast.MakeText(this, "Wysłano", ToastLength.Long).Show();
            }
                               ).SetNegativeButton("Zamknij", delegate
            {
                alertDialogbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogbuilder.Create();
            if (this.Intent.GetBooleanExtra("Show", true))
            {
                alertDialogAndroid.Show();
            }
        }
コード例 #8
0
        public void activateGodmode()
        {
            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.GiftCode, null);

            Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertbuilder.SetView(view);

            String code = "";

            var input = view.FindViewById <EditText>(Resource.Id.editText);

            alertbuilder.SetCancelable(false)
            .SetPositiveButton("Choose", delegate
            {
                code = input.Text;
                if (code == "godmode")
                {
                    godmode = !godmode;
                }
                Console.WriteLine(code + " " + godmode);
                canvasView.Invalidate();
            })
            .SetNegativeButton("Cancel", delegate
            {
                alertbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
            dialog.Show();
        }
コード例 #9
0
        private void goMain(object sender, EventArgs e)
        {
            //ListView_SpacePart_Activity listView_SpacePart_Activity = new ListView_SpacePart_Activity();
            alertDiag.Dispose();
            if (InputCountEditText.Text == "")
            {
                #region alert
                alertDiag = new Android.Support.V7.App.AlertDialog.Builder(Activity);
                alertDiag.SetTitle("ผู้ใช้งานยังไม่ได้กรอกข้อมูล");
                alertDiag.SetMessage("กรุณาตรวจสอบการกรอกข้อมูลที่ถูกต้อง !");

                Dialog diag = alertDiag.Create();
                diag.Show();
                #endregion
            }
            else
            {
                this.updateStock();
                this.checkUpdate();

                //listView_SpacePart_Activity.Remoteitem(spaceParts , position);
                spaceParts.RemoveAt(position);
                var m_listSpaceLayout = new Intent(Activity, typeof(ListView_SpacePart_Activity));
                m_listSpaceLayout.PutExtra("Object_Event", JsonConvert.SerializeObject(spaceParts));
                this.StartActivity(m_listSpaceLayout);
            }
        }
コード例 #10
0
 /// <summary>
 /// Called when a shared preference is changed, added, or removed.
 /// </summary>
 /// <param name="sharedPreferences">Changed shared preference.</param>
 /// <param name="key">The key of the preference that was changed, added, or removed.</param>
 public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
 {
     // if language is changed
     if (key == "list_languages")
     {
         // get new language value
         string newLanguageValue = sharedPreferences.GetString(key, "auto");
         // if new language differs from the previous language
         if (newLanguageValue != _previousLanguageValue)
         {
             // notify user that application must be restarted
             // create the dialog builder
             using (Android.Support.V7.App.AlertDialog.Builder dialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this))
             {
                 // create a button
                 dialogBuilder.SetPositiveButton(Resource.String.ok_button, (EventHandler <DialogClickEventArgs>)null);
                 // create a dialog
                 Android.Support.V7.App.AlertDialog dialog = dialogBuilder.Create();
                 // set dialog title
                 dialog.SetTitle(Resources.GetString(Resource.String.app_name));
                 // set dialog message
                 dialog.SetMessage(Resources.GetString(Resource.String.language_change_message));
                 // show on screen
                 dialog.Show();
             }
             _previousLanguageValue = newLanguageValue;
         }
     }
 }
コード例 #11
0
            protected override void OnPostExecute(JsonResult result)
            {
                base.OnPostExecute(result);
                p.Dismiss();

                if (result != null)
                {
                    if (result.Success == true)
                    {
                        Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(context);
                        builder.SetTitle("Success");
                        builder.SetMessage("Event Profile Photo Updated.");

                        builder.SetPositiveButton("OK", (senderAlert, args) =>
                        {
                            context.Finish();
                        });
                        Dialog dialog = builder.Create();
                        dialog.Show();
                    }
                    else
                    {
                        Toast.MakeText(context, "Error.", ToastLength.Long).Show();
                    }
                }
            }
コード例 #12
0
        private void AuthButtonOnClick(object sender, EventArgs e)
        {
            var isAuthAppInstalled = IsAccountAuthenticatorAppInstalled();

            if (isAuthAppInstalled)
            {
                var accountPickerIntent = default(Intent);
                if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
                {
                    accountPickerIntent =
                        AccountManager.NewChooseAccountIntent(null, null, new[] { AccountType }, null, null, null, null);
                }
                else
                {
                    var accounts = AccountManager.Get(this).GetAccounts();
                    accountPickerIntent =
                        AccountManager.NewChooseAccountIntent(null, accounts, new[] { AccountType }, false, null, null, null, null);
                }

                StartActivityForResult(accountPickerIntent, AccountRequestCode);
            }
            else
            {
                var adb = new Android.Support.V7.App.AlertDialog.Builder(this);
                adb.SetTitle("Attention!");
                adb.SetMessage("This app requires the Account Authenticator! Please install it before continuing...");
                adb.SetPositiveButton("OK", (s, a) => { });
                var dialog = adb.Create();
                dialog.Show();
            }
        }
コード例 #13
0
        /// <summary>
        /// Starts barcode scanning.
        /// </summary>
        internal void ScanBarcode()
        {
            Intent scanIntent = new Intent("com.vintasoft.barcodescanner.SCAN");

            try
            {
                // open the Vintasoft Barcode Scanner application
                StartActivityForResult(scanIntent, 0);
            }
            // if Vintasoft Barcode Scanner application is not found
            catch (ActivityNotFoundException)
            {
                using (Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this))
                {
                    builder.SetPositiveButton(Resource.String.ok_button, ScannerDialogPositiveButton_Clicked);
                    builder.SetNegativeButton(Resource.String.cancel_button, (EventHandler <DialogClickEventArgs>)null);
                    builder.SetTitle(Resource.String.app_name);
                    builder.SetMessage(Resource.String.vintasoft_scanner_not_found_message);

                    // create dialog
                    Android.Support.V7.App.AlertDialog dialog = builder.Create();
                    // show on screen
                    dialog.Show();
                }
            }
        }
コード例 #14
0
ファイル: GameLogic.cs プロジェクト: kjdobrien/Dartboard
        //public static void ShowWinDialog(Context c, Player winner, List<Player> players,  Intent intent,  int leg, int touchCount, int startScore, int numLegs)
        //{
        //    // restart the game
        //    var alert = new Android.Support.V7.App.AlertDialog.Builder(c);
        //    if (winner.legsWon >= (numLegs + 1)/2)
        //    {
        //        alert.SetTitle("Player " + winner.name + " wins the match!");
        //        alert.SetNeutralButton("Start Over", (senderAlert, args) => { c.StartActivity(intent); });
        //    }
        //    else
        //    {
        //        alert.SetTitle("Player " + winner.name + " wins the leg!");
        //        // move to next set/leg or start new game
        //        alert.SetPositiveButton("Move to next leg", (senderAlert, args) => { MoveToNextLeg(leg, players, touchCount, startScore); });
        //        // neutral


        //    }
        //    alert.SetNegativeButton("Back to setup", (senderAlert, args) => { c.StartActivity(typeof(CreateGame)); });
        //    Dialog dialog = alert.Create();
        //    dialog.Show();


        //}

        public static void ShowWinDialog(Context c, Player winner, List <Player> players, Intent intent, int leg, int startScore, int numLegs, Activity activity)
        {
            // restart the game
            var alert = new Android.Support.V7.App.AlertDialog.Builder(c);

            if (winner.legsWon >= (numLegs + 1) / 2)
            {
                alert.SetTitle("Player " + winner.name + " wins the match!");
                alert.SetNeutralButton("New Game", (senderAlert, args) => { MoveToNextLeg(0, players, startScore, activity); });
            }
            else
            {
                alert.SetTitle("Player " + winner.name + " wins the leg!");
                // move to next set/leg or start new game
                alert.SetPositiveButton("Move to next leg", (senderAlert, args) => { MoveToNextLeg(leg, players, startScore, activity); });
            }
            alert.SetNegativeButton("Back to setup", (senderAlert, args) => {
                // Clear the contents of the save file
                HelperFunctions.DeleteSaveFile(Constants.PerviousGameFile);
                c.StartActivity(typeof(CreateGame));
            });
            Dialog dialog = alert.Create();

            dialog.Show();
        }
コード例 #15
0
        private void Win()
        {
            if (_currentSymbolGamer == GameButtonStates.Circle)
            {
                iScoreOfCirclePlayer++;
                _circleTextView.Text = GetScoreText(GameButtonStates.Circle, iScoreOfCirclePlayer);
            }
            else
            {
                iScoreOfCrossPlayer++;
                _crossTextView.Text = GetScoreText(GameButtonStates.Cross, iScoreOfCrossPlayer);
            }

            _resultTextView.Text       = "Wygrał: " + GetWinnerNameText();
            _resultTextView.Visibility = ViewStates.Visible;

            SaveStateGameToDB();
            PlayEndGameBeep();

            using (var alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this))
            {
                string tieTitleString = "Czy chcesz zagrać ponownie:";
                Android.Support.V7.App.AlertDialog myCustomDialog = null;

                alertDialogBuilder.SetTitle(tieTitleString);
                alertDialogBuilder.SetPositiveButton("Tak", OkAction);
                alertDialogBuilder.SetNegativeButton("Nie", CancelAction);
                myCustomDialog = alertDialogBuilder.Create();
                myCustomDialog.Show();
            }
        }
コード例 #16
0
        /// <summary>
        /// Open a popup to enter a new recipient
        /// </summary>
        private void AddRecipientFromPopupButton_Click(object sender, EventArgs e)
        {
            Android.Support.V7.App.AlertDialog addRecipientDialog = null;
            var addRecipientBuilder = new Android.Support.V7.App.AlertDialog.Builder(this, Resource.Style.Theme_AppCompat_Light_Dialog);
            var view = LayoutInflater.Inflate(Resource.Drawable.AddRecipient, null);

            addRecipientBuilder.SetTitle(Resource.String.alertSOS_popupTitle);
            addRecipientBuilder.SetPositiveButton(Resource.String.alertSOS_popupPositive, new EventHandler <DialogClickEventArgs>((o, ev) => { }));
            addRecipientBuilder.SetNegativeButton(Resource.String.alertSOS_popupNegative, new EventHandler <DialogClickEventArgs>((o, ev) =>
            {
                addRecipientDialog.Dismiss();
            }));

            addRecipientBuilder.SetView(view);
            addRecipientDialog            = addRecipientBuilder.Create();
            addRecipientDialog.ShowEvent += (ee, oo) =>
            {
                var button = addRecipientDialog.GetButton((int)Android.Content.DialogButtonType.Positive);
                button.Click += (eee, ooo) =>
                {
                    var displayNameEditText = view.FindViewById <EditText>(Resource.Id.addRecipient_contact);
                    var emailEditText       = view.FindViewById <EditText>(Resource.Id.addRecipient_email);

                    // empty display name
                    if (string.IsNullOrEmpty(displayNameEditText.Text))
                    {
                        displayNameEditText.Error = Resources.GetString(Resource.String.alertSOS_popupEmptyField);
                    }
                    // empty email
                    else if (string.IsNullOrEmpty(emailEditText.Text))
                    {
                        emailEditText.Error = Resources.GetString(Resource.String.alertSOS_popupEmptyField);
                    }
                    // invalide email
                    else if (!Android.Util.Patterns.EmailAddress.Matcher(emailEditText.Text).Matches())
                    {
                        emailEditText.Error = Resources.GetString(Resource.String.alertSOS_popupEmail);
                    }
                    // add the contact
                    else
                    {
                        displayNameEditText.Error = null;
                        emailEditText.Error       = null;

                        App.Locator.Alert.LsRecipients.Add(new AlertRecipientDTO
                        {
                            DisplayName = displayNameEditText.Text,
                            Email       = emailEditText.Text
                        });

                        _selectedContact = new Contact {
                            DisplayName = displayNameEditText.Text, Email = emailEditText.Text
                        };
                        AlertRecipientLayout.AddChild(_selectedContact);
                        addRecipientDialog.Dismiss();
                    }
                };
            };
            addRecipientDialog.Show();
        }
コード例 #17
0
        private void InitializeLocationManager()
        {
            // Obtenir Location Manager et vérifier pour GPS et réseau des services de localisation
            _locationManager = (LocationManager)GetSystemService(LocationService);
            if (!_locationManager.IsProviderEnabled(LocationManager.GpsProvider) || !_locationManager.IsProviderEnabled(LocationManager.NetworkProvider))

            {
                // Construire la boîte de dialogue d' alerte
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("Message Mob1Taxi");
                alert.SetMessage("Vous devez activez votre GPS pour la géolocalisation ! Voulez vous activez le GPS ?");
                alert.SetPositiveButton("OUI", (senderAlert, args) =>

                {
                    // Afficher les paramètres de localisation lorsque l'utilisateur reconnaît la boîte de dialogue d' alerte
                    var intent = new Intent(Android.Provider.Settings.ActionLocationSourceSettings);

                    StartActivity(intent);
                });
                alert.SetNegativeButton("NON", (senderAlert, args) =>
                {
                    // FinishAffinity TUE TOUTE LES ACTIVITY QUI YA EN DESSOUS
                    //SA EVITE LA PILE DES ACTIVITY SI YA TROP DE VAS ET VIEN ENTRE LES ACTIVITY
                    FinishAffinity();
                });
                Dialog dialog = alert.Create();
                dialog.Show();
                Log.Debug(TAG, "InitializeLocationManager" + " " + LocationManager.GpsProvider + " " + LocationManager.NetworkProvider);
            }
        }
コード例 #18
0
        void Call(string number)
        {
            //Check to see if any permission in our group is available, if one, then all are
            const string permission = Manifest.Permission.CallPhone;

            if (CheckSelfPermission(permission) == (int)Permission.Granted)
            {
                var uri    = Android.Net.Uri.Parse($"tel:{number}");
                var intent = new Intent(Intent.ActionCall, uri);
                StartActivity(intent);
                return;
            }

            //need to request permission
            if (ShouldShowRequestPermissionRationale(permission))
            {
                //Explain to the user why we need to read the contacts
                var dialog = new Android.Support.V7.App.AlertDialog.Builder(this, Resource.Style.MyAlertDialogStyle);
                dialog.SetTitle("Ruhusa");
                dialog.SetMessage("Unahitaji kuipa ruhusa app kupiga simu");
                dialog.SetPositiveButton("OK", (sender, e) => { RequestPermissions(PhonePermissions, PERMISSION_REQUEST_CODE); });
                dialog.Create().Show();
                return;
            }

            //Finally request permissions with the list of permissions and Id
            RequestPermissions(PhonePermissions, PERMISSION_REQUEST_CODE);
        }
コード例 #19
0
        /// <summary>
        /// Create a new instance of class ProgressBarDialog
        /// </summary>
        /// <param name="title">Title of ProgressBar Dialog</param>
        /// <param name="content">Content of ProgressBar Dialog</param>
        /// <param name="cancelable">Set if ProgressBar Dialog can be canceled</param>
        /// <param name="neutralEventHandler">Neutral event action</param>
        /// <param name="cancelEventHandler">Cancel event action</param>
        /// <param name="ctx">Context of current Activity</param>
        /// <param name="okButtonText">OkButton text</param>
        /// <param name="neutralButtonText">NeutralButton text</param>
        /// <param name="cancelButtonText">CancelButton text</param>
        /// <param name="okEventHandler">Ok event action</param>
        public ProgressBarDialog(string title, string content, Context ctx, bool cancelable = true,
                                 string okButtonText      = "Ok", EventHandler <DialogClickEventArgs> okEventHandler = null,
                                 string neutralButtonText = "Irresolute", EventHandler <DialogClickEventArgs> neutralEventHandler = null,
                                 string cancelButtonText  = "Cancel", EventHandler <DialogClickEventArgs> cancelEventHandler      = null)
        {
            View view = InitUi(ctx);

            var contentTv = view.FindViewById <TextView>(Resource.Id.loading_msg);

            contentTv.Text = content;
            var builder = new AlertDialog(ctx);

            builder.SetView(view);
            builder.SetTitle(title);

            if (okEventHandler != null)
            {
                builder.SetPositiveButton(okButtonText, okEventHandler);
            }
            if (neutralEventHandler != null)
            {
                builder.SetNeutralButton(neutralButtonText, neutralEventHandler);
            }
            if (cancelEventHandler != null)
            {
                builder.SetNegativeButton(cancelButtonText, cancelEventHandler);
            }
            builder.SetCancelable(cancelable);
            _dialog = builder.Create();
            Window  = _dialog.Window;
            Window.SetBackgroundDrawableResource(Resource.Color.colorPrimaryDark);
        }
コード例 #20
0
        private void AddTimeToOutputList(Time t)
        {
            LayoutInflater inflater     = (LayoutInflater)BaseContext.GetSystemService(Context.LayoutInflaterService);
            View           timeView     = inflater.Inflate(Resource.Layout.single_output_layout, null);
            TextView       textOutput   = timeView.FindViewById <TextView>(Resource.Id.outText);
            Button         removeButton = timeView.FindViewById <Button>(Resource.Id.removeButton);

            outputContainer.AddView(timeView, outputContainer.IndexOfChild(listButtonsGrid));

            textOutput.Text = string.Format("{0}\n{1}", t.SavedTime.ToLongDateString(), t.SavedTime.ToShortTimeString());

            removeButton.Click += delegate
            {
                var alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("Confirmation");
                alert.SetMessage("Do you really want to permanently delete this recorded time ?");

                alert.SetPositiveButton("YES", delegate
                {
                    outputContainer.RemoveView(timeView);
                    //await client.GetTable<RegisteredTime>().DeleteAsync(t);
                    registeredTimesDB.Delete <Time>(t.Id);
                    Toast.MakeText(this, $"The {t.SavedTime.ToLongTimeString()} of {t.SavedTime.ToShortDateString()} has been deleted.", ToastLength.Long).Show();
                });
                alert.SetNegativeButton("NO", delegate { return; });
                alert.Create().Show();
            };
            UpdateGraphicsLayout();
        }
コード例 #21
0
        //private async Task UpdatePackage(string packageName)
        //{
        //    var credentials = new NetworkCredential("logon", "*logon*");
        //    var _c = new WebDAVClient.Client(credentials);
        //    _c.Server = @"https://nextcloud.espackeuro.com";
        //    _c.BasePath = @"/remote.php/dav/files/logon/Android/APK/";
        //    var _local = string.Format("{0}/{1}.apk", Android.OS.Environment.ExternalStorageDirectory.Path, packageName);
        //    try
        //    {
        //        var stream = await _c.Download(String.Format("{0}/{1}.apk", _c.BasePath, packageName));
        //        using (FileStream fs = File.OpenWrite(_local))
        //            await stream.CopyToAsync(fs);

        //        //var items = await _c.List();
        //        //foreach (var item in items)
        //        //{
        //        //    var stream = await _c.Download(item.Href);
        //        //    using (FileStream fs = File.OpenWrite(string.Format(string.Format("{0}/{1}", Android.OS.Environment.ExternalStorageDirectory.Path, item.DisplayName))))
        //        //        await stream.CopyToAsync(fs);
        //        //}
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.WriteLine(ex.Message);
        //    }
        //    var intent = new Intent(Intent.ActionView);
        //    intent.SetDataAndType(Android.Net.Uri.FromFile(new Java.IO.File(_local)), "application/vnd.android.package-archive");
        //    intent.SetFlags(ActivityFlags.NewTask);
        //    StartActivity(intent);
        //}
        private async Task UpdatePackageURL(string packageName)
        {
            using (var c = new WebClient())
            {
                var URL    = string.Format("http://portal.espackeuro.com/{0}.apk", packageName);
                var _local = string.Format("{0}/{1}.apk", Android.OS.Environment.ExternalStorageDirectory.Path, packageName);
                try
                {
                    await c.DownloadFileTaskAsync(URL, _local);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                if (!File.Exists(_local))
                {
                    var builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                    builder.SetTitle("ERROR");
                    builder.SetIcon(Android.Resource.Drawable.IcDialogAlert);
                    builder.SetMessage("Error: the file was not downloaded correctly, the app will not be updated.");
                    builder.SetNeutralButton("OK", delegate
                    {
                        Intent intnt = new Intent();
                        intnt.PutExtra("Result", "OK");
                        SetResult(Result.Ok, intnt);
                        Finish();
                    });
                    RunOnUiThread(() => { builder.Create().Show(); });
                }
                var intent = new Intent(Intent.ActionView);
                intent.SetDataAndType(Android.Net.Uri.FromFile(new Java.IO.File(_local)), "application/vnd.android.package-archive");
                intent.SetFlags(ActivityFlags.NewTask);
                StartActivity(intent);
            }
        }
コード例 #22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.NoInternet);

            Android.Support.V7.App.AlertDialog.Builder dialog = new Android.Support.V7.App.AlertDialog.Builder(this);
            dialog.SetMessage(GetString(Resource.String.NoInternet));
            dialog.SetNeutralButton("OK", this);
            dialog.Create().Show();

            MainToolbar    = FindViewById <SupportToolBar>(Resource.Id.toolbar);
            TryAgainButton = FindViewById <Button>(Resource.Id.RetryButton);
            LoadingPanel   = FindViewById <View>(Resource.Id.loadingPanel);
            NoInternetText = FindViewById <TextView>(Resource.Id.NoInternetText);

            LoadingPanel.Visibility = ViewStates.Invisible;

            if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                TryAgainButton.SetBackgroundResource(Resource.Color.button_ripple);
            }

            MainToolbar.SetLogo(Resource.Drawable.ic_cloud_queue_white_24dp);
            MainToolbar.Title            = "Merit Money";
            MainToolbar.TitleMarginStart = AdditionalFunctions.ConvertDpToPx(40);

            TryAgainButton.Click += TryAgainButton_Click;
        }
コード例 #23
0
            public void DialogMenager(Context cc)
            {
                var builder = new Android.Support.V7.App.AlertDialog.Builder(cc, Resource.Style.DarkThemeDialog);

                //var dialogview =  LayoutInflater.Inflate(Resource.Layout.AddFriendDialog, null);
                builder.SetView(Resource.Layout.AddFriendDialog);

                builder.SetPositiveButton("AKCEPTUJ", (EventHandler <DialogClickEventArgs>)null);
                builder.SetNegativeButton("ODRZUÆ", (EventHandler <DialogClickEventArgs>)null);
                var dialog = builder.Create();

                dialog.Show();
                var PositiveButton = dialog.GetButton((int)DialogButtonType.Positive);

                PositiveButton.Click += delegate
                {
                    dialog.Cancel();
                };
                var NegativeButton = dialog.GetButton((int)DialogButtonType.Positive);

                NegativeButton.Click += delegate
                {
                    dialog.Cancel();
                };
            }
コード例 #24
0
        /// <summary>
        /// Show Reaction dialog when user long click on react button
        /// </summary>
        public void ClickDialog(CommentReplyClickEventArgs postData)
        {
            try
            {
                PostData = postData;

                //Show Dialog With 6 React
                Android.Support.V7.App.AlertDialog.Builder dialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(MainContext);

                //Irrelevant code for customizing the buttons and title
                LayoutInflater inflater   = (LayoutInflater)MainContext.GetSystemService(Context.LayoutInflaterService);
                View           dialogView = inflater.Inflate(Resource.Layout.XReactDialogLayout, null);

                InitializingReactImages(dialogView);
                ClickImageButtons();

                dialogBuilder.SetView(dialogView);
                MReactAlertDialog = dialogBuilder.Create();
                MReactAlertDialog.Window.SetBackgroundDrawableResource(MReactDialogShape);

                Window window = MReactAlertDialog.Window;
                window.SetLayout(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

                MReactAlertDialog.Show();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #25
0
ファイル: MainActivity.cs プロジェクト: jradlov/AlertDialog_1
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            Button btn1 = FindViewById <Button>(Resource.Id.button1);
            Button btn2 = FindViewById <Button>(Resource.Id.button2);

            btn1.Click += delegate {
                Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this);
                builder.SetTitle("Title");

                builder.SetMultiChoiceItems(sports, booleans, OnCheckedItems);
                builder.SetPositiveButton("Done", OkAction);

                var alert = builder.Create();
                alert.Show();
            };

            btn2.Click += delegate {
                Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                builder.SetTitle("Choose one:");
                builder.SetItems(sports, ChooseItem);
                builder.SetNegativeButton("Cancel", CancelAction);
                var alert = builder.Create();
                alert.Show();
            };
        }
コード例 #26
0
        protected override Dialog OnCreateDialog(int id, Bundle args)
        {
            switch (id)
            {
            case AutoDiscoverDialog:
            {
                var builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                builder.SetIconAttribute(Android.Resource.Attribute.AlertDialogIcon);
                builder.SetTitle(Resource.String.list_dialog_title);
                builder.SetSingleChoiceItems(Resource.Array.list_dialog_items, 0, ListClicked);

                builder.SetPositiveButton(Resource.String.dialog_login, OkClicked);
                builder.SetNegativeButton(Resource.String.dialog_cancel, CancelClicked);

                return(builder.Create());
            }

            case DeviceManualDialog:
            {
                var customView = LayoutInflater.Inflate(Resource.Layout.AddDeviceManualDialog, null);

                var builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                builder.SetView(customView);
                builder.SetPositiveButton(Resource.String.dialog_login, OkClicked);
                builder.SetNegativeButton(Resource.String.dialog_cancel, CancelClicked);

                return(builder.Create());
            }
            }

            return(base.OnCreateDialog(id, args));
        }
コード例 #27
0
        public void onDeleteMethodCallback(string expenseID)
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                Toast.MakeText(this, "Please check your internet connection", ToastLength.Long).Show();
                return;
            }
            Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
            // AlertDialog alert = dialog.Create();
            alert.SetTitle("Delete");
            alert.SetMessage("Are you sure you wan't to delete this?");
            // alert.SetIcon(Resource.Drawable.alert);
            alert.SetPositiveButton("YES", (c, ev) =>
            {
                DocumentReference docref = database.Collection("ExpenseTable").Document(expenseID);
                docref.Delete();
                bottomAppBar.TranslationY = 0.0f;
                fab.TranslationY          = -84.0f;
                FetchExpensesTableForMonthYear();
            });
            alert.SetNegativeButton("CANCEL", (c, ev) => { });
            Dialog dialog = alert.Create();

            dialog.Show();
        }
コード例 #28
0
        private async void Queue_Btn_Click(object sender, EventArgs e)
        {
            await get_Queue_Size();

            if (already_queued)
            {
                Toast.MakeText(this, "You are already in the Queue for " + cur_restaurant.name, ToastLength.Short).Show();
            }
            else
            {
                LayoutInflater layoutInflater = LayoutInflater.From(this);
                View           view           = layoutInflater.Inflate(Resource.Layout.Queue_dialog_box, null);
                Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
                alertbuilder.SetView(view);

                party_size = view.FindViewById <EditText>(Resource.Id.party_size);
                view.FindViewById <TextView>(Resource.Id.positionTextView).Text += cur_queue_size;

                alertbuilder.SetCancelable(false).SetPositiveButton("Queue Up", QueueUp)
                .SetNegativeButton("Cancel", delegate
                {
                    alertbuilder.Dispose();
                });
                Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
                dialog.Show();
            }
        }
コード例 #29
0
        private void button_click(object sender, EventArgs e)
        {
            if (ValidateDate().Equals(true))
            {
                client = new WebClient();
                uri    = new Uri("http://" + ip + "/rescheduleBooking.php");
                NameValueCollection parameter = new NameValueCollection();
                string id = Intent.GetStringExtra("idBooking");
                Console.WriteLine("HERE");
                Console.WriteLine("Intent: " + Intent.GetStringExtra("idBooking"));
                Console.WriteLine("ID: " + id);

                parameter.Add("id", id);
                parameter.Add("adate", "2018/" + amonth + "/" + aday);
                parameter.Add("atime", ahour + ":" + amin);
                parameter.Add("service", aservice);

                client.UploadValuesCompleted += Client_UploadValuesCompleted;
                client.UploadValuesAsync(uri, parameter);
            }
            else
            {
                Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);
                alert.SetTitle("Date Past");
                alert.SetMessage("You cannot reschedule to a date that has past");
                alert.SetPositiveButton("OK", (senderAlert, args) =>
                {
                });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
コード例 #30
0
        async void TakePhoto(object sender, System.EventArgs e)
        {
            string dpPath = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ScoutingApp.db3");
            var    db     = new SQLiteConnection(dpPath);

            db.CreateTable <ISTable>();
            ISTable tbl = new ISTable();

            await CrossMedia.Current.Initialize();


            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                PhotoSize          = Plugin.Media.Abstractions.PhotoSize.Medium,
                CompressionQuality = 40,
                Name      = "icon.jpg",
                Directory = "sample"
            });

            if (file == null)
            {
                return;
            }
            byte[] imageArray = System.IO.File.ReadAllBytes(file.Path);



            tbl.Image = imageArray;
            db.Insert(tbl);
            Bitmap bitmap = BitmapFactory.DecodeByteArray(tbl.Image, 0, tbl.Image.Length);

            robotImage.SetImageBitmap(bitmap);


            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.photo_alert, null);

            Android.Support.V7.App.AlertDialog.Builder alertbuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertbuilder.SetView(view);
            var userdata = view.FindViewById <EditText>(Resource.Id.edittextT);


            alertbuilder.SetCancelable(false).SetPositiveButton("Submit", delegate
            {
                int numberT;
                Int32.TryParse(userdata.Text, out numberT);
                tbl.Team = numberT;
                db.Insert(tbl);

                string numstring = tbl.Team.ToString();
                test.Text        = numstring;
                ScoreTest.Text   = tbl.Score.ToString();
                Toast.MakeText(this, "Submit Input: " + userdata.Text, ToastLength.Short).Show();

                //TakePhoto();
            });

            Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
            dialog.Show();
        }
コード例 #31
0
 void Openwait()
 {
     wait = new Android.Support.V7.App.AlertDialog.Builder(this);
     wait.SetTitle("Waiting For Tag...");
     wait.SetMessage("Tap Your Tag To Complete Action...");
     wait.Create().Show();
 }
コード例 #32
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            var p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            var view = new LinearLayout(_context);
            view.LayoutParameters = p;

            var optionHolder = new LinearLayout(_context);
            optionHolder.Orientation = Orientation.Vertical;
            optionHolder.LayoutParameters = p;

            foreach (var option in _options)
            {
                optionHolder.AddView(AddCategoryRow(option));
            }
            var scrollView = new ScrollView(_context);
            scrollView.LayoutParameters = p;
            scrollView.AddView(optionHolder);
            view.AddView(scrollView);

            var dialog = new Android.Support.V7.App.AlertDialog.Builder(_context);
            dialog.SetTitle(_title);
            dialog.SetView(view);
            //dialog.SetNegativeButton("Cancel", (s, a) => { });
            dialog.SetPositiveButton("Ok", (s, a) => { });
            return dialog.Create();
        }
コード例 #33
0
ファイル: MessageDialogs.cs プロジェクト: tamifist/KinderChat
		public void SelectOption (string title, string[] options, Action<int> confirmationAction)
		{
			var builder = new Android.Support.V7.App.AlertDialog.Builder (BaseActivity.CurrentActivity);
			builder.SetTitle (title)
				.SetItems (options, (sender, args) =>
					confirmationAction (args.Which))
				.SetNegativeButton ("Cancel", delegate {
			});
			
			BaseActivity.CurrentActivity.RunOnUiThread (() => builder.Create ().Show ());
		}
コード例 #34
0
ファイル: Dialogs.cs プロジェクト: shaxxx/SignalMeter
 public static Android.Support.V7.App.AlertDialog CreateFullScreenIndeterminateProgressDialog(Context context)
 {
     var builder = new Android.Support.V7.App.AlertDialog.Builder(context);
     builder.SetView(LayoutInflater.From(context).Inflate(Resource.Layout.loader, null));
     //builder.SetCancelable(false);
     builder.SetRecycleOnMeasureEnabled(true);
     builder.SetInverseBackgroundForced(true);
     var dialog = builder.Create();
     dialog.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));
     return dialog;
 }
コード例 #35
0
ファイル: MessageDialogs.cs プロジェクト: tamifist/KinderChat
		public void SendMessage (string message, string title = null)
		{
			var builder = new Android.Support.V7.App.AlertDialog.Builder (BaseActivity.CurrentActivity);
			builder
				.SetTitle (title ?? string.Empty)
				.SetMessage (message)
				.SetPositiveButton (Android.Resource.String.Ok, delegate {
			});             

			BaseActivity.CurrentActivity.RunOnUiThread (() => {
				var alert = builder.Create ();
				alert.Show ();
			});
		}
コード例 #36
0
        public void SendConfirmation(string message, string title, System.Action<bool> confirmationAction)
        {
            var activity = AndroidUtils.Context as Activity;
            var builder = new Android.Support.V7.App.AlertDialog.Builder(activity);
            builder
                .SetTitle(title ?? string.Empty)
                .SetMessage(message)
                .SetPositiveButton(Android.Resource.String.Ok, delegate
                    {
                        confirmationAction(true);
                    }).SetNegativeButton(Android.Resource.String.Cancel, delegate
                        {
                            confirmationAction(false);
                        });

            var alert = builder.Create();
            alert.Show();
        }
コード例 #37
0
ファイル: MessageDialogs.cs プロジェクト: tamifist/KinderChat
		public void SendConfirmation (string message, string title, Action<bool> confirmationAction)
		{
			var builder = new Android.Support.V7.App.AlertDialog.Builder (BaseActivity.CurrentActivity);
			builder
				.SetTitle (title ?? string.Empty)
				.SetMessage (message)
				.SetPositiveButton (Android.Resource.String.Ok, delegate {
				confirmationAction (true);
			})
				.SetNegativeButton (Android.Resource.String.Cancel, delegate {
				confirmationAction (false);
			});


			BaseActivity.CurrentActivity.RunOnUiThread (() => {
				var alert = builder.Create ();
				alert.Show ();
			});
		}
コード例 #38
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            var inflater = (LayoutInflater)_context.GetSystemService(Context.LayoutInflaterService);
            var view = inflater.Inflate(Resource.Layout.NumberPickerDialog, null);
            var numberPicker = view.FindViewById<NumberPicker>(Resource.Id.numberPicker);
            numberPicker.MaxValue = _options.Maximum;
            numberPicker.MinValue = _options.Minimum;
            numberPicker.Value = _options.Initial;

            List<string> values = new List<string>();
            for (var i = _options.Minimum; i <= _options.Maximum; i += 1)
            {
                values.Add((i * _options.Step) + _options.DisplaySuffix);
            }
            numberPicker.SetDisplayedValues(values.ToArray());

            //numberPicker.SetDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);

            var dialog = new Android.Support.V7.App.AlertDialog.Builder(_context);
            dialog.SetTitle(_title);
            dialog.SetView(view);
            dialog.SetNegativeButton("Cancel", (s, a) => { });
            dialog.SetPositiveButton("Ok", (s, a) =>
            {
                if (NumberChanged != null)
                    NumberChanged(this, new NumberPickerValueChanged { CallerKey = _callerKey, Value = numberPicker.Value });
            });

            numberPicker.ValueChanged += (object sender, NumberPicker.ValueChangeEventArgs e) =>
            {
                if (NumberChanged != null)
                    NumberChanged(this, new NumberPickerValueChanged { CallerKey = _callerKey, Value = e.NewVal });
            };

            return dialog.Create();
        }
コード例 #39
0
ファイル: settingsActivity.cs プロジェクト: rifaia/recorder
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            SetContentView(Resource.Layout.settingsLayout);

            var toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.settingsToolbar);
            SetSupportActionBar (toolbar);
            SupportActionBar.Title = "Settings";
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);

            var madview = FindViewById<AdView>(Resource.Id.mysettingadview);
            AdRequest myrqst = new AdRequest.Builder ().AddTestDevice(AdRequest.DeviceIdEmulator).Build ();
            madview.LoadAd (myrqst);

            prefs = Application.Context.GetSharedPreferences ("WingsRecorder", FileCreationMode.Private);

            //			var formattypes = new String[]{ "MP3", "3GP", "AMR" };
            var fileFormatTextview = FindViewById<TextView> (Resource.Id.textViewFileFormat);
            fileFormatTextview.Text = prefs.GetString("FileType", MainActivity.formattypes[0]);
            var fileformatLinLay = FindViewById<LinearLayout> (Resource.Id.linearLayoutFileFormat);
            fileformatLinLay.Click += delegate {
                var builder = new Android.Support.V7.App.AlertDialog.Builder (this);
                builder.SetTitle ("Select File Format")
                    .SetItems(MainActivity.formattypes,
                        new EventHandler<DialogClickEventArgs>(delegate(object sender, DialogClickEventArgs e) {
                            var prefedit = prefs.Edit ();
                            fileFormatTextview.Text = MainActivity.formattypes[e.Which];
                            prefedit.PutString ("FileType", MainActivity.formattypes[e.Which]);
                            prefedit.Commit();
                        }))
                    .SetNegativeButton("Cancel", delegate {
                    });
                builder.Create().Show ();
            };

            //			var audioSourceTypes = new String[]{"Camcorder", "Mic", "Voice Call",
            //				"Voice Communication", "Voice Recognition", "Voice UpLink", "Voice DownLink"};
            var audioSouceTextview = FindViewById<TextView> (Resource.Id.textViewAudioSource);
            audioSouceTextview.Text = prefs.GetString("AudioSource", MainActivity.audioSourceTypes[2]);
            var audiosourceLinLay = FindViewById<LinearLayout> (Resource.Id.linearLayoutAudioSource);
            audiosourceLinLay.Click += delegate {
                var builder = new Android.Support.V7.App.AlertDialog.Builder (this);
                builder.SetTitle ("Select Audio Source")
                    .SetItems (MainActivity.audioSourceTypes,
                        new EventHandler<DialogClickEventArgs>(delegate(object sender, DialogClickEventArgs e) {
                            var prefedit = prefs.Edit ();
                            audioSouceTextview.Text = MainActivity.audioSourceTypes[e.Which];
                            prefedit.PutString ("AudioSource", MainActivity.audioSourceTypes[e.Which]);
                            prefedit.Commit();
                        }))
                    .SetNegativeButton("Cancel", delegate {
                    });
                builder.Create().Show ();
            };

            //			var currentpath = "/storage/emulated/0/";
            //			var f = new File(currentpath).ListFiles();
            //			var files = f.Where(x=>x.IsDirectory).ToList();
            //
            var storagePathLinLay = FindViewById<LinearLayout> (Resource.Id.linearLayoutStorageLocation);
            storagePathLinLay.Click += delegate {
                StartActivity (new Intent (this, typeof(pathChooseActivity)));
            };
        }
コード例 #40
0
ファイル: MessageDialogs.cs プロジェクト: tamifist/KinderChat
		public void AskForString (string message, string title, Action<string> returnString)
		{

			var builder = new Android.Support.V7.App.AlertDialog.Builder (BaseActivity.CurrentActivity);
			//builder.SetIcon (Resource.Drawable.ic_launcher);
			builder.SetTitle (title ?? string.Empty);
			builder.SetMessage (message);
			var view = View.Inflate (BaseActivity.CurrentActivity, Resource.Layout.dialog_ask_text, null);
			builder.SetView (view);

			var textBoxName = view.FindViewById<EditText> (Resource.Id.text);
			builder.SetCancelable (true);
			builder.SetNegativeButton (Android.Resource.String.Cancel, delegate {
				
			});
			builder.SetPositiveButton (Android.Resource.String.Ok, (sender, which) => {

				if (string.IsNullOrWhiteSpace (textBoxName.Text))
					return;

				returnString (textBoxName.Text);
			});

			BaseActivity.CurrentActivity.RunOnUiThread (() => {
				var alertDialog = builder.Create ();
				alertDialog.Show ();
			});


		}
コード例 #41
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = new ListView(this.Activity);

            Console.WriteLine("Max Listings: " + MaxListings + ", Weeks Old: " + WeeksOld);
            feedClient = new CLFeedClient(Query, MaxListings, WeeksOld);
            var connected = feedClient.GetAllPostingsAsync();

            if (!connected)
            {
                var builder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);

                builder.SetTitle("No internet connection")
                    .SetMessage("Please connect and try again")
                    .SetPositiveButton("Ok", delegate
                    {
                        this.FragmentManager.PopBackStack();
                    });

                builder.Create().Show();
            }
            else
            {
                var progressDialog = ProgressDialog.Show(this.Activity, "Please wait...", "Loading listings...", true);
                progressDialog.SetCancelable(true);
                progressDialog.SetCanceledOnTouchOutside(false);
                progressDialog.SetOnCancelListener(this);

                new Thread(new ThreadStart(delegate
                {
                    //HIDE PROGRESS DIALOG
                    feedClient.asyncLoadingComplete += (object sender, EventArgs e) =>
                        {
                            this.Activity.RunOnUiThread(() =>
                            {
                                progressDialog.Hide();
                            });
                            Console.WriteLine("NUM POSTINGS: " + feedClient.postings.Count);
                            feedAdapter = new FeedResultsAdapter(this.Activity, new System.Collections.ObjectModel.ObservableCollection<Models.Posting>(feedClient.postings));
                            this.Activity.RunOnUiThread(() =>
                            {
                                view.Adapter = feedAdapter;
                            });
                        };

                    feedClient.emptyPostingComplete += (object sender, EventArgs e) =>
                    {
                        this.Activity.RunOnUiThread(() => progressDialog.Hide());

                        var builder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);
                        builder.SetTitle("Error loading listings");
                        builder.SetMessage(String.Format("No listings found.{0}Try a different search", System.Environment.NewLine));
                        builder.SetPositiveButton("Ok", delegate
                        {
                            this.FragmentManager.PopBackStack();
                        });

                        this.Activity.RunOnUiThread(() =>
                        {
                            builder.Create().Show();
                        });
                    };

                })).Start();
            }

            view.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                var transaction = this.Activity.SupportFragmentManager.BeginTransaction();
                PostingDetailsFragment postingDetailsFragment = new PostingDetailsFragment();
                postingDetailsFragment.Posting = feedClient.postings[e.Position];
                transaction.Replace(Resource.Id.frameLayout, postingDetailsFragment);
                transaction.AddToBackStack(null);
                transaction.Commit();
            };

            return view;
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (item.ItemId == Resource.Id.action_about)
            {
                var builder = new Android.Support.V7.App.AlertDialog.Builder(this);
                builder
					.SetTitle(Resource.String.about)
					.SetMessage(Resource.String.about_text)
					.SetPositiveButton("OK", delegate
                    {

                    });             

                var alert = builder.Create();
                alert.Show();
            }
            return base.OnOptionsItemSelected(item);
        }
コード例 #43
0
 public override Dialog OnCreateDialog(Bundle savedInstanceState)
 {
     var b_ = new Android.Support.V7.App.AlertDialog.Builder (Context);
     b_.SetItems (new string [] {"Unregister"}, (sender, ea) => {
         var b = new Android.Support.V7.App.AlertDialog.Builder (Context);
         b.SetMessage (string.Format ("Folder '{0}' will be unregistered.", folder))
         .SetNegativeButton ("Cancel", (o, e) => {})
         .SetPositiveButton ("Remove", (o, e) => {
             ApplicationModel.Instance.RemoveSearchPaths (folder);
         });
         b.Show ();
     });
     return b_.Create ();
 }
コード例 #44
0
 public override Dialog OnCreateDialog(Bundle savedInstanceState)
 {
     var b = new Android.Support.V7.App.AlertDialog.Builder (Context);
     var entry = new EditText (Context);
     b.SetMessage ("Select a folder whose descendants contain Soundfonts")
      .SetView (entry)
      .SetNegativeButton ("Cancel", (sender, e) => {})
      .SetPositiveButton ("Add", (sender, e) => {
         ApplicationModel.Instance.AddSearchPaths (entry.Text.Trim ());
     });
     return b.Create ();
 }
コード例 #45
0
		private async void ShowActorsPopup ()
		{
			var builder = new Android.Support.V7.App.AlertDialog.Builder (_context);
			ListView listView = new ListView (_context);
			List<Actor> actors = await DataManager.Instance.GetAllActorsForMovie (_movie);
			listView.Adapter = new ActorsArrayAdapter (_context as Activity, actors.ToArray ());
			listView.ItemClick += (object sender, Android.Widget.AdapterView.ItemClickEventArgs e) => {
				int position = e.Position;
				Intent intent = new Intent (_context, typeof(ActorDetailActivity));
				intent.PutExtra ("selectKey", actors.ToArray () [position].id);
				_context.StartActivity (intent);
			};
			builder.SetView (listView);
			builder.SetOnDismissListener (this);
			builder.Create ().Show ();
		}
コード例 #46
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            var view = new PostingDetailsView(this.Activity);

            view.PostingTitle.Text = Posting.PostTitle;

            if (Posting.ImageLink != "-1")
            {
                view.CurrentImage = Posting.ImageLink;
            }

            imageHelper = new ListingImageDownloader(Posting.Link, Posting.ImageLink);
            var connected = imageHelper.GetAllImagesAsync();
            if (!connected)
            {
                var builder = new Android.Support.V7.App.AlertDialog.Builder(this.Activity);

                builder.SetTitle("No internet connection")
                    .SetMessage("Please connect and try again")
                    .SetPositiveButton("Ok", delegate
                    {
                        Console.WriteLine("Not connected");
                    });

                builder.Create().Show();
            }

            imageHelper.loadingComplete += (sender, e) =>
            {
                if (imageHelper.PostingImagesFound)
                {
                    view.SetImageCollection(imageHelper.images);
                }

                if (imageHelper.PostingBodyAdded)
                    view.PostingDescription.Text = imageHelper.postingDescription;

                if (imageHelper.PostingMapFound)
                {

                    SupportMapFragment _myMapFragment = SupportMapFragment.NewInstance();
                    view.mapFrame.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                                   Convert.ToInt16(Activity.Resources.DisplayMetrics.HeightPixels * 0.5));
                    var tx = Activity.SupportFragmentManager.BeginTransaction();
                    tx.Replace(view.mapFrame.Id, _myMapFragment);
                    tx.Commit();

                    SetUpGoogleMap(_myMapFragment);

                    this.MapReady += (s, ev) =>
                    {
                        if (map != null)
                        {
                            //To initialize the map 
                            map.MapType = GoogleMap.MapTypeNormal; //select the map type
                            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                            builder.Target(imageHelper.postingCoordinates); //Target to some location hardcoded
                            builder.Zoom(10); //Zoom multiplier
                            CameraPosition cameraPosition = builder.Build();
                            CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                            //map.AnimateCamera(cameraUpdate);
                            map.MoveCamera(cameraUpdate);

                            MarkerOptions markerOpt1 = new MarkerOptions();
                            markerOpt1.SetPosition(imageHelper.postingCoordinates);
                            markerOpt1.SetTitle("Here's your listing!");
                            map.AddMarker(markerOpt1);
                        }
                    };
                }
            };

            view.ImageClick += (sender, e) =>
            {
                view.CurrentImage = imageHelper.images.ElementAt(e.Index);
            };

            view.PostingDescription.Text = Posting.Description;
            view.PostingDate.Text = "Listed: " + Posting.Date.ToShortDateString() + " at " + Posting.Date.ToShortTimeString();
            view.WebLink.Text = "Original Listing";

            view.WebLink.Click += (sender, e) =>
            {
                var transaction = Activity.SupportFragmentManager.BeginTransaction();
                WebviewFragment webviewFragment = new WebviewFragment();
                webviewFragment.Link = Posting.Link;

                transaction.Replace(Resource.Id.frameLayout, webviewFragment);
                transaction.AddToBackStack(null);
                transaction.Commit();
            };

            view.PostingImage.Click += (sender, e) =>
            {
                var transaction = Activity.SupportFragmentManager.BeginTransaction();
                ImageZoomFragment zoomFragment = new ImageZoomFragment();
                zoomFragment.ImageUrl = view.CurrentImage;

                transaction.Replace(Resource.Id.frameLayout, zoomFragment);
                transaction.AddToBackStack(null);
                transaction.Commit();
            };

            ((MainActivity)this.Activity).OptionItemSelected += OnOptionItemSelected;

            ScrollView viewContainer = new ScrollView(this.Activity);
            viewContainer.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);

            viewContainer.AddView(view);
            return viewContainer;
        }