Example #1
0
        public WndChallenges(int isChecked, bool editable)
        {
            _editable = editable;

            var title = PixelScene.CreateText(Title, 9);

            title.Hardlight(TitleColor);
            title.Measure();
            title.X = PixelScene.Align(Camera, (WIDTH - title.Width) / 2);
            Add(title);

            _boxes = new List <CheckBox>();

            var pos = title.Height + Gap;

            for (var i = 0; i < Challenges.NAMES.Length; i++)
            {
                var cb = new CheckBox(Challenges.NAMES[i]);
                cb.SetChecked((isChecked & Challenges.MASKS[i]) != 0);
                cb.Active = editable;

                if (i > 0)
                {
                    pos += Gap;
                }

                cb.SetRect(0, pos, WIDTH, BtnHeight);
                pos = cb.Bottom();

                Add(cb);
                _boxes.Add(cb);
            }

            Resize(WIDTH, (int)pos);
        }
Example #2
0
        /**
         * Returns the view for a specific item on the list
         */
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            ToDoItem currentItem = GetItem(position);

            if (row == null)
            {
                LayoutInflater inflater = ((Activity)mContext).GetLayoutInflater();
                row = inflater.Inflate(mLayoutResourceId, parent, false);
            }

            row.SetTag(currentItem);
            CheckBox checkBox = (CheckBox)row.FindViewById(R.Ids.checkToDoItem);

            checkBox.SetText(currentItem.GetText());
            checkBox.SetChecked(false);
            checkBox.SetEnabled(true);

            checkBox.Click += (sender, args) =>
            {
                if (checkBox.IsChecked())
                {
                    checkBox.SetEnabled(false);
                    if (mContext is ToDoActivity)
                    {
                        ToDoActivity activity = (ToDoActivity)mContext;
                        activity.CheckItem(currentItem);
                    }
                }
            };


            return(row);
        }
Example #3
0
        public void SetCheckedTest()
        {
            Vector2    position = new Vector2();                // TODO: Initialize to an appropriate value
            SpriteFont font     = null;                         // TODO: Initialize to an appropriate value
            CheckBox   target   = new CheckBox(position, font); // TODO: Initialize to an appropriate value
            bool       state    = false;                        // TODO: Initialize to an appropriate value

            target.SetChecked(state);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Example #4
0
 /// <summary>
 /// Sets the checked.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">if set to <c>true</c> [value].</param>
 public static void SetChecked(this CheckBox control, bool value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetChecked(value)));
     }
     else
     {
         control.Checked = value;
         control.Refresh();
     }
 }
Example #5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            YogUI.YogUI_LoadContent(this);

            SpriteFont buttonFont = Content.Load <SpriteFont>("buttonFont");

            loadNinepatch   = new Button(new Vector2(46, 23), "Open", buttonFont, loadExisting);
            saveNinepatchAs = new Button(new Vector2(150, 23), "Save", buttonFont, saveImage);

            xStart = new TextField(new Vector2(225, 3), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            xEnd   = new TextField(new Vector2(225, 28), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            xStart.stringPattern   = xEnd.stringPattern = "^\\d+?$";
            xStart.placeHolderText = "X start";
            xEnd.placeHolderText   = "X end";

            yStart = new TextField(new Vector2(305, 3), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            yEnd   = new TextField(new Vector2(305, 28), 70, 15, Color.Black, buttonFont, (string s) => { refresh(); }, (string s) => { refresh(); });
            yStart.stringPattern   = yEnd.stringPattern = "^\\d+?$";
            yStart.placeHolderText = "Y start";
            yEnd.placeHolderText   = "Y end";

            refreshNinepatch = new Button(new Vector2(420, 18), "Refresh", buttonFont, refresh);

            patchScale = new SliderBar(new Vector2(465, 9), 225, 30, 0, 100, buttonFont);

            drawContent = new CheckBox(new Vector2(390, 45), buttonFont);
            drawContent.SetLabel("Draw content");
            drawContent.SetChecked(true);

            scaleX  = new RadioButton(new Vector2(700, 9), buttonFont, "Scale X");
            scaleY  = new RadioButton(new Vector2(700, 23), buttonFont, "Scale Y");
            scaleXY = new RadioButton(new Vector2(700, 37), buttonFont, "Scale X+Y");

            scaleGroup.addButton(scaleX);
            scaleGroup.addButton(scaleY);
            scaleGroup.addButton(scaleXY);

            scaleX.selected = true;

            // TODO: use this.Content to load your game content here
        }
            public override global::Android.Views.View GetView(int position, global::Android.Views.View convertView
                                                               , ViewGroup parent)
            {
                if (convertView == null)
                {
                    LayoutInflater inflater = (LayoutInflater)parent.GetContext().GetSystemService(Context
                                                                                                   .LayoutInflaterService);
                    convertView = inflater.Inflate(R.Layout.view_user, null);
                }
                Couchbase.Lite.Document task = (Couchbase.Lite.Document) this.GetItem(position);
                TextView text = (TextView)convertView.FindViewById(R.ID.text);

                text.SetText((string)task.GetProperty("name"));
                Couchbase.Lite.Document user = (Couchbase.Lite.Document) this.GetItem(position);
                CheckBox checkBox            = (CheckBox)convertView.FindViewById(R.ID.@checked);
                bool     @checked            = this.IsMemberOfTheCurrentList(user);

                checkBox.SetChecked(@checked);
                checkBox.SetOnClickListener(new _OnClickListener_118(this, checkBox, user));
                return(convertView);
            }
Example #7
0
		/// <summary>
		/// 
		/// </summary>
		private void SetupControls()
		{
			TrayManager.ShowCursor();

			// make room for the controls
			TrayManager.ShowLogo( TrayLocation.TopRight );
			TrayManager.ShowFrameStats( TrayLocation.TopRight );
			TrayManager.ToggleAdvancedFrameStats();

			infoLabel = TrayManager.CreateLabel( TrayLocation.Top, "TInfo", "", 350 );

			editMenu = TrayManager.CreateLongSelectMenu( TrayLocation.Bottom, "EditMode", "Edit Mode", 370, 250, 3 );
			editMenu.AddItem( "None" );
			editMenu.AddItem( "Elevation" );
			editMenu.AddItem( "Blend" );
			editMenu.SelectItem( 0 ); // no edit mode

			flyBox = TrayManager.CreateCheckBox( TrayLocation.Bottom, "Fly", "Fly" );
			flyBox.SetChecked( false, false );

			shadowsMenu = TrayManager.CreateLongSelectMenu( TrayLocation.Bottom, "Shadows", "Shadows", 370, 250, 3 );
			shadowsMenu.AddItem( "None" );
			shadowsMenu.AddItem( "Color Shadows" );
			shadowsMenu.AddItem( "Depth Shadows" );
			shadowsMenu.SelectItem( 0 );

			IList<string> names = new List<string>();
			names.Add("Help");
			//a friendly reminder
			TrayManager.CreateParamsPanel( TrayLocation.TopLeft, "Help", 100, names ).SetParamValue( 0, "H/F1" );
		}
Example #8
0
                public override global::Android.Views.View GetView(int position, global::Android.Views.View convertView
                                                                   , ViewGroup parent)
                {
                    if (convertView == null)
                    {
                        LayoutInflater inflater = (LayoutInflater)parent.GetContext().GetSystemService(Context
                                                                                                       .LayoutInflaterService);
                        convertView = inflater.Inflate(Resource.Layout.view_task, null);
                    }
                    Couchbase.Lite.Document task   = (Couchbase.Lite.Document) this.GetItem(position);
                    Bitmap             image       = null;
                    Bitmap             thumbnail   = null;
                    IList <Attachment> attachments = task.GetCurrentRevision().GetAttachments();

                    if (attachments != null && attachments.Count > 0)
                    {
                        Attachment attachment = attachments[0];
                        try
                        {
                            image     = BitmapFactory.DecodeStream(attachment.GetContent());
                            thumbnail = ThumbnailUtils.ExtractThumbnail(image, MainActivity.TasksFragment.ThumbnailSizePx
                                                                        , MainActivity.TasksFragment.ThumbnailSizePx);
                        }
                        catch (Exception e)
                        {
                            Log.E(Application.Tag, "Cannot decode the attached image", e);
                        }
                    }
                    Bitmap    displayImage = image;
                    ImageView imageView    = (ImageView)convertView.FindViewById(Resource.Id.image);

                    if (thumbnail != null)
                    {
                        imageView.SetImageBitmap(thumbnail);
                    }
                    else
                    {
                        imageView.SetImageDrawable(this._enclosing.GetResources().GetDrawable(Resource.Drawable.
                                                                                              ic_camera_light));
                    }
                    imageView.Click += async(sender, e) => {
                        if (displayImage != null)
                        {
                            DispatchImageViewIntent(displayImage);
                        }
                        else
                        {
                            AttachImage(task);
                        }
                    };
                    TextView text = (TextView)convertView.FindViewById(Resource.Id.text);

                    text.SetText((string)task.GetProperty("title"));
                    CheckBox checkBox        = (CheckBox)convertView.FindViewById(Resource.Id.@checked);
                    bool     checkedProperty = (bool)task.GetProperty("checked");
                    bool     @checked        = checkedProperty != null ? checkedProperty : false;

                    checkBox.SetChecked(@checked);
                    checkBox.Click += async(sender, e) => {
                        try
                        {
                            Task.UpdateCheckedStatus(task, checkBox.IsChecked());
                        }
                        catch (CouchbaseLiteException ex)
                        {
                            Log.E(((CouchbaseSample.Android.Application)Application).Tag, "Cannot update checked status", e);
                        }
                    };
                    return(convertView);
                }