예제 #1
0
        static Main()
        {
            var harmony = HarmonyInstance.Create("com.changedresser.rimworld.mod");

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            WidgetUtil.Initialize();

            Log.Message("ChangeDresser: Adding Harmony Postfix to Pawn_DraftController.Drafted { set }");
            Log.Message("ChangeDresser: Adding Harmony Postfix to JobGiver_OptimizeApparel.TryGiveJob(Pawn)");
        }
예제 #2
0
        private bool AddLongInput(float labelLeft, float top, float inputLeft, float inputWidth, string label, ref long value, long maxValue, long factor = 1)
        {
            string stringValue;

            if (value == -1)
            {
                stringValue = string.Empty;
            }
            else
            {
                stringValue = (value / factor).ToString();
            }

            string __result = WidgetUtil.AddNumberTextInput(labelLeft, top, inputLeft, inputWidth, label, stringValue);

            try
            {
                if (result.Length == 0)
                {
                    value = -1;
                    return(true);
                }
                else if (result.Length > 0 && !result.Equals(stringValue))
                {
                    value = long.Parse(result);
                    if (value < 0)
                    {
                        value = 0;
                    }
                    else
                    {
                        value *= factor;
                        if (value > maxValue || value < 0)
                        {
                            value = maxValue;
                        }
                    }

                    return(true);
                }
            }
            catch { }
            return(false);
        }
예제 #3
0
        public override void DoWindowContents(Rect inRect)
        {
            try
            {
                if (this.rerenderPawn)
                {
                    this.dresserDto.Pawn.Drawer.renderer.graphics.ResolveAllGraphics();
                    PortraitsCache.SetDirty(this.dresserDto.Pawn);
                    this.rerenderPawn = false;
                }

                Text.Font = GameFont.Medium;

                Widgets.Label(new Rect(0f, 0f, this.InitialSize.y / 2f + 45f, 50f), "ChangeMirror.MirrorLabel".Translate());

                float portraitBuffer = 30f;

                Rect portraitRect = WidgetUtil.AddPortraitWidget(portraitBuffer, 150f, this.dresserDto);

                float editorLeft  = portraitRect.xMax + portraitBuffer;
                float editorTop   = 30f + WidgetUtil.SelectionRowHeight;
                float editorWidth = 325f;

                WidgetUtil.AddSelectorWidget(portraitRect.xMax + portraitBuffer, 10f, editorWidth, null, this.dresserDto.EditorTypeSelectionDto);

                switch ((CurrentEditorEnum)this.dresserDto.EditorTypeSelectionDto.SelectedItem)
                {
                case CurrentEditorEnum.ChangeMirrorApparelColor:
                    WidgetUtil.AddAppararelColorSelectionWidget(editorLeft, editorTop, editorWidth, this.dresserDto.ApparelSelectionsContainer);
                    break;

                case CurrentEditorEnum.ChangeMirrorBody:
                    bool  isShowing = false;
                    float top       = editorTop;
                    if (this.dresserDto.BodyTypeSelectionDto != null && this.dresserDto.BodyTypeSelectionDto.Count > 1)
                    {
                        WidgetUtil.AddSelectorWidget(editorLeft, top, editorWidth, "ChangeMirror.BodyType".Translate() + ":", this.dresserDto.BodyTypeSelectionDto);
                        top      += WidgetUtil.SelectionRowHeight + 20f;
                        isShowing = true;
                    }
                    if (this.dresserDto.HeadTypeSelectionDto != null && this.dresserDto.HeadTypeSelectionDto.Count > 1)
                    {
                        WidgetUtil.AddSelectorWidget(editorLeft, top, editorWidth, "ChangeMirror.HeadType".Translate() + ":", this.dresserDto.HeadTypeSelectionDto);
                        top      += WidgetUtil.SelectionRowHeight + 20f;
                        isShowing = true;
                    }
                    if (this.dresserDto.SkinColorSliderDto != null)
                    {
                        WidgetUtil.AddSliderWidget(editorLeft, top, editorWidth, "ChangeMirror.SkinColor".Translate() + ":", this.dresserDto.SkinColorSliderDto);
                        isShowing = true;
                    }

                    if (!isShowing)
                    {
                        GUI.Label(new Rect(editorLeft, top, editorWidth, 40), "ChangeMirror.NoEditableAttributes".Translate());
                    }

                    if (Settings.ShowGenderAgeChange)
                    {
                        GUI.Label(new Rect(editorLeft, 300f, editorWidth, 40f), "ChangeMirror.GenderChangeWarning".Translate(), WidgetUtil.MiddleCenter);
                        top = 340f;
                        WidgetUtil.AddSelectorWidget(editorLeft, top, editorWidth, "ChangeMirror.Gender".Translate() + ":", this.dresserDto.GenderSelectionDto);

                        top += WidgetUtil.SelectionRowHeight + 5;
                        long ageBio = this.dresserDto.Pawn.ageTracker.AgeBiologicalTicks;
                        if (AddLongInput(editorLeft, top, 120, 80, "ChangeMirror.AgeBiological".Translate() + ":", ref ageBio, MAX_AGE, TICKS_PER_YEAR))
                        {
                            this.dresserDto.Pawn.ageTracker.AgeBiologicalTicks = ageBio;
                            rerenderPawn = true;
                            if (ageBio > this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks)
                            {
                                this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks = ageBio;
                            }
                        }

                        top += WidgetUtil.SelectionRowHeight + 5;
                        long ageChron = this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks;
                        if (AddLongInput(editorLeft, top, 120, 80, "ChangeMirror.AgeChronological".Translate() + ":", ref ageChron, MAX_AGE, TICKS_PER_YEAR))
                        {
                            this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks = ageChron;
                        }
                    }
                    break;

                case CurrentEditorEnum.ChangeMirrorHair:
                    const float listboxHeight = 250f;
                    if (this.dresserDto.HairStyleSelectionDto != null)
                    {
                        //bool showHairColor = this.dresserDto.HairColorSelectionDto != null;

                        float height = listboxHeight;

                        /*if (!showHairColor)
                         * {
                         *  height += 250;
                         * }*/

                        WidgetUtil.AddListBoxWidget(editorLeft, editorTop, editorWidth, height, "ChangeMirror.HairStyle".Translate() + ":", this.dresserDto.HairStyleSelectionDto);

                        //if (showHairColor)
                        //{
                        WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + listboxHeight + 10f, editorWidth, this.dresserDto.HairColorSelectionDto, this.dresserDto.HairColorSelectionDto.ColorPresetsDTO);
                        //}
                    }
                    break;


                case CurrentEditorEnum.ChangeMirrorAlienSkinColor:
                    if (this.dresserDto.AlienSkinColorPrimary != null)
                    {
                        GUI.color = Color.white;
                        Text.Font = GameFont.Medium;
                        GUI.Label(new Rect(editorLeft, editorTop, editorWidth, 30), "ChangeMirror.AlienPrimarySkinColor".Translate());
                        Text.Font = GameFont.Small;

                        WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + 40, editorWidth, this.dresserDto.AlienSkinColorPrimary, null);
                    }
                    if (this.dresserDto.AlienSkinColorSecondary != null)
                    {
                        GUI.color = Color.white;
                        Text.Font = GameFont.Medium;
                        GUI.Label(new Rect(editorLeft, editorTop + 260, editorWidth, 30), "ChangeMirror.AlienSecondarySkinColor".Translate());
                        Text.Font = GameFont.Small;

                        WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + 300, editorWidth, this.dresserDto.AlienSkinColorSecondary, null);
                    }
                    break;

                    /*case CurrentEditorEnum.ChangeDresserAlienHairColor:
                     *  if (this.dresserDto.AlienHairColorPrimary != null)
                     *  {
                     *      GUI.color = Color.white;
                     *      Text.Font = GameFont.Medium;
                     *      GUI.Label(new Rect(editorLeft, editorTop, editorWidth, 30), "ChangeMirror.AlienPrimaryHairColor".Translate());
                     *      Text.Font = GameFont.Small;
                     *
                     *      WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + 40, editorWidth, this.dresserDto.AlienHairColorPrimary, null);
                     *  }
                     *
                     *  if (this.dresserDto.AlienHairColorSecondary != null)
                     *  {
                     *      GUI.color = Color.white;
                     *      Text.Font = GameFont.Medium;
                     *      GUI.Label(new Rect(editorLeft, editorTop + 260, editorWidth, 30), "ChangeMirror.AlienSecondaryHairColor".Translate());
                     *      Text.Font = GameFont.Small;
                     *
                     *      WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + 300, editorWidth, this.dresserDto.AlienHairColorSecondary, null);
                     *  }
                     *  break;*/
                }

                Text.Anchor = TextAnchor.MiddleLeft;
                Text.Font   = GameFont.Small;
                GUI.Label(new Rect(0, 75, this.InitialSize.y / 2f, 50f), GUI.tooltip);
                Text.Font   = GameFont.Medium;
                Text.Anchor = TextAnchor.UpperLeft;

                float xWidth            = 150;
                float xBuffer           = (this.InitialSize.x - xWidth) / 2;
                Rect  bottomButtonsRect = new Rect(editorLeft, this.InitialSize.y - WidgetUtil.SelectionRowHeight - 36, xWidth, WidgetUtil.SelectionRowHeight);
                GUI.BeginGroup(bottomButtonsRect);
                Text.Anchor = TextAnchor.MiddleCenter;
                Text.Font   = GameFont.Small;
                GUI.color   = Color.white;
                if (Widgets.ButtonText(new Rect(0, 0, 60, WidgetUtil.SelectionRowHeight), "Reset".Translate()))
                {
                    this.ResetToDefault();
                    this.ApparelWithColorChange.Clear();
                }
                if (Widgets.ButtonText(new Rect(90, 0, 60, WidgetUtil.SelectionRowHeight), "Save".Translate()))
                {
                    this.saveChangedOnExit = true;
                    this.Close();
                }
                GUI.EndGroup();
            }
            catch (Exception e)
            {
                Log.Error(this.GetType().Name + " closed due to: " + e.GetType().Name + " " + e.Message);
                Messages.Message(this.GetType().Name + " closed due to: " + e.GetType().Name + " " + e.Message, MessageTypeDefOf.NegativeEvent);
                base.Close();
            }
            finally
            {
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.color   = Color.white;
            }
        }
예제 #4
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            try
            {
                if (_isWaiting || item == null)
                {
                    return(false);
                }

                switch (item.ItemId)
                {
                case Android.Resource.Id.Home:
                    Finish();
                    return(true);

                case Resource.Id.menuItemFileBrowserUpward:
                    if (_currentParent != null && _currentParent.DocumentId != _root.DocumentId)
                    {
                        var previousParentId = _previousParents.Count == 0
                                ? GetParent(_currentParent.DocumentId) ?? _root.DocumentId
                                : _previousParents.Pop();
                        ReplaceFragment(parentDocumentId: previousParentId);
                    }
                    return(true);

                case Resource.Id.menuItemFileBrowserCreateFolder:
                    var dlg = new WidgetUtil();
                    dlg.InputDialog(context: this, titleId: Resource.String.CreateFolderTitle,
                                    layoutId: Resource.Layout.text_input, editTextId: Resource.Id.txtInput,
                                    okAction: (view, value) =>
                    {
                        if (string.IsNullOrEmpty(value))
                        {
                            return(false);
                        }

                        try
                        {
                            var docId = _documentsProvider.CreateDocument(_currentParent.DocumentId,
                                                                          DocumentsContract.Document.MimeTypeDir, value);
                            _previousParents.Push(_currentParent.DocumentId);
                            ReplaceFragment(useCustomAnimation: false, parentDocumentId: docId);
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex);
                            Toast.MakeText(this, GetString(Resource.String.InternalError),
                                           AppSettings.ToastLength)
                            .Show();
                            return(false);
                        }

                        return(true);
                    });
                    return(true);

                case Resource.Id.menuItemFileBrowserSortByName:
                    item.SetChecked(!item.IsChecked);
                    if (item.IsChecked && _orderBy != FileDocumentItemSortOrders.Default && _orderBy != FileDocumentItemSortOrders.ByName)
                    {
                        _orderBy = FileDocumentItemSortOrders.ByName;
                        ReplaceFragment();
                    }
                    return(true);

                case Resource.Id.menuItemFileBrowserSortByDate:
                    item.SetChecked(!item.IsChecked);
                    if (item.IsChecked && _orderBy != FileDocumentItemSortOrders.ByLastModified)
                    {
                        _orderBy = FileDocumentItemSortOrders.ByLastModified;
                        ReplaceFragment();
                    }
                    return(true);

                case Resource.Id.menuItemFileBrowserSortBySize:
                    item.SetChecked(!item.IsChecked);
                    if (item.IsChecked && _orderBy != FileDocumentItemSortOrders.BySize)
                    {
                        _orderBy = FileDocumentItemSortOrders.BySize;
                        ReplaceFragment();
                    }
                    return(true);

                case Resource.Id.menuItemFileBrowserRefresh:
                    ReplaceFragment();
                    return(true);

                case Resource.Id.menuItemFileBrowserSettings:
                    var intent = new Intent(this, typeof(FileBrowserSettingsActivity));
                    _doNotCancel = true;
                    StartActivityForResult(intent, MenuSettingsRequestCode);
                    break;

                default:
                    return(base.OnOptionsItemSelected(item));
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                Toast.MakeText(this, GetString(Resource.String.InternalError), AppSettings.ToastLength)
                .Show();
            }

            return(false);
        }
예제 #5
0
        private void OnItemClick(object sender, ApiKeysManagementAdapter.ItemEventArgs e)
        {
            if (e?.Item == null || e.Item.IsReadOnly)
            {
                return;
            }

            var providerId = e.Item.Id;

            try
            {
                switch (e.Action)
                {
                case ApiKeysManagementViewHolder.EditActions.Edit:
                    var dialogs = new Dialogs();
                    dialogs.ApiKeyDialog(activity: this, providerType: e.Item.ProviderType,
                                         providerId: providerId, alwaysShowDialog: true, okAction: () =>
                    {
                        NotifyItemChanged(e.Position);
                    }, cancelAction: null, toastLength: AppSettings.ToastLength, log: Log);
                    break;

                case ApiKeysManagementViewHolder.EditActions.Delete:
                    var keys = AppSettings.Default.GetApiKeys();
                    if (keys.ContainsKey(providerId))
                    {
                        var dlg = new WidgetUtil();
                        dlg.ShowDialog(context: this, titleId: Resource.String.ApiKeysManagementTitle,
                                       message: GetString(Resource.String.IcDeleteApiKeyConfirmation),
                                       okAction: () =>
                        {
                            try
                            {
                                keys.Remove(providerId);
                                AppSettings.Default.SaveApiKeys(keys);

                                //HARDCODE:
                                if (providerId == AppSettings.GoogleMapsGeocodingApiProviderId &&
                                    AppSettings.Default.UseGoogleMapsGeocodingApi)
                                {
                                    AppSettings.Default.UseGoogleMapsGeocodingApi = false;
                                    SetChangeActivityResult();
                                }

                                NotifyItemChanged(e.Position);
                            }
                            catch (Exception ex)
                            {
                                Log.Error(ex);
                                Toast.MakeText(this, GetString(Resource.String.InternalError),
                                               AppSettings.ToastLength).Show();
                            }
                        });
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                Toast.MakeText(this, Resource.String.InternalError, AppSettings.ToastLength).Show();
            }
        }
예제 #6
0
        public override void DoWindowContents(Rect inRect)
        {
            try
            {
                if (this.rerenderPawn)
                {
                    this.dresserDto.Pawn.Drawer.renderer.graphics.ResolveAllGraphics();
                    PortraitsCache.SetDirty(this.dresserDto.Pawn);
                    this.rerenderPawn = false;
                }

                Text.Font = GameFont.Medium;

                Widgets.Label(
                    new Rect(0f, 0f, this.InitialSize.y / 2f + 45f, 50f),
                    "FacialStuffEditor.FaceStylerTitle".Translate());

                float portraitBuffer = 30f;

                Rect portraitRect = WidgetUtil.AddPortraitWidget(portraitBuffer, 150f, this.dresserDto);

                float editorLeft  = portraitRect.xMax + portraitBuffer;
                float editorTop   = 30f + WidgetUtil.SelectionRowHeight;
                float editorWidth = 325f;
                float top         = editorTop;
                WidgetUtil.AddSelectorWidget(
                    editorLeft,
                    top,
                    editorWidth,
                    "FacialStuffEditor.BodyType".Translate() + ":",
                    this.dresserDto.BodyTypeSelectionDto);
                top += WidgetUtil.SelectionRowHeight + 20f;
                WidgetUtil.AddSelectorWidget(
                    editorLeft,
                    top,
                    editorWidth,
                    "FacialStuffEditor.HeadType".Translate() + ":",
                    this.dresserDto.HeadTypeSelectionDto);
                top += WidgetUtil.SelectionRowHeight + 20f;
                WidgetUtil.AddSliderWidget(
                    editorLeft,
                    top,
                    editorWidth,
                    "FacialStuffEditor.SkinColor".Translate() + ":",
                    this.dresserDto.SkinColorSliderDto);
                if (Controller.settings.ShowGenderAgeChange)
                {
                    GUI.Label(
                        new Rect(editorLeft, 300f, editorWidth, 40f),
                        "FacialStuffEditor.GenderChangeWarning".Translate(),
                        WidgetUtil.MiddleCenter);
                    top = 340f;
                    WidgetUtil.AddSelectorWidget(
                        editorLeft,
                        top,
                        editorWidth,
                        "FacialStuffEditor.Gender".Translate() + ":",
                        this.dresserDto.GenderSelectionDto);

                    top += WidgetUtil.SelectionRowHeight + 5;
                    long ageBio = this.dresserDto.Pawn.ageTracker.AgeBiologicalTicks;
                    if (this.AddLongInput(
                            editorLeft,
                            top,
                            120,
                            80,
                            "FacialStuffEditor.AgeBiological".Translate() + ":",
                            ref ageBio,
                            MAX_AGE,
                            TICKS_PER_YEAR))
                    {
                        this.dresserDto.Pawn.ageTracker.AgeBiologicalTicks = ageBio;
                        this.rerenderPawn = true;
                        if (ageBio > this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks)
                        {
                            this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks = ageBio;
                        }
                    }

                    top += WidgetUtil.SelectionRowHeight + 5;
                    long ageChron = this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks;
                    if (this.AddLongInput(
                            editorLeft,
                            top,
                            120,
                            80,
                            "FacialStuffEditor.AgeChronological".Translate() + ":",
                            ref ageChron,
                            MAX_AGE,
                            TICKS_PER_YEAR))
                    {
                        this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks = ageChron;
                    }
                }

                Text.Anchor = TextAnchor.MiddleLeft;
                Text.Font   = GameFont.Small;
                GUI.Label(new Rect(0, 75, this.InitialSize.y / 2f, 50f), GUI.tooltip);
                Text.Font   = GameFont.Medium;
                Text.Anchor = TextAnchor.UpperLeft;

                float xWidth            = 150;
                float xBuffer           = (this.InitialSize.x - xWidth) / 2;
                Rect  bottomButtonsRect = new Rect(
                    editorLeft,
                    this.InitialSize.y - WidgetUtil.SelectionRowHeight - 36,
                    xWidth,
                    WidgetUtil.SelectionRowHeight);
                GUI.BeginGroup(bottomButtonsRect);
                Text.Anchor = TextAnchor.MiddleCenter;
                Text.Font   = GameFont.Small;
                GUI.color   = Color.white;
                if (Widgets.ButtonText(
                        new Rect(0, 0, 60, WidgetUtil.SelectionRowHeight),
                        "FacialStuffEditor.Reset".Translate()))
                {
                    this.ResetToDefault();
                }

                if (Widgets.ButtonText(
                        new Rect(90, 0, 60, WidgetUtil.SelectionRowHeight),
                        "FacialStuffEditor.Save".Translate()))
                {
                    this.saveChangedOnExit = true;
                    this.Close();
                }

                GUI.EndGroup();
            }
            catch (Exception e)
            {
                Log.Error(this.GetType().Name + " closed due to: " + e.GetType().Name + " " + e.Message);
                Messages.Message(this.GetType().Name + " closed due to: " + e.GetType().Name + " " + e.Message, MessageSound.Negative);
                this.Close();
            }
            finally
            {
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.color   = Color.white;
            }
        }
예제 #7
0
        public bool ApiKeyDialog(Activity activity, ProviderTypes providerType, int providerId,
                                 bool alwaysShowDialog, Action okAction, Action cancelAction, ToastLength toastLength, ILog log)
        {
            if (activity == null)
            {
                throw new ArgumentNullException(nameof(activity));
            }

            var isValidServiceProvider = true;
            var isValidApiKey          = true;

            switch (providerType)
            {
            case ProviderTypes.WeatherProvider:
                isValidServiceProvider = AppSettings.Default.ValidateWeatherProvider(providerId);
                break;
            }

            if (isValidServiceProvider)
            {
                isValidApiKey = AppSettings.Default.ValidateApiKey(providerId);
            }

            var result = isValidServiceProvider && isValidApiKey;

            if (alwaysShowDialog || !result)
            {
                int providerNameId;
                switch (providerType)
                {
                case ProviderTypes.WeatherProvider:
                    providerNameId = AppSettings.Default.GetWeatherProviderNameById(providerId);
                    break;

                default:
                    providerNameId = AppSettings.Default.GetProviderNameById(providerId);
                    break;
                }

                string message = null;

                activity.RunOnUiThread(() =>
                {
                    if (!isValidServiceProvider)
                    {
                        message = string.Format(activity.GetString(Resource.String.WeatherProviderIsNotImplemented),
                                                providerNameId);
                    }
                    else if (alwaysShowDialog || !isValidApiKey)
                    {
                        string GetErrorHandler()
                        {
                            switch (providerType)
                            {
                            case ProviderTypes.WeatherProvider:
                                return(Properties.Resources.UndefinedWeatherProviderApiKey);

                            default:
                                return(Http.Properties.Resources.UndefinedServerApiKey);
                            }
                        }

                        Exception GetExceptionHandler()
                        {
                            switch (providerType)
                            {
                            case ProviderTypes.WeatherProvider:
                                return(new WeatherApiKeyException());

                            default:
                                return(new ApiKeyException());
                            }
                        }

                        var dlg = new WidgetUtil();
                        dlg.InputDialog(context: activity, titleId: providerNameId,
                                        layoutId: Resource.Layout.text_input, editTextId: Resource.Id.txtInput,
                                        createAction: (view, input) =>
                        {
                            if (input == null)
                            {
                                return;
                            }

                            // android:inputType="textPassword"
                            input.InputType = InputTypes.ClassText | InputTypes.TextVariationPassword;
                        },
                                        okAction: (view, value) =>
                        {
                            if (string.IsNullOrEmpty(value))
                            {
                                return(false);
                            }

                            try
                            {
                                AppSettings.Default.SaveApiKey(providerId, value);
                                if (!AppSettings.Default.ValidateApiKey(providerId))
                                {
                                    throw GetExceptionHandler();
                                }

                                okAction?.Invoke();
                            }
                            catch (Exception ex)
                            {
                                log?.ErrorFormat("{0} {1}", "OkAction", ex);
                                Toast.MakeText(activity, activity.GetString(Resource.String.InternalError),
                                               toastLength).Show();
                            }

                            return(true);
                        },
                                        cancelAction: () =>
                        {
                            cancelAction?.Invoke();
                            if (!AppSettings.Default.ValidateApiKey(providerId))
                            {
                                message = GetErrorHandler();
                                if (!string.IsNullOrEmpty(message))
                                {
                                    Toast.MakeText(activity, message, toastLength).Show();
                                }
                            }
                        });

                        return;
                    }

                    if (!string.IsNullOrEmpty(message))
                    {
                        Toast.MakeText(activity, message, toastLength).Show();
                    }
                });
            }

            return(result);
        }