Пример #1
0
		/// <summary>
		/// Start this instance.
		/// <para xml:lang="es">
		/// Inicia la instancia del objeto CheckBox.
		/// </para>
		/// </summary>
		public override void Start()
		{
			base.Start();

			// Create a Stack
			IStack stack = Platform.Current.Create<IStack>();

			// Creates an Label with text and a specific size and adds it to the stack.
			lblLabel = Platform.Current.Create<ILabel>();
			lblLabel.Text = "Click on the checkbox";
			lblLabel.Height = 30;
			stack.Children.Add(lblLabel);

			// Creates an CheckBox selected with the event also click and adds it to the stack.
			checkBox = Platform.Current.Create<ICheckBox>();
			checkBox.Value = true;
			checkBox.ValueChanged += checkBox_ValueChanged;
			stack.Children.Add(checkBox);

			// Creates the Button cmdClose with text specific, with the event also click and adds it to the stack.
			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			// Establishes the content and title of the page
			Platform.Current.Page.Title = "Test checkbox";
			Platform.Current.Page.Content = stack;
		}
Пример #2
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="ctrl"></param>
 /// <param name="host"></param>
 public BaseControlWarpper(IRuntimeDesignControl ctrl, IDesignerHost host)
     : base(host)
 {
     if (ctrl == null)
     {
         this.WrappedObject = null;
     }
     else
     {
         this.WrappedObject = ctrl;
         ICpNode            = ctrl as ICpNode;
         IFormCtrl          = ctrl as IFormCtrl;
         IChkBox            = ctrl as ICheckBox;
         ICbx      = ctrl as ICombox;
         ILine     = ctrl as ICtlLine;
         IPic      = ctrl as IPictureBox;
         IPnl      = ctrl as IPanel;
         ITabCtrl  = ctrl as ITabControl;
         ISign     = ctrl as ISignatureControl;
         IRtf      = ctrl as IRtfEditor;
         IDateTime = ctrl as IXtraDateTime;
         if (ICbx != null)
         {
             ICbx.Items.CollectionChanged -= new CollectionChangeEventHandler(Items_CollectionChanged);
             ICbx.Items.CollectionChanged += new CollectionChangeEventHandler(Items_CollectionChanged);
         }
         if (ITabCtrl != null)
         {
             ITabCtrl.TabPages.CollectionChanged -= new CollectionChangeEventHandler(TabPages_CollectionChanged);
             ITabCtrl.TabPages.CollectionChanged += new CollectionChangeEventHandler(TabPages_CollectionChanged);
         }
     }
 }
Пример #3
0
		public override void Start()
		{
			base.Start();

			IStack stack = Platform.Current.Create<IStack>();

			lblLabel = Platform.Current.Create<ILabel>();
			lblLabel.Text = "This is a label";
			lblLabel.Height = 30;
			stack.Children.Add(lblLabel);

			cbxColor = Platform.Current.Create<ICheckBox>();
			cbxColor.Name = "color";
			cbxColor.Value = true;
			stack.Children.Add(cbxColor);

			IButton cmdChange = Platform.Current.Create<IButton>();
			cmdChange.Text = "Change";
			cmdChange.Click += CmdChange_Click;
			stack.Children.Add(cmdChange);

			IButton cmdClose = Platform.Current.Create<IButton>();
			cmdClose.Text = "Close";
			cmdClose.Click += CmdClose_Click;
			stack.Children.Add(cmdClose);

			Platform.Current.Page.Title = "Test label";
			Platform.Current.Page.Content = stack;
		}
Пример #4
0
 public static void UpdateForeground(this MauiCheckBox platformCheckBox, ICheckBox check)
 {
     // For the moment, we're only supporting solid color Paint for the iOS Checkbox
     if (check.Foreground is SolidPaint solid)
     {
         platformCheckBox.CheckBoxTintColor = solid.Color;
     }
 }
Пример #5
0
 /// <summary>
 /// Constructor to create a new CheckBox mapper object
 /// </summary>
 /// <param name="cb">The CheckBox object to be mapped</param>
 /// <param name="propName">A name for the property</param>
 /// <param name="isReadOnly">Whether this control is read only</param>
 /// <param name="factory">the control factory to be used when creating the controlMapperStrategy</param>
 public CheckBoxMapper(ICheckBox cb, string propName, bool isReadOnly, IControlFactory factory)
     : base(cb, propName, isReadOnly, factory)
 {
     _checkBox = cb;
     _strategy = factory.CreateCheckBoxMapperStrategy();
     if (_strategy == null) return;
     _strategy.AddClickEventHandler(this);
 }
Пример #6
0
 public static void UpdateForeground(this Check platformCheck, ICheckBox check)
 {
     // For the moment, we're only supporting solid color Paint
     if (check.Foreground is SolidPaint solid)
     {
         platformCheck.Color = solid.Color.ToPlatformEFL();
     }
 }
Пример #7
0
 Task ValidateHasColor(ICheckBox checkBoxStub, Color color, Action action = null)
 {
     return(InvokeOnMainThreadAsync(() =>
     {
         var nativeSwitch = GetNativeCheckBox(CreateHandler(checkBoxStub));
         action?.Invoke();
         nativeSwitch.AssertContainsColor(color);
     }));
 }
 public void TestDisplayingRelatedProperty()
 {
     SetupClassDefs(true);
     _cb = GetControlFactory().CreateCheckBox();
     _mapper = new CheckBoxMapper(_cb, "MyRelationship.MyRelatedTestProp", true, GetControlFactory());
     _mapper.BusinessObject = itsMyBo;
     Assert.IsNotNull(_mapper.BusinessObject);
     Assert.AreEqual(true, _cb.Checked);
 }
Пример #9
0
 public void TestDisplayingRelatedProperty()
 {
     SetupClassDefs(true);
     _cb     = GetControlFactory().CreateCheckBox();
     _mapper = new CheckBoxMapper(_cb, "MyRelationship.MyRelatedTestProp", true, GetControlFactory());
     _mapper.BusinessObject = itsMyBo;
     Assert.IsNotNull(_mapper.BusinessObject);
     Assert.AreEqual(true, _cb.Checked);
 }
Пример #10
0
        public ICheckBox CreateCheckBox(string canvas)
        {
            IPrototype clone = _checkBoxPrototype.Clone();

            clone.Init(canvas);
            ICheckBox box = (ICheckBox)clone;

            box.Toggle();
            return(box);
        }
Пример #11
0
 ///<summary>
 /// A Constructor for the BoolCheckBoxFilter
 ///</summary>
 ///<param name="controlFactory"></param>
 ///<param name="propertyName"></param>
 ///<param name="filterClauseOperator"></param>
 public BoolCheckBoxFilter(IControlFactory controlFactory, string propertyName, FilterClauseOperator filterClauseOperator)
 {
     _controlFactory           = controlFactory;
     _propertyName             = propertyName;
     _filterClauseOperator     = filterClauseOperator;
     _checkBox                 = _controlFactory.CreateCheckBox();
     _checkBox.Width           = 10;
     _checkBox.Text            = "";
     _checkBox.CheckedChanged += (sender, e) => FireValueChanged();
 }
        public void TestCreateCheckBoxWin()
        {
            //---------------Set up test pack-------------------
            //---------------Execute Test ----------------------
            ICheckBox cbx = GetControlFactory().CreateCheckBox();

            DisposeOnTearDown(cbx);
            //---------------Test Result -----------------------
            Assert.IsFalse(cbx.Checked);
        }
Пример #13
0
        public static List <object> ConvertCheckboxToEntities(ICheckBox checkbox)
        {
            List <object> entities = new List <object>();

            entities.Add(checkbox);
            if (checkbox.TextLabel != null)
            {
                entities.Add(checkbox.TextLabel);
            }
            return(entities);
        }
        async Task ValidateColor(ICheckBox checkBoxStub, Color color, Action action = null)
        {
            var expected = await GetValueAsync(checkBoxStub, handler =>
            {
                var native = GetNativeCheckBox(handler);
                action?.Invoke();
                return(native.CheckBoxTintColor);
            });

            Assert.Equal(expected, color);
        }
Пример #15
0
 /// <summary>
 /// Constructor to create a new CheckBox mapper object
 /// </summary>
 /// <param name="cb">The CheckBox object to be mapped</param>
 /// <param name="propName">A name for the property</param>
 /// <param name="isReadOnly">Whether this control is read only</param>
 /// <param name="factory">the control factory to be used when creating the controlMapperStrategy</param>
 public CheckBoxMapper(ICheckBox cb, string propName, bool isReadOnly, IControlFactory factory)
     : base(cb, propName, isReadOnly, factory)
 {
     _checkBox = cb;
     _strategy = factory.CreateCheckBoxMapperStrategy();
     if (_strategy == null)
     {
         return;
     }
     _strategy.AddClickEventHandler(this);
 }
Пример #16
0
        public ICheckBox CreateCheckBox(string canvas)
        {
            object[] args = new object[2];
            args[0] = canvas;
            args[1] = _window;

            args = _checkbox.GetConstructors().Any(c => c.GetParameters().Length == 2) ? args : null;
            ICheckBox box = (ICheckBox)System.Activator.CreateInstance(_checkbox, args);

            box.Toggle();
            return(box);
        }
        public void TestAdd_AddBooleanFilterCheckBox_CheckBox()
        {
            //---------------Set up test pack-------------------
            IFilterControl filterControl = GetControlFactory().CreateFilterControl();

            //---------------Execute Test ----------------------
            ICheckBox cb = filterControl.AddBooleanFilterCheckBox("Test:", "TestColumn", false);

            //---------------Test Result -----------------------
            Assert.AreEqual(2, filterControl.FilterPanel.Controls.Count);
            Assert.AreSame(cb, filterControl.FilterPanel.Controls[0]);
        }
Пример #18
0
        public static void UpdateForeground(this MauiCheckBox platformCheckBox, ICheckBox check)
        {
            var tintBrush = check.Foreground?.ToPlatform();

            if (tintBrush == null)
            {
                platformCheckBox.TintBrush = new SolidColorBrush(UI.Colors.Black);
                return;
            }

            platformCheckBox.TintBrush = tintBrush;
        }
Пример #19
0
        public static void UpdateForeground(this MauiCheckBox nativeCheckBox, ICheckBox check)
        {
            var tintBrush = check.Foreground?.ToNative();

            if (tintBrush == null)
            {
                nativeCheckBox.TintBrush = new SolidColorBrush(UI.Colors.Black);
                return;
            }

            nativeCheckBox.TintBrush = tintBrush;
        }
Пример #20
0
        public static void UpdateForeground(this CheckBox platformCheckBox, ICheckBox check)
        {
            var tintBrush = check.Foreground?.ToPlatform();

            if (tintBrush == null)
            {
                platformCheckBox.Resources.RemoveKeys(_tintColorResourceKeys);
            }
            else
            {
                platformCheckBox.Resources.SetValueForAllKey(_tintColorResourceKeys, tintBrush);
            }
        }
Пример #21
0
        public static void UpdateBackground(this AppCompatCheckBox nativeCheckBox, ICheckBox check)
        {
            var paint = check.Background;

            if (paint.IsNullOrEmpty())
            {
                nativeCheckBox.SetBackgroundColor(AColor.Transparent);
            }
            else
            {
                nativeCheckBox.UpdateBackground((IView)check);
            }
        }
        public void TestCreateCheckBoxVWG()
        {
            //---------------Set up test pack-------------------
            //---------------Execute Test ----------------------

            ICheckBox cbx = GetControlFactory().CreateCheckBox(false);
            //---------------Test Result -----------------------
            int expectedHeightAndWidth = GetControlFactory().CreateTextBox().Height;

            Assert.AreEqual(expectedHeightAndWidth, cbx.Height);
            Assert.AreEqual(expectedHeightAndWidth, cbx.Width);
            Assert.IsFalse(cbx.Checked);
        }
        public void TestAdd_AddBooleanFilterCheckBox_CheckBox__GetControl()
        {
            //---------------Set up test pack-------------------
            IFilterControl filterControl = GetControlFactory().CreateFilterControl();
            ICheckBox      tbExpected    = filterControl.AddBooleanFilterCheckBox("Test:", "TestColumn", false);

            filterControl.AddStringFilterTextBox("Test2:", "TestColumn2");
            //---------------Execute Test ----------------------
            ICheckBox tbReturned = (ICheckBox)filterControl.GetChildControl("TestColumn");

            //---------------Test Result -----------------------
            Assert.AreSame(tbExpected, tbReturned);
        }
Пример #24
0
        public ICheckBox GetCheckBox(string id, IAnimation notChecked, IAnimation notCheckedHovered, IAnimation @checked, IAnimation checkedHovered,
                                     float x, float y, string text = "", ITextConfig config = null, bool addToUi = true, float width = -1F, float height = -1F, bool isCheckButton = false)
        {
            if (width == -1f && notChecked != null && notChecked.Frames.Count > 0)
            {
                width = notChecked.Frames[0].Sprite.Width;
            }
            if (height == -1f && notChecked != null && notChecked.Frames.Count > 0)
            {
                height = notChecked.Frames[0].Sprite.Height;
            }
            TypedParameter idParam  = new TypedParameter(typeof(string), id);
            ICheckBox      checkbox = _resolver.Resolve <ICheckBox>(idParam);

            checkbox.TextConfig = config;
            checkbox.Text       = text;
            if (!isCheckButton)
            {
                checkbox.SkinTags.Add(AGSSkin.CheckBoxTag);
                checkbox.Skin.Apply(checkbox);
            }
            checkbox.LabelRenderSize = new AGS.API.SizeF(width, height);
            if (notChecked != null)
            {
                checkbox.NotCheckedAnimation = notChecked;
            }
            if (notCheckedHovered != null)
            {
                checkbox.HoverNotCheckedAnimation = notCheckedHovered;
            }
            if (@checked != null)
            {
                checkbox.CheckedAnimation = @checked;
            }
            if (checkedHovered != null)
            {
                checkbox.HoverCheckedAnimation = checkedHovered;
            }

            checkbox.StartAnimation(checkbox.NotCheckedAnimation);
            checkbox.Tint = Colors.White;
            checkbox.X    = x;
            checkbox.Y    = y;

            if (addToUi)
            {
                _gameState.UI.Add(checkbox);
            }

            return(checkbox);
        }
Пример #25
0
        static ICheckBox AddOption(IDialog dialog, string text, ModuleToolOptions option, ModuleToolOptions defaultOptions, ModuleToolOptions currentOptions)
        {
            ICheckBox result = dialog.AddCheckBox(5, -1, text);

            if (0 == (option & defaultOptions))
            {
                result.Disabled = true;
            }
            else if (0 != (option & currentOptions))
            {
                result.Selected = 1;
            }
            return(result);
        }
Пример #26
0
        public void Show()
        {
            _shouldAnimate = true;
            var player = _game.State.Player;

            _playerAsFeature = new PlayerAsFeature(player);

            var factory = _game.Factory;

            _label = factory.UI.GetLabel("MoveAreaLabel", "Try Walking!", 100f, 30f, 10f, _parent.Height - 30f, _parent);

            _checkbox                  = factory.UI.GetCheckBox("MoveAreaCheckbox", (ButtonAnimation)null, null, null, null, 10f, _parent.Height - 60f, _parent, "Bind Area & Character", width: 20f, height: 20f);
            _checkbox.Checked          = true;
            _shouldBindAreaToCharacter = true;
            _checkbox.OnCheckChanged.Subscribe(onBindChanged);

            var parent = factory.Object.GetObject("Elevator Parent");

            parent.TreeNode.SetParent(_parent.TreeNode);
            parent.RenderLayer = _parent.RenderLayer;
            parent.Image       = new EmptyImage(1f, 1f);
            parent.Opacity     = 0;
            parent.X           = 200f;
            parent.Y           = 100f;

            var areaParent = factory.Object.GetObject("Elevator Area Parent");

            areaParent.TreeNode.SetParent(parent.TreeNode);
            areaParent.RenderLayer = _parent.RenderLayer;

            _playerAsFeature.PlaceInFeatureWindow(parent);

            bool[,] maskArr = new bool[200, 200];
            var mask = factory.Masks.Load(maskArr, "Elevator Mask", true, Colors.GreenYellow.WithAlpha(150));
            var area = factory.Room.GetArea("Elevator Area", mask, true);

            area.Mask.DebugDraw.TreeNode.SetParent(areaParent.TreeNode);
            area.Mask.DebugDraw.RenderLayer = _parent.RenderLayer;
            var areaTranslate = area.AddComponent <ITranslateComponent>();
            var areaRotate    = area.AddComponent <IRotateComponent>();

            player.Room.Areas.Add(area);
            player.PlaceOnWalkableArea();
            player.Z            = area.Mask.DebugDraw.Z - 1;
            _scheme.CurrentMode = RotatingCursorScheme.WALK_MODE;

            animate(parent, areaTranslate, areaRotate);
        }
Пример #27
0
        public void TestChangeCheckBoxAppliesFilter()
        {
            //---------------Set up test pack-------------------
            IControlFactory factory  = GetControlFactory();
            IFilterControl  ctl      = factory.CreateFilterControl();
            ICheckBox       checkBox = ctl.AddBooleanFilterCheckBox("test", "propname", false);

            bool filterFired = false;

            ctl.Filter += delegate { filterFired = true; };
            //---------------Assert Preconditions --------------
            Assert.IsFalse(filterFired);
            //---------------Execute Test ----------------------
            checkBox.Checked = true;
            //---------------Test Result -----------------------
            Assert.IsTrue(filterFired, "The filter event should have been fired when the text was changed.");
        }
Пример #28
0
        public bool TestAndroidButtonClone()
        {
            /*
             * IOS class uses clone via production clone method, using reflection.
             *
             * Android is using vanilla cloning using protected constructors.
             */
            CustomAndroidButton original_button = new CustomAndroidButton();

            //Changing custom attribute of button
            original_button.CustomData = new Products.Data(9999);
            //Changing parent attribute of button
            original_button.AndroidData = new Products.Data(13);

            CustomIOSCheckBox original_box = new CustomIOSCheckBox();

            //Changing custom attribute of box
            original_box.CustomIOSData = new Products.Data(7777);
            //Changing parent attribute of box
            original_box.IOSData = new Products.Data(8888);

            FactoryDE fac = new FactoryDE(original_button, original_box);


            bool isValid = true;

            IButton             button_clone = fac.CreateButton("mycanvas");
            CustomAndroidButton custom       = (CustomAndroidButton)button_clone;

            isValid &= custom.CustomData.Pointer == 9999 &&
                       custom.AndroidData.Pointer == 13 &&
                       custom.CustomData != original_button.CustomData && //Checking references
                       custom.AndroidData != original_button.AndroidData;

            ICheckBox         check_clone = fac.CreateCheckBox("mycanvas");
            CustomIOSCheckBox custom_box  = (CustomIOSCheckBox)check_clone;

            isValid &= custom_box.CustomIOSData.Pointer == 7777 &&
                       custom_box.IOSData.Pointer == 8888 &&
                       custom_box.CustomIOSData != original_box.CustomIOSData &&
                       custom_box.IOSData != original_box.IOSData;

            return(isValid);
        }
        public void TestGetCheckBoxFilterClause()
        {
            //---------------Set up test pack-------------------
            IFilterClauseFactory filterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl       = GetControlFactory().CreateFilterControl();
            ICheckBox            checkBox            = filterControl.AddBooleanFilterCheckBox("Test?", "TestColumn", true);

            //---------------Execute Test ----------------------
            checkBox.Checked = false;
            string filterClauseString = filterControl.GetFilterClause().GetFilterClauseString();

            //---------------Test Result -----------------------
            IFilterClause clause =
                filterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpEquals, "false");

            Assert.AreEqual(clause.GetFilterClauseString(), filterClauseString);

            //---------------Tear Down -------------------------
        }
Пример #30
0
        public void TestChangeCheckBoxDoesNotApplyFilter_InSearchMode()
        {
            //---------------Set up test pack-------------------
            IControlFactory factory = GetControlFactory();
            IFilterControl  ctl     = factory.CreateFilterControl();

            ctl.FilterMode = FilterModes.Search;
            ICheckBox checkBox = ctl.AddBooleanFilterCheckBox("test", "propname", false);

            bool filterFired = false;

            ctl.Filter += delegate { filterFired = true; };
            //---------------Assert Preconditions --------------
            Assert.AreEqual(FilterModes.Search, ctl.FilterMode);
            Assert.IsFalse(filterFired);
            //---------------Execute Test ----------------------
            checkBox.Checked = true;
            //---------------Test Result -----------------------
            Assert.IsFalse(filterFired, "The filter event should not have been fired when the text was changed.");
        }
Пример #31
0
        public static void UpdateForeground(this AppCompatCheckBox nativeCheckBox, ICheckBox check)
        {
            // TODO: Delete when implementing the logic to set the system accent color.
            Graphics.Color accent = Graphics.Color.FromArgb("#ff33b5e5");

            var targetColor = accent;

            // For the moment, we're only supporting solid color Paint for the Android Checkbox
            if (check.Foreground is SolidPaint solid)
            {
                targetColor = solid.Color;
            }

            var tintColor = targetColor.ToNative();

            var tintList = ColorStateListExtensions.CreateCheckBox(tintColor);

            var tintMode = PorterDuff.Mode.SrcIn;

            CompoundButtonCompat.SetButtonTintList(nativeCheckBox, tintList);
            CompoundButtonCompat.SetButtonTintMode(nativeCheckBox, tintMode);
        }
Пример #32
0
        /// <summary>
        /// Anytime the menu view is loaded, find all the important views.
        /// </summary>
        protected override void OnLoad()
        {
            usernameTextBox    = GetControl <ITextBox>("UsernameField");
            passwordTextBox    = GetControl <ITextBox>("PasswordField");
            rememberMeCheckBox = GetControl <ICheckBox>("RememberToggle");
            loginButton        = GetControl <ITriggerButton>("LoginButton");

            loginButton.OnClick += LoginButton_OnClick;
            rememberMeCheckBox.OnCheckChange += RememberMeCheckBox_OnCheckChange;
            usernameTextBox.OnBlur           += UsernameTextBox_OnBlur;
            passwordTextBox.OnBlur           += PasswordTextBox_OnBlur;

            loginConfig = GetConfig <LoginConfig>();

            //Do we have values to populate?
            if (loginConfig.HasToken())
            {
                Model.Username   = loginConfig.Username;
                Model.Password   = "******";
                Model.RememberMe = true;
                Model.Token      = loginConfig.Token;
            }
        }
Пример #33
0
 public CheckBox(Generator g)
     : base(g, typeof(ICheckBox))
 {
     inner = (ICheckBox)base.Handler;
 }
 public CheckBoxMapperStub(ICheckBox cb) : base(cb, "Fdfad", false, new ControlFactoryWin())
 {
 }
Пример #35
0
 public static void UpdateIsChecked(this AppCompatCheckBox nativeCheckBox, ICheckBox check)
 {
     nativeCheckBox.Checked = check.IsChecked;
 }
            /// <summary>
            /// Sets up the panel that shows the error details
            /// </summary>
            private void SetFullDetailsPanel()
            {
                _fullDetail = _controlFactory.CreatePanel();
                _fullDetail.Text = "Error Detail";

                _errorDetails = _controlFactory.CreateTextBox();
                _errorDetails.Text = ExceptionUtilities.GetExceptionString(_exception, 0, false);
                _errorDetails.Multiline = true;
                _errorDetails.ScrollBars = ScrollBars.Both;
                _showStackTrace = _controlFactory.CreateCheckBox();
                _showStackTrace.Text = "&Show stack trace";
                _showStackTrace.CheckedChanged += ShowStackTraceClicked;

                var manager = _controlFactory.CreateBorderLayoutManager(_fullDetail);
                manager.AddControl(_errorDetails, BorderLayoutManager.Position.Centre);
                var chkPanel = _controlFactory.CreatePanel();
                var vgap = LayoutManager.DefaultGapSize + LayoutManager.DefaultBorderSize;
                if (GlobalUIRegistry.UIStyleHints != null)
                    vgap = GlobalUIRegistry.UIStyleHints.LayoutHints.DefaultVerticalGap + GlobalUIRegistry.UIStyleHints.LayoutHints.DefaultBorderSize;
                chkPanel.Height = _showStackTrace.Height + 2 * vgap;
                var chkManager = _controlFactory.CreateBorderLayoutManager(chkPanel);
                chkManager.AddControl(_showStackTrace, BorderLayoutManager.Position.West);
                manager.AddControl(chkPanel, BorderLayoutManager.Position.South);
            }
 public AbstractPlatform(IGUIFactory gUIFactory)
 {
     _button   = gUIFactory.CreateButton();
     _checkBox = gUIFactory.CreateCheckBox();
 }
Пример #38
0
		/// <summary>
		/// Starts instance for confirmation to remove controls.
		/// </summary>
		/// <summary xml:lang="es">
		/// Inicia la instancia para los controles de confirmacion de aliminar.
		/// </summary>
		public override void Start()
		{
			base.Start();

			//add label with instance names, select from database
			ILabel lblInstanceNames = Platform.Current.Create<ILabel>();
			lblInstanceNames.Text = string.Empty;
			Operations.Select select = new Operations.Select();
			select.DataType = Delete.DataType;
			select.Where.AddRange(Delete.Where);
			int count = 0;

			using (var db = DataBase.CreateDataBase())
			{

				foreach(object instance in db.Select(select))
				{
					lblInstanceNames.Text += instance.ToString() + "\n";
					count++;
				}
			}

			lblInstanceNames.Text = count + " records will be deleted:\n\n" + lblInstanceNames.Text;

			//add confirmation checkbox
			lblConfirm = Platform.Current.Create<ILabel>();
			lblConfirm.Text = Resources.Strings.OKHOSTING_ORM_UI_DeleteController_Confirm;

			chkConfirm = Platform.Current.Create<ICheckBox>();

			//add delete button
			IButton delete = Platform.Current.Create<IButton>();
			delete.Text = Resources.Strings.OKHOSTING_ORM_UI_DeleteController_Delete;
			delete.Click += Delete_Click;

			//add Cancel button
			IButton cancel = Platform.Current.Create<IButton>();
			cancel.Text = Resources.Strings.OKHOSTING_ORM_UI_UpdateController_Cancel;
			cancel.Click += Cancel_Click;
			
			//add label for error messages
			lblMessages = Platform.Current.Create<ILabel>();
			lblMessages.Visible = false;

			//create our own grid
			IGrid grid = Platform.Current.Create<IGrid>();
			grid.ColumnCount = 2;
			grid.RowCount = 4;

			grid.SetContent(0, 0, lblInstanceNames);
			grid.SetColumnSpan(2, lblInstanceNames);

			grid.SetContent(1, 0, lblConfirm);
			grid.SetContent(1, 1, chkConfirm);

			grid.SetContent(2, 0, delete);
			grid.SetContent(2, 1, cancel);

			grid.SetContent(3, 0, lblMessages);
			grid.SetColumnSpan(2, lblMessages);

			Platform.Current.Page.Title = Resources.Strings.OKHOSTING_ORM_UI_DeleteController_Delete + ' ' + Translator.Translate(Delete.DataType.InnerType);
			Platform.Current.Page.Content = grid;
		}
 public void SetupTest()
 {
     _cb = CreateCheckBox();
     _mapper = new CheckBoxMapper(_cb, "SampleBoolean", false, GetControlFactory());
     _sampleBusinessObject = new Sample();
 }
 ///<summary>
 /// A Constructor for the BoolCheckBoxFilter
 ///</summary>
 ///<param name="controlFactory"></param>
 ///<param name="propertyName"></param>
 ///<param name="filterClauseOperator"></param>
 public BoolCheckBoxFilter(IControlFactory controlFactory, string propertyName, FilterClauseOperator filterClauseOperator)
 {
     _controlFactory = controlFactory;
     _propertyName = propertyName;
     _filterClauseOperator = filterClauseOperator;
     _checkBox = _controlFactory.CreateCheckBox();
     _checkBox.Width = 10;
     _checkBox.Text = "";
     _checkBox.CheckedChanged += (sender, e) => FireValueChanged();
 }