Inheritance: MonoBehaviour
示例#1
0
文件: MainForm.cs 项目: mbl111/Ava
 public MainForm()
 {
     InitializeComponent();
     ColorPicker picker = new ColorPicker("Auto");
     picker.ShowDialog();
     button1.Text = picker.ColorIndex + "";
 }
示例#2
0
 public SpellDrawer(Menu mainMenu)
 {
     Drawing.OnDraw += Drawing_OnDraw;
     Menu = mainMenu;
     DangerColorPickers = new ColorPicker[4];
     Game_OnGameLoad();
 }
 /// <summary>
 /// Show the color category editor form.
 /// </summary>
 /// <param name="e"></param>
 public void ShowEdit(IColorCategory e)
 {
     using (var frm = new ColorPicker(e))
     {
         ShowDialog(frm);
     }
 }
示例#4
0
        /// <summary>
        /// Edits the given object value using the editor style provided by the <see cref="M:System.Drawing.Design.ColorEditor.GetEditStyle(System.ComponentModel.ITypeDescriptorContext)"></see> method</summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"></see> through which editing services may be obtained</param>
        /// <param name="value">An instance of the value being edited</param>
        /// <returns>The new value of the object. If the value of the object has not changed, this should return the same object it was passed.</returns>
        public override object EditValue(
            ITypeDescriptorContext context,
            IServiceProvider provider,
            object value)
        {
            IWindowsFormsEditorService editorService =
                provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (editorService != null)
            {
                ColorPicker picker = new ColorPicker((Color)value, m_enableAlpha);

                // skin service,  skins this control
                // when it shown so it override the labels
                // used for primary and seconadary color.
                // When it shown we need to reset the color property.
                Color color = (Color)value;
                picker.Shown += (sender, e) =>
                    {
                        var colorpicker = (ColorPicker)sender;
                        colorpicker.SetStartColor(color, m_enableAlpha);
                    };
                if (DialogResult.OK == editorService.ShowDialog(picker))
                    value = picker.PrimaryColor;
            }
            return value;
        }
 public void basic_colorpicker_render()
 {
     var html = new ColorPicker("foo").ToString();
     html.ShouldHaveHtmlNode("foo")
         .ShouldBeNamed(HtmlTag.Input)
         .ShouldHaveAttribute(HtmlAttribute.Type).WithValue(HtmlInputType.Color);
 }
 public void GetColorPicker_Should_Find_And_Return_Correct_ColorPicker()
 {
     var actual = new ColorPicker("MyColorPicker");
     var fake = new ColorPicker("MyMenuSection.MyColorPicker");
     _sut._colorPickers.Add(actual);
     _sut._colorPickers.Add(fake);
     Assert.AreEqual(actual,_sut.GetColorPicker("MyColorPicker"));
 }
 public void It_Should_Be_Possible_To_Add_Multiple_ColorPickers()
 {
     var first = new ColorPicker("MyColorPicker1");
     var second = new ColorPicker("MyColorPicker2");
     var third = new ColorPicker("MyColorPicker3");
     _sut.With(() => first).With(() => second).With(() => third);
     Assert.AreEqual(3, _sut._colorPickers.Count);
 }
        public ColorPickerViewModel(ColorPicker view)
        {
            _view = view;

            HueSpan = 36;
            SaturationSpan = 10;
            Brightness = 1;
        }
示例#9
0
		private void ColorPanel_Click(object sender, EventArgs e)
		{
			using (ColorPicker picker = new ColorPicker()) {
				picker.Color = XYZ.FromRGB(Color);
				if (picker.ShowDialog() == DialogResult.OK) {
					Color = picker.Color.ToRGB();
				}
			}
		}
示例#10
0
 public ThemeSettings(bool isGlobal)
 {
     InitializeComponent();
     this.cPicker = new ColorPicker();
     this.cPicker.Hide();
     this.cPicker.setColorPreview += new setColorHandler(setColorPreview);
     this.cPicker.getColor += new getColorHandler(getColor);
     global = isGlobal;
 }
示例#11
0
        /// <summary>
        /// ComboBox that display systema and web colors.
        /// </summary>
        public ColorComboBox()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // Subscibe to ColorPicker's events
            cp = new ColorPicker();
            cp.ColorChanged += new EventHandler(ColorPicker_ColorChanged);
            cp.Deactivate   += new EventHandler(ColorPicker_Deactivate);
        }
示例#12
0
		private void panelColor_Click(object sender, EventArgs e)
		{
			using (ColorPicker cp = new ColorPicker()) {
				cp.Color = XYZ.FromRGB(panelColor.BackColor);
				DialogResult result = cp.ShowDialog();
				if (result == DialogResult.OK) {
					panelColor.BackColor = cp.Color.ToRGB().ToArgb();
				}
			}
		}
示例#13
0
        public ColorPickerPopup(ColorPicker cp)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            lStatus.Text = "";
            _ColorPicker = cp;
        }
	// Use this for initialization
	void Start ()
	{
		_content = GameObject.Find ("MaterialsContent");
		_materialsDict = new Dictionary<int, GameObject> ();
		_selectedMaterials = new List<int> ();
		_materialColors = new Dictionary<int, Color> ();
		_colorPicker = GameObject.Find ("ColorPicker").GetComponent<ColorPicker> ();
		_demo = GameObject.Find ("DemoObject").GetComponent<Demo> ();
		Invoke("OnNewMaterial", 0.5f);
	}
示例#15
0
 private void bInsertColor_Click( object sender, EventArgs e ) {
     if( colorPicker == null ) colorPicker = new ColorPicker("Insert color",0);
     if( colorPicker.ShowDialog() == DialogResult.OK){
         string colorToInsert = MainForm.Parse( colorPicker.ColorIndex );
         int selectionStart = tText.SelectionStart;
         tText.Paste( colorToInsert );
         tText.Select( selectionStart, 2 );
         tText.Focus();
     }
 }
 private void panelColor_Click(object sender, EventArgs e)
 {
     using (ColorPicker cp = new ColorPicker()) {
         cp.LockValue_V = true;
         cp.Color = XYZ.FromRGB(ColorValue);
         DialogResult result = cp.ShowDialog();
         if (result == DialogResult.OK) {
             ColorValue = cp.Color.ToRGB().ToArgb();
         }
     }
 }
示例#17
0
 private void BadgesAppearance_ColorChanged(ColorPicker sender, EventArgs e)
 {
     if (badgesForm != null)
     {
         switch (sender.Name)
         {
             case "cpBadgesBackColor":
                 Properties.Settings.Default.BadgesBackColor = badgesForm.BackColor = sender.Color;
                 break;
             case "cpBadgesForeColor":
                 Properties.Settings.Default.BadgesForeColor = badgesForm.ForeColor = sender.Color;
                 break;
         }
         Properties.Settings.Default.Save();
     }
 }
示例#18
0
        /// <summary>
        /// Edits the given object value using the editor style provided by the <see cref="M:System.Drawing.Design.ColorEditor.GetEditStyle(System.ComponentModel.ITypeDescriptorContext)"></see> method</summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"></see> through which editing services may be obtained</param>
        /// <param name="value">An instance of the value being edited</param>
        /// <returns>The new value of the object. If the value of the object has not changed, this should return the same object it was passed.</returns>
        public override object EditValue(
            ITypeDescriptorContext context,
            IServiceProvider provider,
            object value)
        {
            IWindowsFormsEditorService editorService =
                provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (editorService != null)
            {
                ColorPicker picker = new ColorPicker((Color)value, m_enableAlpha);
                if (DialogResult.OK == editorService.ShowDialog(picker))
                    value = picker.PrimaryColor;
            }
            return value;
        }
示例#19
0
		public override Object ShowDialog(PropertyItem propertyItem, Object propertyValue, IInputElement commandSource)
		{
			HashSet<Color> discreteColors = GetDiscreteColors(propertyItem.Component);

			Color colorValue;
			if (propertyValue != null)
			{
				colorValue = (Color)propertyValue;
			}
			else
			{
				colorValue = discreteColors.Any() ? discreteColors.First() : Color.White;
			}
			DialogResult result;
			if (discreteColors.Any())
			{
				using (DiscreteColorPicker dcp = new DiscreteColorPicker())
				{
					dcp.ValidColors = discreteColors;
					dcp.SingleColorOnly = true;
					dcp.SelectedColors = new List<Color> {colorValue};
					dcp.Text = propertyItem.DisplayName;
					result = dcp.ShowDialog();
					if (result == DialogResult.OK)
					{
						propertyValue = !dcp.SelectedColors.Any() ? discreteColors.First() : dcp.SelectedColors.First();
					}
				}
			}
			else
			{
				using (ColorPicker cp = new ColorPicker())
				{
					cp.LockValue_V = true;
					cp.Color = XYZ.FromRGB(colorValue);
					cp.Text = propertyItem.DisplayName;
					result = cp.ShowDialog();
					if (result == DialogResult.OK)
					{
						propertyValue = cp.Color.ToRGB().ToArgb();
					}
				}
			}

			return propertyValue;
		}
示例#20
0
 private void btnAddColor_Click(object sender, EventArgs e)
 {
     if (CurrentCollection == null)
         return;
     using (ColorPicker cp = new ColorPicker())
     {
         cp.LockValue_V = true;
         cp.Color = XYZ.FromRGB(ColorValue);
         cp.StartPosition = FormStartPosition.Manual;
         cp.Top = this.Top;
         cp.Left = this.Left + this.Width;
         DialogResult result = cp.ShowDialog();
         if (result == DialogResult.OK)
         {
             ColorValue = cp.Color.ToRGB().ToArgb();
             CurrentCollection.Color.Add(ColorValue);
             isDirty = true;
             PopulateCollectionColors(CurrentCollection);
         }
     }
 }
 private void AddColorToCollection()
 {
     if (_currentCollection == null)
         return;
     using (ColorPicker cp = new ColorPicker())
     {
         cp.LockValue_V = false;
         cp.Color = XYZ.FromRGB(_colorValue);
         cp.StartPosition = FormStartPosition.Manual;
         cp.Top = Top;
         cp.Left = Left + Width;
         DialogResult result = cp.ShowDialog();
         if (result == DialogResult.OK)
         {
             _colorValue = cp.Color.ToRGB().ToArgb();
             _currentCollection.Color.Add(_colorValue);
             _isDirty = true;
             PopulateCollectionColors(_currentCollection);
         }
     }
 }
示例#22
0
    public void setRightDownPosition(int x, int y, GUISkin skin)
    {
        int windowWidth = config.width + config.sliderPaletteInterval + config.sliderWidth;

        contentWindowRect  = new Rect(x - windowWidth,
                       y - config.height,
                    windowWidth,
                    config.height);

        paletteRect = new Rect(0,0, config.width, config.height);
        sliderRect = new Rect(config.width + config.sliderPaletteInterval,
                      0,
                      config.sliderWidth,
                      config.height);

        if (colorPicker == null)
            colorPicker = new ColorPicker();
        colorPicker.initialize(paletteRect,sliderRect);

        window.setProperties(contentWindowRect, new GUIContent(config.windowCaption.Localized()), skin, doMyWindow,
            closeWindow,
            closeWindow);
    }
示例#23
0
        private static bool GetColor(Control ctrl, Color initialColor, out Color resultColor, bool showNone = true)
        {
            var result = false;
            resultColor = Color.Black;
            const int offset = 6;

            using (var dialog = new ColorPicker(initialColor, showNone)) {
                dialog.Location = dialog.GetBestLocation(ctrl.PointToScreen(new Point(0, 0)), offset);
                dialog.ShowDialog();

                switch (dialog.DialogResult) {
                    case DialogResult.OK:
                        resultColor = dialog.GetColor();
                        result = true;
                        break;
                    case DialogResult.No:
                        resultColor = Color.Transparent;
                        result = true;
                        break;
                }
            }

            return result;
        }
示例#24
0
 private void bColorPM_Click( object sender, EventArgs e ) {
     ColorPicker picker = new ColorPicker( "Private / rank chat color", colorPM );
     picker.ShowDialog();
     colorPM = picker.ColorIndex;
     ApplyColor( bColorPM, colorPM );
     Color.PM = Parse( colorPM );
 }
示例#25
0
 private void InitializeComponent()
 {
     this.VisibleCheckBox            = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.NameTextBox                = new EditBox();
     this.focusLabel1                = new FocusLabel();
     this.XAxisNameTextBox           = new EditBox();
     this.focusLabel4                = new FocusLabel();
     this.YAxisNameTextBox           = new EditBox();
     this.focusLabel5                = new FocusLabel();
     this.ColorPicker                = new ColorPicker();
     this.label8                     = new FocusLabel();
     this.XStartTextBox              = new EditBox();
     this.XReferenceLabel            = new FocusLabel();
     this.TitleTextBox               = new EditMultiLine();
     this.focusLabel2                = new FocusLabel();
     this.EnabledCheckBox            = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.XStopTextBox               = new EditBox();
     this.focusLabel3                = new FocusLabel();
     this.ContextMenuEnabledCheckBox = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.LayerNumericUpDown         = new Iocomp.Design.Plugin.EditorControls.NumericUpDown();
     this.label1                     = new FocusLabel();
     this.UserCanEditCheckBox        = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.ClippingStyleComboBox      = new Iocomp.Design.Plugin.EditorControls.ComboBox();
     this.focusLabel8                = new FocusLabel();
     this.UserCanMoveCheckBox        = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.HitRegionSizeUpDown        = new Iocomp.Design.Plugin.EditorControls.NumericUpDown();
     this.focusLabel6                = new FocusLabel();
     this.CanFocusCheckBox           = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     base.SuspendLayout();
     this.VisibleCheckBox.Location     = new Point(248, 3);
     this.VisibleCheckBox.Name         = "VisibleCheckBox";
     this.VisibleCheckBox.PropertyName = "Visible";
     this.VisibleCheckBox.Size         = new Size(72, 24);
     this.VisibleCheckBox.TabIndex     = 6;
     this.VisibleCheckBox.Text         = "Visible";
     this.NameTextBox.LoadingBegin();
     this.NameTextBox.Location     = new Point(80, 8);
     this.NameTextBox.Name         = "NameTextBox";
     this.NameTextBox.PropertyName = "Name";
     this.NameTextBox.Size         = new Size(144, 20);
     this.NameTextBox.TabIndex     = 0;
     this.NameTextBox.LoadingEnd();
     this.focusLabel1.LoadingBegin();
     this.focusLabel1.FocusControl = this.NameTextBox;
     this.focusLabel1.Location     = new Point(43, 10);
     this.focusLabel1.Name         = "focusLabel1";
     this.focusLabel1.Size         = new Size(37, 15);
     this.focusLabel1.Text         = "Name";
     this.focusLabel1.LoadingEnd();
     this.XAxisNameTextBox.LoadingBegin();
     this.XAxisNameTextBox.Location     = new Point(80, 136);
     this.XAxisNameTextBox.Name         = "XAxisNameTextBox";
     this.XAxisNameTextBox.PropertyName = "XAxisName";
     this.XAxisNameTextBox.Size         = new Size(144, 20);
     this.XAxisNameTextBox.TabIndex     = 4;
     this.XAxisNameTextBox.LoadingEnd();
     this.focusLabel4.LoadingBegin();
     this.focusLabel4.FocusControl = this.XAxisNameTextBox;
     this.focusLabel4.Location     = new Point(8, 138);
     this.focusLabel4.Name         = "focusLabel4";
     this.focusLabel4.Size         = new Size(72, 15);
     this.focusLabel4.Text         = "X-Axis Name";
     this.focusLabel4.LoadingEnd();
     this.YAxisNameTextBox.LoadingBegin();
     this.YAxisNameTextBox.Location     = new Point(80, 160);
     this.YAxisNameTextBox.Name         = "YAxisNameTextBox";
     this.YAxisNameTextBox.PropertyName = "YAxisName";
     this.YAxisNameTextBox.Size         = new Size(144, 20);
     this.YAxisNameTextBox.TabIndex     = 5;
     this.YAxisNameTextBox.LoadingEnd();
     this.focusLabel5.LoadingBegin();
     this.focusLabel5.FocusControl = this.YAxisNameTextBox;
     this.focusLabel5.Location     = new Point(8, 162);
     this.focusLabel5.Name         = "focusLabel5";
     this.focusLabel5.Size         = new Size(72, 15);
     this.focusLabel5.Text         = "Y-Axis Name";
     this.focusLabel5.LoadingEnd();
     this.ColorPicker.Location     = new Point(80, 200);
     this.ColorPicker.Name         = "ColorPicker";
     this.ColorPicker.PropertyName = "Color";
     this.ColorPicker.Size         = new Size(48, 21);
     this.ColorPicker.Style        = ColorPickerStyle.ColorBox;
     this.ColorPicker.TabIndex     = 13;
     this.label8.LoadingBegin();
     this.label8.FocusControl = this.ColorPicker;
     this.label8.Location     = new Point(46, 203);
     this.label8.Name         = "label8";
     this.label8.Size         = new Size(34, 15);
     this.label8.Text         = "Color";
     this.label8.LoadingEnd();
     this.XStartTextBox.LoadingBegin();
     this.XStartTextBox.Location     = new Point(80, 72);
     this.XStartTextBox.Name         = "XStartTextBox";
     this.XStartTextBox.PropertyName = "XStart";
     this.XStartTextBox.Size         = new Size(144, 20);
     this.XStartTextBox.TabIndex     = 2;
     this.XStartTextBox.LoadingEnd();
     this.XReferenceLabel.LoadingBegin();
     this.XReferenceLabel.FocusControl = this.XStartTextBox;
     this.XReferenceLabel.Location     = new Point(38, 74);
     this.XReferenceLabel.Name         = "XReferenceLabel";
     this.XReferenceLabel.Size         = new Size(42, 15);
     this.XReferenceLabel.Text         = "X-Start";
     this.XReferenceLabel.LoadingEnd();
     this.TitleTextBox.EditFont     = null;
     this.TitleTextBox.Location     = new Point(80, 40);
     this.TitleTextBox.Name         = "TitleTextBox";
     this.TitleTextBox.PropertyName = "TitleText";
     this.TitleTextBox.Size         = new Size(144, 20);
     this.TitleTextBox.TabIndex     = 1;
     this.focusLabel2.LoadingBegin();
     this.focusLabel2.FocusControl = this.TitleTextBox;
     this.focusLabel2.Location     = new Point(27, 43);
     this.focusLabel2.Name         = "focusLabel2";
     this.focusLabel2.Size         = new Size(53, 15);
     this.focusLabel2.Text         = "Title Text";
     this.focusLabel2.LoadingEnd();
     this.EnabledCheckBox.Location     = new Point(248, 27);
     this.EnabledCheckBox.Name         = "EnabledCheckBox";
     this.EnabledCheckBox.PropertyName = "Enabled";
     this.EnabledCheckBox.Size         = new Size(80, 24);
     this.EnabledCheckBox.TabIndex     = 7;
     this.EnabledCheckBox.Text         = "Enabled";
     this.XStopTextBox.LoadingBegin();
     this.XStopTextBox.Location     = new Point(80, 96);
     this.XStopTextBox.Name         = "XStopTextBox";
     this.XStopTextBox.PropertyName = "XStop";
     this.XStopTextBox.Size         = new Size(144, 20);
     this.XStopTextBox.TabIndex     = 3;
     this.XStopTextBox.LoadingEnd();
     this.focusLabel3.LoadingBegin();
     this.focusLabel3.FocusControl = this.XStopTextBox;
     this.focusLabel3.Location     = new Point(39, 98);
     this.focusLabel3.Name         = "focusLabel3";
     this.focusLabel3.Size         = new Size(41, 15);
     this.focusLabel3.Text         = "X-Stop";
     this.focusLabel3.LoadingEnd();
     this.ContextMenuEnabledCheckBox.Location     = new Point(248, 51);
     this.ContextMenuEnabledCheckBox.Name         = "ContextMenuEnabledCheckBox";
     this.ContextMenuEnabledCheckBox.PropertyName = "ContextMenuEnabled";
     this.ContextMenuEnabledCheckBox.Size         = new Size(152, 24);
     this.ContextMenuEnabledCheckBox.TabIndex     = 8;
     this.ContextMenuEnabledCheckBox.Text         = "Context Menu Enabled";
     this.LayerNumericUpDown.Location             = new Point(168, 200);
     this.LayerNumericUpDown.Maximum = new decimal(new int[4]
     {
         10000,
         0,
         0,
         0
     });
     this.LayerNumericUpDown.Minimum = new decimal(new int[4]
     {
         10000,
         0,
         0,
         -2147483648
     });
     this.LayerNumericUpDown.Name         = "LayerNumericUpDown";
     this.LayerNumericUpDown.PropertyName = "Layer";
     this.LayerNumericUpDown.Size         = new Size(56, 20);
     this.LayerNumericUpDown.TabIndex     = 14;
     this.LayerNumericUpDown.TextAlign    = HorizontalAlignment.Center;
     this.label1.LoadingBegin();
     this.label1.FocusControl = this.LayerNumericUpDown;
     this.label1.Location     = new Point(133, 201);
     this.label1.Name         = "label1";
     this.label1.Size         = new Size(35, 15);
     this.label1.Text         = "Layer";
     this.label1.LoadingEnd();
     this.UserCanEditCheckBox.Location           = new Point(248, 76);
     this.UserCanEditCheckBox.Name               = "UserCanEditCheckBox";
     this.UserCanEditCheckBox.PropertyName       = "UserCanEdit";
     this.UserCanEditCheckBox.Size               = new Size(96, 24);
     this.UserCanEditCheckBox.TabIndex           = 9;
     this.UserCanEditCheckBox.Text               = "User Can Edit";
     this.ClippingStyleComboBox.DropDownStyle    = ComboBoxStyle.DropDownList;
     this.ClippingStyleComboBox.Location         = new Point(312, 200);
     this.ClippingStyleComboBox.MaxDropDownItems = 20;
     this.ClippingStyleComboBox.Name             = "ClippingStyleComboBox";
     this.ClippingStyleComboBox.PropertyName     = "ClippingStyle";
     this.ClippingStyleComboBox.Size             = new Size(80, 21);
     this.ClippingStyleComboBox.TabIndex         = 15;
     this.focusLabel8.LoadingBegin();
     this.focusLabel8.FocusControl = this.ClippingStyleComboBox;
     this.focusLabel8.Location     = new Point(237, 202);
     this.focusLabel8.Name         = "focusLabel8";
     this.focusLabel8.Size         = new Size(75, 15);
     this.focusLabel8.Text         = "Clipping Style";
     this.focusLabel8.LoadingEnd();
     this.UserCanMoveCheckBox.Location     = new Point(248, 100);
     this.UserCanMoveCheckBox.Name         = "UserCanMoveCheckBox";
     this.UserCanMoveCheckBox.PropertyName = "UserCanMove";
     this.UserCanMoveCheckBox.Size         = new Size(120, 24);
     this.UserCanMoveCheckBox.TabIndex     = 10;
     this.UserCanMoveCheckBox.Text         = "User Can Move";
     this.HitRegionSizeUpDown.Location     = new Point(336, 160);
     this.HitRegionSizeUpDown.Maximum      = new decimal(new int[4]
     {
         10000,
         0,
         0,
         0
     });
     this.HitRegionSizeUpDown.Minimum = new decimal(new int[4]
     {
         10000,
         0,
         0,
         -2147483648
     });
     this.HitRegionSizeUpDown.Name         = "HitRegionSizeUpDown";
     this.HitRegionSizeUpDown.PropertyName = "HitRegionSize";
     this.HitRegionSizeUpDown.Size         = new Size(56, 20);
     this.HitRegionSizeUpDown.TabIndex     = 12;
     this.HitRegionSizeUpDown.TextAlign    = HorizontalAlignment.Center;
     this.focusLabel6.LoadingBegin();
     this.focusLabel6.FocusControl = this.HitRegionSizeUpDown;
     this.focusLabel6.Location     = new Point(253, 161);
     this.focusLabel6.Name         = "focusLabel6";
     this.focusLabel6.Size         = new Size(83, 15);
     this.focusLabel6.Text         = "Hit Region Size";
     this.focusLabel6.LoadingEnd();
     this.CanFocusCheckBox.Location     = new Point(248, 124);
     this.CanFocusCheckBox.Name         = "CanFocusCheckBox";
     this.CanFocusCheckBox.PropertyName = "CanFocus";
     this.CanFocusCheckBox.Size         = new Size(80, 24);
     this.CanFocusCheckBox.TabIndex     = 11;
     this.CanFocusCheckBox.Text         = "Can Focus";
     base.Controls.Add(this.CanFocusCheckBox);
     base.Controls.Add(this.HitRegionSizeUpDown);
     base.Controls.Add(this.focusLabel6);
     base.Controls.Add(this.UserCanMoveCheckBox);
     base.Controls.Add(this.ClippingStyleComboBox);
     base.Controls.Add(this.focusLabel8);
     base.Controls.Add(this.UserCanEditCheckBox);
     base.Controls.Add(this.LayerNumericUpDown);
     base.Controls.Add(this.label1);
     base.Controls.Add(this.ContextMenuEnabledCheckBox);
     base.Controls.Add(this.XStopTextBox);
     base.Controls.Add(this.focusLabel3);
     base.Controls.Add(this.TitleTextBox);
     base.Controls.Add(this.focusLabel2);
     base.Controls.Add(this.EnabledCheckBox);
     base.Controls.Add(this.XStartTextBox);
     base.Controls.Add(this.XReferenceLabel);
     base.Controls.Add(this.ColorPicker);
     base.Controls.Add(this.label8);
     base.Controls.Add(this.YAxisNameTextBox);
     base.Controls.Add(this.focusLabel5);
     base.Controls.Add(this.XAxisNameTextBox);
     base.Controls.Add(this.focusLabel4);
     base.Controls.Add(this.NameTextBox);
     base.Controls.Add(this.focusLabel1);
     base.Controls.Add(this.VisibleCheckBox);
     base.Location = new Point(10, 20);
     base.Name     = "PlotLimitBandXEditorPlugIn";
     base.Size     = new Size(456, 240);
     base.ResumeLayout(false);
 }
示例#26
0
    // Update is called once per frame
    public void _DrawGUI()
    {
        if (titleStyle == null)
        {
            titleStyle = new GUIStyle(GUI.skin.label);
            titleStyle.normal.textColor = textColor;
        }

        Rect rectColorEdit   = new Rect(startPos.x + sizeCurr + 10, startPos.y + 30, 40, 140);
        Rect rectColorSlider = new Rect(startPos.x + sizeCurr + 50, startPos.y + 30, 60, 140);

        GUI.Label(new Rect(startPos.x + sizeCurr + 60, startPos.y, 200, 30), Title, titleStyle);

        GUI.DrawTexture(new Rect(startPos.x + sizeCurr + 10, startPos.y, 40, 20), txColorDisplay);

        if (mState == ESTATE.Showed)
        {
            txtR = GUI.TextField(new Rect(startPos.x + sizeCurr + 10, startPos.y + 30, 40, 20), txtR, 3);
            txtG = GUI.TextField(new Rect(startPos.x + sizeCurr + 10, startPos.y + 60, 40, 20), txtG, 3);
            txtB = GUI.TextField(new Rect(startPos.x + sizeCurr + 10, startPos.y + 90, 40, 20), txtB, 3);
            txtA = GUI.TextField(new Rect(startPos.x + sizeCurr + 10, startPos.y + 120, 40, 20), txtA, 3);
            valR = GUI.HorizontalSlider(new Rect(startPos.x + sizeCurr + 50, startPos.y + 35, 60, 20), valR, 0.0f, 1.0f);
            valG = GUI.HorizontalSlider(new Rect(startPos.x + sizeCurr + 50, startPos.y + 65, 60, 20), valG, 0.0f, 1.0f);
            valB = GUI.HorizontalSlider(new Rect(startPos.x + sizeCurr + 50, startPos.y + 95, 60, 20), valB, 0.0f, 1.0f);
            valA = GUI.HorizontalSlider(new Rect(startPos.x + sizeCurr + 50, startPos.y + 125, 60, 20), valA, 0.0f, 1.0f);
            if (GUI.Button(new Rect(startPos.x + sizeCurr + 10, startPos.y + 150, 60, 20), "Apply"))
            {
                ApplyColor();
                SelectedColor = TempColor;
                if (receiver)
                {
                    receiver.SendMessage(colorSetFunctionName, SelectedColor, SendMessageOptions.DontRequireReceiver);
                }
            }

            GUIStyle labelStyleRGBA = new GUIStyle(GUI.skin.label);
            labelStyleRGBA.normal.textColor = Color.white;
            GUI.Label(new Rect(startPos.x + sizeCurr + 110, startPos.y + 30, 20, 20), "R", labelStyleRGBA);
            GUI.Label(new Rect(startPos.x + sizeCurr + 110, startPos.y + 60, 20, 20), "G", labelStyleRGBA);
            GUI.Label(new Rect(startPos.x + sizeCurr + 110, startPos.y + 90, 20, 20), "B", labelStyleRGBA);
            GUI.Label(new Rect(startPos.x + sizeCurr + 110, startPos.y + 120, 20, 20), "A", labelStyleRGBA);
        }

        //update scaling states
        if (mState == ESTATE.Showing)
        {
            sizeCurr = Mathf.Lerp(sizeHidden, sizeFull, dt / animTime);
            if (dt / animTime > 1.0f)
            {
                mState = ESTATE.Showed;
            }
            dt += Time.deltaTime;
        }
        if (mState == ESTATE.Hidding)
        {
            sizeCurr = Mathf.Lerp(sizeFull, sizeHidden, dt / animTime);
            if (dt / animTime > 1.0f)
            {
                mState = ESTATE.Hidden;
            }
            dt += Time.deltaTime;
        }
        //draw color picker
        Rect rect = new Rect(startPos.x, startPos.y, sizeCurr, sizeCurr);

        GUI.DrawTexture(rect, colorSpace);

        float   alphaGradHeight = alphaGradientHeight * (sizeCurr / sizeFull);
        Vector2 startPosAlpha   = startPos + new Vector2(0, sizeCurr);
        Rect    rectAlpha       = new Rect(startPosAlpha.x, startPosAlpha.y, sizeCurr, alphaGradHeight);

        GUI.DrawTexture(rectAlpha, alphaGradient);

        Rect rectFullSize = new Rect(startPos.x, startPos.y, sizeCurr, sizeCurr + alphaGradHeight);

        Vector2 mousePos           = Event.current.mousePosition;
        Event   e                  = Event.current;
        bool    isLeftMBtnClicked  = e.type == EventType.MouseUp;
        bool    isLeftMBtnDragging = e.type == EventType.MouseDrag;
        bool    openCondition      = (rectFullSize.Contains(e.mousePosition) && (((e.type == EventType.MouseUp || e.type == EventType.MouseDrag || e.type == EventType.MouseMove) && e.isMouse)));
        bool    closeCondition     = isLeftMBtnClicked || (!rectFullSize.Contains(e.mousePosition)) && (e.isMouse && (e.type == EventType.MouseMove || e.type == EventType.MouseDown));

        if (openCondition && (activeColorPicker == null || activeColorPicker.mState == ESTATE.Hidden))
        {
            if (mState == ESTATE.Hidden)
            {
                mState            = ESTATE.Showing;
                activeColorPicker = this;
                dt = 0;
            }
        }
        if (closeCondition)
        {
            if (mState == ESTATE.Showed)
            {
                if (isLeftMBtnClicked)
                {
                    ApplyColor();
                }
                else
                {
                    SetColor(SelectedColor);
                }

                mState = ESTATE.Hidding;
                dt     = 0;
            }
        }
        if (mState == ESTATE.Showed)
        {
            if (rect.Contains(e.mousePosition))
            {
                float   coeffX        = colorSpace.width / sizeCurr;
                float   coeffY        = colorSpace.height / sizeCurr;
                Vector2 localImagePos = (mousePos - startPos);
                Color   res           = colorSpace.GetPixel((int)(coeffX * localImagePos.x), colorSpace.height - (int)(coeffY * localImagePos.y) - 1);
                SetColor(res);
                if (isLeftMBtnDragging)
                {
                    ApplyColor();
                }
                UpdateColorEditFields(false);
                UpdateColorSliders(false);
            }
            else if (rectAlpha.Contains(e.mousePosition))
            {
                float   coeffX        = alphaGradient.width / sizeCurr;
                float   coeffY        = alphaGradient.height / sizeCurr;
                Vector2 localImagePos = (mousePos - startPosAlpha);
                Color   res           = alphaGradient.GetPixel((int)(coeffX * localImagePos.x), colorSpace.height - (int)(coeffY * localImagePos.y) - 1);
                Color   curr          = GetColor();
                curr.a = res.r;
                SetColor(curr);
                if (isLeftMBtnDragging)
                {
                    ApplyColor();
                }
                UpdateColorEditFields(false);
                UpdateColorSliders(false);
            }
            else if (rectColorEdit.Contains(e.mousePosition))
            {
                UpdateColorEditFields(true);
                UpdateColorSliders(false);
            }
            else if (rectColorSlider.Contains(e.mousePosition))
            {
                UpdateColorEditFields(false);
                UpdateColorSliders(true);
            }
            else
            {
                SetColor(SelectedColor);
            }
        }
    }
        public CreateCharAppearanceGump()
            : base(0, 0)
        {
            // get the resource provider
            IResourceProvider provider = ServiceRegistry.GetService <IResourceProvider>();

            // backdrop
            AddControl(new GumpPicTiled(this, 0, 0, 800, 600, 9274));
            AddControl(new GumpPic(this, 0, 0, 5500, 0));
            // character name
            AddControl(new GumpPic(this, 280, 53, 1801, 0));
            m_TxtName         = new TextEntry(this, 238, 70, 234, 20, 0, 0, 29, string.Empty);
            m_TxtName.HtmlTag = "<span color='#000' style='font-family:uni0;'>";
            AddControl(new ResizePic(this, m_TxtName));
            AddControl(m_TxtName);
            // character window
            AddControl(new GumpPic(this, 238, 98, 1800, 0));
            // paperdoll
            m_paperdoll = new PaperdollLargeUninteractable(this, 237, 97);
            m_paperdoll.IsCharacterCreation = true;
            AddControl(m_paperdoll);

            // left option window
            AddControl(new ResizePic(this, 82, 125, 3600, 151, 310));
            // this is the place where you would put the race selector.
            // if you do add it, move everything else in this left window down by 45 pixels
            // gender
            AddControl(new TextLabelAscii(this, 100, 141, 2036, 9, provider.GetString(3000120)), 1);
            AddControl(m_Gender = new DropDownList(this, 97, 154, 122, new string[] { provider.GetString(3000118), provider.GetString(3000119) }, 2, 0, false));
            // hair (male)
            AddControl(new TextLabelAscii(this, 100, 186, 2036, 9, provider.GetString(3000121)), 1);
            AddControl(m_HairMale = new DropDownList(this, 97, 199, 122, HairStyles.MaleHairNames, 6, 0, false), 1);
            // facial hair (male)
            AddControl(new TextLabelAscii(this, 100, 231, 2036, 9, provider.GetString(3000122)), 1);
            AddControl(m_FacialHairMale = new DropDownList(this, 97, 244, 122, HairStyles.FacialHair, 6, 0, false), 1);
            // hair (female)
            AddControl(new TextLabelAscii(this, 100, 186, 2036, 9, provider.GetString(3000121)), 2);
            AddControl(m_HairFemale = new DropDownList(this, 97, 199, 122, HairStyles.FemaleHairNames, 6, 0, false), 2);

            // right option window
            AddControl(new ResizePic(this, 475, 125, 3600, 151, 310));
            // skin tone
            AddControl(new TextLabelAscii(this, 489, 141, 2036, 9, provider.GetString(3000183)));
            AddControl(m_SkinHue = new ColorPicker(this, new Rectangle(490, 154, 120, 24), new Rectangle(490, 140, 120, 280), 7, 8, Hues.SkinTones));
            // hair color
            AddControl(new TextLabelAscii(this, 489, 186, 2036, 9, provider.GetString(3000184)));
            AddControl(m_HairHue = new ColorPicker(this, new Rectangle(490, 199, 120, 24), new Rectangle(490, 140, 120, 280), 8, 6, Hues.HairTones));
            // facial hair color (male)
            AddControl(new TextLabelAscii(this, 489, 231, 2036, 9, provider.GetString(3000185)), 1);
            AddControl(m_FacialHairHue = new ColorPicker(this, new Rectangle(490, 244, 120, 24), new Rectangle(490, 140, 120, 280), 8, 6, Hues.HairTones), 1);

            // back button
            AddControl(new Button(this, 586, 435, 5537, 5539, ButtonTypes.Activate, 0, (int)Buttons.BackButton), 1);
            ((Button)LastControl).GumpOverID = 5538;
            // forward button
            AddControl(new Button(this, 610, 435, 5540, 5542, ButtonTypes.Activate, 0, (int)Buttons.ForwardButton), 1);
            ((Button)LastControl).GumpOverID = 5541;
            // quit button
            AddControl(new Button(this, 554, 2, 5513, 5515, ButtonTypes.Activate, 0, (int)Buttons.QuitButton));
            ((Button)LastControl).GumpOverID = 5514;

            IsUncloseableWithRMB = true;
        }
示例#28
0
 private void Awake()
 {
     ColorPicker.inst = this;
 }
示例#29
0
 void OnGetColor(ColorPicker picker)
 {
     picker.NotifyColor(camera.backgroundColor);
 }
示例#30
0
        /// <summary>
        /// Create and display an empty rule row in UI
        /// </summary>
        private void AddNewRuleRow()
        {
            lastRowNumber          += 1;
            AddRuleButton.IsEnabled = false;
            newRule = new RuleSet
            {
                FilterID_Filter = filterId
            };

            RowDefinition rowDefinition = new RowDefinition();

            rowDefinition.Height = new GridLength(80);
            this.RulesGrid.RowDefinitions.Add(rowDefinition);

            ComboBox targetsList = new ComboBox();

            targetsList.Name              = RULE_TARGET_FIELDLIST_NAME + lastRowNumber;
            targetsList.ItemsSource       = ruleVM.Targets;
            targetsList.DisplayMemberPath = "Name";
            targetsList.SetValue(Grid.ColumnProperty, 1);
            targetsList.SetValue(Grid.RowProperty, lastRowNumber);
            targetsList.VerticalAlignment          = VerticalAlignment.Top;
            targetsList.FontSize                   = 16;
            targetsList.HorizontalContentAlignment = HorizontalAlignment.Center;
            targetsList.SelectionChanged          += new SelectionChangedEventHandler(
                (sender, e) => {
                bool b;
                int targetId     = (targetsList.SelectedValue as TargetSet).ID_Target;
                ComboBox clicked = e.Source as ComboBox;
                int position     = Convert.ToInt32(clicked.Name.Substring(RULE_TARGET_FIELDLIST_NAME.Length));
                if (stopProcessSelectionChanged.TryGetValue(targetsList.Name, out b) == false)
                {
                    newRule.TargetID_Target = targetId;
                }
                SwitchAssociatedField(targetId, position);
            }
                );
            RegisterName(RULE_TARGET_FIELDLIST_NAME + lastRowNumber, targetsList);
            this.RulesGrid.Children.Add(targetsList);

            ComboBox templatesList = new ComboBox();

            templatesList.Name              = RULE_BADGEEVENT_FIELDLIST_NAME + lastRowNumber;
            templatesList.ItemsSource       = ruleVM.BadgeEvents;
            templatesList.DisplayMemberPath = "Name";
            templatesList.SetValue(Grid.ColumnProperty, 2);
            templatesList.SetValue(Grid.RowProperty, lastRowNumber);
            templatesList.VerticalAlignment          = VerticalAlignment.Top;
            templatesList.FontSize                   = 16;
            templatesList.HorizontalContentAlignment = HorizontalAlignment.Center;
            templatesList.SelectionChanged          += new SelectionChangedEventHandler(
                (sender, e) => {
                bool b;
                if (stopProcessSelectionChanged.TryGetValue(templatesList.Name, out b) == false)
                {
                    newRule.BadgeEventID_BadgeEvent = (templatesList.SelectedValue as BadgeEventSet).ID_BadgeEvent;
                }
            }
                );
            //templatesList.Visibility = Visibility.Hidden;
            templatesList.IsEnabled = false;
            RegisterName(RULE_BADGEEVENT_FIELDLIST_NAME + lastRowNumber, templatesList);
            this.RulesGrid.Children.Add(templatesList);

            ColorPicker colorPicker = new ColorPicker();

            colorPicker.Name = RULE_COLORPICKER_NAME + lastRowNumber;
            colorPicker.SetValue(Grid.ColumnProperty, 3);
            colorPicker.SetValue(Grid.RowProperty, lastRowNumber);
            colorPicker.VerticalAlignment          = VerticalAlignment.Top;
            colorPicker.HorizontalContentAlignment = HorizontalAlignment.Center;
            colorPicker.FontSize              = 16;
            colorPicker.SelectedColorChanged += ColorPicker_SelectedColorChanged;
            //colorPicker.Visibility = Visibility.Hidden;
            colorPicker.IsEnabled = false;
            RegisterName(RULE_COLORPICKER_NAME + lastRowNumber, colorPicker);
            this.RulesGrid.Children.Add(colorPicker);

            Button deleteRule = new Button();

            deleteRule.Content   = "X";
            deleteRule.IsEnabled = false;
            deleteRule.Name      = RULE_DELETE_RULE_NAME + lastRowNumber;
            deleteRule.SetValue(Grid.ColumnProperty, 4);
            deleteRule.Width = 50;
            deleteRule.SetValue(Grid.RowProperty, lastRowNumber);
            deleteRule.VerticalAlignment = VerticalAlignment.Top;
            deleteRule.Click            += new RoutedEventHandler(OnClick_DeleteRule);
            RegisterName(RULE_DELETE_RULE_NAME + lastRowNumber, deleteRule);
            this.RulesGrid.Children.Add(deleteRule);
        }
示例#31
0
    public override void _Ready()
    {
        organelleSelectionElements = GetTree().GetNodesInGroup("OrganelleSelectionElement");
        membraneSelectionElements  = GetTree().GetNodesInGroup("MembraneSelectionElement");
        itemTooltipElements        = GetTree().GetNodesInGroup("ItemTooltip");

        menu                          = GetNode <Control>(MenuPath);
        sizeLabel                     = GetNode <Label>(SizeLabelPath);
        speedLabel                    = GetNode <Label>(SpeedLabelPath);
        generationLabel               = GetNode <Label>(GenerationLabelPath);
        mutationPointsLabel           = GetNode <Label>(MutationPointsLabelPath);
        mutationPointsBar             = GetNode <TextureProgress>(MutationPointsBarPath);
        speciesNameEdit               = GetNode <LineEdit>(SpeciesNameEditPath);
        membraneColorPicker           = GetNode <ColorPicker>(MembraneColorPickerPath);
        newCellButton                 = GetNode <TextureButton>(NewCellButtonPath);
        undoButton                    = GetNode <TextureButton>(UndoButtonPath);
        redoButton                    = GetNode <TextureButton>(RedoButtonPath);
        symmetryButton                = GetNode <TextureButton>(SymmetryButtonPath);
        finishButton                  = GetNode <Button>(FinishButtonPath);
        atpBalanceLabel               = GetNode <Label>(ATPBalanceLabelPath);
        atpProductionBar              = GetNode <SegmentedBar>(ATPProductionBarPath);
        atpConsumptionBar             = GetNode <SegmentedBar>(ATPConsumptionBarPath);
        glucoseReductionLabel         = GetNode <Label>(GlucoseReductionLabelPath);
        autoEvoLabel                  = GetNode <Label>(AutoEvoLabelPath);
        externalEffectsLabel          = GetNode <Label>(ExternalEffectsLabelPath);
        mapDrawer                     = GetNode <PatchMapDrawer>(MapDrawerPath);
        patchNothingSelected          = GetNode <Control>(PatchNothingSelectedPath);
        patchDetails                  = GetNode <Control>(PatchDetailsPath);
        patchName                     = GetNode <Label>(PatchNamePath);
        patchPlayerHere               = GetNode <Control>(PatchPlayerHerePath);
        patchBiome                    = GetNode <Label>(PatchBiomePath);
        patchTemperature              = GetNode <Label>(PatchTemperaturePath);
        patchPressure                 = GetNode <Label>(PatchPressurePath);
        patchLight                    = GetNode <Label>(PatchLightPath);
        patchOxygen                   = GetNode <Label>(PatchOxygenPath);
        patchNitrogen                 = GetNode <Label>(PatchNitrogenPath);
        patchCO2                      = GetNode <Label>(PatchCO2Path);
        patchHydrogenSulfide          = GetNode <Label>(PatchHydrogenSulfidePath);
        patchAmmonia                  = GetNode <Label>(PatchAmmoniaPath);
        patchGlucose                  = GetNode <Label>(PatchGlucosePath);
        patchPhosphate                = GetNode <Label>(PatchPhosphatePath);
        patchIron                     = GetNode <Label>(PatchIronPath);
        speciesList                   = GetNode <VBoxContainer>(SpeciesListPath);
        physicalConditionsBox         = GetNode <Control>(PhysicalConditionsBoxPath);
        atmosphericConditionsBox      = GetNode <Control>(AtmosphericConditionsBoxPath);
        compoundsBox                  = GetNode <Control>(CompoundsBoxPath);
        moveToPatchButton             = GetNode <Button>(MoveToPatchButtonPath);
        physicalConditionsButton      = GetNode <Control>(PhysicalConditionsButtonPath);
        atmosphericConditionsButton   = GetNode <Control>(AtmosphericConditionsButtonPath);
        compoundsButton               = GetNode <Control>(CompoundsBoxButtonPath);
        speciesListButton             = GetNode <Control>(SpeciesListButtonPath);
        symmetryIcon                  = GetNode <TextureRect>(SymmetryIconPath);
        patchTemperatureSituation     = GetNode <TextureRect>(PatchTemperatureSituationPath);
        patchLightSituation           = GetNode <TextureRect>(PatchLightSituationPath);
        patchHydrogenSulfideSituation = GetNode <TextureRect>(PatchHydrogenSulfideSituationPath);
        patchGlucoseSituation         = GetNode <TextureRect>(PatchGlucoseSituationPath);
        patchIronSituation            = GetNode <TextureRect>(PatchIronSituationPath);
        patchAmmoniaSituation         = GetNode <TextureRect>(PatchAmmoniaSituationPath);
        patchPhosphateSituation       = GetNode <TextureRect>(PatchPhosphateSituationPath);
        rigiditySlider                = GetNode <Slider>(RigiditySliderPath);

        mapDrawer.OnSelectedPatchChanged = drawer => { UpdateShownPatchDetails(); };

        atpProductionBar.SelectedType  = SegmentedBar.Type.ATP;
        atpProductionBar.IsProduction  = true;
        atpConsumptionBar.SelectedType = SegmentedBar.Type.ATP;

        // Fade out for that smooth satisfying transition
        TransitionManager.Instance.AddScreenFade(Fade.FadeType.FadeOut, 0.5f);
        TransitionManager.Instance.StartTransitions(null, string.Empty);
    }
示例#32
0
 //event handler to set the raster canvas' current color to the color picker's color
 private void colorPicker_ColorChanged(ColorPicker sender, ColorChangedEventArgs args)
 {
     mainCanvas.DrawColor = colorPicker.Color;
 }
示例#33
0
        public LoginWindow(Manager manager, LoginScreen screen) : base(manager)
        {
            this.screen = screen;

            // Events

            // Listen for valid response from auth server
            screen.Client.Events.Network.Auth.InitReceived.AddHandler(OnInit);

            // Listen for failed login response from auth server
            screen.Client.Events.Network.Auth.FailedLogin.AddHandler(OnFailedLogin);

            // Setup the window
            CaptionVisible   = false;
            Caption.Text     = "Welcome to Bricklayer!";
            Description.Text =
                "An open source, fully moddable and customizable 2D\nbuilding game.";
            Movable         = false;
            Resizable       = false;
            Width           = 450;
            Height          = 218;
            TopPanel.Height = 72;
            Shadow          = true;
            Center();

            // Text boxes
            txtUsername = new TextBox(Manager);
            txtUsername.Init();
            txtUsername.Width       = ClientWidth / 2 - 16;
            txtUsername.Left        = 8;
            txtUsername.Top         = TopPanel.Bottom + 8;
            txtUsername.Placeholder = "Username";
            txtUsername.Text        = screen.Client.IO.Config.Client.Username;
            Add(txtUsername);

            txtPassword = new TextBox(Manager);
            txtPassword.Init();
            txtPassword.Width       = txtUsername.Width;
            txtPassword.Left        = txtUsername.Left;
            txtPassword.Top         = txtUsername.Bottom + 8;
            txtPassword.Placeholder = "Password";
            txtPassword.Text        = screen.Client.IO.GetPassword();
            txtPassword.Mode        = TextBoxMode.Password;
            Add(txtPassword);

            chkRemember = new CheckBox(Manager);
            chkRemember.Init();
            chkRemember.Width   = txtUsername.Width;
            chkRemember.Left    = txtUsername.Right + 16;
            chkRemember.Top     = txtPassword.Top + 3;
            chkRemember.Text    = "Remember Me";
            chkRemember.Checked = screen.Client.IO.Config.Client.RememberMe;
            Add(chkRemember);

            // Sign in buttons
            btnLoginAccount = new Button(Manager);
            btnLoginAccount.Init();
            btnLoginAccount.Width  = txtUsername.Width;
            btnLoginAccount.Left   = txtUsername.Left;
            btnLoginAccount.Top    = 8;
            btnLoginAccount.Click += LoginAccountClick;
            btnLoginAccount.Text   = "Sign in";
            BottomPanel.Add(btnLoginAccount);

            btnLoginGuest         = new Button(Manager);
            btnLoginGuest.Enabled = false;
            btnLoginGuest.Init();
            btnLoginGuest.Width = btnLoginAccount.Width;
            btnLoginGuest.Left  = btnLoginAccount.Right + 16;
            btnLoginGuest.Top   = btnLoginAccount.Top;
            btnLoginGuest.Text  = "Try as Guest";
            BottomPanel.Add(btnLoginGuest);

            // Links
            lnkForgot = new LinkLabel(Manager);
            lnkForgot.Init();
            lnkForgot.Width     = txtUsername.Width;
            lnkForgot.Alignment = Alignment.MiddleCenter;
            lnkForgot.Left      = txtUsername.Left;
            lnkForgot.Top       = btnLoginAccount.Bottom + 8;
            lnkForgot.Text      = "Forgot Password?";
            lnkForgot.URL       = Constants.Strings.ForgotPasswordURL;
            lnkForgot.ToolTip   = new ToolTip(Manager)
            {
                Text = "A new browser window will be opened."
            };
            BottomPanel.Add(lnkForgot);

            lnkCreateAccount = new LinkLabel(Manager);
            lnkCreateAccount.Init();
            lnkCreateAccount.Width     = txtUsername.Width;
            lnkCreateAccount.Alignment = Alignment.MiddleCenter;
            lnkCreateAccount.Left      = btnLoginGuest.Left;
            lnkCreateAccount.Top       = lnkForgot.Top;
            lnkCreateAccount.Text      = "Create an account";
            lnkCreateAccount.URL       = Constants.Strings.CreateAccountURL;
            BottomPanel.Add(lnkCreateAccount);

            // Color selector
            bodyClr = new ColorPicker(Manager)
            {
                Left = txtUsername.Right + 16, Top = txtUsername.Top, Width = txtUsername.Width - 18 - 8, Saturation = 210, Value = 250
            };
            bodyClr.Init();
            bodyClr.ValueChanged += (sender, args) =>
            {
                BodyImg.Color = bodyClr.SelectedColor;
                // TODO: Update value in the game class
            };
            Add(bodyClr);

            BodyImg = new ImageBox(Manager)
            {
                Left = bodyClr.Right + 8, Top = bodyClr.Top, Width = 18, Height = 18, Image = screen.Client.Content["entity.body"]
            };
            BodyImg.Init();
            Add(BodyImg);

            SmileyImg = new ImageBox(Manager)
            {
                Left = BodyImg.Left, Top = BodyImg.Top, Width = 18, Height = 18, Image = screen.Client.Content["entity.smileys"], SourceRect = new Rectangle(0, 0, 18, 18)
            };
            SmileyImg.Init();
            SmileyImg.ToolTip.Text = "I love this color!";
            Add(SmileyImg);

            bodyClr.Hue = screen.Client.IO.Config.Client.Color;

            BottomPanel.Height = lnkForgot.Bottom + 28;
            BottomPanel.Top    = Height - BottomPanel.Height;
        }
示例#34
0
 private void InitializeComponent()
 {
     this.EnabledCheckBox     = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.VisibleCheckBox     = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.FontButton          = new FontButton();
     this.focusLabel11        = new FocusLabel();
     this.ForeColorPicker     = new ColorPicker();
     this.TextEditMultiLine   = new EditMultiLine();
     this.focusLabel2         = new FocusLabel();
     this.checkBox1           = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.UserCanEditCheckBox = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.UserCanSizeCheckBox = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.UserCanMoveCheckBox = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.NameTextBox         = new EditBox();
     this.focusLabel7         = new FocusLabel();
     this.YAxisNameTextBox    = new EditBox();
     this.focusLabel5         = new FocusLabel();
     this.XAxisNameTextBox    = new EditBox();
     this.focusLabel6         = new FocusLabel();
     this.LayerNumericUpDown  = new Iocomp.Design.Plugin.EditorControls.NumericUpDown();
     this.focusLabel4         = new FocusLabel();
     this.RotationTextBox     = new EditBox();
     this.focusLabel1         = new FocusLabel();
     this.YTextBox            = new EditBox();
     this.label9       = new FocusLabel();
     this.XTextBox     = new EditBox();
     this.label8       = new FocusLabel();
     this.WidthTextBox = new EditBox();
     this.label7       = new FocusLabel();
     this.ContextMenuEnabledCheckBox = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.ClippingStyleComboBox      = new Iocomp.Design.Plugin.EditorControls.ComboBox();
     this.focusLabel3        = new FocusLabel();
     this.OuterMarginEditBox = new EditBox();
     this.focusLabel8        = new FocusLabel();
     this.CanFocusCheckBox   = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     base.SuspendLayout();
     this.EnabledCheckBox.Location     = new Point(16, 35);
     this.EnabledCheckBox.Name         = "EnabledCheckBox";
     this.EnabledCheckBox.PropertyName = "Enabled";
     this.EnabledCheckBox.Size         = new Size(72, 24);
     this.EnabledCheckBox.TabIndex     = 1;
     this.EnabledCheckBox.Text         = "Enabled";
     this.VisibleCheckBox.Location     = new Point(16, 11);
     this.VisibleCheckBox.Name         = "VisibleCheckBox";
     this.VisibleCheckBox.PropertyName = "Visible";
     this.VisibleCheckBox.Size         = new Size(72, 24);
     this.VisibleCheckBox.TabIndex     = 0;
     this.VisibleCheckBox.Text         = "Visible";
     this.FontButton.Location          = new Point(144, 208);
     this.FontButton.Name         = "FontButton";
     this.FontButton.PropertyName = "Font";
     this.FontButton.Size         = new Size(72, 23);
     this.FontButton.TabIndex     = 17;
     this.focusLabel11.LoadingBegin();
     this.focusLabel11.FocusControl = this.ForeColorPicker;
     this.focusLabel11.Location     = new Point(221, 211);
     this.focusLabel11.Name         = "focusLabel11";
     this.focusLabel11.Size         = new Size(59, 15);
     this.focusLabel11.Text         = "Fore Color";
     this.focusLabel11.LoadingEnd();
     this.ForeColorPicker.Location       = new Point(280, 208);
     this.ForeColorPicker.Name           = "ForeColorPicker";
     this.ForeColorPicker.PropertyName   = "ForeColor";
     this.ForeColorPicker.Size           = new Size(49, 21);
     this.ForeColorPicker.Style          = ColorPickerStyle.ColorBox;
     this.ForeColorPicker.TabIndex       = 18;
     this.TextEditMultiLine.EditFont     = null;
     this.TextEditMultiLine.Location     = new Point(144, 176);
     this.TextEditMultiLine.Name         = "TextEditMultiLine";
     this.TextEditMultiLine.PropertyName = "Text";
     this.TextEditMultiLine.Size         = new Size(400, 20);
     this.TextEditMultiLine.TabIndex     = 16;
     this.focusLabel2.LoadingBegin();
     this.focusLabel2.FocusControl = this.TextEditMultiLine;
     this.focusLabel2.Location     = new Point(115, 179);
     this.focusLabel2.Name         = "focusLabel2";
     this.focusLabel2.Size         = new Size(29, 15);
     this.focusLabel2.Text         = "Text";
     this.focusLabel2.LoadingEnd();
     this.checkBox1.Location               = new Point(344, 208);
     this.checkBox1.Name                   = "checkBox1";
     this.checkBox1.PropertyName           = "FixedSize";
     this.checkBox1.Size                   = new Size(80, 24);
     this.checkBox1.TabIndex               = 19;
     this.checkBox1.Text                   = "Fixed Size";
     this.UserCanEditCheckBox.Location     = new Point(16, 107);
     this.UserCanEditCheckBox.Name         = "UserCanEditCheckBox";
     this.UserCanEditCheckBox.PropertyName = "UserCanEdit";
     this.UserCanEditCheckBox.Size         = new Size(96, 24);
     this.UserCanEditCheckBox.TabIndex     = 4;
     this.UserCanEditCheckBox.Text         = "User Can Edit";
     this.UserCanSizeCheckBox.Location     = new Point(16, 83);
     this.UserCanSizeCheckBox.Name         = "UserCanSizeCheckBox";
     this.UserCanSizeCheckBox.PropertyName = "UserCanSize";
     this.UserCanSizeCheckBox.TabIndex     = 3;
     this.UserCanSizeCheckBox.Text         = "User Can Size";
     this.UserCanMoveCheckBox.Location     = new Point(16, 59);
     this.UserCanMoveCheckBox.Name         = "UserCanMoveCheckBox";
     this.UserCanMoveCheckBox.PropertyName = "UserCanMove";
     this.UserCanMoveCheckBox.TabIndex     = 2;
     this.UserCanMoveCheckBox.Text         = "User Can Move";
     this.NameTextBox.LoadingBegin();
     this.NameTextBox.Location     = new Point(232, 16);
     this.NameTextBox.Name         = "NameTextBox";
     this.NameTextBox.PropertyName = "Name";
     this.NameTextBox.Size         = new Size(144, 20);
     this.NameTextBox.TabIndex     = 7;
     this.NameTextBox.LoadingEnd();
     this.focusLabel7.LoadingBegin();
     this.focusLabel7.FocusControl = this.NameTextBox;
     this.focusLabel7.Location     = new Point(195, 18);
     this.focusLabel7.Name         = "focusLabel7";
     this.focusLabel7.Size         = new Size(37, 15);
     this.focusLabel7.Text         = "Name";
     this.focusLabel7.LoadingEnd();
     this.YAxisNameTextBox.LoadingBegin();
     this.YAxisNameTextBox.Location     = new Point(232, 64);
     this.YAxisNameTextBox.Name         = "YAxisNameTextBox";
     this.YAxisNameTextBox.PropertyName = "YAxisName";
     this.YAxisNameTextBox.Size         = new Size(144, 20);
     this.YAxisNameTextBox.TabIndex     = 9;
     this.YAxisNameTextBox.LoadingEnd();
     this.focusLabel5.LoadingBegin();
     this.focusLabel5.FocusControl = this.YAxisNameTextBox;
     this.focusLabel5.Location     = new Point(160, 66);
     this.focusLabel5.Name         = "focusLabel5";
     this.focusLabel5.Size         = new Size(72, 15);
     this.focusLabel5.Text         = "Y-Axis Name";
     this.focusLabel5.LoadingEnd();
     this.XAxisNameTextBox.LoadingBegin();
     this.XAxisNameTextBox.Location     = new Point(232, 40);
     this.XAxisNameTextBox.Name         = "XAxisNameTextBox";
     this.XAxisNameTextBox.PropertyName = "XAxisName";
     this.XAxisNameTextBox.Size         = new Size(144, 20);
     this.XAxisNameTextBox.TabIndex     = 8;
     this.XAxisNameTextBox.LoadingEnd();
     this.focusLabel6.LoadingBegin();
     this.focusLabel6.FocusControl = this.XAxisNameTextBox;
     this.focusLabel6.Location     = new Point(160, 42);
     this.focusLabel6.Name         = "focusLabel6";
     this.focusLabel6.Size         = new Size(72, 15);
     this.focusLabel6.Text         = "X-Axis Name";
     this.focusLabel6.LoadingEnd();
     this.LayerNumericUpDown.Location = new Point(320, 88);
     this.LayerNumericUpDown.Maximum  = new decimal(new int[4]
     {
         10000,
         0,
         0,
         0
     });
     this.LayerNumericUpDown.Minimum = new decimal(new int[4]
     {
         10000,
         0,
         0,
         -2147483648
     });
     this.LayerNumericUpDown.Name         = "LayerNumericUpDown";
     this.LayerNumericUpDown.PropertyName = "Layer";
     this.LayerNumericUpDown.Size         = new Size(56, 20);
     this.LayerNumericUpDown.TabIndex     = 11;
     this.LayerNumericUpDown.TextAlign    = HorizontalAlignment.Center;
     this.focusLabel4.LoadingBegin();
     this.focusLabel4.FocusControl = this.LayerNumericUpDown;
     this.focusLabel4.Location     = new Point(285, 89);
     this.focusLabel4.Name         = "focusLabel4";
     this.focusLabel4.Size         = new Size(35, 15);
     this.focusLabel4.Text         = "Layer";
     this.focusLabel4.LoadingEnd();
     this.RotationTextBox.LoadingBegin();
     this.RotationTextBox.Location     = new Point(232, 88);
     this.RotationTextBox.Name         = "RotationTextBox";
     this.RotationTextBox.PropertyName = "Rotation";
     this.RotationTextBox.Size         = new Size(48, 20);
     this.RotationTextBox.TabIndex     = 10;
     this.RotationTextBox.LoadingEnd();
     this.focusLabel1.LoadingBegin();
     this.focusLabel1.FocusControl = this.RotationTextBox;
     this.focusLabel1.Location     = new Point(183, 90);
     this.focusLabel1.Name         = "focusLabel1";
     this.focusLabel1.Size         = new Size(49, 15);
     this.focusLabel1.Text         = "Rotation";
     this.focusLabel1.LoadingEnd();
     this.YTextBox.LoadingBegin();
     this.YTextBox.Location     = new Point(432, 40);
     this.YTextBox.Name         = "YTextBox";
     this.YTextBox.PropertyName = "Y";
     this.YTextBox.Size         = new Size(112, 20);
     this.YTextBox.TabIndex     = 14;
     this.YTextBox.LoadingEnd();
     this.label9.LoadingBegin();
     this.label9.FocusControl = this.YTextBox;
     this.label9.Location     = new Point(417, 42);
     this.label9.Name         = "label9";
     this.label9.Size         = new Size(15, 15);
     this.label9.Text         = "Y";
     this.label9.LoadingEnd();
     this.XTextBox.LoadingBegin();
     this.XTextBox.Location     = new Point(432, 16);
     this.XTextBox.Name         = "XTextBox";
     this.XTextBox.PropertyName = "X";
     this.XTextBox.Size         = new Size(112, 20);
     this.XTextBox.TabIndex     = 13;
     this.XTextBox.LoadingEnd();
     this.label8.LoadingBegin();
     this.label8.FocusControl = this.XTextBox;
     this.label8.Location     = new Point(417, 18);
     this.label8.Name         = "label8";
     this.label8.Size         = new Size(15, 15);
     this.label8.Text         = "X";
     this.label8.LoadingEnd();
     this.WidthTextBox.LoadingBegin();
     this.WidthTextBox.Location     = new Point(432, 64);
     this.WidthTextBox.Name         = "WidthTextBox";
     this.WidthTextBox.PropertyName = "Width";
     this.WidthTextBox.Size         = new Size(112, 20);
     this.WidthTextBox.TabIndex     = 15;
     this.WidthTextBox.LoadingEnd();
     this.label7.LoadingBegin();
     this.label7.FocusControl = this.WidthTextBox;
     this.label7.Location     = new Point(396, 66);
     this.label7.Name         = "label7";
     this.label7.Size         = new Size(36, 15);
     this.label7.Text         = "Width";
     this.label7.LoadingEnd();
     this.ContextMenuEnabledCheckBox.Location     = new Point(16, 132);
     this.ContextMenuEnabledCheckBox.Name         = "ContextMenuEnabledCheckBox";
     this.ContextMenuEnabledCheckBox.PropertyName = "ContextMenuEnabled";
     this.ContextMenuEnabledCheckBox.Size         = new Size(144, 24);
     this.ContextMenuEnabledCheckBox.TabIndex     = 5;
     this.ContextMenuEnabledCheckBox.Text         = "Context Menu Enabled";
     this.ClippingStyleComboBox.DropDownStyle     = ComboBoxStyle.DropDownList;
     this.ClippingStyleComboBox.Location          = new Point(232, 112);
     this.ClippingStyleComboBox.MaxDropDownItems  = 20;
     this.ClippingStyleComboBox.Name         = "ClippingStyleComboBox";
     this.ClippingStyleComboBox.PropertyName = "ClippingStyle";
     this.ClippingStyleComboBox.Size         = new Size(80, 21);
     this.ClippingStyleComboBox.TabIndex     = 12;
     this.focusLabel3.LoadingBegin();
     this.focusLabel3.FocusControl = this.ClippingStyleComboBox;
     this.focusLabel3.Location     = new Point(157, 114);
     this.focusLabel3.Name         = "focusLabel3";
     this.focusLabel3.Size         = new Size(75, 15);
     this.focusLabel3.Text         = "Clipping Style";
     this.focusLabel3.LoadingEnd();
     this.OuterMarginEditBox.LoadingBegin();
     this.OuterMarginEditBox.Location     = new Point(496, 208);
     this.OuterMarginEditBox.Name         = "OuterMarginEditBox";
     this.OuterMarginEditBox.PropertyName = "OuterMargin";
     this.OuterMarginEditBox.Size         = new Size(48, 20);
     this.OuterMarginEditBox.TabIndex     = 20;
     this.OuterMarginEditBox.LoadingEnd();
     this.focusLabel8.LoadingBegin();
     this.focusLabel8.FocusControl = this.OuterMarginEditBox;
     this.focusLabel8.Location     = new Point(424, 210);
     this.focusLabel8.Name         = "focusLabel8";
     this.focusLabel8.Size         = new Size(72, 15);
     this.focusLabel8.Text         = "Outer Margin";
     this.focusLabel8.LoadingEnd();
     this.CanFocusCheckBox.Location     = new Point(16, 157);
     this.CanFocusCheckBox.Name         = "CanFocusCheckBox";
     this.CanFocusCheckBox.PropertyName = "CanFocus";
     this.CanFocusCheckBox.Size         = new Size(80, 24);
     this.CanFocusCheckBox.TabIndex     = 6;
     this.CanFocusCheckBox.Text         = "Can Focus";
     base.Controls.Add(this.CanFocusCheckBox);
     base.Controls.Add(this.OuterMarginEditBox);
     base.Controls.Add(this.focusLabel8);
     base.Controls.Add(this.ClippingStyleComboBox);
     base.Controls.Add(this.focusLabel3);
     base.Controls.Add(this.ContextMenuEnabledCheckBox);
     base.Controls.Add(this.NameTextBox);
     base.Controls.Add(this.focusLabel7);
     base.Controls.Add(this.YAxisNameTextBox);
     base.Controls.Add(this.focusLabel5);
     base.Controls.Add(this.XAxisNameTextBox);
     base.Controls.Add(this.focusLabel6);
     base.Controls.Add(this.LayerNumericUpDown);
     base.Controls.Add(this.focusLabel4);
     base.Controls.Add(this.RotationTextBox);
     base.Controls.Add(this.focusLabel1);
     base.Controls.Add(this.YTextBox);
     base.Controls.Add(this.label9);
     base.Controls.Add(this.XTextBox);
     base.Controls.Add(this.label8);
     base.Controls.Add(this.WidthTextBox);
     base.Controls.Add(this.label7);
     base.Controls.Add(this.UserCanEditCheckBox);
     base.Controls.Add(this.UserCanSizeCheckBox);
     base.Controls.Add(this.UserCanMoveCheckBox);
     base.Controls.Add(this.checkBox1);
     base.Controls.Add(this.FontButton);
     base.Controls.Add(this.focusLabel11);
     base.Controls.Add(this.ForeColorPicker);
     base.Controls.Add(this.TextEditMultiLine);
     base.Controls.Add(this.focusLabel2);
     base.Controls.Add(this.EnabledCheckBox);
     base.Controls.Add(this.VisibleCheckBox);
     base.Location = new Point(10, 20);
     base.Name     = "PlotAnnotationTextBoxEditorPlugIn";
     base.Size     = new Size(616, 272);
     base.ResumeLayout(false);
 }
        public static ColorPicker CreateColorPicker(this VRUIViewController parent, Vector2 anchoredPosition, Vector2 sizeDelta)
        {
            ColorPicker colorPicker = BeatSaberUI.CreateColorPicker(parent.rectTransform, anchoredPosition, sizeDelta);

            return(colorPicker);
        }
示例#36
0
        /// <summary>
        /// Builds the controls.
        /// </summary>
        private void BuildControls()
        {
            bool          inPanel            = false;
            List <string> lessColorFunctions = new List <string>()
            {
                "lighten", "darken", "saturate", "desaturate", "fadein", "fadeout", "fade", "spin", "mix"
            };

            /*Rock.Web.UI.Controls.ImageUploader fupTest = new Rock.Web.UI.Controls.ImageUploader();
             * fupTest.ID = "test";
             * fupTest.BinaryFileTypeGuid
             * phThemeControls.Controls.Add( fupTest );*/

            if (!string.IsNullOrWhiteSpace(_themeName))
            {
                if (!File.Exists(_variableFile) || !File.Exists(_variableOverrideFile))
                {
                    nbMessages.NotificationBoxType = NotificationBoxType.Warning;
                    nbMessages.Text = "This theme does not have a variables file(s) to allow overriding.";
                    btnSave.Visible = false;
                    return;
                }

                // get list of current overrides
                Dictionary <string, string> overrides = GetVariables(_variableOverrideFile);

                foreach (string line in File.ReadLines(_variableFile))
                {
                    if (line.Left(4) == @"//--")
                    {
                        Literal spacing = new Literal();
                        spacing.Text = "<br/><br/>";
                        AddControl(spacing, inPanel);
                    }
                    else if (line.Left(4) == @"////")
                    {
                        Literal  header    = new Literal();
                        string[] lineParts = line.Split(new char[] { '{', '}' }, StringSplitOptions.RemoveEmptyEntries);

                        string headerText  = string.Empty;
                        string summaryText = string.Empty;

                        if (lineParts.Length > 0)
                        {
                            headerText = lineParts[0].Replace(@"/", string.Empty);
                        }

                        if (lineParts.Length > 1)
                        {
                            summaryText = lineParts[1];
                        }

                        header.Text = string.Format("<h4>{0}</h4><p>{1}</p>", headerText, summaryText);
                        AddControl(header, inPanel);
                    }
                    else if (line.Left(2) == @"//")
                    {
                        string title = line.Substring(2);

                        StringBuilder content = new StringBuilder();

                        // panel
                        if (inPanel)
                        {
                            Literal panelClose = new Literal();
                            panelClose.Text = "</div></div>";
                            AddControl(panelClose, true);

                            inPanel = false;
                        }

                        bool showInEditor = false;
                        if (title.Contains("*show in editor*"))
                        {
                            showInEditor = true;
                            title        = title.Replace("*show in editor*", string.Empty);
                        }

                        if (showInEditor)
                        {
                            inPanel = true;

                            content.Append("<div class='panel panel-widget'>");
                            content.Append("<div class='panel-heading'>");
                            content.Append(string.Format("<h1 class='panel-title'>{0}<div class='pull-right'><a class='btn btn-link btn-xs js-panel-toggle'><i class='fa fa-chevron-up'></i></a></div></h1>", title));
                            content.Append("</div>");
                            content.Append("<div class='panel-body'>");

                            Literal header = new Literal();
                            header.Text = content.ToString();
                            AddControl(header, inPanel);
                        }
                    }
                    else if (line.Left(1) == "@")
                    {
                        // variable
                        char[]   delimiters    = new char[] { ':', ';' };
                        string[] variableParts = Array.ConvertAll(line.Split(delimiters), p => p.Trim());

                        string helpText = string.Empty;

                        // determine type
                        VariableType variableType = VariableType.Text;
                        if (variableParts.Length >= 3)
                        {
                            // determine if we should use a color control. only do this if:
                            //     - if the comments tell us it's a color (#color)
                            //     - it's not a less variable (starts with a @)
                            //     - it's not a less color function

                            // todo check for less color functions
                            if (variableParts[2].Contains("#color") && !variableParts[1].StartsWith("@") && !lessColorFunctions.Any(x => variableParts[1].StartsWith(x)))
                            {
                                variableType = VariableType.Color;
                            }

                            // get help
                            helpText = variableParts[2].Replace("#color", string.Empty).Replace("//", string.Empty).Trim();
                        }

                        // get variable name
                        string variableName = variableParts[0].Replace("@", string.Empty).Replace("-", " ").Titleize();
                        string variableKey  = variableParts[0].Replace("@", string.Empty);

                        // get variable value
                        string variableValue = string.Empty;
                        if (variableParts.Length > 1)
                        {
                            variableValue = variableParts[1].Trim();
                        }

                        Literal overrideControl = new Literal();

                        switch (variableType)
                        {
                        case VariableType.Color:
                        {
                            if (phThemeControls.FindControl(variableName) == null)
                            {
                                ColorPicker colorPicker = new ColorPicker();
                                colorPicker.ID    = variableKey;
                                colorPicker.Label = variableName;

                                // check if override of the variable exists
                                if (overrides.ContainsKey(variableKey))
                                {
                                    colorPicker.Text = overrides[variableKey];

                                    // add restore logic
                                    overrideControl.Text = string.Format("<i class='fa fa-times margin-l-sm js-color-override variable-override pull-left' style='margin-top: 34px; cursor: pointer;' data-control='{0}' data-original-value='{1}'></i>", variableKey, variableValue);
                                }
                                else
                                {
                                    colorPicker.Text = variableValue;
                                }

                                if (!string.IsNullOrWhiteSpace(helpText))
                                {
                                    colorPicker.Help = helpText;
                                }

                                colorPicker.RequiredFieldValidator = null;
                                colorPicker.FormGroupCssClass      = "pull-left";

                                Literal beginWrapper = new Literal();
                                beginWrapper.Text = "<div class='clearfix'>";

                                AddControl(beginWrapper, inPanel);
                                AddControl(colorPicker, inPanel);
                                AddControl(overrideControl, inPanel);

                                Literal endWrapper = new Literal();
                                endWrapper.Text = "</div>";
                                AddControl(endWrapper, inPanel);
                            }

                            break;
                        }

                        default:
                        {
                            if (phThemeControls.FindControl(variableName) == null)
                            {
                                RockTextBox textbox = new RockTextBox();
                                textbox.Label    = variableName;
                                textbox.ID       = variableKey;
                                textbox.CssClass = "input-width-xl";
                                textbox.Help     = helpText;

                                // check if override of the variable exists
                                if (overrides.ContainsKey(variableKey))
                                {
                                    textbox.Text = overrides[variableKey];

                                    // add restore logic
                                    overrideControl.Text = string.Format("<i class='fa fa-times margin-l-sm js-text-override variable-override pull-left' style='margin-top: 34px; cursor: pointer;' data-control='{0}' data-original-value='{1}'></i>", variableKey, variableValue);
                                }
                                else
                                {
                                    textbox.Text = variableValue;
                                }

                                textbox.FormGroupCssClass      = "pull-left";
                                textbox.RequiredFieldValidator = null;

                                Literal beginWrapper = new Literal();
                                beginWrapper.Text = "<div class='clearfix'>";

                                AddControl(beginWrapper, inPanel);
                                AddControl(textbox, inPanel);
                                AddControl(overrideControl, inPanel);

                                Literal endWrapper = new Literal();
                                endWrapper.Text = "</div>";
                                AddControl(endWrapper, inPanel);
                            }

                            break;
                        }
                        }
                    }
                }

                if (inPanel)
                {
                    Literal panelClose = new Literal();
                    panelClose.Text = "</div></div>";
                    AddControl(panelClose, true);
                }

                if (phThemeControls.Controls.Count == 0 && !pnlFontAwesomeSettings.Visible)
                {
                    btnSave.Visible = false;
                    nbMessages.NotificationBoxType = NotificationBoxType.Warning;
                    nbMessages.Text = "This theme does not define any variables for editing.";
                }
            }
        }
示例#37
0
 /// <summary>
 /// Update a color label from his ColorPicker.
 /// </summary>
 private void UpdateColorLabel(Label label, ColorPicker colorPicker)
 {
     label.Clear();
     label.Text = $"{colorPicker.SelectedColor} - {(int)colorPicker.SelectedColor}";
 }
示例#38
0
 public void Change_Label(ColorPicker picker)
 {
     cur_label = picker.label_index;
     cur_color = picker.color;
 }
示例#39
0
 public SurfaceHandler(ColorPicker colorPicker, List <SpinBox> spinBoxes)
 {
     this.colorPicker = colorPicker;
     spinBoxList      = spinBoxes;
 }
示例#40
0
 private void InitializeComponent()
 {
     this.VisibleInLegendCheckBox = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.VisibleCheckBox         = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.EnabledCheckBox         = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.NameTextBox             = new EditBox();
     this.focusLabel1             = new FocusLabel();
     this.CapacityTextBox         = new EditBox();
     this.focusLabel3             = new FocusLabel();
     this.XAxisNameTextBox        = new EditBox();
     this.focusLabel4             = new FocusLabel();
     this.YAxisNameTextBox        = new EditBox();
     this.focusLabel5             = new FocusLabel();
     this.ColorPicker             = new ColorPicker();
     this.label8 = new FocusLabel();
     this.SendXAxisTrackingDataCheckBox = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.SendYAxisTrackingDataCheckBox = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.LegendNameTextBox             = new EditBox();
     this.focusLabel8  = new FocusLabel();
     this.TitleTextBox = new EditMultiLine();
     this.focusLabel2  = new FocusLabel();
     this.ContextMenuEnabledCheckBox = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.LayerNumericUpDown         = new Iocomp.Design.Plugin.EditorControls.NumericUpDown();
     this.label1 = new FocusLabel();
     this.UserCanEditCheckBox        = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.RingBufferCountEditBox     = new EditBox();
     this.focusLabel10               = new FocusLabel();
     this.ClippingStyleComboBox      = new Iocomp.Design.Plugin.EditorControls.ComboBox();
     this.focusLabel7                = new FocusLabel();
     this.CanFocusCheckBox           = new Iocomp.Design.Plugin.EditorControls.CheckBox();
     this.OPCXValueSourceComboBox    = new Iocomp.Design.Plugin.EditorControls.ComboBox();
     this.focusLabel6                = new FocusLabel();
     this.MarkersTurnOffLimitTextBox = new EditBox();
     this.focusLabel11               = new FocusLabel();
     ((ISupportInitialize)this.LayerNumericUpDown).BeginInit();
     base.SuspendLayout();
     this.VisibleInLegendCheckBox.Location     = new Point(368, 3);
     this.VisibleInLegendCheckBox.Name         = "VisibleInLegendCheckBox";
     this.VisibleInLegendCheckBox.PropertyName = "VisibleInLegend";
     this.VisibleInLegendCheckBox.Size         = new Size(112, 24);
     this.VisibleInLegendCheckBox.TabIndex     = 15;
     this.VisibleInLegendCheckBox.Text         = "Visible In Legend";
     this.VisibleCheckBox.Location             = new Point(264, 3);
     this.VisibleCheckBox.Name         = "VisibleCheckBox";
     this.VisibleCheckBox.PropertyName = "Visible";
     this.VisibleCheckBox.Size         = new Size(72, 24);
     this.VisibleCheckBox.TabIndex     = 12;
     this.VisibleCheckBox.Text         = "Visible";
     this.EnabledCheckBox.Location     = new Point(264, 27);
     this.EnabledCheckBox.Name         = "EnabledCheckBox";
     this.EnabledCheckBox.PropertyName = "Enabled";
     this.EnabledCheckBox.Size         = new Size(80, 24);
     this.EnabledCheckBox.TabIndex     = 13;
     this.EnabledCheckBox.Text         = "Enabled";
     this.NameTextBox.LoadingBegin();
     this.NameTextBox.Location     = new Point(96, 8);
     this.NameTextBox.Name         = "NameTextBox";
     this.NameTextBox.PropertyName = "Name";
     this.NameTextBox.Size         = new Size(144, 20);
     this.NameTextBox.TabIndex     = 0;
     this.NameTextBox.LoadingEnd();
     this.focusLabel1.LoadingBegin();
     this.focusLabel1.FocusControl = this.NameTextBox;
     this.focusLabel1.Location     = new Point(59, 10);
     this.focusLabel1.Name         = "focusLabel1";
     this.focusLabel1.Size         = new Size(37, 15);
     this.focusLabel1.Text         = "Name";
     this.focusLabel1.LoadingEnd();
     this.CapacityTextBox.LoadingBegin();
     this.CapacityTextBox.Location     = new Point(96, 100);
     this.CapacityTextBox.Name         = "CapacityTextBox";
     this.CapacityTextBox.PropertyName = "Capacity";
     this.CapacityTextBox.Size         = new Size(144, 20);
     this.CapacityTextBox.TabIndex     = 3;
     this.CapacityTextBox.LoadingEnd();
     this.focusLabel3.LoadingBegin();
     this.focusLabel3.FocusControl = this.CapacityTextBox;
     this.focusLabel3.Location     = new Point(46, 102);
     this.focusLabel3.Name         = "focusLabel3";
     this.focusLabel3.Size         = new Size(50, 15);
     this.focusLabel3.Text         = "Capacity";
     this.focusLabel3.LoadingEnd();
     this.XAxisNameTextBox.LoadingBegin();
     this.XAxisNameTextBox.Location     = new Point(96, 136);
     this.XAxisNameTextBox.Name         = "XAxisNameTextBox";
     this.XAxisNameTextBox.PropertyName = "XAxisName";
     this.XAxisNameTextBox.Size         = new Size(144, 20);
     this.XAxisNameTextBox.TabIndex     = 4;
     this.XAxisNameTextBox.LoadingEnd();
     this.focusLabel4.LoadingBegin();
     this.focusLabel4.FocusControl = this.XAxisNameTextBox;
     this.focusLabel4.Location     = new Point(24, 138);
     this.focusLabel4.Name         = "focusLabel4";
     this.focusLabel4.Size         = new Size(72, 15);
     this.focusLabel4.Text         = "X-Axis Name";
     this.focusLabel4.LoadingEnd();
     this.YAxisNameTextBox.LoadingBegin();
     this.YAxisNameTextBox.Location     = new Point(96, 160);
     this.YAxisNameTextBox.Name         = "YAxisNameTextBox";
     this.YAxisNameTextBox.PropertyName = "YAxisName";
     this.YAxisNameTextBox.Size         = new Size(144, 20);
     this.YAxisNameTextBox.TabIndex     = 6;
     this.YAxisNameTextBox.LoadingEnd();
     this.focusLabel5.LoadingBegin();
     this.focusLabel5.FocusControl = this.YAxisNameTextBox;
     this.focusLabel5.Location     = new Point(24, 162);
     this.focusLabel5.Name         = "focusLabel5";
     this.focusLabel5.Size         = new Size(72, 15);
     this.focusLabel5.Text         = "Y-Axis Name";
     this.focusLabel5.LoadingEnd();
     this.ColorPicker.Location     = new Point(96, 224);
     this.ColorPicker.Name         = "ColorPicker";
     this.ColorPicker.PropertyName = "Color";
     this.ColorPicker.Size         = new Size(48, 21);
     this.ColorPicker.Style        = ColorPickerStyle.ColorBox;
     this.ColorPicker.TabIndex     = 9;
     this.label8.LoadingBegin();
     this.label8.FocusControl = this.ColorPicker;
     this.label8.Location     = new Point(62, 227);
     this.label8.Name         = "label8";
     this.label8.Size         = new Size(34, 15);
     this.label8.Text         = "Color";
     this.label8.LoadingEnd();
     this.SendXAxisTrackingDataCheckBox.Location     = new Point(248, 136);
     this.SendXAxisTrackingDataCheckBox.Name         = "SendXAxisTrackingDataCheckBox";
     this.SendXAxisTrackingDataCheckBox.PropertyName = "SendXAxisTrackingData";
     this.SendXAxisTrackingDataCheckBox.Size         = new Size(160, 24);
     this.SendXAxisTrackingDataCheckBox.TabIndex     = 5;
     this.SendXAxisTrackingDataCheckBox.Text         = "Send X-Axis Tracking Data";
     this.SendYAxisTrackingDataCheckBox.Location     = new Point(248, 160);
     this.SendYAxisTrackingDataCheckBox.Name         = "SendYAxisTrackingDataCheckBox";
     this.SendYAxisTrackingDataCheckBox.PropertyName = "SendYAxisTrackingData";
     this.SendYAxisTrackingDataCheckBox.Size         = new Size(160, 24);
     this.SendYAxisTrackingDataCheckBox.TabIndex     = 7;
     this.SendYAxisTrackingDataCheckBox.Text         = "Send Y-Axis Tracking Data";
     this.LegendNameTextBox.LoadingBegin();
     this.LegendNameTextBox.Location     = new Point(96, 192);
     this.LegendNameTextBox.Name         = "LegendNameTextBox";
     this.LegendNameTextBox.PropertyName = "LegendName";
     this.LegendNameTextBox.Size         = new Size(144, 20);
     this.LegendNameTextBox.TabIndex     = 8;
     this.LegendNameTextBox.LoadingEnd();
     this.focusLabel8.LoadingBegin();
     this.focusLabel8.FocusControl = this.LegendNameTextBox;
     this.focusLabel8.Location     = new Point(20, 194);
     this.focusLabel8.Name         = "focusLabel8";
     this.focusLabel8.Size         = new Size(76, 15);
     this.focusLabel8.Text         = "Legend Name";
     this.focusLabel8.LoadingEnd();
     this.TitleTextBox.EditFont     = null;
     this.TitleTextBox.Location     = new Point(96, 40);
     this.TitleTextBox.Name         = "TitleTextBox";
     this.TitleTextBox.PropertyName = "TitleText";
     this.TitleTextBox.Size         = new Size(144, 20);
     this.TitleTextBox.TabIndex     = 1;
     this.focusLabel2.LoadingBegin();
     this.focusLabel2.FocusControl = this.TitleTextBox;
     this.focusLabel2.Location     = new Point(43, 43);
     this.focusLabel2.Name         = "focusLabel2";
     this.focusLabel2.Size         = new Size(53, 15);
     this.focusLabel2.Text         = "Title Text";
     this.focusLabel2.LoadingEnd();
     this.ContextMenuEnabledCheckBox.Location     = new Point(368, 27);
     this.ContextMenuEnabledCheckBox.Name         = "ContextMenuEnabledCheckBox";
     this.ContextMenuEnabledCheckBox.PropertyName = "ContextMenuEnabled";
     this.ContextMenuEnabledCheckBox.Size         = new Size(144, 24);
     this.ContextMenuEnabledCheckBox.TabIndex     = 16;
     this.ContextMenuEnabledCheckBox.Text         = "Context Menu Enabled";
     this.LayerNumericUpDown.Location             = new Point(184, 224);
     this.LayerNumericUpDown.Maximum = new decimal(new int[4]
     {
         10000,
         0,
         0,
         0
     });
     this.LayerNumericUpDown.Minimum = new decimal(new int[4]
     {
         10000,
         0,
         0,
         -2147483648
     });
     this.LayerNumericUpDown.Name         = "LayerNumericUpDown";
     this.LayerNumericUpDown.PropertyName = "Layer";
     this.LayerNumericUpDown.Size         = new Size(56, 20);
     this.LayerNumericUpDown.TabIndex     = 10;
     this.LayerNumericUpDown.TextAlign    = HorizontalAlignment.Center;
     this.label1.LoadingBegin();
     this.label1.FocusControl = this.LayerNumericUpDown;
     this.label1.Location     = new Point(149, 225);
     this.label1.Name         = "label1";
     this.label1.Size         = new Size(35, 15);
     this.label1.Text         = "Layer";
     this.label1.LoadingEnd();
     this.UserCanEditCheckBox.Location     = new Point(264, 51);
     this.UserCanEditCheckBox.Name         = "UserCanEditCheckBox";
     this.UserCanEditCheckBox.PropertyName = "UserCanEdit";
     this.UserCanEditCheckBox.Size         = new Size(96, 24);
     this.UserCanEditCheckBox.TabIndex     = 14;
     this.UserCanEditCheckBox.Text         = "User Can Edit";
     this.RingBufferCountEditBox.LoadingBegin();
     this.RingBufferCountEditBox.Location     = new Point(96, 76);
     this.RingBufferCountEditBox.Name         = "RingBufferCountEditBox";
     this.RingBufferCountEditBox.PropertyName = "RingBufferCount";
     this.RingBufferCountEditBox.Size         = new Size(144, 20);
     this.RingBufferCountEditBox.TabIndex     = 2;
     this.RingBufferCountEditBox.LoadingEnd();
     this.focusLabel10.LoadingBegin();
     this.focusLabel10.FocusControl = this.RingBufferCountEditBox;
     this.focusLabel10.Location     = new Point(1, 78);
     this.focusLabel10.Name         = "focusLabel10";
     this.focusLabel10.Size         = new Size(95, 15);
     this.focusLabel10.Text         = "Ring Buffer Count";
     this.focusLabel10.LoadingEnd();
     this.ClippingStyleComboBox.DropDownStyle    = ComboBoxStyle.DropDownList;
     this.ClippingStyleComboBox.Location         = new Point(328, 224);
     this.ClippingStyleComboBox.MaxDropDownItems = 20;
     this.ClippingStyleComboBox.Name             = "ClippingStyleComboBox";
     this.ClippingStyleComboBox.PropertyName     = "ClippingStyle";
     this.ClippingStyleComboBox.Size             = new Size(80, 21);
     this.ClippingStyleComboBox.TabIndex         = 11;
     this.focusLabel7.LoadingBegin();
     this.focusLabel7.FocusControl = this.ClippingStyleComboBox;
     this.focusLabel7.Location     = new Point(253, 226);
     this.focusLabel7.Name         = "focusLabel7";
     this.focusLabel7.Size         = new Size(75, 15);
     this.focusLabel7.Text         = "Clipping Style";
     this.focusLabel7.LoadingEnd();
     this.CanFocusCheckBox.Location                = new Point(368, 51);
     this.CanFocusCheckBox.Name                    = "CanFocusCheckBox";
     this.CanFocusCheckBox.PropertyName            = "CanFocus";
     this.CanFocusCheckBox.Size                    = new Size(144, 24);
     this.CanFocusCheckBox.TabIndex                = 17;
     this.CanFocusCheckBox.Text                    = "Can Focus";
     this.OPCXValueSourceComboBox.DropDownStyle    = ComboBoxStyle.DropDownList;
     this.OPCXValueSourceComboBox.Location         = new Point(368, 100);
     this.OPCXValueSourceComboBox.MaxDropDownItems = 20;
     this.OPCXValueSourceComboBox.Name             = "OPCXValueSourceComboBox";
     this.OPCXValueSourceComboBox.PropertyName     = "OPCXValueSource";
     this.OPCXValueSourceComboBox.Size             = new Size(136, 21);
     this.OPCXValueSourceComboBox.TabIndex         = 31;
     this.focusLabel6.LoadingBegin();
     this.focusLabel6.FocusControl = this.OPCXValueSourceComboBox;
     this.focusLabel6.Location     = new Point(258, 102);
     this.focusLabel6.Name         = "focusLabel6";
     this.focusLabel6.Size         = new Size(110, 15);
     this.focusLabel6.Text         = "OPC X-Value Source";
     this.focusLabel6.LoadingEnd();
     this.MarkersTurnOffLimitTextBox.LoadingBegin();
     this.MarkersTurnOffLimitTextBox.Location     = new Point(544, 224);
     this.MarkersTurnOffLimitTextBox.Name         = "MarkersTurnOffLimitTextBox";
     this.MarkersTurnOffLimitTextBox.PropertyName = "MarkersTurnOffLimit";
     this.MarkersTurnOffLimitTextBox.Size         = new Size(64, 20);
     this.MarkersTurnOffLimitTextBox.TabIndex     = 44;
     this.MarkersTurnOffLimitTextBox.LoadingEnd();
     this.focusLabel11.LoadingBegin();
     this.focusLabel11.FocusControl = this.MarkersTurnOffLimitTextBox;
     this.focusLabel11.Location     = new Point(428, 226);
     this.focusLabel11.Name         = "focusLabel11";
     this.focusLabel11.Size         = new Size(116, 15);
     this.focusLabel11.Text         = "Markers Turn-Off Limit";
     this.focusLabel11.LoadingEnd();
     base.Controls.Add(this.MarkersTurnOffLimitTextBox);
     base.Controls.Add(this.focusLabel11);
     base.Controls.Add(this.OPCXValueSourceComboBox);
     base.Controls.Add(this.focusLabel6);
     base.Controls.Add(this.CanFocusCheckBox);
     base.Controls.Add(this.ClippingStyleComboBox);
     base.Controls.Add(this.focusLabel7);
     base.Controls.Add(this.RingBufferCountEditBox);
     base.Controls.Add(this.focusLabel10);
     base.Controls.Add(this.UserCanEditCheckBox);
     base.Controls.Add(this.LayerNumericUpDown);
     base.Controls.Add(this.label1);
     base.Controls.Add(this.ContextMenuEnabledCheckBox);
     base.Controls.Add(this.TitleTextBox);
     base.Controls.Add(this.focusLabel2);
     base.Controls.Add(this.LegendNameTextBox);
     base.Controls.Add(this.focusLabel8);
     base.Controls.Add(this.SendYAxisTrackingDataCheckBox);
     base.Controls.Add(this.SendXAxisTrackingDataCheckBox);
     base.Controls.Add(this.ColorPicker);
     base.Controls.Add(this.label8);
     base.Controls.Add(this.YAxisNameTextBox);
     base.Controls.Add(this.focusLabel5);
     base.Controls.Add(this.XAxisNameTextBox);
     base.Controls.Add(this.focusLabel4);
     base.Controls.Add(this.CapacityTextBox);
     base.Controls.Add(this.focusLabel3);
     base.Controls.Add(this.NameTextBox);
     base.Controls.Add(this.focusLabel1);
     base.Controls.Add(this.VisibleInLegendCheckBox);
     base.Controls.Add(this.VisibleCheckBox);
     base.Controls.Add(this.EnabledCheckBox);
     base.Location = new Point(10, 20);
     base.Name     = "PlotChannelDigitalEditorPlugIn";
     base.Size     = new Size(664, 272);
     ((ISupportInitialize)this.LayerNumericUpDown).EndInit();
     base.ResumeLayout(false);
 }
示例#41
0
        // edits the selected color in the 'edit' control
        private void editSelectedPoints()
        {
            if (edit.Gradient == null || edit.FocusSelection)
            {
                return;
            }

            if (DiscreteColors)
            {
                List <Color> selectedColors = new List <Color>();
                foreach (ColorGradient.Point point in edit.Selection)
                {
                    ColorPoint pt = point as ColorPoint;
                    if (pt == null)
                    {
                        continue;
                    }
                    selectedColors.Add(pt.Color.ToRGB().ToArgb());
                }

                using (DiscreteColorPicker picker = new DiscreteColorPicker()) {
                    picker.ValidColors    = ValidDiscreteColors;
                    picker.SelectedColors = selectedColors;
                    if (picker.ShowDialog() == DialogResult.OK)
                    {
                        if (picker.SelectedColors.Count() == 0)
                        {
                            DeleteColor();
                        }
                        //else if (picker.SelectedColors.Count() == selectedColors.Count) {
                        //	int i = 0;
                        //	foreach (Color selectedColor in picker.SelectedColors) {
                        //		ColorPoint pt = edit.Selection[i] as ColorPoint;
                        //		pt.Color = XYZ.FromRGB(selectedColor);
                        //	}
                        //}
                        else
                        {
                            double position = edit.Selection.First().Position;

                            foreach (ColorGradient.Point point in edit.Selection)
                            {
                                edit.Gradient.Colors.Remove(point as ColorPoint);
                            }

                            foreach (Color selectedColor in picker.SelectedColors)
                            {
                                ColorPoint newPoint = new ColorPoint(selectedColor, position);
                                edit.Gradient.Colors.Add(newPoint);
                            }
                        }
                    }
                }
            }
            else
            {
                if (edit.Selection.Count > 1)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error;                     //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Non-discrete color gradient, >1 selected point. oops! please report it.", "Delete library gradient?", false, false);
                    messageBox.ShowDialog();
                }
                ColorPoint pt = edit.Selection.FirstOrDefault() as ColorPoint;
                if (pt == null)
                {
                    return;
                }
                using (ColorPicker frm = new ColorPicker(_mode, _fader)) {
                    frm.LockValue_V = LockColorEditorHSV_Value;
                    frm.Color       = _xyz;
                    if (frm.ShowDialog(this.FindForm()) == DialogResult.OK)
                    {
                        pt.Color             = _xyz = frm.Color;
                        lblColorSelect.Color = _xyz.ToRGB().ToArgb();
                        _mode  = frm.SecondaryMode;
                        _fader = frm.PrimaryFader;
                    }
                }
            }
        }
示例#42
0
        /// <summary>
        /// Populates the settings panel with the settings of a given plugin.
        /// </summary>
        /// <param name="plugin">The plugin whose settings to display</param>
        private void PopulateSettings(Plugin plugin)
        {
            SettingsGrid.RowDefinitions.Clear();
            SettingsGrid.Children.Clear();

            for (int i = 0; i < plugin.Settings.Count; i++)
            {
                Setting s = plugin.Settings[i];

                // add row
                SettingsGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });

                // create label
                TextBlock tb = new TextBlock()
                {
                    Text              = plugin.T(s.ID),
                    Margin            = new Thickness(5, 5, 10, 5),
                    VerticalAlignment = VerticalAlignment.Center
                };

                tb.SetBinding(TextBlock.VisibilityProperty, new Binding("IsVisible")
                {
                    Source    = s,
                    Mode      = BindingMode.OneWay,
                    Converter = new BooleanToVisibilityConverter()
                });

                Grid.SetRow(tb, i);
                Grid.SetColumn(tb, 0);
                SettingsGrid.Children.Add(tb);

                FrameworkElement control = null;

                // create control
                if (s.Type == typeof(Boolean))
                {
                    // checkbox
                    control = new CheckBox()
                    {
                        Height = 15
                    };
                    control.SetBinding(CheckBox.IsCheckedProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode   = BindingMode.TwoWay
                    });
                }
                else if (s.Type == typeof(Color))
                {
                    // color selector
                    control = new ColorPicker()
                    {
                        ShowAvailableColors = false,
                        ShowStandardColors  = true,
                        Width = 50,
                    };
                    if (s.PossibleValues != null)
                    {
                        ColorConverter converter = new ColorConverter();
                        ((ColorPicker)control).AvailableColors.Clear();
                        foreach (Color c in s.PossibleValues)
                        {
                            System.Windows.Media.Color color = (System.Windows.Media.Color)converter.Convert(c, null, null, null);
                            ((ColorPicker)control).AvailableColors.Add(new ColorItem(color, c.Name));
                        }
                    }
                    control.SetBinding(ColorPicker.SelectedColorProperty, new Binding("Value")
                    {
                        Source    = s,
                        Mode      = BindingMode.TwoWay,
                        Converter = new ColorConverter()
                    });
                }
                else if (s.PossibleValues != null)
                {
                    // dropdown
                    control = new ComboBox();
                    foreach (Object val in s.PossibleValues)
                    {
                        try
                        {
                            String content = val.ToString();
                            if (s.Type == typeof(String))
                            {
                                content = plugin.T(val.ToString());
                            }
                            ((ComboBox)control).Items.Add(new ComboBoxItem
                            {
                                Content = content,
                                Name    = val.ToString()
                            });
                        }
                        catch (Exception exc)
                        {
                            U.L(LogLevel.Warning, "PLUGIN", "Could not add combobox item in plugin settings: " + exc.Message);
                        }
                    }
                    ((ComboBox)control).SelectedValuePath = "Name";
                    control.SetBinding(ComboBox.SelectedValueProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode   = BindingMode.TwoWay
                    });
                }
                else if (s.Type == typeof(String))
                {
                    // text input
                    control = new TextBox()
                    {
                        MaxWidth = 400,
                        MinWidth = 250
                    };
                    control.SetBinding(TextBox.TextProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode   = BindingMode.TwoWay
                    });
                }
                else if (s.Type == typeof(Int32))
                {
                    if (s.Maximum != null)
                    {
                        // slider
                        control = new Slider()
                        {
                            Maximum = (Int32)s.Maximum,
                            AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                            Width = 200,
                        };
                        if (s.Minimum != null)
                        {
                            ((Slider)control).Minimum = (Int32)s.Minimum;
                        }
                        control.SetBinding(Slider.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode   = BindingMode.TwoWay
                        });
                    }
                    else
                    {
                        // spinner
                        control = new IntegerUpDown();
                        control.SetBinding(IntegerUpDown.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode   = BindingMode.TwoWay
                        });
                    }
                }
                else if (s.Type == typeof(Double))
                {
                    if (s.Maximum != null)
                    {
                        // slider
                        control = new Slider()
                        {
                            Maximum = (Double)s.Maximum,
                            AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                            Width = 200,
                        };
                        if (s.Minimum != null)
                        {
                            ((Slider)control).Minimum = (Double)s.Minimum;
                        }
                        control.SetBinding(Slider.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode   = BindingMode.TwoWay
                        });
                    }
                    else
                    {
                        // spinner
                        control = new DoubleUpDown();
                        control.SetBinding(DoubleUpDown.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode   = BindingMode.TwoWay
                        });
                    }
                }

                if (control != null)
                {
                    control.Margin              = new Thickness(0, 5, 0, 5);
                    control.VerticalAlignment   = VerticalAlignment.Center;
                    control.HorizontalAlignment = HorizontalAlignment.Left;

                    control.SetBinding(FrameworkElement.VisibilityProperty, new Binding("IsVisible")
                    {
                        Source    = s,
                        Mode      = BindingMode.OneWay,
                        Converter = new BooleanToVisibilityConverter()
                    });

                    Grid.SetRow(control, i);
                    Grid.SetColumn(control, 1);
                    SettingsGrid.Children.Add(control);
                }
            }
        }
示例#43
0
        static public void TrySetElementValue(UIElement u, object o)
        {
            try
            {
                switch (u.GetType().ToString())
                {
                case "System.Windows.Controls.Slider":
                    Slider s = u as Slider;
                    //System.Windows.Forms.MessageBox.Show(o.GetType().ToString());

                    s.Value = (double)o;
                    return;

                case "System.Windows.Controls.ListBox":
                    ListBox lb = u as ListBox;
                    lb.SelectedIndex = getSelectedItemIndex(lb, (string)o);
                    return;

                case "System.Windows.Controls.TextBox":
                    TextBox tb = u as TextBox;
                    tb.Text = (string)o;
                    return;

                case "System.Windows.Controls.ComboBox":
                    ComboBox cb = u as ComboBox;
                    cb.SelectedIndex = getSelectedItemIndex(cb, (string)o);
                    return;

                case "Xceed.Wpf.Toolkit.ColorPicker":
                    ColorPicker          colP   = u as ColorPicker;
                    System.Drawing.Color sysCol = (System.Drawing.Color)o;
                    colP.SelectedColor = HUI_Util.ToMediaColor(sysCol);
                    return;

                case "System.Windows.Controls.ScrollViewer":
                    //it's a checklist
                    ScrollViewer sv        = u as ScrollViewer;
                    List <bool>  valueList = (List <bool>)o;
                    ItemsControl ic        = sv.Content as ItemsControl;
                    var          cbs       = from cbx in ic.Items.OfType <CheckBox>() select cbx;
                    int          i         = 0;
                    foreach (CheckBox chex in cbs)
                    {
                        chex.IsChecked = valueList[i];
                        i++;
                    }

                    return;

                case "System.Windows.Controls.CheckBox":
                    CheckBox chb = u as CheckBox;
                    chb.IsChecked = (bool)o;
                    return;

                case "MahApps.Metro.Controls.ToggleSwitch":
                    ToggleSwitch ts = u as ToggleSwitch;
                    ts.IsChecked = (bool)o;
                    return;

                case "MahApps.Metro.Controls.RangeSlider":
                    RangeSlider rs         = u as RangeSlider;
                    var         valueRange = (Interval)o;
                    rs.UpperValue = valueRange.Max;
                    rs.LowerValue = valueRange.Min;
                    return;

                case "System.Windows.Controls.RadioButton":
                    RadioButton rb = u as RadioButton;
                    rb.IsChecked = (bool)o;
                    return;

                case "System.Windows.Controls.DataGrid":
                    DataGrid      datagrid            = u as DataGrid;
                    List <string> selectedRowContents = (List <string>)o;
                    try
                    {
                        DataView dv = datagrid.ItemsSource as DataView;
                        foreach (DataRowView drv in dv)
                        {
                            var items = drv.Row.ItemArray.Cast <string>().ToList();
                            items.RemoveAt(0);     //get rid of hidden index column
                            bool selectRow = true;
                            for (int counter = 0; counter < items.Count; counter++)
                            {
                                if (selectedRowContents[counter] != items[counter])
                                {
                                    selectRow = false;
                                    break;
                                }
                            }
                            if (selectRow)
                            {
                                datagrid.SelectedItem = drv;
                            }
                        }
                    }
                    catch
                    {
                    }
                    return;

                case "HumanUI.MDSliderElement":
                    MDSliderElement mds = u as MDSliderElement;
                    mds.SliderPoint = (Rhino.Geometry.Point3d)o;
                    return;

                case "HumanUI.GraphMapperElement":
                    GraphMapperElement gme = u as GraphMapperElement;

                    gme.SetByCurve((Rhino.Geometry.NurbsCurve)o);
                    return;

                case "HumanUI.HUI_GradientEditor":
                    HUI_GradientEditor hge      = u as HUI_GradientEditor;
                    HUI_Gradient       gradient = HUI_Gradient.FromString((string)o);
                    hge.Gradient = gradient;
                    return;

                case "HumanUI.FilePicker":
                    FilePicker fp = u as FilePicker;
                    fp.Path = (string)o;
                    return;

                default:
                    return;
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
            }
        }
示例#44
0
        public BaseButtonSection()
        {
            Styles.Add <Label>(null, l => l.VerticalAlignment = VerticalAlignment.Center);

            Image image      = TestIcons.TestIcon.WithSize(16, 16);
            Image plainImage = CreatePlainImage();
            Image largeImage = TestIcons.TestIcon.WithSize(100, 100);

            DefaultSpacing = new Size(2, 2);

            var button = new T();

            button.Text  = DefaultText;
            button.Image = image;
            Control      = button;

            var originalMinimumSize = button.MinimumSize;

            LogEvents(button);

            var textBox = new TextBox();

            textBox.TextBinding.Bind(button, b => b.Text);

            var enabledCheck = new CheckBox {
                Text = "Enabled"
            };

            enabledCheck.CheckedBinding.Bind(button, b => b.Enabled);

            var visibleCheck = new CheckBox {
                Text = "Visible"
            };

            visibleCheck.CheckedBinding.Bind(button, b => b.Visible);

            var withTextCheck = new CheckBox {
                Text = "With Text"
            };

            withTextCheck.CheckedBinding
            .Convert(r => r == true ? textBox.Text : null, s => !string.IsNullOrEmpty(s))
            .Bind(button, c => c.Text);
            withTextCheck.CheckedBinding.Bind(textBox, b => b.Enabled);

            var withImageSelection = new RadioButtonList {
                Items = { "Image", "Large Image", "Plain Image", "No Image" }
            };

            withImageSelection.SelectedIndexBinding
            .Convert(
                i => i == 0 ? image : i == 1 ? largeImage : i == 2 ? plainImage : null,
                img => img == image ? 0 : img == largeImage ? 1 : img == plainImage ? 2 : 3
                )
            .Bind(button, c => c.Image);

            var performClick = new Button {
                Text = "PerformClick"
            };

            performClick.Click += (sender, e) => button.PerformClick();

            var minimumSizeEntry = new SizeEntry();

            minimumSizeEntry.ValueBinding.Bind(button, b => b.MinimumSize);

            var clearMinimumSize = new CheckBox {
                Text = "Clear MinimumSize"
            };

            clearMinimumSize.CheckedBinding
            .Convert(ischecked => ischecked == true ? Size.Empty : originalMinimumSize, size => size.IsEmpty)
            .Bind(button, c => c.MinimumSize);
            clearMinimumSize.CheckedBinding.Inverse().Bind(minimumSizeEntry, m => m.Enabled);

            var sizeEntry = new SizeEntry();

            sizeEntry.ValueBinding.Bind(button, b => b.Size, DualBindingMode.OneWayToSource);

            var imagePositionDropDown = new EnumDropDown <ButtonImagePosition>();

            imagePositionDropDown.SelectedValueBinding.Bind(button, c => c.ImagePosition);

            var backgroundColorPicker = new ColorPicker {
                AllowAlpha = true
            };

            backgroundColorPicker.ValueBinding.Bind(button, b => b.BackgroundColor);

            var textColorPicker = new ColorPicker {
                AllowAlpha = true
            };

            textColorPicker.ValueBinding.Bind(button, b => b.TextColor);

            BeginVertical(padding: 10);
            AddSeparateRow(null, enabledCheck, visibleCheck, null);
            AddSeparateRow(null, "With:", withImageSelection, imagePositionDropDown, null);
            AddSeparateRow(null, withTextCheck, textBox, null);
            AddSeparateRow(null, clearMinimumSize, minimumSizeEntry, null);
            AddSeparateRow(null, "Size:", sizeEntry, null);
            AddSeparateRow(null, "BackgroundColor", backgroundColorPicker, "TextColor", textColorPicker, null);
            AddSeparateRow(null, performClick, null);
            AddAdditionalOptions();
            EndVertical();

            AddAutoSized(button, centered: true);
        }
示例#45
0
 public Adapter(ColorPicker control)
 {
     this.control = control;
 }
示例#46
0
        static public object GetElementValue(UIElement u)
        {
            switch (u.GetType().ToString())
            {
            case "System.Windows.Controls.Slider":
                Slider s = u as Slider;
                return(s.Value);

            case "System.Windows.Controls.Button":
                Button b = u as Button;
                return((System.Windows.Input.Mouse.LeftButton == System.Windows.Input.MouseButtonState.Pressed) && b.IsMouseOver);

            case "HumanUI.TrueOnlyButton":
                TrueOnlyButton tob = u as TrueOnlyButton;
                return((System.Windows.Input.Mouse.LeftButton == System.Windows.Input.MouseButtonState.Pressed) && tob.IsMouseOver);

            case "HumanUI.HUI_RhPickButton":
                HUI_RhPickButton rpb = u as HUI_RhPickButton;
                return(rpb.objIDs);

            case "System.Windows.Controls.Label":
                Label l = u as Label;
                return(l.Content);

            case "System.Windows.Controls.ListBox":
                ListBox   lb  = u as ListBox;
                TextBlock lab = lb.SelectedItem as TextBlock;
                if (lab != null)
                {
                    return(lab.Text);
                }
                else
                {
                    return(null);
                }

            case "System.Windows.Controls.ScrollViewer":
                ScrollViewer sv       = u as ScrollViewer;
                ItemsControl ic       = sv.Content as ItemsControl;
                List <bool>  checkeds = new List <bool>();
                var          cbs      = from cbx in ic.Items.OfType <CheckBox>() select cbx;
                foreach (CheckBox chex in cbs)
                {
                    checkeds.Add(chex.IsChecked == true);
                }


                return(checkeds);

            case "System.Windows.Controls.TextBox":
                TextBox tb = u as TextBox;
                return(tb.Text);

            case "System.Windows.Controls.ComboBox":
                ComboBox  cb  = u as ComboBox;
                TextBlock cbi = cb.SelectedItem as TextBlock;
                if (cbi != null)
                {
                    return(cbi.Text);
                }
                else
                {
                    return(null);
                }

            case "Xceed.Wpf.Toolkit.ColorPicker":
                ColorPicker colP = u as ColorPicker;

                //return cbi.Content;
                return(HUI_Util.ToSysColor(colP.SelectedColor));

            case "System.Windows.Controls.ListView":
                ListView      v           = u as ListView;
                var           cbxs        = from cbx in v.Items.OfType <CheckBox>() select cbx;
                List <string> checkedVals = new List <string>();
                foreach (CheckBox chex in cbxs)
                {
                    if (chex.IsChecked == true)
                    {
                        checkedVals.Add(chex.Content.ToString());
                    }
                }

                return(String.Join(",", checkedVals));

            case "System.Windows.Controls.CheckBox":
                CheckBox chb = u as CheckBox;
                return(chb.IsChecked);

            case "System.Windows.Controls.RadioButton":
                RadioButton rb = u as RadioButton;
                return(rb.IsChecked);

            case "System.Windows.Controls.Image":
                Image img = u as Image;

                return(img.Source.ToString());

            case "System.Windows.Controls.Expander":
                Expander exp = u as Expander;
                return(exp.IsExpanded);

            case "System.Windows.Controls.TabControl":
                TabControl tc = u as TabControl;
                TabItem    ti = tc.SelectedItem as TabItem;
                if (ti == null)
                {
                    ti = tc.Items[0] as TabItem;
                }
                return(ti.Header.ToString());

            case "MahApps.Metro.Controls.ToggleSwitch":
                ToggleSwitch ts = u as ToggleSwitch;

                return(ts.IsChecked);

            case "MahApps.Metro.Controls.RangeSlider":
                RangeSlider rs = u as RangeSlider;

                return(new Interval(rs.LowerValue, rs.UpperValue));

            case "De.TorstenMandelkow.MetroChart.ChartBase":
            case "De.TorstenMandelkow.MetroChart.PieChart":
            case "De.TorstenMandelkow.MetroChart.ClusteredBarChart":
            case "De.TorstenMandelkow.MetroChart.ClusteredColumnChart":
            case "De.TorstenMandelkow.MetroChart.DoughnutChart":
            case "De.TorstenMandelkow.MetroChart.RadialGaugeChart":
            case "De.TorstenMandelkow.MetroChart.StackedBarChart":
            case "De.TorstenMandelkow.MetroChart.StackedColumnChart":
                ChartBase chart        = u as ChartBase;
                ChartItem selectedItem = chart.SelectedItem as ChartItem;

                if (selectedItem != null)
                {
                    string response = "";
                    if (!String.IsNullOrEmpty(selectedItem.ClusterCategory))
                    {
                        response += selectedItem.ClusterCategory + ": ";
                    }
                    response += selectedItem.Category;
                    return(response);
                }
                else
                {
                    return(null);
                }

            case "System.Windows.Controls.DataGrid":
                DataGrid datagrid     = u as DataGrid;
                var      SelectedItem = datagrid.SelectedItem;
                //System.Data.DataView dv = datagrid.ItemsSource as System.Data.DataView;
                List <string> result = new List <string>();
                try
                {
                    System.Data.DataRowView drv = SelectedItem as System.Data.DataRowView;
                    result = drv.Row.ItemArray.Cast <string>().ToList();
                    result.RemoveAt(0);
                }
                catch
                {
                }

                return(result);

            case "HumanUI.MDSliderElement":
                MDSliderElement mds = u as MDSliderElement;

                return(mds.SliderPoint);

            case "HumanUI.GraphMapperElement":
                GraphMapperElement gme = u as GraphMapperElement;
                return(gme.GetCurve().ToNurbsCurve());

            case "HumanUI.HUI_GradientEditor":
                HUI_GradientEditor hge = u as HUI_GradientEditor;
                return(hge.Gradient.ToString());

            case "HumanUI.FilePicker":
                FilePicker fp = u as FilePicker;
                return(fp.Path);

            case "HumanUI.ClickableShapeGrid":
                ClickableShapeGrid csg = u as ClickableShapeGrid;
                return(csg.SelectedStates);

            case "System.Windows.Controls.WebBrowser":
                WebBrowser wb = u as WebBrowser;
                return(wb.Source?.AbsoluteUri);

            default:
                return(null);
            }
        }
 private void AccentColorPicker_OnColorChanged(ColorPicker sender, ColorChangedEventArgs args)
 {
     ThemeSettingsService.AppAccentColor = args.NewColor;
 }
示例#48
0
        private void OnClick_Save(object sender, RoutedEventArgs e)
        {
            // There is a new filter to save
            if (newRule != null)
            {
                if (newRule.HexaCode == null && newRule.BadgeEventID_BadgeEvent == 0)
                {
                    return;
                }
                if (newRule.TargetID_Target == 0)
                {
                    return;
                }
                RuleSet newR = ruleVM.SaveNewRule(newRule);

                // remove events for the added filter
                stopProcessSelectionChanged.Add(RULE_TARGET_FIELDLIST_NAME + lastRowNumber, true);
                stopProcessSelectionChanged.Add(RULE_BADGEEVENT_FIELDLIST_NAME + lastRowNumber, true);
                stopProcessSelectionChanged.Add(RULE_COLORPICKER_NAME + lastRowNumber, true);

                newRule = null;
                AddRuleButton.IsEnabled = true;

                Button deleteButton = FindName(RULE_DELETE_RULE_NAME + lastRowNumber) as Button;
                deleteButton.IsEnabled = true;

                TextBox ruleId = new TextBox();
                ruleId.Name = RULE_ID + lastRowNumber;
                ruleId.Text = newR.ID_Rule.ToString();
                ruleId.SetValue(Grid.ColumnProperty, 0);
                ruleId.SetValue(Grid.RowProperty, lastRowNumber);
                ruleId.Visibility = Visibility.Hidden;
                RegisterName(RULE_ID + lastRowNumber, ruleId);
                this.RulesGrid.Children.Add(ruleId);
            }

            // Update the existing filters
            int id_rule_name = 2;

            foreach (RuleSet item in ruleVM.Rules)
            {
                if (deletedRules.Contains(id_rule_name))
                {
                    id_rule_name += 1;
                    continue;
                }
                ;

                ComboBox targets             = FindName(RULE_TARGET_FIELDLIST_NAME + id_rule_name) as ComboBox;
                int      current_target_id   = (targets.SelectedValue as TargetSet).ID_Target;
                ComboBox templates           = FindName(RULE_BADGEEVENT_FIELDLIST_NAME + id_rule_name) as ComboBox;
                int      current_template_id = 0;
                string   current_hexa_code   = null;
                if ((templates.SelectedValue as BadgeEventSet) != null)
                {
                    current_template_id = (templates.SelectedValue as BadgeEventSet).ID_BadgeEvent;
                }
                ColorPicker picker = FindName(RULE_COLORPICKER_NAME + id_rule_name) as ColorPicker;
                if ((picker.SelectedColor) != null)
                {
                    current_hexa_code = picker.SelectedColor.Value.ToString();
                }

                item.TargetID_Target         = current_target_id;
                item.BadgeEventID_BadgeEvent = current_template_id;
                item.HexaCode = current_hexa_code;
                id_rule_name += 1;
            }
            ruleVM.UpdateAllRules();
        }
示例#49
0
 public ColorAssert(ColorPicker colorPicker) : base(colorPicker)
 {
     ColorPicker = colorPicker;
 }
示例#50
0
        /// <summary>
        /// Create and display the given rule row in UI
        /// </summary>
        private void AddNewRuleRow(RuleSet rule)
        {
            lastRowNumber += 1;

            RowDefinition rowDefinition = new RowDefinition();

            rowDefinition.Height = new GridLength(80);
            this.RulesGrid.RowDefinitions.Add(rowDefinition);

            TextBox ruleId = new TextBox();

            ruleId.Name = RULE_ID + lastRowNumber;
            ruleId.Text = rule.ID_Rule.ToString();
            ruleId.SetValue(Grid.ColumnProperty, 0);
            ruleId.SetValue(Grid.RowProperty, lastRowNumber);
            ruleId.Visibility = Visibility.Hidden;
            RegisterName(RULE_ID + lastRowNumber, ruleId);
            this.RulesGrid.Children.Add(ruleId);

            ComboBox targetsList = new ComboBox();

            targetsList.Name              = RULE_TARGET_FIELDLIST_NAME + lastRowNumber;
            targetsList.ItemsSource       = ruleVM.Targets;
            targetsList.DisplayMemberPath = "Name";
            targetsList.SetValue(Grid.ColumnProperty, 1);
            targetsList.SetValue(Grid.RowProperty, lastRowNumber);
            targetsList.VerticalAlignment = VerticalAlignment.Top;
            targetsList.FontSize          = 16;
            targetsList.SelectedValue     = ruleVM.Targets.LastOrDefault(t => t.ID_Target == rule.TargetID_Target);
            targetsList.SelectionChanged += new SelectionChangedEventHandler(
                (sender, e) => {
                int targetId     = (targetsList.SelectedValue as TargetSet).ID_Target;
                ComboBox clicked = e.Source as ComboBox;
                int position     = Convert.ToInt32(clicked.Name.Substring(RULE_TARGET_FIELDLIST_NAME.Length));
                SwitchAssociatedField(targetId, position);
            }
                );
            targetsList.HorizontalContentAlignment = HorizontalAlignment.Center;
            RegisterName(RULE_TARGET_FIELDLIST_NAME + lastRowNumber, targetsList);
            this.RulesGrid.Children.Add(targetsList);

            ComboBox templatesList = new ComboBox();

            templatesList.Name              = RULE_BADGEEVENT_FIELDLIST_NAME + lastRowNumber;
            templatesList.ItemsSource       = ruleVM.BadgeEvents;
            templatesList.DisplayMemberPath = "Name";
            templatesList.SetValue(Grid.ColumnProperty, 2);
            templatesList.SetValue(Grid.RowProperty, lastRowNumber);
            templatesList.VerticalAlignment          = VerticalAlignment.Top;
            templatesList.FontSize                   = 16;
            templatesList.HorizontalContentAlignment = HorizontalAlignment.Center;
            //if (rule.BadgeEventID_BadgeEvent == 0) templatesList.Visibility = Visibility.Hidden;
            if (rule.BadgeEventID_BadgeEvent == 0)
            {
                templatesList.IsEnabled = false;
            }
            else
            {
                targetsList.SelectedValue = ruleVM.BadgeEvents.LastOrDefault(be => be.ID_BadgeEvent == rule.BadgeEventID_BadgeEvent);
            }
            RegisterName(RULE_BADGEEVENT_FIELDLIST_NAME + lastRowNumber, templatesList);
            this.RulesGrid.Children.Add(templatesList);

            ColorPicker colorPicker = new ColorPicker();

            colorPicker.Name = RULE_COLORPICKER_NAME + lastRowNumber;
            colorPicker.SetValue(Grid.ColumnProperty, 3);
            colorPicker.SetValue(Grid.RowProperty, lastRowNumber);
            colorPicker.VerticalAlignment          = VerticalAlignment.Top;
            colorPicker.HorizontalContentAlignment = HorizontalAlignment.Center;
            colorPicker.FontSize = 16;
            //if (rule.HexaCode == null) colorPicker.Visibility = Visibility.Hidden;
            if (rule.HexaCode == null)
            {
                colorPicker.IsEnabled = false;
            }
            else
            {
                colorPicker.SelectedColor = (Color)ColorConverter.ConvertFromString(rule.HexaCode);
            }
            RegisterName(RULE_COLORPICKER_NAME + lastRowNumber, colorPicker);
            this.RulesGrid.Children.Add(colorPicker);

            Button deleteRule = new Button();

            deleteRule.Content = "X";
            deleteRule.Name    = RULE_DELETE_RULE_NAME + lastRowNumber;
            deleteRule.SetValue(Grid.ColumnProperty, 4);
            deleteRule.Width = 50;
            deleteRule.SetValue(Grid.RowProperty, lastRowNumber);
            deleteRule.VerticalAlignment = VerticalAlignment.Top;
            deleteRule.Click            += new RoutedEventHandler(OnClick_DeleteRule);
            RegisterName(RULE_DELETE_RULE_NAME + lastRowNumber, deleteRule);
            this.RulesGrid.Children.Add(deleteRule);
        }
示例#51
0
 public void OnGetColor(ColorPicker picker)
 {
     sphere.SendMessage("OnGetColor", picker);
 }
示例#52
0
 private void bColorMe_Click( object sender, EventArgs e ) {
     ColorPicker picker = new ColorPicker( "/Me command color", colorMe );
     picker.ShowDialog();
     colorMe = picker.ColorIndex;
     ApplyColor( bColorMe, colorMe );
     Color.Me = Parse( colorMe );
 }
示例#53
0
 private void bColorAnnouncement_Click( object sender, EventArgs e ) {
     ColorPicker picker = new ColorPicker( "Announcement color", colorAnnouncement );
     picker.ShowDialog();
     colorAnnouncement = picker.ColorIndex;
     ApplyColor( bColorAnnouncement, colorAnnouncement );
     Color.Announcement = Parse( colorAnnouncement );
 }
示例#54
0
 private void bColorRank_Click( object sender, EventArgs e ) {
     ColorPicker picker = new ColorPicker( "Rank color for \"" + selectedRank.Name + "\"", ParseToIndex( selectedRank.Color ) );
     picker.ShowDialog();
     ApplyColor( bColorRank, picker.ColorIndex );
     selectedRank.Color = Parse( picker.ColorIndex );
 }
示例#55
0
 private void bColorWarning_Click( object sender, EventArgs e ) {
     ColorPicker picker = new ColorPicker( "Warning / Error message color", colorWarning );
     picker.ShowDialog();
     colorWarning = picker.ColorIndex;
     ApplyColor( bColorWarning, colorWarning );
     Color.Warning = Parse( colorWarning );
 }
        public App()
        {
            InitializeComponent();

            MainPage = new ColorPicker();
        }
示例#57
0
 private void bColorIRC_Click( object sender, EventArgs e ) {
     ColorPicker picker = new ColorPicker( "IRC message color", colorIRC );
     picker.ShowDialog();
     colorIRC = picker.ColorIndex;
     ApplyColor( bColorIRC, colorIRC );
     Color.IRC = Parse( colorIRC );
 }
示例#58
0
 private void ColorPicker_ColorChanged(ColorPicker sender, ColorChangedEventArgs args)
 {
     StrokeColor = args.NewColor;
 }
示例#59
0
	void OnGetColor(ColorPicker picker)
	{
		picker.NotifyColor(GetComponent<Camera>().backgroundColor);
	}
 private void ColorPicker_ColorChanged(ColorPicker sender, ColorChangedEventArgs args)
 {
     myAcrylicBrush.TintColor = args.NewColor;
 }