Exemple #1
0
        public void UpdateKeyLayout(FPKey key)
        {
            if (key.DefaultIcon != null && key.DefaultIcon != string.Empty)               //if there is an icon, we display an icon
            {
                Icon.Image       = UIImage.FromFile(ConfigsEngine.GetImageForCurrentConfiguration(key.DefaultIcon));
                Icon.Hidden      = false;
                MainTitle.Hidden = true;
            }
            else
            {
                MainTitle.Text   = key.MainTitle;
                Icon.Hidden      = true;
                MainTitle.Hidden = false;
            }

            SubTitle.Text       = key.SubTitle;
            SubTitle.TextColor  = Util.GetUicolorFromRGBString(key.SubTitleColor);
            MainTitle.TextColor = Util.GetUicolorFromRGBString(key.MainTitleColor);

            this.Layer.BorderColor = Util.BorderColor;

            if (key.BackgroundColor == null && key.Action == null)
            {
                this.BackgroundColor = Util.CellBackgroundColor;
            }
            else if (key.BackgroundColor == null && key.Action != null)
            {
                this.BackgroundColor = UIColor.White;
            }
            else
            {
                this.BackgroundColor = Util.GetUicolorFromRGBString(key.BackgroundColor);
            }
        }
Exemple #2
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            MainTitleTbox.Text  = _loadedKey.MainTitle;
            SubTitleTbox.Text   = _loadedKey.SubTitle;
            PersistentSwitch.On = _loadedKey.PersistSelected;
            if (_loadedKey.DefaultIcon != null && _loadedKey.DefaultIcon != string.Empty)
            {
                if (System.IO.File.Exists(ConfigsEngine.GetImageForCurrentConfiguration(_loadedKey.DefaultIcon)))
                {
                    DefaultIconBtn.SetImage(UIImage.FromFile(ConfigsEngine.GetImageForCurrentConfiguration(_loadedKey.DefaultIcon)), UIControlState.Normal);
                    _loadedDefaultIconName = _loadedKey.DefaultIcon;
                }
            }
            else
            {
                DefaultIconBtn.SetImage(null, UIControlState.Normal);
                _loadedDefaultIconName = string.Empty;
            }
            if (!string.IsNullOrEmpty(_loadedKey.SelectedIcon))
            {
                SelectedIconBtn.SetImage(UIImage.FromFile(ConfigsEngine.GetImageForCurrentConfiguration(_loadedKey.SelectedIcon)), UIControlState.Normal);
                _loadedSelectedIconName = _loadedKey.SelectedIcon;
            }
            else
            {
                SelectedIconBtn.SetImage(null, UIControlState.Normal);
                _loadedKey.SelectedIcon = string.Empty;
            }

            TitleColorBtn.BackgroundColor        = Util.GetUicolorFromRGBString(_loadedKey.MainTitleColor);
            SubtitleColorBtn.BackgroundColor     = Util.GetUicolorFromRGBString(_loadedKey.SubTitleColor);
            TitleSelColorBtn.BackgroundColor     = Util.GetUicolorFromRGBString(_loadedKey.SelectedMainTitleColor);
            SubtitleSelColorBtn.BackgroundColor  = Util.GetUicolorFromRGBString(_loadedKey.SelectedSubTitleColor);
            BackgroundColorBtn.BackgroundColor   = Util.GetUicolorFromRGBString(_loadedKey.BackgroundColor);
            BackroundSelColorBtn.BackgroundColor = Util.GetUicolorFromRGBString(_loadedKey.SelectedBackgroundColor);
            ActionTbox.Text = "";
            _actionKeys.Clear();

            if (_loadedKey.Action != null)
            {
                try
                {
                    _actionKeys = JsonConvert.DeserializeObject <List <int> >(_loadedKey.Action);
                }
                catch (Exception e)
                {
                    FPLog.Instance.WriteLine("Error deserializing key");
                }
            }

            if (_actionKeys != null && _actionKeys.Count > 0)
            {
                PopulateActionTextBox();
            }


            SetupKeyboard();
        }
Exemple #3
0
        public void UpdateKeyLayoutSelected(FPKey key)
        {
            if (key.SelectedIcon != null && key.SelectedIcon != string.Empty)                //if there is an icon, we display an icon
            {
                Icon.Image = UIImage.FromFile(ConfigsEngine.GetImageForCurrentConfiguration(key.SelectedIcon));
            }
            else
            {
                MainTitle.Text = key.MainTitle;
            }

            SubTitle.Text       = key.SubTitle;
            SubTitle.TextColor  = Util.GetUicolorFromRGBString(key.SelectedSubTitleColor);
            MainTitle.TextColor = Util.GetUicolorFromRGBString(key.SelectedMainTitleColor);

            if (key.BackgroundColor == null)
            {
                this.BackgroundColor = UIColor.Cyan;
            }
            else
            {
                this.BackgroundColor = Util.GetUicolorFromRGBString(key.SelectedBackgroundColor);
            }

            this.Layer.BorderColor = UIColor.Green.CGColor;
        }