private void DisplayPrompt(PreferenceType preferenceType, string title, string text, string checkText)
        {
            if (!preferences.GetSavePromptPreference(preferenceType))
            {
                return;
            }

            PromptView   prompt    = Injector.GetInstance <PromptView>();
            CheckBoxData checkData = new CheckBoxData(preferenceType, checkText);

            prompt.Initialize(title, text, new CheckBoxData[] { checkData });

            bool?result = prompt.ShowDialog();

            if (result == false)
            {
                args.CancelLoading();
            }

            if (prompt.RememberChoice && prompt.GetChecked(preferenceType))
            {
                preferences.SetPromptPreference(preferenceType, false);
                database.SavePromptSavePref(preferenceType, false);
            }
        }
예제 #2
0
 public void Should_return_HTML_code_representing_a_checkbox_field_with_its_value_embedded_in_it()
 {
     var value = false;
     var checkBoxData = new CheckBoxData(value)
         .WithId(Reflection.GetPropertyName(() => value).ToCamelCase());
     var actual = checkBoxData.ToString();
     actual.ShouldBeEqualTo(HtmlText, actual);
 }
예제 #3
0
        public static bool PromptUserIfOutsideOfCenterScreenPlaceholders(PlaceHolderCollectionModel collectionModel, UserPreferencesModel preferences, Database database)
        {
            if (preferences.PromptOutsidePlaceholders == OutsidePlaceholdersPrefType.DO_NOTHING)
            {
                return(false);
            }

            bool outsidePlaceholder = false;

            foreach (PlaceholderModel placeholder in collectionModel.Items)
            {
                ScreenPositionType screen = ScreenUtils.GetScreen(placeholder);
                if (screen != ScreenPositionType.CENTER)
                {
                    outsidePlaceholder = true;
                    break;
                }
            }

            if (outsidePlaceholder)
            {
                if (preferences.PromptOutsidePlaceholders == OutsidePlaceholdersPrefType.MOVE)
                {
                    MovePlaceholders(collectionModel);
                }
                else if (preferences.PromptOutsidePlaceholders == OutsidePlaceholdersPrefType.PROMPT)
                {
                    PromptView   prompt    = Injector.GetInstance <PromptView>();
                    CheckBoxData checkData = new CheckBoxData(PreferenceType.PROMPT_OUTSIDE_PLACEHOLDER, "Remember my choice");
                    prompt.Initialize("Placeholder(s) outside of center screen", "Some placeholders are now outside of the screen.\nMove them to center screen?", new CheckBoxData[] { checkData });

                    bool result = (bool)prompt.ShowDialog();
                    if (prompt.RememberChoice && prompt.GetChecked(PreferenceType.PROMPT_OUTSIDE_PLACEHOLDER))
                    {
                        if (result)
                        {
                            preferences.PromptOutsidePlaceholders = OutsidePlaceholdersPrefType.MOVE;
                            database.SaveOutsidePlaceholdersPref(OutsidePlaceholdersPrefType.MOVE);
                        }
                        else
                        {
                            preferences.PromptOutsidePlaceholders = OutsidePlaceholdersPrefType.DO_NOTHING;
                            database.SaveOutsidePlaceholdersPref(OutsidePlaceholdersPrefType.DO_NOTHING);
                        }
                    }

                    if (result)
                    {
                        MovePlaceholders(collectionModel);
                        return(true);
                    }
                }
            }
            return(false);
        }
예제 #4
0
 public CheckBoxData Post(CheckBoxData request)
 {
     return(Get(new GetCheckBox()));
 }
 public void BeforeEachTest()
 {
     IsChecked = true;
     CheckBoxData = new CheckBoxData(true);
 }
 private void set_the_value_to_true_in_the_generated_html(CheckBoxData obj)
 {
     CheckBoxData.ToString().ParseHtmlTag()["value"].ShouldBeEqualTo("true");
 }
 private void put_the_value_in_the_generated_html(CheckBoxData checkBoxData)
 {
     CheckBoxData.ToString().ParseHtmlTag()["value"].ShouldBeEqualTo("false");
 }
 private static void value_set_to_false(CheckBoxData checkBoxData)
 {
     checkBoxData.WithValue("false");
 }
 private static void value_not_set(CheckBoxData checkBoxData)
 {
     checkBoxData.WithValue(null);
 }
예제 #10
0
 public CheckBoxData Post(CheckBoxData request)
 {
     return Get(new GetCheckBox());
 }
예제 #11
0
 private static void SetLabel(CheckBoxData checkBoxData)
 {
     var label = new LabelData
                 {
                     Text = "Label:"
                 };
     checkBoxData.WithLabel(label);
 }