Пример #1
0
        private void SignIn()
        {
            var db       = new SQLiteConnection(DBPath);
            var accounts = db.Table <Account>();
            var account  = accounts.Where(x => x.UserName == ViewModel.UserName).FirstOrDefault();

            Android.Support.V7.App.AlertDialog         alertDialog = null;
            Android.Support.V7.App.AlertDialog.Builder builder     = new Android.Support.V7.App.AlertDialog.Builder(this)
                                                                     .SetTitle("Account Information")
                                                                     .SetPositiveButton("Ok", (object s, Android.Content.DialogClickEventArgs dialogClickEventArgs) =>
            {
                alertDialog.Show();
            });

            alertDialog = builder.Create();

            if (account == null)
            {
                alertDialog.SetMessage("This account does not exist.");
            }
            else if (account.Password != ViewModel.Password)
            {
                alertDialog.SetMessage("Password is incorrect.");
            }
            else
            {
                alertDialog.SetMessage("User successfully found.");
            }

            alertDialog.Show();
        }
Пример #2
0
 /*
  * Creates an incoming conversation UI dialog
  */
 void showInviteDialog(IIncomingInvite incomingInvite)
 {
     alertDialog = Dialog.CreateInviteDialog(incomingInvite.Invitee,
                                             new EventHandler <DialogClickEventArgs> ((s, e) => {
         /*
          * Accept incoming invite
          */
         var localMedia = setupLocalMedia();
         incomingInvite.Accept(localMedia, new ConversationCallback {
             ConversationHandler = (c, ex) => {
                 Android.Util.Log.Error(TAG, "sendConversationInvite onConversation");
                 if (ex == null)
                 {
                     this.conversation      = c;
                     c.ConversationListener = conversationListener();
                 }
                 else
                 {
                     Android.Util.Log.Error(TAG, ex.Message);
                     hangup();
                     reset();
                 }
             }
         });
         setHangupAction();
     }),
                                             new EventHandler <DialogClickEventArgs> ((s, e) => {
         incomingInvite.Reject();
         setCallAction();
     }), this);
     alertDialog.Show();
 }
Пример #3
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;
         }
     }
 }
Пример #4
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();
                }
            }
        }
Пример #5
0
        private void TxtWidth_FocusChange(object sender, View.FocusChangeEventArgs e)
        {
            var txt = (EditText)sender;

            if (txt.Text != string.Empty)
            {
                var resp = Validartxt(txt);

                if (resp == false)
                {
                    alert.Builder adb = new alert.Builder(this);

                    adb.SetTitle("Advertencia?");
                    adb.SetMessage("Verifique el datos ingresado " + txt.Text + " y corregir!!!");
                    adb.SetNeutralButton("Mantener Dato", (senderAlert, args) =>
                    {
                    });
                    adb.SetPositiveButton("Borrar Dato Ingresado", (senderAlert, args) =>
                    {
                        txt.Text = "";
                        txt.RequestFocus();
                    });

                    alert dialog = adb.Create();

                    dialog.Show();
                }
                else
                {
                    txt.Focusable = true;
                }
            }
        }
Пример #6
0
 private void TxtPricingScheme_Click(object sender, EventArgs e)
 {
     if (alertDialog != null)
     {
         alertDialog.Show();
     }
 }
Пример #7
0
        /// <summary>
        /// Show Reaction dialog when user long click on react button
        /// </summary>
        public void LongClickDialog(GlobalClickEventArgs postData, NativePostAdapter nativeFeedAdapter, string namePage = "")
        {
            try
            {
                PostData          = postData;
                NamePage          = namePage;
                NativeFeedAdapter = nativeFeedAdapter;

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

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

                InitializingReactImages(dialogView);
                SetReactionsArray();
                ResetReactionsIcons();
                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)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Пример #8
0
        private void OnTestBtnOnClick(object sender, EventArgs e)
        {
            this.Window.AddFlags(WindowManagerFlags.Fullscreen);
            this.Window.ClearFlags(WindowManagerFlags.Fullscreen);


            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           view           = layoutInflater.Inflate(Resource.Layout.user_input_dialog, 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.editText);

            alertbuilder.SetCancelable(false)
            .SetPositiveButton("Speichern", delegate
            {
                Toast.MakeText(this, "Eingabe Speichern: " + userdata.Text, ToastLength.Short).Show();
            })
            .SetNegativeButton("Abbrechen", delegate
            {
                alertbuilder.Dispose();
            });
            Android.Support.V7.App.AlertDialog dialog = alertbuilder.Create();
            dialog.Show();
        }
Пример #9
0
 private void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (!DataManager.IsReadResult)
     {
         Android.Support.V7.App.AlertDialog.Builder dialog = new Android.Support.V7.App.AlertDialog.Builder(this);
         dialog.SetCancelable(true);
         dialog.SetPositiveButton("YES", delegate
         {
             countDownTimer.Stop();
             Intent intent = new Intent(this, typeof(ResultActivity));
             intent.PutExtra("Answers", DataManager.AnswersChoosed);
             StartActivityForResult(intent, REQUESTCODE);
         }
                                  );
         dialog.SetNegativeButton("NO", delegate { });
         Android.Support.V7.App.AlertDialog alert = dialog.Create();
         alert.SetTitle("Thông báo");
         alert.SetMessage("Bạn có chắc chắn muốn nộp bài?");
         alert.Show();
     }
     else
     {
         Intent intent = new Intent(this, typeof(ResultActivity));
         intent.PutExtra("Answers", DataManager.AnswersChoosed);
         StartActivityForResult(intent, REQUESTCODE);
         DataManager.IsReadResult = false;
     }
 }
Пример #10
0
 private void CreatePositionsData(int id)
 {
     try
     {
         positionsList = new List <Position>();
         JsonSerializer serializer = new JsonSerializer();
         serializer.NullValueHandling = NullValueHandling.Ignore;
         var            json         = new WebClient().DownloadString("http://192.168.1.33/CMOS/CMOSS/GetPositionsPreorderApi/" + id.ToString());
         JObject        googleSearch = JObject.Parse(json);
         IList <JToken> results      = googleSearch["data"].Children().ToList();
         foreach (JToken result in results)
         {
             Position searchResult = result.ToObject <Position>();
             positionsList.Add(searchResult);
         }
         positionsList.Add(new Position {
             Code = "", Color = "", Loading = "", Name = "", Norm = 0, Order = "", ShortName = ""
         });
         isEdit = false;
     }
     catch (Exception ex)
     {
         RunOnUiThread(() =>
         {
             AlertDialog.Builder dialog = new AlertDialog.Builder(this);
             AlertDialog alert          = dialog.Create();
             alert.SetTitle("Сервер не отвечает");
             alert.SetMessage("Обратитесь к администратору" + ex.Message);
             alert.Show();
             return;
         });
     }
 }
Пример #11
0
        /// <summary>
        /// Dialog for editing phone number
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditPhone_Click(object sender, EventArgs e)
        {
            LayoutInflater inflater = LayoutInflater.From(this);
            View           view     = inflater.Inflate(Resource.Layout.dialog_profile_phone, null);

            AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
            alertBuilder.SetView(view);

            var editPhone = view.FindViewById <EditText>(Resource.Id.dialog_edit_phone);

            // editPhone.Text = phone.Text;

            alertBuilder.SetTitle("Edit Phone")
            .SetPositiveButton("Submit", delegate
            {
                Toast.MakeText(this, "You clicked Submit!", ToastLength.Short).Show();
            })
            .SetNegativeButton("Cancel", delegate
            {
                alertBuilder.Dispose();
            });

            AlertDialog alertDialog = alertBuilder.Create();

            alertDialog.Show();
        }
Пример #12
0
 private void CreateOrdersData()
 {
     try
     {
         ordersList = new List <Order>();
         JsonSerializer serializer = new JsonSerializer();
         serializer.NullValueHandling = NullValueHandling.Ignore;
         var            json         = new WebClient().DownloadString("http://192.168.1.33/CMOS/CMOSS/GetTableNoClothingOrderApi");
         JObject        googleSearch = JObject.Parse(json);
         IList <JToken> results      = googleSearch["data"].Children().ToList();
         foreach (JToken result in results)
         {
             Order searchResult = result.ToObject <Order>();
             searchResult.PositionName      = searchResult.PositionName;
             searchResult.PercentComplited += "%";
             searchResult.Id       = "Заказ №: " + searchResult.Id;
             searchResult.NumberTN = "ПТМЦ №: " + searchResult.NumberTN;
             ordersList.Add(searchResult);
         }
         isEdit = false;
     }
     catch (Exception ex)
     {
         RunOnUiThread(() =>
         {
             AlertDialog.Builder dialog = new AlertDialog.Builder(this);
             AlertDialog alert          = dialog.Create();
             alert.SetTitle("Сервер не отвечает");
             alert.SetMessage("Обратитесь к администратору" + ex.Message);
             alert.Show();
             return;
         });
     }
 }
        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();
        }
        void OnActionSheetRequested(Page sender, ActionSheetArguments arguments)
        {
            var builder = new AlertDialog.Builder(this);

            builder.SetTitle(arguments.Title);
            string[] items = arguments.Buttons.ToArray();
            builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which]));

            if (arguments.Cancel != null)
            {
                builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel));
            }

            if (arguments.Destruction != null)
            {
                builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction));
            }

            AlertDialog dialog = builder.Create();

            builder.Dispose();
            //to match current functionality of renderer we set cancelable on outside
            //and return null
            dialog.SetCanceledOnTouchOutside(true);
            dialog.CancelEvent += (o, e) => arguments.SetResult(null);
            dialog.Show();
        }
Пример #15
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();
            }
        }
        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();
            }
        }
Пример #17
0
        protected void showInputDialog()
        {
            LayoutInflater layoutInflater = LayoutInflater.From(this);
            View           promptView     = layoutInflater.Inflate(Resource.Layout.Dialog_SearchExam, null);

            Android.Support.V7.App.AlertDialog.Builder alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
            alertDialogBuilder.SetView(promptView);

            EditText editText = (EditText)promptView.FindViewById(Resource.Id.edittext);

            editText.RequestFocus();

            alertDialogBuilder.SetCancelable(true);

            alertDialogBuilder.SetPositiveButton("OK", (sender, args) =>
            {
                String t = editText.Text;

                Exams_Collection exi = ep.search(editText.Text);

                listView.Adapter = new ListAdapter_Exams(this, exi.list);
                listView.InvalidateViews();
            });
            alertDialogBuilder.SetNegativeButton("Abbrechen", (sender, args) =>
            {
            });


            Android.Support.V7.App.AlertDialog alert = alertDialogBuilder.Create();
            alert.Show();
        }
Пример #18
0
        //Alert handler to improve code cleanliness
        public AlertDialog CreateAlert(AlertType type, string alertMessage, string alertTitle)
        {
            if (type == AlertType.Error)
            {
                AlertDialog.Builder dialogConnection = new AlertDialog.Builder(this);
                dialog = dialogConnection.Create();
                dialog.SetTitle(alertTitle);
                dialog.SetMessage(alertMessage);
            }
            else if (type == AlertType.Load)
            {
                dialog = new EDMTDialogBuilder()
                         .SetContext(this)
                         .SetMessage(alertMessage)
                         .Build();
            }
            else if (type == AlertType.Info)
            {
                AlertDialog.Builder dialogConnection = new AlertDialog.Builder(this);
                var btnOk = Resources.GetText(Resource.String.btnOk);
                dialogConnection.SetPositiveButton(btnOk, (senderAlert, args) => {
                    dialogConnection.Dispose();
                });
                dialog = dialogConnection.Create();
                dialog.SetTitle(alertTitle);
                dialog.SetMessage(alertMessage);
                dialog.SetCanceledOnTouchOutside(true);
            }

            dialog.Show();

            return(dialog);
        }
Пример #19
0
        protected void ShowAlertDialog(Exception ex)
        {
            Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(this);

            builder.SetMessage(ex.Message).SetTitle(Resource.String.errorDialogTitle);
            builder.SetNeutralButton(Resource.String.errorDialogButton, this);

            Android.Support.V7.App.AlertDialog dialog = builder.Create();
            dialog.Show();
        }
 private void btnGeoWithAddress_Click(object sender, EventArgs e)
 {
     search_view = base.LayoutInflater.Inflate(Resource.Layout.search_alert_layout, null);
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.SetView(search_view);
     builder.SetTitle("Search Location");
     builder.SetNegativeButton("Cancel", (send, arg) => { builder.Dispose(); });
     search_view.FindViewById <Button>(Resource.Id.btnSearch).Click += btnSearchClicked;
     alert = builder.Create();
     alert.Show();
 }
Пример #21
0
 private void SavePosData()
 {
     try
     {
         if (pos != null)
         {
             int quentity = Int32.Parse(quentityInput.Text);
             if (quentity > pos.Norm)
             {
                 quentity = pos.Norm;
             }
             pos.Rate = quentity;
             if (pos.Weight != Double.Parse(weightInput.Text.Replace(".", ",")))
             {
                 pos.IsWeight = true;
             }
             pos.Weight   = Double.Parse(weightInput.Text.Replace(".", ","));
             positionItem = positionsList.FindIndex(a => a.Id == pos.Id);
             foreach (var t in positionsList)
             {
                 if (t.Code == pos.Code)
                 {
                     t.Weight = pos.Weight;
                 }
             }
             RunOnUiThread(() => codeInput.Text     = pos.Code);
             RunOnUiThread(() => quentityInput.Text = pos.Rate.ToString());
             RunOnUiThread(() => weightInput.Text   = pos.Weight.ToString());
             MainThread.BeginInvokeOnMainThread(() =>
             {
                 adapterPosition            = new PositionsAdapter(positionsList);
                 adapterPosition.ItemClick += OnPositionClick;
                 ordersRecyclerView.SetAdapter(adapterPosition);
                 ordersRecyclerView.ScrollToPosition(positionItem);
             });
             codeInput.ClearFocus();
             quentityInput.ClearFocus();
             weightInput.ClearFocus();
             isEdit = true;
         }
     }
     catch (Exception ex)
     {
         RunOnUiThread(() =>
         {
             AlertDialog.Builder dialog = new AlertDialog.Builder(this);
             AlertDialog alert          = dialog.Create();
             alert.SetTitle("Ошибка сохранения");
             alert.SetMessage("Ошибка: " + ex.Message);
             alert.Show();
             return;
         });
     }
 }
        /// <summary>
        /// Shows a dialog.
        /// </summary>
        /// <param name="title">A dialog title.</param>
        /// <param name="value">A dialog value.</param>
        /// <param name="canCopy">Indicates that "Copy value" is activated.</param>
        /// <param name="valueToCopy">Value to copy by button.</param>
        internal void ShowInfoDialog(string title, string value, bool canCopy, string valueToCopy)
        {
            // dialog builder
            using (Android.Support.V7.App.AlertDialog.Builder dialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogTheme)))
            {
                // create button
                dialogBuilder.SetPositiveButton(Resources.GetString(Resource.String.ok_button), (EventHandler <DialogClickEventArgs>)null);
                if (canCopy)
                {
                    dialogBuilder.SetNeutralButton(Resources.GetString(Resource.String.copy_value_button), (EventHandler <DialogClickEventArgs>)null);
                    _infoDialogValueToCopy = valueToCopy;
                }
                // create dialog
                _infoDialog = dialogBuilder.Create();

                _infoDialog.Window.SetBackgroundDrawableResource(Android.Resource.Drawable.ScreenBackgroundDarkTransparent);
                // set dialog title
                _infoDialog.SetTitle(title);
                // set dialog message
                _infoDialog.SetMessage(value);
                // show on screen
                _infoDialog.Show();

                // get display size
                DisplayMetrics displayMetrics = new DisplayMetrics();
                WindowManager.DefaultDisplay.GetMetrics(displayMetrics);
                int height = (int)(displayMetrics.HeightPixels * 3 / 4);

                // if dialog content height is greater than 3/4 of screen height
                if (_infoDialog.Window.Attributes.Height > height)
                {
                    _infoDialog.Window.SetLayout(_infoDialog.Window.Attributes.Width, height);
                }

                TextView dialogTextView = _infoDialog.FindViewById <TextView>(Android.Resource.Id.Message);
                // allow to select dialog text
                dialogTextView.SetTextIsSelectable(true);
                // allow to click links
                dialogTextView.MovementMethod = LinkMovementMethod.Instance;
                dialogTextView.LinksClickable = true;
                // add links
                Utils.MyLinkify.AddLinks(dialogTextView, Patterns.EmailAddress, null);
                Utils.MyLinkify.AddLinks(dialogTextView, Patterns.WebUrl, null, new Utils.MyLinkify(), null);

                if (canCopy)
                {
                    _infoDialogNeutralButton         = _infoDialog.GetButton((int)DialogButtonType.Neutral);
                    _infoDialogNeutralButton.Click  += NeutralButton_Click;
                    _infoDialogPositiveButton        = _infoDialog.GetButton((int)DialogButtonType.Positive);
                    _infoDialogPositiveButton.Click += PositiveButton_Click;
                }
            }
        }
Пример #23
0
 private void OnTimedEvent(object sender, ElapsedEventArgs e)
 {
     RunOnUiThread(() =>
     {
         AlertDialog.Builder dialog = new AlertDialog.Builder(this);
         AlertDialog alert          = dialog.Create();
         alert.SetTitle("Вы давно не сохранялись");
         alert.SetMessage("Возможно стоит нажать кнопку СОХРАНИТЬ? :)");
         alert.Show();
         return;
     });
 }
Пример #24
0
 private void ErrorMessage(string ex)
 {
     RunOnUiThread(() =>
     {
         AlertDialog.Builder dialog = new AlertDialog.Builder(this);
         AlertDialog alert          = dialog.Create();
         alert.SetTitle("Ошибка программы");
         alert.SetMessage(ex);
         alert.Show();
         return;
     });
 }
Пример #25
0
        private void ProfilePic_Click(object sender, EventArgs e)
        {
            //Open Dialog
            AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);

            alertBuilder.SetTitle("Add Photo");
            alertBuilder.SetItems(Resource.Array.upload_photo, this);

            AlertDialog alertDialog = alertBuilder.Create();

            alertDialog.Show();
        }
Пример #26
0
        private void fabFunctions()
        {
            View view = null;

            Android.Support.V7.App.AlertDialog dialog = null;
            switch (fabfunctionidentifier)
            {
            case 1:
                if (view != null)
                {
                    view = null;
                }

                if (dialog != null)
                {
                    dialog = null;
                }

                view   = LayoutInflater.Inflate(Resource.Layout.add_project_dialog, null);
                dialog = helpDialog.AddProjectDialog(this, core, view);
                dialog.Show();
                break;

            case 2:
                if (view != null)
                {
                    view = null;
                }

                if (dialog != null)
                {
                    dialog = null;
                }

                view = LayoutInflater.Inflate(Resource.Layout.add_task_layout, null);
                //dialog = helpDialog.AddTaskDialog(this, core,view, pServer);
                //dialog.Show();
                break;

            case 3:
                timesheetFragment.ShowAddLineDialog();
                break;

            case 4:
                helpDialog.AddEnterpriseResource(this).Show();
                break;

            case 5:

                break;
            }
        }
Пример #27
0
        private void StartTraining_Click(object sender, EventArgs e)
        {
            switch (modelNumber)
            {
            case 0:
                flag = true;

                LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this);
                View           view = layoutInflaterAndroid.Inflate(Resource.Layout.trainingDate, null);
                Android.Support.V7.App.AlertDialog.Builder alertDialogBuilder = new Android.Support.V7.App.AlertDialog.Builder(this);
                alertDialogBuilder.SetView(view);
                dateTraining = view.FindViewById <DatePicker>(Resource.Id.dateTraining);

                alertDialogBuilder.SetCancelable(false)
                .SetPositiveButton("Stwórz", delegate
                {
                    var db = new SQLiteConnection(_dbPath);
                    db.CreateTable <Training>();
                    var maxPk         = db.Table <Training>().OrderByDescending(c => c.Id).FirstOrDefault();
                    Training training = new Training()
                    {
                        Id           = (maxPk == null ? 1 : maxPk.Id + 1),
                        Name         = trainingName,
                        UserId       = userId,
                        TrainingDone = true,
                        TrainingDate = getDate()
                    };
                    trainingIdCurrent = training.Id;

                    db.Insert(training);
                    startTraining.Visibility = ViewStates.Invisible;
                    Toast.MakeText(this, trainingName + " rozpoczeto", ToastLength.Short).Show();
                })
                .SetNegativeButton("Anuluj", delegate
                {
                    alertDialogBuilder.Dispose();
                });

                Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogBuilder.Create();
                alertDialogAndroid.Show();

                break;


            case 1:
                Intent intent = new Intent(this, typeof(EditTraining));
                intent.PutExtra("TrainingId", trainingId);
                StartActivity(intent);
                Finish();
                break;
            }
        }
Пример #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeleteAccount_Click(object sender, EventArgs e)
        {
            LayoutInflater inflater = LayoutInflater.From(this);
            View           view     = inflater.Inflate(Resource.Layout.dialog_delete_account, null);

            AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
            alertBuilder.SetView(view);

            var email    = view.FindViewById <EditText>(Resource.Id.dialog_delete_email);
            var password = view.FindViewById <EditText>(Resource.Id.dialog_delete_password);


            alertBuilder.SetTitle("Delete Account")
            .SetPositiveButton("Submit", delegate
            {
                try
                {
                    //update current user
                    var user = auth.CurrentUser;
                    if (user != null)
                    {
                        uid = user.Uid;

                        //delete from auth
                        var reauth = auth.CurrentUser.ReauthenticateAsync(EmailAuthProvider
                                                                          .GetCredential(email.Text, password.Text)).ContinueWith(task => {
                            if (task.IsCompletedSuccessfully)
                            {
                                Task result = user.Delete().AddOnCompleteListener(this);
                                Toast.MakeText(this, "Yeah!", ToastLength.Short).Show();
                            }
                            else
                            {
                                Toast.MakeText(this, "Failed to reauthenticate account.", ToastLength.Short).Show();
                            }
                        });
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, "Sorry, an error occured during delete", ToastLength.Short).Show();
                }
            })
            .SetNegativeButton("No", delegate
            {
                alertBuilder.Dispose();
            });

            AlertDialog alertDialog = alertBuilder.Create();

            alertDialog.Show();
        }
Пример #29
0
        /*
         * Creates an outgoing conversation UI dialog
         */
        private void showCallDialog()
        {
            var participantEditText = new EditText(this);

            alertDialog = Dialog.CreateCallParticipantsDialog(participantEditText, delegate {
                /*
                 * Make outgoing invite
                 */
                var participant = participantEditText.Text;
                if (!string.IsNullOrEmpty(participant) && conversationsClient != null)
                {
                    stopPreview();
                    // Create participants set (we support only one in this example)
                    var participants = new List <string> ();
                    participants.Add(participant);

                    // Create local media
                    var localMedia = setupLocalMedia();

                    // Create outgoing invite
                    outgoingInvite = conversationsClient.SendConversationInvite(participants, localMedia, new ConversationCallback {
                        ConversationHandler = (c, err) => {
                            if (err == null)
                            {
                                // Participant has accepted invite, we are in active conversation
                                this.conversation = c;
                                conversation.ConversationListener = conversationListener();
                            }
                            else
                            {
                                Android.Util.Log.Error(TAG, err.Message);
                                hangup();
                                reset();
                            }
                        }
                    });

                    setHangupAction();
                }
                else
                {
                    Android.Util.Log.Error(TAG, "invalid participant call");
                    conversationStatusTextView.Text = "call participant failed";
                }
            }, delegate {
                setCallAction();
                alertDialog.Dismiss();
            }, this);

            alertDialog.Show();
        }
Пример #30
0
        /// <summary>
        /// Dialog for editing first and last name
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditName_Click(object sender, EventArgs e)
        {
            LayoutInflater inflater = LayoutInflater.From(this);
            View           view     = inflater.Inflate(Resource.Layout.dialog_profile_name, null);

            AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
            alertBuilder.SetView(view);

            var fName = view.FindViewById <EditText>(Resource.Id.dialog_edit_fname);
            var lName = view.FindViewById <EditText>(Resource.Id.dialog_edit_lname);

            //string[] fullName = name.Text.Split(" ");
            //fName.Text = fullName[0];
            //lName.Text = fullName[1];

            alertBuilder.SetTitle("Edit Name")
            .SetPositiveButton("Submit", delegate
            {
                try
                {
                    //get current user
                    if (auth.CurrentUser != null)
                    {
                        var document = db.Collection("users").Document(auth.CurrentUser.Uid);
                        var data     = new Dictionary <string, Java.Lang.Object>();
                        data.Add("FName", fName.Text);
                        data.Add("LName", lName.Text);

                        document.Update((IDictionary <string, Java.Lang.Object>)data);

                        Toast.MakeText(this, "Done!", ToastLength.Long).Show();
                    }
                    else
                    {
                        Toast.MakeText(this, "Something went wrong. Sorry.", ToastLength.Long).Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(this, "Failed to update. Sorry.", ToastLength.Long).Show();
                }
            })
            .SetNegativeButton("Cancel", delegate
            {
                alertBuilder.Dispose();
            });

            AlertDialog alertDialog = alertBuilder.Create();

            alertDialog.Show();
        }
Пример #31
0
 private void ShowCalendarInDialog(string title, int layoutResId)
 {
     dialogView = (CalendarPickerView)LayoutInflater.Inflate(layoutResId, null, false);
     theDialog = new AlertDialog.Builder(this)
         .SetTitle(title)
         .SetView(dialogView)
         .SetNeutralButton("Dismiss", (sender, e) => theDialog.Dismiss())
         .Create();
     theDialog.ShowEvent += delegate
     {
         dialogView.FixDialogDimens();
     };
     theDialog.Show();
 }