Example #1
0
        private void MergeDuplicateCheckboxes()
        {
            List <TextAnchor> checkboxes2Del = new List <TextAnchor>();

            for (int i = 0; i < Checkboxes.Count; i++)
            {
                if (!Checkboxes[i].IsDeleted)
                {
                    for (int j = i + 1; j < Checkboxes.Count; j++)
                    {
                        if (!Checkboxes[j].IsDeleted)
                        {
                            if (Checkboxes[i].Line == Checkboxes[j].Line)
                            {
                                checkboxes2Del.Add(Checkboxes[j]);
                            }
                        }
                    }
                }
            }

            foreach (TextAnchor checkbox2Del in checkboxes2Del)
            {
                Checkboxes.Remove(checkbox2Del);
            }

            checkboxes2Del.Clear();
            IsChanged = true;
        }
 /// <summary>Method for selecting a specific number of checkboxes </summary>
 public void SelectCheckboxes(int countOfMessages)
 {
     for (int i = 0; i < countOfMessages; i++)
     {
         Checkboxes.ElementAt(i).Click();
     }
 }
Example #3
0
        // ----------------------------------------------------------------------------------------
        //  Checkboxes
        // ----------------------------------------------------------------------------------------
        // line - с единицы
        public void AddCheckbox(int line)
        {
            TextAnchor anchor = Document.CreateAnchor(Document.Lines[line - 1].Offset);

            Checkboxes.Add(anchor);

            IsChanged = true;
        }
 public MainWindow()
 {
     DataContext = this;
     for (int i = 0; i < 50; i++)
     {
         Checkboxes.Add(new CheckboxData {
             Id = i, Label = $"Checkbox {i} - init"
         });
     }
 }
Example #5
0
        private void DrawBoolOption(int idx, bool value, string propertyName, SpriteBatch b)
        {
            var checkboxSize = 9 * Game1.pixelZoom;

            var xPos = this.xPositionOnScreen + this.width - (3 * BorderWidth) - checkboxSize;
            var yPos = this.yPositionOnScreen + BorderWidth + (idx * OptionHeight) + (OptionHeight / 2) - (checkboxSize / 2);

            var uncheckedSrc = new Rectangle(227, 425, 9, 9);
            var checkedSrc   = new Rectangle(236, 425, 9, 9);
            var src          = value ? checkedSrc : uncheckedSrc;

            var checkbox = new ClickableTextureComponent(propertyName, new Rectangle(xPos, yPos, checkboxSize, checkboxSize), "", "", Game1.mouseCursors, src, Game1.pixelZoom, false);

            Checkboxes.Add(checkbox);
            checkbox.draw(b);
        }
Example #6
0
        private void entd2CheckBox_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox   box = (CheckBox)sender;
            Checkboxes cb  = (Checkboxes)Enum.Parse(typeof(Checkboxes), box.Tag as string);

            switch (cb)
            {
            case Checkboxes.ENTD1:
                ENTD1 = box.Checked;
                break;

            case Checkboxes.ENTD2:
                ENTD2 = box.Checked;
                break;

            case Checkboxes.ENTD3:
                ENTD3 = box.Checked;
                break;

            case Checkboxes.ENTD4:
                ENTD4 = box.Checked;
                break;

            case Checkboxes.ENTD5:
                ENTD5 = box.Checked;
                break;

            case Checkboxes.Decrypt:
                RegenECC = box.Checked;
                break;

            case Checkboxes.ApplySlowdownFix:
                ApplySlowdownFix = box.Checked;
                break;

            default:
                break;
            }
            UpdateNextEnabled();
        }
Example #7
0
        private void entd2CheckBox_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox   box = (CheckBox)sender;
            Checkboxes cb  = (Checkboxes)Enum.Parse(typeof(Checkboxes), box.Tag as string);

            switch (cb)
            {
            case Checkboxes.ENTD1:
                ENTD1 = box.Checked;
                break;

            case Checkboxes.ENTD2:
                ENTD2 = box.Checked;
                break;

            case Checkboxes.ENTD3:
                ENTD3 = box.Checked;
                break;

            case Checkboxes.ENTD4:
                ENTD4 = box.Checked;
                break;

            case Checkboxes.RegenECC:
                RegenECC = box.Checked;
                break;

            case Checkboxes.StoreInventory:
                StoreInventory = box.Checked;
                break;

            case Checkboxes.Propositions:
                Propositions = box.Checked;
                break;

            default:
                break;
            }
            UpdateNextEnabled();
        }
Example #8
0
        private void SetUpCheckboxesAndRadioButtons(AdminUser user, CentreContractAdminUsage numberOfAdmins)
        {
            if (!numberOfAdmins.TrainersAtOrOverLimit || user.IsTrainer)
            {
                Checkboxes.Add(AdminRoleInputs.TrainerCheckbox);
            }

            if (!numberOfAdmins.CcLicencesAtOrOverLimit || user.IsContentCreator)
            {
                Checkboxes.Add(AdminRoleInputs.ContentCreatorCheckbox);
            }

            if (!numberOfAdmins.CmsAdministratorsAtOrOverLimit || user.IsCmsAdministrator)
            {
                Radios.Add(AdminRoleInputs.CmsAdministratorRadioButton);
            }

            if (!numberOfAdmins.CmsManagersAtOrOverLimit || user.IsCmsManager)
            {
                Radios.Add(AdminRoleInputs.CmsManagerRadioButton);
            }

            Radios.Add(AdminRoleInputs.NoCmsPermissionsRadioButton);
        }
Example #9
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            var options = new Dictionary <string, object>(Events);

            if (!string.IsNullOrEmpty(DataSource.Transport.Read.Url))
            {
                options["dataSource"] = DataSource.ToJson();
            }
            else if (DataSource.Data != null)
            {
                options["dataSource"] = DataSource.Data;
            }

            if (DragAndDrop)
            {
                options["dragAndDrop"] = true;
            }

            if (AutoBind)
            {
                options["autoBind"] = true;
            }

            if (!LoadOnDemand)
            {
                options["loadOnDemand"] = false;
            }

            if (!string.IsNullOrEmpty(DataTextField))
            {
                options["dataTextField"] = DataTextField;
            }

            if (!string.IsNullOrEmpty(DataUrlField))
            {
                options["dataUrlField"] = DataUrlField;
            }

            if (!string.IsNullOrEmpty(DataSpriteCssClassField))
            {
                options["dataSpriteCssClassField"] = DataSpriteCssClassField;
            }

            if (!string.IsNullOrEmpty(DataImageUrlField))
            {
                options["dataImageUrlField"] = DataImageUrlField;
            }

            var idPrefix = "#";

            if (IsInClientTemplate)
            {
                idPrefix = "\\" + idPrefix;
            }

            if (!string.IsNullOrEmpty(TemplateId))
            {
                options["template"] = new ClientHandlerDescriptor {
                    HandlerName = string.Format("$('{0}{1}').html()", idPrefix, TemplateId)
                };
            }
            else if (!string.IsNullOrEmpty(Template))
            {
                options["template"] = Template;
            }

            var checkboxes = Checkboxes.ToJson();

            if (checkboxes.Keys.Any())
            {
                options["checkboxes"] = checkboxes["checkboxes"];
            }

            var animation = Animation.ToJson();

            if (animation.Keys.Any())
            {
                options["animation"] = animation["animation"];
            }

            writer.Write(Initializer.Initialize(Selector, "TreeView", options));

            base.WriteInitializationScript(writer);
        }
Example #10
0
        /// <summary>
        /// Создает новый экземпляр CreditsPanel с указанными параметрами
        /// </summary>
        /// <param name="content">Управляющий контентом для этой панели</param>
        /// <param name="sprite">Спрайт, изображение панели</param>
        /// <param name="spriteBatch">Спрайт батч, нужный для создания чекбоксов</param>
        /// <param name="settings">Настройки игры</param>
        public OptionsPanel(Screen owner, ContentManager content, Sprite sprite, Settings settings)
            : base(owner, content, sprite)
        {
            checkboxes    = new List <Checkbox>();
            sliders       = new List <Slider>();
            font          = content.Load <SpriteFont>(Fnames.PanelFont);
            bFont         = content.Load <SpriteFont>(Fnames.ButtonFont);
            this.settings = settings;
            initMusicV    = settings.MusicVolume;

            #region Buttons

            Button ExitLocal = new Button(MultiSprite.CreateSprite(content, spriteBatch, Fnames.ExitLocalB, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 3.2f, Bounds.Top + (float)Bounds.Height / 4f * 3f), new Vector2(128, 35), Vector2.One),
                                          CreateSound3D(content, Fnames.UIButtonClick),
                                          CreateSound3D(content, Fnames.UIButtonSelect),
                                          bFont);
            ExitLocal.Text          = "";
            ExitLocal.Visible       = false;
            ExitLocal.Click        += new EventHandler <MouseElementEventArgs>(ExitLocal_Click);
            ExitLocal.MouseMove    += new EventHandler <MouseElementEventArgs>(Button_MouseMove);
            ExitLocal.MouseMoveOut += new EventHandler <MouseElementEventArgs>(Button_MouseMoveOut);

            Button Apply = new Button(MultiSprite.CreateSprite(content, spriteBatch, Fnames.ApplyB, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 1f, Bounds.Top + (float)Bounds.Height / 4f * 3f), new Vector2(128, 35), Vector2.One),
                                      CreateSound3D(content, Fnames.UIButtonClick),
                                      CreateSound3D(content, Fnames.UIButtonSelect),
                                      bFont);
            Apply.Text          = "";
            Apply.Visible       = false;
            Apply.Click        += new EventHandler <MouseElementEventArgs>(Apply_Click);
            Apply.MouseMove    += new EventHandler <MouseElementEventArgs>(Button_MouseMove);
            Apply.MouseMoveOut += new EventHandler <MouseElementEventArgs>(Button_MouseMoveOut);

            Buttons.Add(ExitLocal);
            Buttons.Add(Apply);

            #endregion

            #region Checkboxes

            musicMute = new Checkbox(MultiSprite.CreateSprite(content, spriteBatch, Fnames.Checkbox1, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 1f, Bounds.Top + (float)Bounds.Height / 4f * 1f), new Vector2(42, 39), new Vector2(2, 1)),
                                     CreateSound(content, Fnames.UIButtonClick));
            musicMute.Visible = false;
            musicMute.Checked = !settings.MusicIsMuted;
            musicMute.Click  += new EventHandler <MouseElementEventArgs>(musicMute_Click);

            soundMute = new Checkbox(MultiSprite.CreateSprite(content, spriteBatch, Fnames.Checkbox1, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 1f, Bounds.Top + (float)Bounds.Height / 4f * 1.8f), new Vector2(42, 39), new Vector2(2, 1)),
                                     CreateSound(content, Fnames.UIButtonClick));
            soundMute.Visible = false;
            soundMute.Checked = !settings.SoundIsMuted;
            soundMute.Click  += new EventHandler <MouseElementEventArgs>(soundMute_Click);

            Checkboxes.Add(musicMute);
            Checkboxes.Add(soundMute);

            #endregion

            #region Sliders

            musicSlider = new Slider(MultiSprite.CreateSprite(content, spriteBatch, Fnames.Slider1, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 1f, Bounds.Top + (float)Bounds.Height / 4f * 1.4f), new Vector2(238, 26), Vector2.One),
                                     Sprite.CreateSprite(content, Fnames.Slider_, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 1f, Bounds.Top + (float)Bounds.Height / 4f * 1.4f), new Vector2(12, 26)));
            musicSlider.Visible    = false;
            musicSlider.MouseMove += new EventHandler <MouseElementEventArgs>(musicSlider_MouseMove);
            musicSlider.Value      = settings.MusicVolume;

            soundSlider = new Slider(MultiSprite.CreateSprite(content, spriteBatch, Fnames.Slider1, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 1f, Bounds.Top + (float)Bounds.Height / 4f * 2.2f), new Vector2(238, 26), Vector2.One),
                                     Sprite.CreateSprite(content, Fnames.Slider_, new Vector2(Bounds.Left + (float)Bounds.Width / 5f * 1f, Bounds.Top + (float)Bounds.Height / 4f * 2.2f), new Vector2(12, 26)));
            soundSlider.Visible    = false;
            soundSlider.MouseMove += new EventHandler <MouseElementEventArgs>(soundSlider_MouseMove);
            soundSlider.Value      = settings.SoundVolume;

            Sliders.Add(musicSlider);
            Sliders.Add(soundSlider);

            #endregion

            Components.AddRange(Buttons);
            Components.AddRange(Checkboxes);
            Components.AddRange(Sliders);
        }
Example #11
0
        public void DeleteCheckbox(int line)
        {
            Checkboxes.RemoveAll(anchor => anchor.Line == line);

            IsChanged = true;
        }