Esempio n. 1
0
        static WinExtensions()
        {
            roundedButtonStyles = new Dictionary <ButtonTypes, RoundedButtonStateStyle>();
            controlProperties   = new Dictionary <string, Dictionary <string, string> >();

            #region Load button styles

            string configFile = Path.Combine(FXConsts.FOLDER_RESOURCE.GetFolder(), FXConsts.RESOURCE_FILE_UI_STYLES);
            if (!File.Exists(configFile))
            {
                return;
            }

            IniDocument doc = new IniDocument(configFile);

            for (int i = 1; i < 5; i++)
            {
                ButtonTypes btp   = (ButtonTypes)Enum.Parse(typeof(ButtonTypes), string.Format("Type{0:d2}", i));
                var         style = new RoundedButtonStateStyle();
                var         props = style.GetType().GetProperties();

                foreach (var prop in props)
                {
                    if (!prop.Name.Contains("Color"))
                    {
                        continue;
                    }


                    var   section = doc.Sections[btp.ToString().ToUpper()];
                    var   val     = section.GetValue(prop.Name);
                    Color col     = val.FromHtmlColor();
                    prop.SetValue(style, col, null);
                }

                roundedButtonStyles.Add(btp, style);
            }

            #endregion

            #region Control properties

            foreach (DictionaryEntry entry in doc.Sections)
            {
                var section = doc.Sections[entry.Key.ToString()];
                Dictionary <string, string> props = new Dictionary <string, string>();
                string[] keys = section.GetKeys();
                foreach (var key in keys)
                {
                    props.Add(key, section.GetValue(key));
                }

                controlProperties.Add(entry.Key.ToString(), props);
            }

            #endregion
        }
Esempio n. 2
0
        public async Task SendButtonAsync(ButtonTypes type)
        {
            if (!_mouseSocket.IsAlive)
            {
                await ConnectAsync(_hostName);
            }

            _logger.LogTrace($"Sending Button: {type}");

            _mouseSocket.Send($"type:button\nname:{type.ToString().ToUpperInvariant()}\n\n");
        }
    /// <summary>
    /// Send the controller the button press event.
    /// </summary>
    void ButtonClick()
    {
        controller.ButtonPress(buttonType.ToString());
        if (buttonType == ButtonTypes.Record)
        {
            ColorBlock block = new ColorBlock();
            block.normalColor      = new Color32(255, 255, 255, 255);
            block.highlightedColor = new Color32(255, 0, 0, 255);
            block.disabledColor    = new Color32(255, 0, 0, 255);
            block.pressedColor     = new Color32(255, 0, 0, 255);
            block.fadeDuration     = 0.1f;
            block.colorMultiplier  = 1f;

            GetComponent <Button>().colors = block;
        }
    }
Esempio n. 4
0
        private DressTypes ButtonTypeToDressType(ButtonTypes aButton)
        {
            DressTypes Res = DressTypes.None;

            foreach (DressTypes aDress in Enum.GetValues(typeof(DressTypes)))
            {
                if (aButton.ToString().Equals(aDress.ToString()))
                {
                    Res = aDress;
                    break;
                }
            }
            if (aButton == ButtonTypes.ClearBtn)
            {
                Res = DressTypes.Naked;
            }
            return(Res);
        }