コード例 #1
0
        //this is called after the user Select the image from dropbox
        private void DownloadImageTask(NSUrl imageLink, string imageName)
        {
            try{
                UIImage img = Util.FromNSUrl(imageLink);
                if (img != null)
                {
                    ConfigsEngine.SaveImageForCurrentConfiguration(imageName, img);
                    InvokeOnMainThread(() => {
                        if (_iconSelection == IconSelection.DEFAULT)
                        {
                            DefaultIconBtn.SetImage(img, UIControlState.Normal);
                            DefaultIconBtn.BackgroundColor = UIColor.Clear;
                            _loadedDefaultIconName         = imageName;
                        }
                        else if (_iconSelection == IconSelection.SELECTED)
                        {
                            SelectedIconBtn.SetImage(img, UIControlState.Normal);
                            SelectedIconBtn.BackgroundColor = UIColor.Clear;
                            _loadedSelectedIconName         = imageName;
                        }

                        _activityIndicator.StopAnimating();
                        _activityIndicator.RemoveFromSuperview();
                    });
                }
            }
            catch (Exception) {
                InvokeOnMainThread(() => {
                    var alert = new UIAlertView("Error", "Error downloading image from dropbox", null, "Ok");
                    alert.Show();
                });
            }
        }
コード例 #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();
        }
コード例 #3
0
 partial void RemoveDefaultIcon(NSObject sender)
 {
     _loadedDefaultIconName = null;
     DefaultIconBtn.SetImage(null, UIControlState.Normal);
 }