Ejemplo n.º 1
0
        /// <summary>
        /// Shows the message box.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="caption">The caption.</param>
        /// <param name="button">The button.</param>
        /// <param name="icon">The icon.</param>
        /// <returns>The message result.</returns>
        /// <exception cref="ArgumentException">The <paramref name="message"/> is <c>null</c> or whitespace.</exception>
        protected virtual Task<MessageResult> ShowMessageBox(string message, string caption = "", MessageButton button = MessageButton.OK, MessageImage icon = MessageImage.None)
        {
            var messageResult = MessageResult.Cancel;
            var context = Catel.Android.ContextHelper.CurrentContext;
            var builder = new AlertDialog.Builder(context);

            switch (button)
            {
                case MessageButton.OK:
                    builder.SetPositiveButton("OK", (sender, e) => { messageResult = MessageResult.OK; });
                    break;

                case MessageButton.OKCancel:
                    builder.SetPositiveButton("OK", (sender, e) => { messageResult = MessageResult.OK; });
                    builder.SetCancelable(true);
                    break;

                case MessageButton.YesNo:
                    builder.SetPositiveButton("Yes", (sender, e) => { messageResult = MessageResult.Yes; });
                    builder.SetNegativeButton("No", (sender, e) => { messageResult = MessageResult.No; });
                    break;

                case MessageButton.YesNoCancel:
                    builder.SetPositiveButton("Yes", (sender, e) => { messageResult = MessageResult.Yes; });
                    builder.SetNegativeButton("No", (sender, e) => { messageResult = MessageResult.No; });
                    builder.SetCancelable(true);
                    break;

                default:
                    throw new ArgumentOutOfRangeException("button");
            }

            return Task<MessageResult>.Run(() =>
            {
                builder.SetMessage(message).SetTitle(caption);
                builder.Show();

                return messageResult;
            });
        }
Ejemplo n.º 2
0
        public void LoadTypeScanCustom()
        {
            AlertDialog.Builder MsBox = new AlertDialog.Builder(this);
            MsBox.SetTitle("اسکن سفارشی");
            View ViewMs = View.Inflate(this, Resource.Layout.LayoutCustomScan, null);

            MsBox.SetView(ViewMs);
            Spinner SpB = (Spinner)ViewMs.FindViewById(Resource.Id.LCusScanSpinnerBord);
            Spinner SpD = (Spinner)ViewMs.FindViewById(Resource.Id.LCusScanSpinnerDegat);

            string[] itemSB          = new string[] { "حداقل", "متوسط", "حداکثر", "حداکثر ++" };
            string[] itemSD          = new string[] { "کم", "متوسط", "زیاد" };
            ArrayAdapter <string> IB = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, itemSB);
            ArrayAdapter <string> ID = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, itemSD);

            SpB.Adapter = IB; SpD.Adapter = ID;

            SpB.ItemSelected += delegate
            {
                CusB = SpB.SelectedItemPosition;
            };
            SpD.ItemSelected += delegate
            {
                CusD = SpD.SelectedItemPosition;
            };

            MsBox.SetCancelable(false);
            MsBox.SetPositiveButton("اجرا", delegate
            {
                typeScan = TypeScanMD.Custom;
                Toast.MakeText(this, "اسکن سفارشی فعال شد", ToastLength.Short).Show();
                ProgressMain.Progress = 0;
            });
            MsBox.SetNegativeButton("لغو", delegate { SpinnerTypeScan.SetSelection(0); });
            MsBox.Create(); MsBox.Show();
        }
Ejemplo n.º 3
0
        public void ShowDialog(Context context, int?titleId, ICharSequence message,
                               int okId        = Android.Resource.String.Ok, int cancelId = Android.Resource.String.Cancel,
                               Action okAction = null, Action cancelAction                = null)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var alertDialog = new AlertDialog.Builder(context).Create();

            alertDialog.SetCancelable(false);

            if (titleId.HasValue)
            {
                alertDialog.SetTitle(titleId.Value);
            }

            alertDialog.SetMessage(message);

            alertDialog.SetButton(context.GetString(okId), (s, e) =>
            {
                okAction?.Invoke();
                alertDialog.Dismiss();
                alertDialog = null;
            });

            alertDialog.SetButton2(context.GetString(cancelId), (s, e) =>
            {
                cancelAction?.Invoke();
                alertDialog.Dismiss();
                alertDialog = null;
            });

            alertDialog.Show();
        }
 private void SonrakiSoru_Click(object sender, EventArgs e)
 {
     if (viewPager.CurrentItem + 1 == 10)
     {
         var cevap = new AlertDialog.Builder(this);
         cevap.SetCancelable(true);
         cevap.SetIcon(Resource.Mipmap.ic_launcher);
         cevap.SetTitle(Spannla(Color.Black, "TestBang!"));
         cevap.SetMessage(Spannla(Color.DarkGray, "Oyunu bitirmek istediğine emin misin?"));
         cevap.SetPositiveButton(Spannla(Color.Black, "Evet"), delegate
         {
             OyunuBitir();
             ShowLoading.Show(this, "Rakibin oyunu bitirmesi bekleniyor..");
         });
         cevap.SetNegativeButton(Spannla(Color.Black, "Hayır"), delegate
         {
         });
         cevap.Show();
     }
     else
     {
         viewPager.CurrentItem = viewPager.CurrentItem + 1;
     }
 }
Ejemplo n.º 5
0
        void LoginFailed(LoginScreenFaultDetails details)
        {
            RunOnUiThread(() =>
            {
                progressDialog.Dismiss();

                if (!string.IsNullOrEmpty(details.UserNameErrorMessage))
                {
                    ShowAlert(userNameEdit, details.UserNameErrorMessage);
                }

                if (!string.IsNullOrEmpty(details.PasswordErrorMessage))
                {
                    ShowAlert(passwordEdit, details.PasswordErrorMessage);
                }

                if (!string.IsNullOrEmpty(details.CommonErrorMessage))
                {
                    var builder = new AlertDialog.Builder(this);

                    builder.SetCancelable(false);

                    builder.SetTitle(messages.LoginCommonErrorTitle);
                    builder.SetMessage(details.CommonErrorMessage);

                    builder.SetPositiveButton(messages.AlertCancelButtonTitle, (sender, args) =>
                    {
                        // do nothing => dismiss
                    });

                    var dialog = builder.Create();

                    dialog.Show();
                }
            });
        }
Ejemplo n.º 6
0
 private AlertDialog.Builder GetDialog()
 {
     try
     {
         var builder = new AlertDialog.Builder(this);
         builder.SetMessage(Resource.String.LicenseFailedMessageString);
         builder.SetPositiveButton(GetString(Resource.String.WriteString), delegate
         {
             try
             {
                 var emailIntent = new Intent(Intent.ActionSendto, Uri.Parse("mailto:[email protected]"));
                 emailIntent.PutExtra(Intent.ExtraSubject, "Ошибка лицензии");
                 StartActivity(Intent.CreateChooser(emailIntent, string.Empty));
             }
             catch (Exception exception)
             {
                 GaService.TrackAppException(this.Class, "SendEmail", exception, false);
                 var errorBuilder = new AlertDialog.Builder(this);
                 errorBuilder.SetMessage(GetString(Resource.String.SendEmailFailedHeaderString)
                                         + System.Environment.NewLine
                                         + GetString(Resource.String.SendEmailFailedString));
                 errorBuilder.SetCancelable(false);
                 errorBuilder.SetPositiveButton("Ok", (sender, args) => base.OnBackPressed());
                 errorBuilder.Show();
             }
         });
         builder.SetNegativeButton("Ok", (sender, args) => base.OnBackPressed());
         builder.SetCancelable(false);
         return(builder);
     }
     catch (Exception exception)
     {
         GaService.TrackAppException(this.Class, "GetDialog", exception, false);
         throw;
     }
 }
Ejemplo n.º 7
0
        public static AlertDialog ShowDialog(String title_text, String message, String okButton)
        {
            Android.App.Activity act     = Locator.Current.GetService <Android.App.Activity>();
            AlertDialog.Builder  builder = new AlertDialog.Builder(act);

            if (title_text != null)
            {
                builder.SetTitle(title_text);
            }

            builder.SetMessage(message);
            builder.SetCancelable(false);
            builder.SetNegativeButton(okButton, (s, ev) =>
            {
                ((AlertDialog)s).Cancel();
            });
            AlertDialog alert = builder.Create();

            act.RunOnUiThread(() =>
            {
                alert.Show();
            });
            return(alert);
        }
Ejemplo n.º 8
0
        private void Save_Address(object sender, DialogClickEventArgs args)
        {
            tblDeath updatdeath = new tblDeath();

            updatdeath.id               = Convert.ToInt32(Intent.GetStringExtra("death_id"));
            updatdeath.address_id       = Intent.GetStringExtra("address_id");
            updatdeath.fname            = txtfname.Text;
            updatdeath.lname            = txtlname.Text;
            updatdeath.ename            = txtexname.Text;
            updatdeath.gender           = spngender.SelectedItem.ToString();
            updatdeath.age_death        = txtbday.Text;
            updatdeath.birthcertificate = spndeathcert.SelectedItem.ToString();
            updatdeath.register         = spnregisterdeath.SelectedItem.ToString();

            ConDeath.UpdateList(updatdeath);

            var builder = new AlertDialog.Builder(this);

            builder.SetTitle("Census");
            builder.SetMessage("Updating Death Information Successful");
            builder.SetCancelable(false);
            builder.SetPositiveButton("Ok", Save_success);
            builder.Show();
        }
        private void SaveLargeFile()
        {
            int maxValue = 999;

            try
            {
                using (var utilities = new FileUtilities(directory))
                {
                    utilities.OpenFile();

                    for (int i = 0; i <= maxValue; i++)
                    {
                        utilities.WriteLineToFile("Writing line to file at index: " + i);
                    }
                    utilities.CloseFile();
                }
            }
            catch (Exception ex)
            {
                AlertDialog.Builder dlgException = new AlertDialog.Builder(this);
                dlgException.SetMessage("An error has occurred adding lines to file: " + ex.Message);
                dlgException.SetTitle("Error");
                dlgException.SetPositiveButton("OK", (sender, args) => { });
                dlgException.SetCancelable(true);
                dlgException.Create().Show();
                return;
            }

            AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
            dlgAlert.SetMessage("All lines written to file");
            dlgAlert.SetTitle("Success");
            dlgAlert.SetPositiveButton("OK", (sender, args) => { });
            dlgAlert.SetCancelable(true);
            dlgAlert.Create().Show();
            return;
        }
Ejemplo n.º 10
0
        public void ShowConfirmation(string title, string message, bool cancelable, string buttonLabel, Action buttonAction)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            if (!String.IsNullOrWhiteSpace(title))
            {
                builder.SetTitle(title);
            }

            builder.SetMessage(message);
            builder.SetCancelable(cancelable);

            var dialog = builder.Create();

            if (buttonLabel == null)
            {
                builder.SetPositiveButton(Resource.String.ok, (sender, args) => dialog.Dismiss());
            }
            else
            {
                builder.SetPositiveButton(buttonLabel,
                                          (sender, args) => {
                    if (buttonAction != null)
                    {
                        Task.Factory.StartNew(buttonAction);
                    }
                    dialog.Dismiss();
                });

                if (cancelable)
                {
                    builder.SetNegativeButton(Resource.String.cancel, (sender, args) => dialog.Dismiss());
                }
            }

            builder.Show();
        }
Ejemplo n.º 11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Data_Local dLoc = new Data_Local();

            ListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, dLoc.List_Languages());

            if (dLoc.List_Languages().Count == 0)
            {
                AlertDialog.Builder alertEmpty = new AlertDialog.Builder(this);
                alertEmpty.SetTitle("No Stacks Found");
                alertEmpty.SetMessage("You don't have any stacks! You can get some from the online store.");
                alertEmpty.SetPositiveButton("OK", delegate { Finish(); });
                alertEmpty.SetCancelable(false);
                alertEmpty.Show();
            }

            ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
                Intent intAct = new Intent(this, typeof(actLibraryListStacks));
                intAct.PutExtra("Language", ListView.GetItemAtPosition(e.Position).ToString());
                intAct.PutExtras(Intent);   // Include existing info- username, etc.
                StartActivity(intAct);
            };
        }
Ejemplo n.º 12
0
        public Task <string> OpenPopupWithResult()
        {
            taskCompletionSource = new TaskCompletionSource <string>();
            string         value   = "";
            LayoutInflater layout  = LayoutInflater.From(CrossCurrentActivity.Current.Activity);
            View           view    = layout.Inflate(Resource.Layout.dialog_add_dish, null);
            var            editext = view.FindViewById <EditText>(Resource.Id.editNewDish);

            AlertDialog.Builder builder = new AlertDialog.Builder(CrossCurrentActivity.Current.Activity);
            builder.SetView(view);
            builder.SetCancelable(true);

            builder.SetPositiveButton("Add dish", (sender, args) =>
            {
                value = editext.Text;
                taskCompletionSource.SetResult(value);
            });

            AlertDialog dialog = builder.Create();

            dialog.Show();

            return(taskCompletionSource.Task);
        }
Ejemplo n.º 13
0
        public override Task <int?> ShowDialogAsync(
            object body,
            IEnumerable <object> buttons,
            string caption = null,
            int defaultAcceptButtonIndex      = -1,
            DialogController dialogController = null)
        {
            Context context = ResolveContext();

            AlertDialog.Builder builder = CreateAlertDialogBuilder(context, DialogStyle);

            if (dialogController != null && !dialogController.Cancellable)
            {
                builder.SetCancelable(false);
            }

            if (!string.IsNullOrWhiteSpace(caption))
            {
                var stringParserService = Dependency.Resolve <IStringParserService>();
                var parsedText          = stringParserService.Parse(caption);
                builder.SetTitle(parsedText);
            }

            var bodyView = body as View;

            if (bodyView != null)
            {
                builder.SetView(bodyView);
            }
            else
            {
                var sequence = body as ICharSequence;
                if (sequence != null)
                {
                    builder.SetMessage(sequence);
                }
                else
                {
                    string bodyText = body?.ToString();

                    if (!string.IsNullOrWhiteSpace(bodyText))
                    {
                        var stringParserService = Dependency.Resolve <IStringParserService>();
                        var parsedText          = stringParserService.Parse(bodyText);
                        ;                                               builder.SetMessage(parsedText);
                    }
                }
            }

            List <string> labels     = null;
            int           labelCount = 0;

            if (buttons != null)
            {
                labels = new List <string>();
                foreach (var button in buttons)
                {
                    string buttonText = button.ToString();
                    labels.Add(buttonText);
                }

                labelCount = labels.Count;
            }

            var resultSource = new TaskCompletionSource <int?>();

            if (labelCount >= 2)
            {
                builder.SetNegativeButton(labels[0],
                                          (dialog, whichButton) =>
                {
                    resultSource.TrySetResult(0);
                });

                for (int i = 1; i < labelCount - 1; i++)
                {
                    int iClosureCopy = i;
                    builder.SetNeutralButton(labels[i],
                                             (dialog, whichButton) =>
                    {
                        resultSource.TrySetResult(iClosureCopy);
                    });
                }

                builder.SetPositiveButton(labels[labelCount - 1],
                                          (dialog, whichButton) =>
                {
                    int selectedIndex = labelCount - 1;
                    resultSource.TrySetResult(selectedIndex);
                });
            }
            else
            {
                if (labelCount == 1)
                {
                    string buttonLabel = labels[0];

                    builder.SetPositiveButton(buttonLabel,
                                              (dialog, whichButton) =>
                    {
                        resultSource.TrySetResult(0);
                    });
                }
            }

            builder.NothingSelected += (sender, e) => resultSource.TrySetResult(-1);

            Android.App.Application.SynchronizationContext.Post((object state) =>
            {
                try
                {
                    Interlocked.Increment(ref openDialogCount);

                    AlertDialog alertDialog = builder.Show();

                    var dialogStyles = dialogController?.DialogStyles;

                    if (dialogStyles.HasValue)
                    {
                        var styles    = dialogStyles.Value;
                        var lp        = new WindowManagerLayoutParams();
                        Window window = alertDialog.Window;
                        lp.CopyFrom(window.Attributes);

                        var stretchHorizontal = (styles & DialogStyles.StretchHorizontal) == DialogStyles.StretchHorizontal;
                        var stretchVertical   = (styles & DialogStyles.StretchVertical) == DialogStyles.StretchVertical;
                        lp.Width          = stretchHorizontal ? ViewGroup.LayoutParams.MatchParent : lp.Width;
                        lp.Height         = stretchVertical ? ViewGroup.LayoutParams.MatchParent : lp.Height;                //ViewGroup.LayoutParams.WrapContent;
                        window.Attributes = lp;
                    }

                    //var backgroundImage = dialogController?.BackgroundImage;
                    //
                    //if (backgroundImage != null)
                    //{
                    //	//Window window = alertDialog.Window;
                    //	//window.SetBackgroundDrawable(backgroundImage);;
                    //}

                    alertDialog.CancelEvent += delegate
                    {
                        resultSource.TrySetResult(-1);
                    };

                    if (dialogController != null)
                    {
                        dialogController.CloseRequested += delegate
                        {
                            if (alertDialog.IsShowing)
                            {
                                alertDialog.Cancel();
                            }
                        };
                    }

                    /* Subscribing to the DismissEvent to set the result source
                     * is unnecessary as other events are always raised.
                     * The DismissEvent is, however, always raised and thus
                     * we place the bodyView removal code here. */
                    alertDialog.DismissEvent += (sender, args) =>
                    {
                        Interlocked.Decrement(ref openDialogCount);
                        builder.SetView(null);

                        try
                        {
                            (bodyView?.Parent as ViewGroup)?.RemoveView(bodyView);
                        }
                        catch (ObjectDisposedException)
                        {
                            /* View was already disposed in user code. */
                        }
                        catch (Exception ex)
                        {
                            var log = Dependency.Resolve <ILog>();
                            log.Debug("Exception raised when removing view from alert.", ex);
                        }
                    };

                    if (AlertDialogDividerColor.HasValue)
                    {
                        var resources     = context.Resources;
                        int id            = resources.GetIdentifier("titleDivider", "id", "android");
                        View titleDivider = alertDialog.FindViewById(id);
                        if (titleDivider != null)
                        {
                            var color = AlertDialogDividerColor.Value;
                            if (color == Color.Transparent)
                            {
                                titleDivider.Visibility = ViewStates.Gone;
                            }

                            titleDivider.SetBackgroundColor(color);
                        }
                    }

                    if (AlertDialogTitleColor.HasValue)
                    {
                        var resources = context.Resources;
                        int id        = resources.GetIdentifier("alertTitle", "id", "android");
                        var textView  = alertDialog.FindViewById <TextView>(id);
                        if (textView != null)
                        {
                            var color = AlertDialogTitleColor.Value;
                            textView.SetTextColor(color);
                        }
                    }

                    if (AlertDialogBackgroundColor.HasValue)
                    {
                        var v = bodyView ?? alertDialog.ListView;
                        v.SetBackgroundColor(AlertDialogBackgroundColor.Value);
                    }
                }
                catch (WindowManagerBadTokenException ex)
                {
                    /* See http://stackoverflow.com/questions/2634991/android-1-6-android-view-windowmanagerbadtokenexception-unable-to-add-window*/
                    resultSource.SetException(new Exception(
                                                  "Unable to use the Application.Context object to create a dialog. Please either set the Context property of this DialogService or register the current activity using Dependency.Register<Activity>(myActivity)", ex));
                }
            }, null);

            return(resultSource.Task);
        }
        private void BookmarkButton_Click(object sender, EventArgs e)
        {
            int  lineNum      = mContext.lines.IndexOf(line);
            long bookmarkPos  = mContext.GetPosition(mContext.lines, lineNum + 1, wordIndex, true);
            int  bookmarksPos = Bookmark.SearchClosest(bookmarkPos, mContext.mBookmarks);

            if (mContext.mBookmarks.Count > bookmarksPos && mContext.mBookmarks[bookmarksPos].mPosition == bookmarkPos)
            {
                mContext.mBookmarks.RemoveAt(bookmarksPos);
                if (!Bookmark.SaveToFile(mContext.mBookmarks, mContext.curFilePath + ".bookmarks"))
                {
                    Toast.MakeText(mContext, "Bookmarks could not be stored. File location is not writable.", ToastLength.Long).Show();
                }

                int foundBookmarksPos = Bookmark.SearchClosest(bookmarkPos, mContext.mFoundBookmarks);
                if (mContext.mFoundBookmarks.Count > foundBookmarksPos && mContext.mFoundBookmarks[foundBookmarksPos].mPosition == bookmarkPos)
                {
                    mContext.mFoundBookmarks.RemoveAt(foundBookmarksPos);
                }

                mContext.linesAdapter.NotifyItemChanged(lineNum + 1);
                show(mContext.linesLayoutManager.FindViewByPosition(lineNum + 1), line, wordIndex, showX, false);
            }
            else
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
                builder.SetTitle("New bookmark");
                EditText inputBookmark = new EditText(mContext);
                inputBookmark.InputType = InputTypes.TextFlagCapSentences;
                inputBookmark.Text      = Dict.PinyinToTones(Dict.GetPinyin(entry));
                inputBookmark.SelectAll();
                builder.SetView(inputBookmark);
                builder.SetCancelable(true);
                builder.SetPositiveButton("OK", delegate
                {
                    try
                    {
                        int lineNum1           = mContext.lines.IndexOf(line);
                        long bookmarkPos1      = mContext.GetPosition(mContext.lines, lineNum1 + 1, wordIndex, true);
                        int bookmarksPos1      = Bookmark.SearchClosest(bookmarkPos1, mContext.mBookmarks);
                        int foundBookmarksPos1 = Bookmark.SearchClosest(bookmarkPos1, mContext.mFoundBookmarks);

                        Bookmark newBookmark = new Bookmark(bookmarkPos1, inputBookmark.Text.ToString());
                        newBookmark.SetAnnotatedPosition(lineNum1, wordIndex);
                        mContext.mFoundBookmarks.Insert(foundBookmarksPos1, newBookmark);
                        mContext.mBookmarks.Insert(bookmarksPos1, newBookmark);

                        if (!Bookmark.SaveToFile(mContext.mBookmarks, mContext.curFilePath + ".bookmarks"))
                        {
                            Toast.MakeText(mContext, "Bookmarks could not be stored. File location is not writable.", ToastLength.Long).Show();
                        }

                        mContext.linesAdapter.NotifyItemChanged(lineNum1 + 1);
                        show(mContext.linesLayoutManager.FindViewByPosition(lineNum1 + 1), line, wordIndex, showX, false);
                    }
                    catch (FormatException)
                    {
                        Toast.MakeText(mContext, "", ToastLength.Long).Show();
                    }
                });
                builder.SetNegativeButton("Cancel", delegate
                {
                });
                AlertDialog dialog = builder.Create();
                dialog.Window.SetSoftInputMode(SoftInput.StateVisible);

                dialog.Show();
            }
        }
Ejemplo n.º 15
0
        async void AddressChangeRequest()
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetMessage(TranslationHelper.GetString("changeAddressInAccordanceWithTheMarkedPoint", _ci));
            builder.SetPositiveButton(TranslationHelper.GetString("replace", _ci), async(object sender1, DialogClickEventArgs e1) =>
            {
                var res_ = await ReverseGeocodeToConsoleAsync();
                InitializeReverseValues();
            });
            builder.SetCancelable(true);
            builder.SetNegativeButton(TranslationHelper.GetString("doNotReplace", _ci), (object sender1, DialogClickEventArgs e1) => { });
            AlertDialog dialog = builder.Create();

            CameFromMap = false;
            if (!String.IsNullOrEmpty(FullCompanyAddressStatic))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(FullCompanyAddressTemp))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(Country))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(Region))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(City))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(Index))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(Notation))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(CountryTemp))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(RegionTemp))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(CityTemp))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(IndexTemp))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(NotationTemp))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(_countryEt.Text))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(_regionEt.Text))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(_cityEt.Text))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(_detailAddressEt.Text))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(_indexEt.Text))
            {
                dialog.Show();
                return;
            }
            if (!String.IsNullOrEmpty(_notationEt.Text))
            {
                dialog.Show();
                return;
            }
            string res = null;

            try
            {
                res = await ReverseGeocodeToConsoleAsync();
            }
            catch (Exception ex)
            {
                if (!_methods.IsConnected())
                {
                    NoConnectionActivity.ActivityName = this;
                    StartActivity(typeof(NoConnectionActivity));
                    Finish();
                    return;
                }
            }
            if (String.IsNullOrEmpty(res))
            {
                if (!_methods.IsConnected())
                {
                    NoConnectionActivity.ActivityName = this;
                    StartActivity(typeof(NoConnectionActivity));
                    Finish();
                    return;
                }
            }
            InitializeReverseValues();
        }
Ejemplo n.º 16
0
        public View GetSampleContent(Context con)
        {
            LinearLayout linear = new LinearLayout(con);

            linear.Orientation = Orientation.Vertical;

            LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent, (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 3, con.Resources.DisplayMetrics));
            int margin;

            if (IsTabletDevice(con))
            {
                margin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 15, con.Resources.DisplayMetrics);
            }
            else
            {
                margin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 9.5f, con.Resources.DisplayMetrics);
            }

            linearLayoutParams.SetMargins(margin, margin, margin, margin);

            ImageView imageView = new ImageView(con);

            imageView.SetScaleType(ImageView.ScaleType.FitStart);
            imageView.SetAdjustViewBounds(true);
            imageView.SetImageResource(Resource.Drawable.Pizzaimage);
            linear.AddView(imageView);

            int padding = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 7, con.Resources.DisplayMetrics);

            LinearLayout frameParent = new LinearLayout(con);

            frameParent.SetBackgroundColor(Color.White);
            frameParent.Orientation      = Orientation.Vertical;
            frameParent.LayoutParameters = linearLayoutParams;

            LinearLayout frame = new LinearLayout(con);

            frame.Orientation = Orientation.Vertical;
            int currentapiVersion = (int)Build.VERSION.SdkInt;

            if (currentapiVersion > 21)
            {
                frame.Background = con.Resources.GetDrawable(Resource.Drawable.shadow, con.Theme);
            }

            TextView headLabel = new TextView(con);

            headLabel.SetPadding(padding, headLabel.PaddingTop, headLabel.PaddingRight, headLabel.PaddingBottom);
            headLabel.TextSize = 18;
            headLabel.SetTextColor(Color.ParseColor("#FF007DE6"));
            headLabel.Text = "Add Extra Toppings";
            frame.AddView(headLabel);

            #region Items Layout

            selectAllBox          = new SfCheckBox(con);
            selectAllBox.Text     = "Select All";
            selectAllBox.TextSize = 15;
            selectAllBox.SetTextColor(Color.ParseColor("#FF000000"));
            selectAllBox.StateChanged    += SelectAll1_StateChanged;
            selectAllBox.LayoutParameters = linearLayoutParams;
            frame.AddView(selectAllBox);

            grilledBox          = new SfCheckBox(con);
            grilledBox.Text     = "Grilled Chicken";
            grilledBox.TextSize = 15;
            grilledBox.SetTextColor(Color.ParseColor("#FF000000"));
            grilledBox.StateChanged    += NonvegToppingsChanged;
            grilledBox.LayoutParameters = linearLayoutParams;
            frame.AddView(grilledBox);

            tikkaBox          = new SfCheckBox(con);
            tikkaBox.Text     = "Chicken Tikka";
            tikkaBox.TextSize = 15;
            tikkaBox.SetTextColor(Color.ParseColor("#FF000000"));
            tikkaBox.StateChanged    += NonvegToppingsChanged;
            tikkaBox.LayoutParameters = linearLayoutParams;
            frame.AddView(tikkaBox);

            sausaga          = new SfCheckBox(con);
            sausaga.Text     = "Chicken Sausage";
            sausaga.TextSize = 15;
            sausaga.SetTextColor(Color.ParseColor("#FF000000"));
            sausaga.StateChanged    += NonvegToppingsChanged;
            sausaga.LayoutParameters = linearLayoutParams;
            frame.AddView(sausaga);

            beefBox          = new SfCheckBox(con);
            beefBox.Text     = "Beef";
            beefBox.TextSize = 15;
            beefBox.SetTextColor(Color.ParseColor("#FF000000"));
            beefBox.StateChanged    += NonvegToppingsChanged;
            beefBox.LayoutParameters = linearLayoutParams;
            frame.AddView(beefBox);

            frameParent.AddView(frame);
            linear.AddView(frameParent);
            #endregion

            button = new Button(con);
            button.SetWidth(ActionBar.LayoutParams.MatchParent);
            button.SetHeight(43);
            button.TextSize = 21;
            button.Text     = "Order Now";
            button.SetBackgroundColor(Color.ParseColor("#FF007DE6"));
            button.SetTextColor(Color.ParseColor("#73FFFFFF"));
            button.Click  += SearchButton_Click;
            button.Enabled = false;

            linear.AddView(button);

            resultsDialog = new AlertDialog.Builder(con);
            resultsDialog.SetPositiveButton("OK", (object sender, DialogClickEventArgs e) =>
            {
            });

            resultsDialog.SetCancelable(true);
            return(linear);
        }
Ejemplo n.º 17
0
        private void Init()
        {
#if _TRIAL_
            try
            {
                interstitialAds    = new InterstitialAd(this);                // initializing interstitial ads
                mAdView.Visibility = ViewStates.Visible;
                var adRequest = new Android.Gms.Ads.AdRequest.Builder();
#if DEBUG
                adRequest.AddTestDevice(Android.Gms.Ads.AdRequest.DeviceIdEmulator);                //"TEST_EMULATOR"
#endif
                var build = adRequest.Build();
                mAdView.LoadAd(build);

#if DEBUG
                //Test
                interstitialAds.AdUnitId = "ca-app-pub-3940256099942544/1033173712";
#else
                interstitialAds.AdUnitId = Resources.GetString(Resource.String.adMob_api_interstitial_key);
#endif

                // loading test ad using adrequest
                interstitialAds.LoadAd(build);

                var ThisAdListener = new BigDays.AdListener(this);
                interstitialAds.AdListener = ThisAdListener;

                ThisAdListener.AdLoaded += () =>
                {
                    _trialImg.Visibility = ViewStates.Invisible;
                    mAdView.Visibility   = ViewStates.Visible;
                };
            }
            catch
            {
            }
#endif



#if _TRIAL_
            _trialImg.Visibility = ViewStates.Visible;
            _shopping.Visibility = ViewStates.Visible;
            Intent browserIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(Constants.VersionLink));
            _trialImg.Click += (sender, e) =>
            {
                StartActivity(browserIntent);
            };
            _shopping.Click += (sender, e) =>
            {
                StartActivity(browserIntent);
            };
#else
            _trialImg.Visibility = ViewStates.Gone;
            _shopping.Visibility = ViewStates.Gone;
            #endif


            long max_memory   = Runtime.GetRuntime().MaxMemory();
            long total_memory = Runtime.GetRuntime().TotalMemory();

            _BDDB = new DataService();
            _BDDB.ConnectToDB("BigDaysNew.db3");

            _BDDB.CreateTable();
            _BDDB.CheckRepeats();
            _BDitems = _BDDB.SelectBDItems();

            _ActiveBD = _BDitems.FirstOrDefault(x => x._Active == true);
            if (_ActiveBD == null)
            {
                _ActiveBD = _BDitems.FirstOrDefault();
            }


            var Display = WindowManager.DefaultDisplay;
            _DisplayHeight = Display.Height;
            _DisplayWidth  = Display.Width;
            _infoBoxControl.SetOnTouchListener(this);
            GlobalLayoutListener l = null;
            l = new GlobalLayoutListener(() =>
            {
                if (_FirstAppOpen == 0)
                {
                    RelativeLayout.LayoutParams infoBoxParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent - 30, ViewGroup.LayoutParams.WrapContent);
                    infoBoxParams.LeftMargin = _ActiveBD._PosLeft;
                    infoBoxParams.TopMargin  = _ActiveBD._PosTop;
                    if (_ActiveBD._ChangePos)
                    {
                        _infoBoxControl.LayoutParameters = infoBoxParams;
                    }
                    else
                    {
                        RelativeLayout.LayoutParams infoBoxParamsDef = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent - 30, ViewGroup.LayoutParams.WrapContent);
                        infoBoxParamsDef.LeftMargin = 0;
                        infoBoxParamsDef.AddRule(LayoutRules.CenterVertical);
                        _infoBoxControl.LayoutParameters = infoBoxParamsDef;
                    }

                    _FirstAppOpen = 1;
                }
                _infoBoxControl.ViewTreeObserver.RemoveGlobalOnLayoutListener(l);
            });
            _infoBoxControl.ViewTreeObserver.AddOnGlobalLayoutListener(l);

            int _ItemID = Intent.GetIntExtra("ItemID", 0);
            if (_BDitems.Count > 0)
            {
                BitmapHelpers.LoadImages(this, _BDitems);
                _CurrentItem = _BDDB.GetCurrentItem();
                if (_ItemID != 0)
                {
                    _CurrentItem._ID = _ItemID;
                }

                var currentItem = _BDitems.FirstOrDefault(n => n._ID == _CurrentItem._ID);

                if (currentItem != null)
                {
                    ShowImage(currentItem);
                }

                _infoBoxControl.Visibility = ViewStates.Visible;
            }
            else
            {
                ShowDefImage();
                _infoBoxControl.Visibility = ViewStates.Gone;
            }


            if (_infoBoxControl.Visibility != ViewStates.Gone)
            {
                _infoBoxControl.Title = _CurrentItem._Name;
            }


            var ui_showListButton = FindViewById <ImageButton>(Resource.Id.showListButton);
            ui_showListButton.Click += (sender, e) =>
            {
                var IntentListActivity = new Intent(this, typeof(ListActivity));
                StartActivityForResult(IntentListActivity, (int)BigDays.Enums.RequestCode.List_BigDays);
            };

            var ui_addBigDaysBtn = FindViewById <ImageButton>(Resource.Id.mainAddBigDays);
            ui_addBigDaysBtn.Click += (sender, e) =>
            {
#if _TRIAL_
                if (_BDitems.Count == 1)
                {
                    AlertDialog.Builder builder;
                    builder = new AlertDialog.Builder(this);
                    builder.SetTitle("Free Version");
                    builder.SetMessage("You can add only 1 Big Day item in free version. Please purchase full version to enable adding unlimited Big Days items and Facebook share function.\n\nBy clicking \"Buy Now\" you will redirect to Full version (no ad banner) purchase page.");
                    builder.SetCancelable(false);
                    builder.SetPositiveButton("Buy Now", delegate
                    {
                        StartActivity(browserIntent);
                    });
                    builder.SetNegativeButton("Continue", delegate { });
                    builder.Show();
                }
                else
                {
                    var IntentNewBigDaysActivity = new Intent(this, typeof(NewBigDays));
                    StartActivityForResult(IntentNewBigDaysActivity, (int)Enums.RequestCode.AddNew_BigDay);
                }
#else
                var IntentNewBigDaysActivity = new Intent(this, typeof(NewBigDays));
                StartActivityForResult(IntentNewBigDaysActivity, (int)BigDays.Enums.RequestCode.AddNew_BigDay);
#endif
            };

            var ui_Feedback = FindViewById <ImageButton>(Resource.Id.Feedback);
            ui_Feedback.Click += (sender, e) =>
            {
                var IntentFeedbackActivity = new Intent(this, typeof(Feedback));
                StartActivity(IntentFeedbackActivity);
            };

            _infoBoxControl.EditBigDaysBtn.Click += (sender, e) =>
            {
                var IntentNewBigDaysActivity = new Intent(this, typeof(NewBigDays));
                IntentNewBigDaysActivity.PutExtra("Edit", true);
                IntentNewBigDaysActivity.PutExtra("ID", _CurrentItem._ID);
                StartActivityForResult(IntentNewBigDaysActivity, (int)BigDays.Enums.RequestCode.Edit_BigDay);
            };

            _infoBoxControl.ShareBigDaysBtn.Click += (sender, e) =>
            {
                var IntentShareActivity = new Intent(this, typeof(Share));
                IntentShareActivity.PutExtra("ID", _CurrentItem._ID);
                StartActivity(IntentShareActivity);
            };

            if (_infoBoxControl.Visibility != ViewStates.Gone)
            {
                if (_ActiveBD._ChangePos)
                {
                    RelativeLayout.LayoutParams infoBoxParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent - 30, ViewGroup.LayoutParams.WrapContent);
                    infoBoxParams.LeftMargin = _ActiveBD._PosLeft;
                    infoBoxParams.TopMargin  = _ActiveBD._PosTop;

                    _infoBoxControl.LayoutParameters = infoBoxParams;
                }
                else
                {
                    RelativeLayout.LayoutParams infoBoxParamsDef = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent - 30, ViewGroup.LayoutParams.WrapContent);
                    infoBoxParamsDef.LeftMargin = 0;
                    infoBoxParamsDef.AddRule(LayoutRules.CenterVertical);
                    _infoBoxControl.LayoutParameters = infoBoxParamsDef;
                }
            }

            _TimerHandler = new Handler();
            UpdateGeneration();
        }
Ejemplo n.º 18
0
        public View GetSampleContent(Context con)
        {
            context = con;
            InitialMethod();

            ScrollView scroll   = new ScrollView(con);
            bool       isTablet = SfMaskedEditText.IsTabletDevice(con);

            linear = new LinearLayout(con);
            linear.SetBackgroundColor(Color.White);
            linear.Orientation = Orientation.Vertical;
            linear.SetPadding(12, 12, 12, 12);

            TextView headLabel = new TextView(con);

            headLabel.TextSize = 30;
            headLabel.SetTextColor(Color.ParseColor("#262626"));
            headLabel.Typeface = Typeface.DefaultBold;
            headLabel.Text     = "Funds Transfer";
            linear.AddView(headLabel);

            TextView fundTransferLabelSpacing = new TextView(con);

            fundTransferLabelSpacing.SetHeight(40);
            linear.AddView(fundTransferLabelSpacing);

            TextView textToAccount = new TextView(con);

            textToAccount.SetTextColor(Color.ParseColor("#6d6d72"));
            textToAccount.TextSize = 18;
            textToAccount.Typeface = Typeface.Default;
            textToAccount.Text     = "To Account";
            textToAccount.SetPadding(0, 0, 0, 10);
            linear.AddView(textToAccount);


            sfToAccount                 = new SfMaskedEdit(con);
            sfToAccount.Mask            = "0000 0000 0000 0000";
            sfToAccount.Gravity         = GravityFlags.Start;
            sfToAccount.ValidationMode  = InputValidationMode.KeyPress;
            sfToAccount.ValueMaskFormat = MaskFormat.ExcludePromptAndLiterals;
            sfToAccount.Hint            = "1234 1234 1234 1234";
            sfToAccount.FocusChange    += SfToAccount_FocusChange;
            sfToAccount.SetHintTextColor(Color.LightGray);
            linear.AddView(sfToAccount);

            erroToAccount = new TextView(con);
            erroToAccount.SetTextColor(Color.Red);
            erroToAccount.TextSize = 14;
            erroToAccount.Typeface = Typeface.Default;
            linear.AddView(erroToAccount);

            TextView textDesc = new TextView(con);

            textDesc.Text     = "Description";
            textDesc.Typeface = Typeface.Default;
            textDesc.SetPadding(0, 30, 0, 10);
            textDesc.TextSize = 18;
            linear.AddView(textDesc);


            sfDesc                 = new SfMaskedEdit(con);
            sfDesc.Mask            = "";
            sfDesc.Gravity         = GravityFlags.Start;
            sfDesc.ValidationMode  = InputValidationMode.KeyPress;
            sfDesc.ValueMaskFormat = MaskFormat.ExcludePromptAndLiterals;
            sfDesc.Hint            = "Enter description";
            sfDesc.FocusChange    += SfToAccount_FocusChange;
            sfDesc.SetHintTextColor(Color.LightGray);
            linear.AddView(sfDesc);


            TextView textAmount = new TextView(con);

            textAmount.Text     = "Amount";
            textAmount.Typeface = Typeface.Default;
            textAmount.SetPadding(0, 30, 0, 10);
            textAmount.TextSize = 18;
            linear.AddView(textAmount);

            amountMask                 = new SfMaskedEdit(con);
            amountMask.Mask            = "$ 0,000.00";
            amountMask.Gravity         = GravityFlags.Start;
            amountMask.ValidationMode  = InputValidationMode.KeyPress;
            amountMask.ValueMaskFormat = MaskFormat.IncludePromptAndLiterals;
            amountMask.Hint            = "$ 3,874.00";
            amountMask.FocusChange    += SfToAccount_FocusChange;
            amountMask.SetHintTextColor(Color.LightGray);
            linear.AddView(amountMask);

            errotextAmount = new TextView(con);
            errotextAmount.SetTextColor(Color.Red);
            errotextAmount.TextSize = 12;
            errotextAmount.Typeface = Typeface.Default;
            linear.AddView(errotextAmount);

            TextView textEmail = new TextView(con);

            textEmail.Text     = "Email ID";
            textEmail.Typeface = Typeface.Default;
            textEmail.SetPadding(0, 30, 0, 10);
            textEmail.TextSize = 18;
            linear.AddView(textEmail);

            emailMask                 = new SfMaskedEdit(con);
            emailMask.Mask            = @"\w+@\w+\.\w+";
            emailMask.MaskType        = MaskType.RegEx;
            emailMask.Gravity         = GravityFlags.Start;
            emailMask.ValidationMode  = InputValidationMode.KeyPress;
            emailMask.ValueMaskFormat = MaskFormat.ExcludePromptAndLiterals;
            emailMask.Hint            = "*****@*****.**";
            emailMask.FocusChange    += SfToAccount_FocusChange;
            emailMask.SetHintTextColor(Color.LightGray);
            linear.AddView(emailMask);

            errotextEmail = new TextView(con);
            errotextEmail.SetTextColor(Color.Red);
            errotextEmail.TextSize = 12;
            errotextEmail.Typeface = Typeface.Default;
            linear.AddView(errotextEmail);

            TextView textPhone = new TextView(con);

            textPhone.Text     = "Mobile Number ";
            textPhone.Typeface = Typeface.Default;
            textPhone.SetPadding(0, 30, 0, 10);
            textPhone.TextSize = 18;
            linear.AddView(textPhone);

            phoneMask                 = new SfMaskedEdit(con);
            phoneMask.Mask            = "+1 000 000 0000";
            phoneMask.Gravity         = GravityFlags.Start;
            phoneMask.ValueMaskFormat = MaskFormat.ExcludePromptAndLiterals;
            phoneMask.ValidationMode  = InputValidationMode.KeyPress;
            phoneMask.Hint            = "+1 323 339 3392";
            phoneMask.FocusChange    += SfToAccount_FocusChange;
            phoneMask.SetHintTextColor(Color.LightGray);
            linear.AddView(phoneMask);

            errotextPhone = new TextView(con);
            errotextPhone.SetTextColor(Color.Red);
            errotextPhone.TextSize = 12;
            errotextPhone.Typeface = Typeface.Default;
            linear.AddView(errotextPhone);

            TextView transferButtonSpacing = new TextView(con);

            transferButtonSpacing.SetHeight(30);

            Button transferButton = new Button(con);

            transferButton.SetWidth(ActionBar.LayoutParams.MatchParent);
            transferButton.SetHeight(40);
            transferButton.Text = "TRANSFER MONEY";
            transferButton.SetTextColor(Color.White);
            transferButton.SetBackgroundColor(Color.Rgb(72, 178, 224));
            transferButton.Click += (object sender, EventArgs e) =>
            {
                if (string.IsNullOrEmpty(sfToAccount.Text) || string.IsNullOrEmpty(sfDesc.Text) || string.IsNullOrEmpty(amountMask.Text) || string.IsNullOrEmpty(emailMask.Text) || string.IsNullOrEmpty(phoneMask.Text))
                {
                    resultsDialog.SetMessage("Please fill all the required data!");
                }
                else if ((sfToAccount.HasError || sfDesc.HasError || amountMask.HasError || emailMask.HasError || phoneMask.HasError))
                {
                    resultsDialog.SetMessage("Please enter valid details");
                }
                else
                {
                    resultsDialog.SetMessage(string.Format("Amount of {0} has been transferred successfully!", amountMask.Value));
                    string mask1 = sfToAccount.Mask;
                    sfToAccount.Mask = string.Empty;
                    sfToAccount.Mask = mask1;

                    mask1       = sfDesc.Mask;
                    sfDesc.Mask = "0";
                    sfDesc.Mask = mask1;

                    mask1           = amountMask.Mask;
                    amountMask.Mask = string.Empty;
                    amountMask.Mask = mask1;

                    mask1          = emailMask.Mask;
                    emailMask.Mask = string.Empty;
                    emailMask.Mask = mask1;

                    mask1          = phoneMask.Mask;
                    phoneMask.Mask = string.Empty;
                    phoneMask.Mask = mask1;
                }
                resultsDialog.Create().Show();
            };
            linear.AddView(transferButtonSpacing);
            linear.AddView(transferButton);

            TextView transferAfterButtonSpacing = new TextView(con);

            transferAfterButtonSpacing.SetHeight(60);
            linear.AddView(transferAfterButtonSpacing);

            sfToAccount.ValueChanged      += SfToAccount_ValueChanged;
            sfToAccount.MaskInputRejected += SfToAccount_MaskInputRejected;

            amountMask.ValueChanged      += AmountMask_ValueChanged;
            amountMask.MaskInputRejected += AmountMask_MaskInputRejected;

            emailMask.ValueChanged      += EmailMask_ValueChanged;
            emailMask.MaskInputRejected += EmailMask_MaskInputRejected;

            phoneMask.ValueChanged      += PhoneMask_ValueChanged;
            phoneMask.MaskInputRejected += PhoneMask_MaskInputRejected;

            linear.Touch += (object sender, View.TouchEventArgs e) =>
            {
                if (sfToAccount.IsFocused || sfDesc.IsFocused || amountMask.IsFocused || emailMask.IsFocused || phoneMask.IsFocused)
                {
                    Rect outRect = new Rect();
                    sfToAccount.GetGlobalVisibleRect(outRect);
                    sfDesc.GetGlobalVisibleRect(outRect);
                    amountMask.GetGlobalVisibleRect(outRect);
                    emailMask.GetGlobalVisibleRect(outRect);
                    phoneMask.GetGlobalVisibleRect(outRect);
                    if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY))
                    {
                        sfToAccount.ClearFocus();
                        sfDesc.ClearFocus();
                        amountMask.ClearFocus();
                        emailMask.ClearFocus();
                        phoneMask.ClearFocus();
                    }
                }
                hideSoftKeyboard((Activity)con);
            };

            //results dialog
            resultsDialog = new AlertDialog.Builder(con);
            resultsDialog.SetTitle("Status");
            resultsDialog.SetPositiveButton("OK", (object sender, DialogClickEventArgs e) =>
            {
            });

            resultsDialog.SetCancelable(true);

            frame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            frame.SetBackgroundColor(Color.White);
            frame.SetPadding(10, 10, 10, 10);

            //scrollView1
            mainPageScrollView = new ScrollView(con);
            mainPageScrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.7), GravityFlags.Top | GravityFlags.CenterHorizontal);
            mainPageScrollView.AddView(linear);
            frame.AddView(mainPageScrollView);

            //buttomButtonLayout
            buttomButtonLayout = new FrameLayout(con);
            buttomButtonLayout.SetBackgroundColor(Color.Transparent);
            buttomButtonLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.1), GravityFlags.Bottom | GravityFlags.CenterHorizontal);

            //propertyButton
            propertyButton = new Button(con);
            propertyButton.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Bottom | GravityFlags.CenterHorizontal);
            propertyButton.Text             = "OPTIONS";
            propertyButton.Gravity          = GravityFlags.Start;
            propertyFrameLayout             = new FrameLayout(con);
            propertyFrameLayout.SetBackgroundColor(Color.Rgb(236, 236, 236));
            propertyFrameLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.3), GravityFlags.CenterHorizontal);
            propertyFrameLayout.AddView(GetPropertyLayout(con));

            //propertyButton Click Listener
            propertyButton.Click += (object sender, EventArgs e) =>
            {
                buttomButtonLayout.RemoveAllViews();
                propertyFrameLayout.RemoveAllViews();
                propPageScrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.3), GravityFlags.Bottom | GravityFlags.CenterHorizontal);
                mainPageScrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.7), GravityFlags.Top | GravityFlags.CenterHorizontal);
                propertyFrameLayout.AddView(GetPropertyLayout(con));
            };

            //scrollView
            propPageScrollView = new ScrollView(con);
            propPageScrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.3), GravityFlags.Bottom | GravityFlags.CenterHorizontal);
            propPageScrollView.AddView(propertyFrameLayout);

            frame.AddView(propPageScrollView);
            frame.AddView(buttomButtonLayout);
            frame.FocusableInTouchMode = true;

            return(frame);
        }
Ejemplo n.º 19
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ImagePreview);

            Geneticist.Splice(this);

            var helpRelaLayout = FindViewById <RelativeLayout>(Resource.Id.helpRelaLayout);

            helpRelaLayout.Click += (sender, e) =>
            {
                helpRelaLayout.Visibility = ViewStates.Gone;
            };
            _scaleImageView = FindViewById <ScaleImageView>(Resource.Id.scaleImageView);


            if (!string.IsNullOrEmpty(Constants.ImageBtmUri))
            {
                var options = new DisplayImageOptions.Builder()
                              .ShowImageOnLoading(Resource.Drawable.ic_stub)
                              .ShowImageForEmptyUri(Resource.Drawable.ic_empty)
                              .ShowImageOnFail(Resource.Drawable.ic_error)
                              .CacheInMemory(false)
                              .CacheOnDisk(false)
                              .BitmapConfig(Bitmap.Config.Rgb565)
                              .Build();

                ImageLoader.Instance.DisplayImage(
                    Constants.ImageBtmUri,
                    _scaleImageView,
                    options,
                    new ImageLoadingListener(
                        loadingStarted: delegate
                {
                    //spinner.Visibility = ViewStates.Visible;
                },
                        loadingComplete: delegate
                {
                    //spinner.Visibility = ViewStates.Gone;
                },
                        loadingFailed: (imageUri, _view, failReason) =>
                {
                    string message = null;
                    if (failReason.Type == FailReason.FailType.IoError)
                    {
                        message = "Input/Output error";
                    }
                    else if (failReason.Type == FailReason.FailType.DecodingError)
                    {
                        message = "Image can't be decoded";
                    }
                    else if (failReason.Type == FailReason.FailType.NetworkDenied)
                    {
                        message = "Downloads are denied";
                    }
                    else if (failReason.Type == FailReason.FailType.OutOfMemory)
                    {
                        message = "Out Of Memory error";
                    }
                    else
                    {
                        message = "Unknown error";
                    }

                    AlertDialog.Builder builder;
                    builder = new AlertDialog.Builder(this);
                    builder.SetTitle("Error CodeBloc №102/1");
                    builder.SetMessage("message");
                    builder.SetCancelable(false);
                    builder.SetPositiveButton("OK", delegate { Finish(); });
                    builder.Show();

                    //spinner.Visibility = ViewStates.Gone;
                }));
            }
            else
            {
                AlertDialog.Builder builder;
                builder = new AlertDialog.Builder(this);
                builder.SetTitle("Error CodeBlock №102/2");
                builder.SetMessage("File not support");
                builder.SetCancelable(false);
                builder.SetPositiveButton("OK", delegate { Finish(); });
                builder.Show();
            }
        }
Ejemplo n.º 20
0
        public static void ShowChangeLog(Context ctx, Action onDismiss)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog));
            builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title));
            List <string> changeLog = new List <string> {
                BuildChangelogString(ctx, Resource.Array.ChangeLog_1_09d, "1.09d"),
                BuildChangelogString(ctx, Resource.Array.ChangeLog_1_09c, "1.09c"),
                BuildChangelogString(ctx, Resource.Array.ChangeLog_1_09b, "1.09b"),
                BuildChangelogString(ctx, Resource.Array.ChangeLog_1_09a, "1.09a"),
                BuildChangelogString(ctx, Resource.Array.ChangeLog_1_08d, "1.08d"),
                BuildChangelogString(ctx, Resource.Array.ChangeLog_1_08c, "1.08c"),
                BuildChangelogString(ctx, Resource.Array.ChangeLog_1_08b, "1.08b"),
                BuildChangelogString(ctx, Resource.Array.ChangeLog_1_08, "1.08"),
                ctx.GetString(Resource.String.ChangeLog_1_07b),
                ctx.GetString(Resource.String.ChangeLog_1_07),
                ctx.GetString(Resource.String.ChangeLog_1_06),
                ctx.GetString(Resource.String.ChangeLog_1_05),
                ctx.GetString(Resource.String.ChangeLog_1_04b),
                ctx.GetString(Resource.String.ChangeLog_1_04),
                ctx.GetString(Resource.String.ChangeLog_1_03),
                ctx.GetString(Resource.String.ChangeLog_1_02),
#if !NoNet
                ctx.GetString(Resource.String.ChangeLog_1_01g),
                ctx.GetString(Resource.String.ChangeLog_1_01d),
#endif
                ctx.GetString(Resource.String.ChangeLog_1_01),
                ctx.GetString(Resource.String.ChangeLog_1_0_0e),
                ctx.GetString(Resource.String.ChangeLog_1_0_0),
                ctx.GetString(Resource.String.ChangeLog_0_9_9c),
                ctx.GetString(Resource.String.ChangeLog_0_9_9),
                ctx.GetString(Resource.String.ChangeLog_0_9_8c),
                ctx.GetString(Resource.String.ChangeLog_0_9_8b),
                ctx.GetString(Resource.String.ChangeLog_0_9_8),
#if !NoNet
                //0.9.7b fixes were already included in 0.9.7 offline
                ctx.GetString(Resource.String.ChangeLog_0_9_7b),
#endif
                ctx.GetString(Resource.String.ChangeLog_0_9_7),
                ctx.GetString(Resource.String.ChangeLog_0_9_6),
                ctx.GetString(Resource.String.ChangeLog_0_9_5),
                ctx.GetString(Resource.String.ChangeLog_0_9_4),
                ctx.GetString(Resource.String.ChangeLog_0_9_3_r5),
                ctx.GetString(Resource.String.ChangeLog_0_9_3),
                ctx.GetString(Resource.String.ChangeLog_0_9_2),
                ctx.GetString(Resource.String.ChangeLog_0_9_1),
                ctx.GetString(Resource.String.ChangeLog_0_9),
                ctx.GetString(Resource.String.ChangeLog_0_8_6),
                ctx.GetString(Resource.String.ChangeLog_0_8_5),
                ctx.GetString(Resource.String.ChangeLog_0_8_4),
                ctx.GetString(Resource.String.ChangeLog_0_8_3),
                ctx.GetString(Resource.String.ChangeLog_0_8_2),
                ctx.GetString(Resource.String.ChangeLog_0_8_1),
                ctx.GetString(Resource.String.ChangeLog_0_8),
                ctx.GetString(Resource.String.ChangeLog_0_7),
                ctx.GetString(Resource.String.ChangeLog)
            };

            String version;

            try {
                PackageInfo packageInfo = ctx.PackageManager.GetPackageInfo(ctx.PackageName, 0);
                version = packageInfo.VersionName;
            } catch (PackageManager.NameNotFoundException) {
                version = "";
            }

            string warning = "";

            if (version.Contains("pre"))
            {
                warning = ctx.GetString(Resource.String.PreviewWarning);
            }

            builder.SetPositiveButton(Android.Resource.String.Ok, (dlgSender, dlgEvt) => { ((AlertDialog)dlgSender).Dismiss(); });
            builder.SetCancelable(false);

            WebView wv = new WebView(ctx);

            wv.SetBackgroundColor(Color.White);
            wv.LoadDataWithBaseURL(null, GetLog(changeLog, warning, ctx), "text/html", "UTF-8", null);


            //builder.SetMessage("");
            builder.SetView(wv);
            Dialog dialog = builder.Create();

            dialog.DismissEvent += (sender, e) =>
            {
                onDismiss();
            };
            dialog.Show();

            /*TextView message = (TextView)dialog.FindViewById(Android.Resource.Id.Message);
             *
             *
             * message.TextFormatted = Html.FromHtml(ConcatChangeLog(ctx, changeLog.ToArray()));
             * message.AutoLinkMask=MatchOptions.WebUrls;*/
        }
Ejemplo n.º 21
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            var provider = cachedProvider;

            if (provider == null)
            {
                if (savedInstanceState != null)
                {
                    var savedProviderString = savedInstanceState.GetString(SavedProvider);
                    if (!string.IsNullOrEmpty(savedProviderString))
                    {
                        cachedProvider = JsonConvert.DeserializeObject <SimpleDialogProvider>(savedProviderString);
                        provider       = cachedProvider;
                    }
                }
            }

            if (provider == null)
            {
                throw new InvalidProgramException("Unable to get dialog provider.");
            }

            Dialog dialog = null;

            switch (provider.Type)
            {
            case SimpleDialogProvider.DialogType.AlertDialog:
                var dialogBuilder = new AlertDialog.Builder(Activity);
                if (provider.TitleResId > 0)
                {
                    dialogBuilder.SetTitle(MainApp.ThisApp.Resources.GetString(provider.TitleResId));
                }

                dialogBuilder.SetMessage(MainApp.ThisApp.Resources.GetString(provider.MessageResId));
                dialogBuilder.SetCancelable(provider.Cancelable);
                Cancelable = provider.Cancelable;
                dialogBuilder.SetPositiveButton(
                    provider.PositiveButtonResId > 0
                            ? MainApp.ThisApp.Resources.GetString(provider.PositiveButtonResId)
                            : Activity.Resources.GetString(Resource.String.OK),
                    new EventHandler <DialogClickEventArgs>(OnButtonClick));
                if (provider.NegativeButtonResId >= 0)
                {
                    dialogBuilder.SetNegativeButton(
                        provider.NegativeButtonResId == 0
                                ? Activity.Resources.GetString(Resource.String.Cancel)
                                : Activity.Resources.GetString(provider.NegativeButtonResId),
                        new EventHandler <DialogClickEventArgs>(OnButtonClick));
                }

                dialog = dialogBuilder.Create();
                if (provider.TitleResId > 0)
                {
                    dialog.RequestWindowFeature((int)WindowFeatures.NoTitle);
                }

                dialog.SetCanceledOnTouchOutside(provider.CanceledOnTouchOutside);
                break;

            case SimpleDialogProvider.DialogType.PleaseWaitDialog:
                var progressDialog = new ProgressDialog(Activity);
                progressDialog.Indeterminate = true;
                progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
                progressDialog.SetMessage(
                    provider.MessageResId > 0
                            ? Activity.Resources.GetString(provider.MessageResId)
                            : Activity.Resources.GetString(Resource.String.PleaseWaitMessage));
                progressDialog.SetCancelable(false);
                progressDialog.SetCanceledOnTouchOutside(false);
                dialog     = progressDialog;
                Cancelable = false;
                break;

            default:
                throw new InvalidProgramException("Unknown dialog type.");
            }

            return(dialog);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ProfileView);

            string UserFname = Intent.GetStringExtra("FIRSTNAME");
            string UserLname = Intent.GetStringExtra("LASTNAME");
            string UserEmail = Intent.GetStringExtra("USERID");

            ProfileFname    = FindViewById <TextView>(Resource.Id.ProfileFirstNameId);
            ProfileLname    = FindViewById <TextView>(Resource.Id.ProfileLastNameId);
            ProfileEmail    = FindViewById <TextView>(Resource.Id.ProfileEmailId);
            ProfileUsername = FindViewById <TextView>(Resource.Id.ProfileUsernameId);
            ProfilePassword = FindViewById <TextView>(Resource.Id.ProfilePasswordId);
            Update          = FindViewById <Button>(Resource.Id.UpdateId);
            back            = FindViewById <Button>(Resource.Id.BackId);

            realmObj = Realm.GetInstance();
            var userInfo = realmObj.All <User>();

            foreach (var temp in userInfo)
            {
                if (temp.Email.Equals(UserEmail))
                {
                    ProfileFname.Text    = temp.FirstName.ToString();
                    ProfileLname.Text    = temp.LastName.ToString();
                    ProfileEmail.Text    = temp.Email.ToString();
                    ProfileUsername.Text = temp.Username.ToString();
                    ProfilePassword.Text = temp.Password.ToString();
                }
            }
            Update.Click += delegate
            {
                AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);

                LayoutInflater layoutInflate = LayoutInflater.From(this);
                View           view          = layoutInflate.Inflate(Resource.Layout.ProfileUpdatePopUp, null);
                alertBuilder.SetView(view);
                var Fname    = view.FindViewById <TextView>(Resource.Id.PopUpFirstNameId);
                var Lname    = view.FindViewById <EditText>(Resource.Id.PopUpLastNameId);
                var email    = view.FindViewById <TextView>(Resource.Id.PopUpEmailId);
                var userName = view.FindViewById <EditText>(Resource.Id.PopUpUsernameId);
                var pass     = view.FindViewById <EditText>(Resource.Id.PopUpPasswordId);

                email.Text = UserEmail.ToString();
                Fname.Text = UserFname.ToString();

                alertBuilder.SetCancelable(false)
                .SetPositiveButton("Update", delegate
                {
                    var user = realmObj.All <User>();
                    foreach (var temp in user)
                    {
                        if (temp.Email.Equals(UserEmail))
                        {
                            var updateInfo       = new User();
                            updateInfo.FirstName = Fname.Text;
                            updateInfo.LastName  = Lname.Text;
                            updateInfo.Email     = email.Text;
                            updateInfo.Username  = userName.Text;
                            updateInfo.Password  = pass.Text;

                            realmObj.Write(() =>
                            {
                                realmObj.Add(updateInfo, update: true);
                            });
                        }
                    }
                    Intent newScreen = new Intent(this, typeof(ViewProfile));
                    newScreen.PutExtra("FIRSTNAME", UserFname);
                    newScreen.PutExtra("LASTNAME", UserLname);
                    newScreen.PutExtra("USERID", UserEmail);
                    StartActivity(newScreen);
                })
                .SetNegativeButton("Cancel", delegate
                {
                    alertBuilder.Dispose();
                });
                AlertDialog dialog = alertBuilder.Create();
                dialog.Show();
            };

            back.Click += delegate
            {
                Intent newScreen = new Intent(this, typeof(Main_Page));
                newScreen.PutExtra("FIRSTNAME", UserFname);
                newScreen.PutExtra("LASTNAME", UserLname);
                newScreen.PutExtra("EMAIL", UserEmail);
                StartActivity(newScreen);
            };
        }
Ejemplo n.º 23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.actLogin);

            Button   btnLogin    = FindViewById <Button>(Resource.Id.btnLogin);
            TextView txtUsername = FindViewById <TextView>(Resource.Id.txtfldUsername);
            TextView txtPassword = FindViewById <TextView>(Resource.Id.txtfldPassword);

            Data_Local dLoc = new Data_Local();

            AlertDialog.Builder alertExisting = new AlertDialog.Builder(this);
            Player thisPlayer = dLoc.Player_Default();

            if (thisPlayer == null)
            {
                alertExisting.SetTitle("No user found");
                alertExisting.SetMessage("No user has logged in on this device. Please create a user.");
                alertExisting.SetPositiveButton("OK", delegate { });
                alertExisting.SetCancelable(false);
                alertExisting.Show();
            }
            else
            {
                alertExisting.SetTitle("Local user found!");
                alertExisting.SetMessage(String.Format("Would you like to continue as {0}?", thisPlayer.Username));
                alertExisting.SetPositiveButton("Yes", delegate
                {
                    Intent intAct = new Intent(this, typeof(actMainMenu));
                    intAct.PutExtra("Username", thisPlayer.Username);
                    StartActivity(intAct);
                });
                alertExisting.SetNegativeButton("No", delegate { });
                alertExisting.Show();
            }

            btnLogin.Click += (object sender, EventArgs e) => {
                Data_Server         srvClass   = new Data_Server();
                bool                loginValid = srvClass.Player_Login(txtUsername.Text, txtPassword.Text);
                AlertDialog.Builder alertLogin = new AlertDialog.Builder(this);

                if (loginValid)
                {
                    alertLogin.SetTitle("Success!");
                    alertLogin.SetMessage("You have been logged in.");
                    alertLogin.SetPositiveButton("OK", delegate
                    {
                        dLoc.Player_Add(new Player(txtUsername.Text));
                        Intent intAct = new Intent(this, typeof(actMainMenu));
                        intAct.PutExtra("Username", txtUsername.Text);
                        StartActivity(intAct);
                    });
                }
                else
                {
                    alertLogin.SetTitle("Error");
                    alertLogin.SetMessage("Error logging in. Please check your login information and ensure you are connected to the internet.");
                    alertLogin.SetPositiveButton("OK", delegate { });
                }
                alertLogin.SetCancelable(false);
                alertLogin.Show();
            };
        }
Ejemplo n.º 24
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            ViewGroup root = FindViewById <ViewGroup>(Android.Resource.Id.Content);

            SetContentView(Resource.Layout.SettingsLayout);

            SetSupportActionBar(FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.SettingsToolbar));

            SettingsListView = (ListView)FindViewById(Resource.Id.SettingsListView);

            SettingsListAdapter = new ViewGeneratorArrayAdapter(
                this,

                (pos, convertView, parent) =>
            {
                View view = convertView ?? LayoutInflater.Inflate(Android.Resource.Layout.SimpleListItem1, null);
                view.FindViewById <TextView>(Android.Resource.Id.Text1).Text = "TODO: Add proper settings.";
                return(view);
            },

                (pos, convertView, parent) =>
            {
                View view = convertView ?? LayoutInflater.Inflate(Android.Resource.Layout.SimpleListItem1, null);
                view.FindViewById <TextView>(Android.Resource.Id.Text1).SetText(Resource.String.License);
                ListActions[pos] = () =>
                {
                    AlertDialog dialog = null;
                    using (AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this))
                    {
                        TextView msg = new TextView(this);
                        msg.SetText(Resource.String.Licenses);
                        msg.ApplyHTML();

                        msg.SetPadding(20, 20, 20, 20);

                        ScrollView msgScroll = new ScrollView(this);
                        msgScroll.AddView(msg);

                        dialogBuilder.SetTitle(Resource.String.License);
                        dialogBuilder.SetView(msgScroll);
                        dialogBuilder.SetCancelable(true);
                        dialogBuilder.SetPositiveButton(Android.Resource.String.Ok, (s, e) =>
                        {
                            dialog.Dismiss();
                        });
                        dialog = dialogBuilder.Show();
                    }
                };
                return(view);
            },

                (pos, convertView, parent) =>
            {
                View view   = convertView ?? LayoutInflater.Inflate(Android.Resource.Layout.SimpleListItem1, null);
                TextView tv = view.FindViewById <TextView>(Android.Resource.Id.Text1);
                tv.SetText(Resource.String.ListTail);
                tv.ApplyHTML();
                return(view);
            }
                );
            SettingsListView.Adapter = SettingsListAdapter;

            SettingsListView.ItemClick += (s, e) =>
            {
                Action action;
                if (ListActions.TryGetValue(e.Position, out action))
                {
                    action?.Invoke();
                }
            };
        }
Ejemplo n.º 25
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            // Set AppPreferences object
            Context        mContext = Android.App.Application.Context;
            AppPreferences ap       = new AppPreferences(mContext);

            // Get current phone numbers
            string _phonenumbers = ap.getAccessKey();

            // Get our button from the layout resource,
            // and attach an event to it
            Button   bSendSMS      = FindViewById <Button>(Resource.Id.btnSendSMS);
            Button   bGetLocation  = FindViewById <Button>(Resource.Id.btnLocation);
            EditText tPhoneNumbers = FindViewById <EditText>(Resource.Id.txtPhoneNumbers);

            tPhoneNumbers.Text = _phonenumbers;

            // Get the text fields from the layout
            _addressText = FindViewById <TextView>(Resource.Id.txtLocation);
            _LatLongText = FindViewById <TextView>(Resource.Id.txtLatLong);

            //Disable buttons until location is found
            bSendSMS.Enabled     = false;
            bGetLocation.Enabled = false;

            InitializeLocationManager();

            bSendSMS.Click += delegate {
                var _PhoneNumbersText = FindViewById <TextView>(Resource.Id.txtPhoneNumbers);
                var _SituationRB      = FindViewById <RadioGroup>(Resource.Id.radioGroup1);
                var _SituationButton  = FindViewById <RadioButton>(_SituationRB.CheckedRadioButtonId);
                var _Comments         = FindViewById <TextView>(Resource.Id.txtComments);

                // fetch the Sms Manager
                SmsManager sms = SmsManager.Default;

                String _SMSString = "Current Lat/Long: " + _currentLocation.Latitude.ToString() + " / " + _currentLocation.Longitude.ToString() +
                                    "\r\n\r\nComments: " + _Comments.Text +
                                    "\r\n\r\nSituation: " + _SituationButton.Text;

                // split it between any commas, stripping whitespace afterwards
                String   userInput = _PhoneNumbersText.Text.ToString();
                String[] numbers   = userInput.Split(',');

                foreach (string number in numbers)
                {
                    sms.SendTextMessage(number, null, _SMSString, null, null);
                }

                ap.saveAccessKey(userInput);

                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.SetTitle("Alert");
                builder.SetMessage("Message(s) sent");
                builder.SetCancelable(false);
                builder.SetPositiveButton("OK", delegate { Finish(); });
                builder.Show();
            };

            bGetLocation.Click += delegate
            {
                btnLocation_OnClick();
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Menulistaoffline);
            string ipadress = Intent.GetStringExtra("ipadre");

            listareprod   = new List <string>();
            listareprod2  = new List <string>();
            textboxtitulo = FindViewById <TextView>(Resource.Id.textView1);
            ImageView playpause    = FindViewById <ImageView>(Resource.Id.imageView5);
            var       botonelimiar = FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.imageView7);
            var       botonagregar = FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.imageView6);
            ImageView botonhome    = FindViewById <ImageView>(Resource.Id.imageView4);

            listbox = FindViewById <ListView>(Resource.Id.listView1);
            ImageView botonreproducir = FindViewById <ImageView>(Resource.Id.imageView3);

            lineall2     = FindViewById <LinearLayout>(Resource.Id.linearLayout1);
            listaenlinea = Intent.GetStringExtra("listaenlinea");
            lineaa       = FindViewById <LinearLayout>(Resource.Id.linearlayout0);
            instance     = this;

            botonagregar.Enabled = true;
            //  animar2(lineall2);
            var adaptadolo = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> {
                "No hay elementos para mostrar.."
            });

            RunOnUiThread(() => {
                var parcelable  = listbox.OnSaveInstanceState();
                listbox.Adapter = adaptadolo;
                listbox.OnRestoreInstanceState(parcelable);
            });
            llenarlista();
            AnimationHelper.AnimateFAB(botonagregar);
            // lineaa.SetBackgroundColor(Android.Graphics.Color.DarkGray);
            tree = new Thread(new ThreadStart(cojerstream));
            tree.Start();
            textboxtitulo.Selected = true;
            // botonelimiar.SetBackgroundResource(Resource.Drawable.playlistedit);
            UiHelper.SetBackgroundAndRefresh(this);
            //  lineall2.SetBackgroundColor(Android.Graphics.Color.ParseColor("#2b2e30"));

            listbox.ItemClick += (aaa, aaaa) =>
            {
                if (listareprod.Count > 0)
                {
                    if (File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + listareprod[aaaa.Position]).Split('$')[0].Split(';').ToList().Count >= 1 && File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + listareprod[aaaa.Position]).Split('$')[0].Split(';')[0].Trim() != "")
                    {
                        Intent internado = new Intent(this, typeof(Reproducirlistadialog));
                        internado.PutExtra("ip", Intent.GetStringExtra("ipadre"));
                        internado.PutExtra("nombrelista", listareprod[aaaa.Position]);
                        internado.PutExtra("index", aaaa.Position.ToString());
                        StartActivity(internado);
                    }
                    else
                    {
                        Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show();
                    }
                }
            };
            botonelimiar.Click += delegate
            {
                animar(botonelimiar);
                if (eneliminacion)
                {
                    eneliminacion = false;
                    //  botonelimiar.SetBackgroundResource(Resource.Drawable.playlistedit);
                    ArrayAdapter adaptador  = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, listareprod);
                    var          parcelable = listbox.OnSaveInstanceState();

                    listbox.Adapter = adaptador;
                    listbox.OnRestoreInstanceState(parcelable);
                }

                else
                {
                    //   botonelimiar.SetBackgroundResource(Resource.Drawable.playlistcheck);
                    adapterlistaremotoconeliminar adaptador = new adapterlistaremotoconeliminar(this, listareprod, listareprod2, "noser", true, false);
                    var parcelable = listbox.OnSaveInstanceState();
                    listbox.Adapter = adaptador;
                    listbox.OnRestoreInstanceState(parcelable);
                    eneliminacion = true;
                }
            };
            botonagregar.Click += delegate
            {
                /*  Intent intento = new Intent(this,typeof(agregarlistaoffline));
                 * intento.PutExtra("ipadre", ipadress);
                 * StartActivity(intento);
                 */
                EditText texto = new EditText(this);
                texto.Hint = "Nombre de la lista";

                new AlertDialog.Builder(this)
                .SetTitle("Introduzca el nombre de la nueva lista de reproduccion")
                .SetView(texto)
                .SetCancelable(false)
                .SetNegativeButton("Cancelar", (ax, ax100) => { })
                .SetPositiveButton("Crear", (xd, xdd) => {
                    if (texto.Text.Length < 3)
                    {
                        Toast.MakeText(this, "El nombre debe tener almenos 3 caracteres", ToastLength.Long).Show();
                    }
                    else
                    {
                        var saas = Directory.GetFiles(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist");
                        if (!saas.Contains(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + RemoveIllegalPathCharacters(texto.Text)))
                        {
                            crearlista(texto.Text);
                        }
                        else
                        {
                            AlertDialog.Builder ad = new AlertDialog.Builder(this);
                            ad.SetTitle("Advertencia");
                            ad.SetMessage("El elemento " + texto.Text + " ya existe desea reemplazarlo??");
                            ad.SetCancelable(false);
                            ad.SetIcon(Resource.Drawable.warningsignonatriangularbackground);
                            ad.SetPositiveButton("Si", (axx, axxx) => {
                                crearlista(texto.Text);
                            });
                            ad.SetNegativeButton("No", (ux, uxdd) => {
                                Toast.MakeText(this, "Operacion cancelada", ToastLength.Long).Show();
                            });
                            ad.Create();
                            ad.Show();
                        }
                    }
                })
                .Create().Show();
            };

            playpause.Click += delegate
            {
                animar(playpause);
                YoutubePlayerServerActivity.gettearinstancia().imgPlay.PerformClick();
            };
            botonhome.Click += delegate
            {
                animar(botonhome);

                tree.Abort();
                this.Finish();
            };



            // Create your application here
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Crearlistaoffline);
            cliente.Connect(Intent.GetStringExtra("ipadre"), 1024);
            listbox       = FindViewById <ListView>(Resource.Id.listView1);
            textbox       = FindViewById <EditText>(Resource.Id.editText1);
            botonagregar  = FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.imageView2);
            botoneliminar = FindViewById <Android.Support.Design.Widget.FloatingActionButton>(Resource.Id.imageView3);
            botonsalir    = FindViewById <ImageView>(Resource.Id.imageView1);

            //  elementossincortar = clasesettings.gettearvalor("elementosactuales");
            lineall  = FindViewById <LinearLayout>(Resource.Id.linearlayout0);
            lineall2 = FindViewById <LinearLayout>(Resource.Id.linearLayout1);
            var adaptadolo = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> {
                "No hay elementos para mostrar.."
            });

            RunOnUiThread(() => {
                var parcelable  = listbox.OnSaveInstanceState();
                listbox.Adapter = adaptadolo;
                listbox.OnRestoreInstanceState(parcelable);
            });
            UiHelper.SetBackgroundAndRefresh(this);
            AlertDialog.Builder adx = new AlertDialog.Builder(this);
            adx.SetCancelable(false);
            adx.SetTitle("Cargar elementos en reproduccion");
            adx.SetIcon(Resource.Drawable.alert);
            adx.SetMessage("Desea cargar todos los elementos que estan en reproduccion actualmente?");
            adx.SetNegativeButton("No", nox);
            adx.SetPositiveButton("Si", six);
            adx.Create();
            adx.Show();


            eneliminacion = true;

            /* adapterlistaremoto adaptador = new adapterlistaremoto(this, listanombres,listalinks);
             * listbox.Adapter = adaptador;*/
            lineall2.SetBackgroundColor(Android.Graphics.Color.ParseColor("#2b2e30"));
            // animar2(lineall2);
            botoneliminar.Click += delegate
            {
                // animar(botoneliminar);
                if (!eneliminacion)
                {
                    //botoneliminar.SetBackgroundResource(Resource.Drawable.playlistcheck);
                    adaptadorlista adalter    = new adaptadorlista(this, listanombres, listalinks, textbox.Text, false, true);
                    var            parcelable = listbox.OnSaveInstanceState();

                    listbox.Adapter = adalter;
                    listbox.OnRestoreInstanceState(parcelable);
                    eneliminacion = true;
                }
                else
                {
                    //  botoneliminar.SetBackgroundResource(Resource.Drawable.playlistedit);

                    /*  adaptadorzz = new adapterlistaremoto(this, listanombres,listalinks);
                     * listbox.Adapter = adaptadorzz;
                     * eneliminacion = false;*/
                }
            };
            botonagregar.Click += delegate {
                // animar(botonagregar);
                if (textbox.Text.Length >= 3)
                {
                    var saas = Directory.GetFiles(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist");
                    if (!saas.Contains(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + textbox.Text))
                    {
                        StreamWriter escritor;
                        string       elementosfull = "";
                        escritor = File.CreateText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + RemoveIllegalPathCharacters(textbox.Text));

                        if (listanombres.Count > 0 && listalinks.Count > 0 && listanombres[0].Trim() != "" && listalinks[0].Trim() != "")
                        {
                            elementosfull = string.Join(";", listanombres) + ";" + "$" + string.Join(";", listalinks) + ";";
                        }
                        else
                        {
                            elementosfull = "  $  ";
                        }
                        escritor.Write(elementosfull);
                        escritor.Close();
                        menulistaoffline.gettearinstancia().llenarlista();
                        cliente.Client.Disconnect(false);
                        Toast.MakeText(this, "Lista guardada satisfactoriamente", ToastLength.Long).Show();
                        Finish();
                        MultiHelper.ExecuteGarbageCollection();
                    }
                    else
                    {
                        AlertDialog.Builder ad = new AlertDialog.Builder(this);
                        ad.SetTitle("Advertencia");
                        ad.SetMessage("El elemento " + textbox.Text + " ya existe desea reemplazarlo??");
                        ad.SetCancelable(false);
                        ad.SetIcon(Resource.Drawable.warningsignonatriangularbackground);
                        ad.SetPositiveButton("Si", ok);
                        ad.SetNegativeButton("No", no);
                        ad.Create();
                        ad.Show();
                    }
                }
                else
                {
                    Toast.MakeText(this, "El nombre de la lista de reproduccion debe tener almenos 3 caracteres", ToastLength.Long).Show();
                }
            };
            botonsalir.Click += delegate
            {
                cliente.Client.Disconnect(false);
                animar(botonsalir);
                Finish();
                MultiHelper.ExecuteGarbageCollection();
            };
        }
Ejemplo n.º 28
0
        internal void ShowPopUp(string positive, string negative)
        {
            alertBuilder.SetTitle("Enter Text");
            editText.Text = _inputstring;
            editText.FocusableInTouchMode = true;
            editText.RequestFocus();
            editText.SetBackgroundColor(Color.WhiteSmoke);
            editText.SetTextColor(Color.Black);
            alertBuilder.SetView(editText);
            alertBuilder.SetCancelable(false);

            alertBuilder.SetPositiveButton(positive, (senderAlert, args) =>
            {
                diagram.Alpha = 1;
                diagram.PageSettings.BackgroundColor = Color.White;
                if (editText.Text == null)
                {
                    editText.Text = "";
                }
                var node = new Node(diagram.Context);
                if (CurrentHandle == UserHandlePosition.Left)
                {
                    node.OffsetX = SelectedNode.OffsetX - SelectedNode.Width - 100;
                    node.OffsetY = SelectedNode.OffsetY;
                }
                else if (CurrentHandle == UserHandlePosition.Right)
                {
                    node.OffsetX = SelectedNode.OffsetX + SelectedNode.Width + 100;
                    node.OffsetY = SelectedNode.OffsetY;
                }
                node.Width             = SelectedNode.Width;
                node.Height            = SelectedNode.Height;
                node.ShapeType         = ShapeType.RoundedRectangle;
                node.Style.StrokeWidth = 3;
                if (SelectedNode == RootNode)
                {
                    index                  = rnd.Next(5);
                    node.Style.Brush       = new SolidBrush(FColor[index]);
                    node.Style.StrokeBrush = new SolidBrush(SColor[index]);
                }
                else
                {
                    node.Style = SelectedNode.Style;
                }
                node.Annotations.Add(new Annotation()
                {
                    Content = editText.Text, FontSize = 14 * MainActivity.Factor, TextBrush = new SolidBrush(Color.Black)
                });
                diagram.AddNode(node);
                var c1        = new Connector(diagram.Context);
                c1.SourceNode = SelectedNode;
                c1.TargetNode = node;
                //c1.Style.StrokeBrush = node.Style.StrokeBrush;
                //c1.Style.StrokeWidth = 3;
                //c1.TargetDecoratorStyle.Fill = (node.Style.StrokeBrush as SolidBrush).FillColor;
                //c1.TargetDecoratorStyle.StrokeColor = (c1.TargetNode.Style.StrokeBrush as SolidBrush).FillColor;
                //c1.SegmentType = SegmentType.CurveSegment;
                //c1.Style.StrokeStyle = StrokeStyle.Dashed;
                diagram.AddConnector(c1);
                if (CurrentHandle == UserHandlePosition.Left)
                {
                    if (!(diagram.LayoutManager.Layout as MindMapLayout).EnableFreeForm)
                    {
                        (diagram.LayoutManager.Layout as MindMapLayout).UpdateLeftOrTop();
                    }
                }
                else if (CurrentHandle == UserHandlePosition.Right)
                {
                    if (!(diagram.LayoutManager.Layout as MindMapLayout).EnableFreeForm)
                    {
                        (diagram.LayoutManager.Layout as MindMapLayout).UpdateRightOrBottom();
                    }
                }
                m_mindmap.SelectedNode = node;
                m_mindmap.UpdateHandle();
                diagram.Select(node);

                diagram.BringToView(node);
                m_mindmap.UpdateTheme();
            });
            alertBuilder.SetNegativeButton(negative, (senderAlert, args) =>
            {
                alertBuilder.SetCancelable(true);
            });
            alertBuilder.Show();
        }
        public string ShowKeyboardInput(
            string defaultText)
        {
            var waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);

            OnKeyboardWillShow();

            IsVisible = true;



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

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

                // Set the input fields input filter to accept only uppercase
                input.SetFilters(new Android.Text.IInputFilter[] { new Android.Text.InputFilterAllCaps() });

                if (defaultText != null)
                {
                    input.SetSelection(defaultText.Length);
                }
                alert.SetView(input);

                alert.SetPositiveButton("Ok", (dialog, whichButton) =>
                {
                    ContentText = input.Text;
                    waitHandle.Set();
                    IsVisible = false;
                    OnKeyboardWillHide();
                });

                alert.SetNegativeButton("Cancel", (dialog, whichButton) =>
                {
                    ContentText = null;
                    waitHandle.Set();
                    IsVisible = false;
                    OnKeyboardWillHide();
                });
                alert.SetCancelable(false);

                alertDialog = alert.Create();
                alertDialog.Show();
                OnKeyboardDidShow();
            });
            waitHandle.WaitOne();

            if (alertDialog != null)
            {
                alertDialog.Dismiss();
                alertDialog.Dispose();
                alertDialog = null;
            }

            OnReplaceText(new CCIMEKeybardEventArgs(contentText, contentText.Length));
            IsVisible = false;

            return(contentText);
        }
Ejemplo n.º 30
0
        private void OpenPlanPopUp()
        {
            try {
                GeneralValues objGeneralValues = new GeneralValues();
                //planfetchdialog = ProgressDialog.Show(this, "Fectching Plan", "Please wait.....");
                StreamReader reader     = null;
                var          webrequest = (HttpWebRequest)WebRequest.Create("https://api.stripe.com/v1/plans?limit=2");
                webrequest.Method = "GET";
                webrequest.Headers.Add("Authorization", "Bearer " + objGeneralValues.SecretKey);
                HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();
                reader = new StreamReader(webresponse.GetResponseStream());
                string    obj        = reader.ReadToEnd();
                var       parsedjson = JObject.Parse(obj) ["data"].Value <JArray> ();
                string [] arrlist    = new string [parsedjson.Count];

                int i = 0;
                if (UserPlan.ToLower().Contains("gold"))
                {
                    arrplans = new string [1];
                    arrlist  = new string [1];
                    foreach (var item in parsedjson)
                    {
                        var    parseditemjson = JObject.Parse(item.ToString().Replace("{{", "{").Replace("}}", "}"));
                        string planname       = parseditemjson ["name"].ToString();
                        string amount         = parseditemjson ["amount"].ToString();
                        string currency       = parseditemjson ["currency"].ToString();
                        string id             = parseditemjson ["id"].ToString();
                        if (planname.ToLower().Contains("platinum"))
                        {
                            arrlist [0]  = planname;
                            arrplans [0] = planname + "|||" + amount + "|||" + id;
                            i            = i + 1;
                        }
                    }
                }
                else
                {
                    arrplans = new string [parsedjson.Count];
                    foreach (var item in parsedjson)
                    {
                        var    parseditemjson = JObject.Parse(item.ToString().Replace("{{", "{").Replace("}}", "}"));
                        string planname       = parseditemjson ["name"].ToString();
                        string amount         = parseditemjson ["amount"].ToString();
                        string currency       = parseditemjson ["currency"].ToString();
                        string id             = parseditemjson ["id"].ToString();
                        arrlist [i]  = planname;
                        arrplans [i] = planname + "|||" + amount + "|||" + id;
                        i            = i + 1;
                    }
                }
                planfetchdialog.Dismiss();
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.SetTitle("Choose plan");
                builder.SetSingleChoiceItems(arrlist, 0, ListClicked);
                builder.SetNeutralButton("Ok", (object sender, DialogClickEventArgs e) => {
                    string item = arrplans [selecteditempositin].ToString();
                    var token   = CreateToken(item);
                });

                builder.SetCancelable(false);
                builder.Show();
            } catch (Exception ex) {
            }
        }
Ejemplo n.º 31
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var          view        = inflater.Inflate(Resource.Layout.driver_not_found_tasks, container, false);
            SwitchCompat btn_switch  = view.FindViewById <SwitchCompat>(Resource.Id.switch_compat);
            var          txt_comment = view.FindViewById <TextView>(Resource.Id.txtNoTask);

            btn_switch.Focusable             = true;
            StaticTask.IsStoppedGettingTasks = false;

            if (StaticDriver.busy == "0")
            {
                btn_switch.Text    = "Свободен. У вас нет задач на перевозку груза.";
                btn_switch.Checked = true;
            }
            else if (StaticDriver.busy == "1")
            {
                btn_switch.Text    = "Занят. Задачи на перевозку вам не распределяются.";
                btn_switch.Checked = false;
            }
            else
            {
                txt_comment.Text   = "Ошибка сервера. Зайдите на страницу позже.";
                btn_switch.Enabled = false;
            }


            btn_switch.Click += (o, e) => {
                // Perform action on clicks
                if (btn_switch.Checked)
                {
                    AlertDialog.Builder alert = new AlertDialog.Builder(Activity);
                    alert.SetTitle("Подтверждение действия");
                    alert.SetMessage("Задачи Вам будут распределяться. Вы действительно освободились?");
                    alert.SetPositiveButton("Ок", (senderAlert, args) =>
                    {
                        var result = FreeStatus();
                        if (result.Result == TaskStatus.ServerError)
                        {
                            StaticDriver.busy  = "1";
                            btn_switch.Text    = "Занят. Задачи на перевозку вам не распределяются.";
                            btn_switch.Checked = false;
                        }
                        else
                        {
                            StaticDriver.busy  = "0";
                            btn_switch.Text    = "Свободен. У вас нет задач на перевозку груза.";
                            btn_switch.Checked = true;
                        }
                        //to do...
                    });
                    alert.SetNegativeButton("Отмена", (senderAlert, args) =>
                    {
                        StaticDriver.busy  = "1";
                        btn_switch.Text    = "Занят. Задачи на перевозку вам не распределяются.";
                        btn_switch.Checked = false;
                    });
                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
                else
                {
                    btn_switch.Text = "Занят. Задачи на перевозку вам не распределяются.";
                    AlertDialog.Builder alert = new AlertDialog.Builder(Activity);
                    alert.SetTitle("Подтверждение действия");
                    alert.SetMessage("Задачи Вам не будут распределяться. Вы действительно заняты?");
                    alert.SetPositiveButton("Ок", (senderAlert, args) =>
                    {
                        LayoutInflater layoutInflater = LayoutInflater.From(Activity);
                        View view = layoutInflater.Inflate(Resource.Layout.driver_confirm_task, null);
                        AlertDialog.Builder alert = new AlertDialog.Builder(Activity);
                        alert.SetView(view);
                        #region Объявление переменных в диалоговом окне
                        var edit_text_other_task     = view.FindViewById <EditText>(Resource.Id.edit_text_other_task);
                        var rbnt_malfunction_task    = view.FindViewById <RadioButton>(Resource.Id.rbnt_malfunction_task);
                        var rbnt_relaxation_task     = view.FindViewById <RadioButton>(Resource.Id.rbnt_relaxation_task);
                        var rbnt_finished_shift_task = view.FindViewById <RadioButton>(Resource.Id.rbnt_finished_shift_task);
                        var rbnt_other_task          = view.FindViewById <RadioButton>(Resource.Id.rbnt_other_task);

                        Task <TaskStatus> result;
                        edit_text_other_task.Enabled = false;
                        #endregion

                        #region Обработка событий кнопок

                        rbnt_other_task.Click += delegate
                        {
                            edit_text_other_task.Enabled = true;
                            StaticTask.comment           = edit_text_other_task.Text;
                        };

                        rbnt_finished_shift_task.Click += delegate
                        {
                            edit_text_other_task.Enabled = false;
                            StaticTask.comment           = "Закончил смену";
                        };

                        rbnt_relaxation_task.Click += delegate
                        {
                            edit_text_other_task.Enabled = false;
                            StaticTask.comment           = "Отдых";
                        };

                        rbnt_malfunction_task.Click += delegate
                        {
                            edit_text_other_task.Enabled = false;
                            StaticTask.comment           = "Неисправность";
                        };

                        #endregion

                        alert.SetCancelable(false)
                        .SetPositiveButton("Прервать", delegate
                        {
                            if (rbnt_other_task.Checked)
                            {
                                StaticTask.comment = edit_text_other_task.Text;
                            }
                            else if (rbnt_finished_shift_task.Checked)
                            {
                                StaticTask.comment = "Закончил смену";
                            }
                            else if (rbnt_malfunction_task.Checked)
                            {
                                StaticTask.comment = "Неисправность";
                            }
                            else if (rbnt_relaxation_task.Checked)
                            {
                                StaticTask.comment = "Отдых";
                            }


                            result = BusyStatus();
                            if (result.Result == TaskStatus.ServerError)
                            {
                                StaticDriver.busy  = "0";
                                btn_switch.Text    = "Свободен. У вас нет задач на перевозку груза.";
                                btn_switch.Checked = true;
                            }
                            else
                            {
                                StaticDriver.busy  = "1";
                                btn_switch.Text    = "Занят. Задачи на перевозку вам не распределяются.";
                                btn_switch.Checked = false;
                            }
                        })
                        .SetNegativeButton("Отмена", delegate
                        {
                            StaticDriver.busy  = "1";
                            btn_switch.Text    = "Занят. Задачи на перевозку вам не распределяются.";
                            btn_switch.Checked = false;
                            alert.Dispose();
                        });
                        Dialog dialog = alert.Create();
                        dialog.Show();


                        //to do...
                    });
                    alert.SetNegativeButton("Отмена", (senderAlert, args) =>
                    {
                        StaticDriver.busy  = "0";
                        btn_switch.Text    = "Свободен. У вас нет задач на перевозку груза.";
                        btn_switch.Checked = true;
                    });
                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
            };
            return(view);
        }