Exemple #1
0
            public override void SetupDialog(Android.App.Dialog dialog, int style)
            {
                base.SetupDialog(dialog, style);
                var alertdialog = dialog as AlertDialog;

                alertdialog.ShowEvent += (s, e) =>
                {
                    View posButton = alertdialog.GetButton((int)DialogButtonType.Positive);
                    View negButton = alertdialog.GetButton((int)DialogButtonType.Negative);
                    posButton.Click += PositiveButtonClick;
                    if (NegativeButtonClick == null)
                    {
                        negButton.Click += delegate { dialog.Dismiss(); }
                    }
                    ;
                    else
                    {
                        negButton.Click += NegativeButtonClick;
                    }
                };

                Key = Settings.API_KEY;

                if (CurrentAPI == WeatherData.WeatherAPI.Here)
                {
                    string app_id   = String.Empty;
                    string app_code = String.Empty;

                    if (!String.IsNullOrWhiteSpace(Key))
                    {
                        var keyArr = Key.Split(';');
                        app_id   = keyArr.First();
                        app_code = keyArr.Last();
                    }

                    keyEntry.Text  = app_id;
                    keyEntry2.Text = app_code;
                }
            }
Exemple #2
0
        private async void LoadPopUpAsync(object sender, EventArgs e)
        {
            //string title = (sender as Button).Text;
            string title = (sender as RelativeLayout).Tag.ToString();

            /* Disable the button                                            */
            (sender as RelativeLayout).Enabled = false;

            /* Find the current theme                                        */
            TypedValue attrValue = new TypedValue();

            Activity.Theme.ResolveAttribute(
                Resource.Attribute.modThemeName, attrValue, true);

            /* Create the dialog box based on the current theme              */
            if (attrValue.String.ToString() == "ModAppCompatLightTheme")
            {
                _dialogBox = new Dialog(Activity, Resource.Style.ModAppCompatLightTheme);
            }
            else
            {
                _dialogBox = new Dialog(Activity, Resource.Style.ModAppCompatDarkTheme);
            }

            #region NOT NEEDED

            /*_dialogBox.Window.RequestFeature(WindowFeatures.NoTitle);
             * _dialogBox.RequestWindowFeature(1);*/
            #endregion

            /* ViewModel Text must be passed to all these layouts            */
            switch (title)
            {
            case AndroidApp.FacilityCategory.Academics:
            {
                _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesAcademic);
            }
            break;

            case AndroidApp.FacilityCategory.Church:
            {
                _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesChurch);
            }
            break;

            case AndroidApp.FacilityCategory.Dining:
            {
                _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesDining);
            }
            break;

            case AndroidApp.FacilityCategory.Dorm:
            {
                _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesDorm);
            }
            break;

            case AndroidApp.FacilityCategory.Recreation:
            {
                _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesRecreation);
            }
            break;

            case AndroidApp.FacilityCategory.Service:
            {
                _dialogBox.Window.SetContentView(Resource.Layout.FacilityTimesService);
            }
            break;
            }

            _dialogBox.Window.SetWindowAnimations(Resource.Style.Base_Animation_AppCompat_DropDownUp);
            dialogToolbar = _dialogBox.Window.FindViewById <SupportToolbar>(Resource.Id.toolbar);
            dialogToolbar.SetNavigationIcon(Resource.Drawable.abc_ic_ab_back_material);
            dialogToolbar.Title            = title;/* Or create a tag for each button and set its tag as the title */
            dialogToolbar.NavigationClick += async(navSender, navEvent) =>
            {
                await Task.Delay(150);

                _dialogBox.Dismiss();
            };

            await Task.Delay(150);

            _dialogBox.Show();
            await Task.Delay(400);

            (sender as RelativeLayout).Enabled = true;
        }