public override void Start()
        {
            base.Start();

            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "This is a label";
            lblLabel.Height = 30;
            stack.Children.Add(lblLabel);

            IListPicker lstFont = Platform.Current.Create <IListPicker>();

            lstFont.Items         = new string[] { "Arial", "Verdana", "Times new roman", "Helvetica" };
            lstFont.ValueChanged += (object sender, string e) => lblLabel.FontFamily = lstFont.Value;
            stack.Children.Add(lstFont);

            lstColor       = Platform.Current.Create <IListPicker>();
            lstColor.Items = new string[] { "Red", "Green", "Blue" };
            stack.Children.Add(lstColor);

            IButton cmdColor = Platform.Current.Create <IButton>();

            cmdColor.Text   = "Set Color";
            cmdColor.Click += CmdSetColor_Click;
            stack.Children.Add(cmdColor);

            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;
        }
Esempio n. 2
0
        public override void Start()
        {
            base.Start();

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

            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "This is a label";
            lblLabel.Height = 30;
            stack.Children.Add(lblLabel);

            ITextBox txtText = Platform.Current.Create <ITextBox>();

            txtText.Value         = "Update label text here";
            txtText.ValueChanged += (object sender, string e) => lblLabel.Text = txtText.Value;
            stack.Children.Add(txtText);

            IListPicker lstFont = Platform.Current.Create <IListPicker>();

            lstFont.Items         = new string[] { "Arial", "Verdana", "Times new roman", "Helvetica" };
            lstFont.ValueChanged += (object sender, string e) => lblLabel.FontFamily = lstFont.Value;
            stack.Children.Add(lstFont);

            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;
        }
		public override void Start()
		{
			base.Start();

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

			IListPicker lstFont = Platform.Current.Create<IListPicker>();
			lstFont.Items = new string[] { "Arial", "Verdana", "Times new roman", "Helvetica" };
			lstFont.ValueChanged += (object sender, string e) => lblLabel.FontFamily = lstFont.Value;
			stack.Children.Add(lstFont);

			lstColor = Platform.Current.Create<IListPicker>();
			lstColor.Items = new string[] { "Red", "Green", "Blue" };
			stack.Children.Add(lstColor);

			IButton cmdColor = Platform.Current.Create<IButton>();
			cmdColor.Text = "Set Color";
			cmdColor.Click += CmdSetColor_Click;
			stack.Children.Add(cmdColor);

			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;
		}
Esempio n. 4
0
        public override void Start()
        {
            base.Start();

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

            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "This is a label";
            lblLabel.Height = 30;
            grid.Children.Add(lblLabel);

            ITextBox txtText = Platform.Current.Create <ITextBox>();

            txtText.Value         = "Update label text here";
            txtText.ValueChanged += (object sender, string e) => lblLabel.Text = txtText.Value;
            grid.Children.Add(txtText);

            IListPicker lstFont = Platform.Current.Create <IListPicker>();

            lstFont.Items.AddRange(new string[] { "Arial", "Verdana", "Times new roman", "Helvetica" });
            lstFont.ValueChanged += (object sender, string e) => lblLabel.FontFamily = lstFont.Value;
            grid.Children.Add(lstFont);

            Platform.Current.Page.Title   = "Test label";
            Platform.Current.Page.Content = grid;
        }
        /// <summary>
        /// Creates the controls for displaying the field
        /// </summary>
        protected override void CreateValueControl()
        {
            ValueControl = Platform.Current.Create <IListPicker>();

            //Add null value to DropDwonList if not required
            if (!Required)
            {
                ValueControl.Items.Insert(0, Resources.Strings.OKHOSTING_UI_Controls_Forms_EmptyValue);
            }
        }
		/// <summary>
		/// Creates the controls for displaying the field
		/// </summary>
		protected override void CreateValueControl()
		{
			ValueControl = Platform.Current.Create<IListPicker>();
			
			//Add null value to DropDwonList if not required
			if (!Required)
			{
				ValueControl.Items.Insert(0, Resources.Strings.OKHOSTING_UI_Controls_Forms_EmptyValue);
			}
		}
Esempio n. 7
0
        /// <summary>
        /// Creates the controls for displaying the field
        /// <para xml:lang="es">
        /// Crea los controles para visualizar el campo.
        /// </para>
        /// </summary>
        protected override void CreateValueControl()
        {
            //create a sinple TextBox
            ValueControl = Platform.Current.Create <IFlow>();

            txtValue           = Platform.Current.Create <ITextBox>();
            txtValue.InputType = ITextBoxInputType.Number;
            txtValue.Value     = "0";

            lstUnit       = Platform.Current.Create <IListPicker>();
            lstUnit.Items = new List <string>();

            foreach (Enum unit in Enum.GetValues(typeof(Core.TimeUnit.Unit)))
            {
                lstUnit.Items.Add(Translator.Translate(unit));
            }

            ValueControl.Children.Add(txtValue);
            ValueControl.Children.Add(lstUnit);
        }
Esempio n. 8
0
        /// <summary>
        /// Start this instance.
        /// <para xml:lang="es">
        /// Inicia una instancia de este objeto
        /// </para>
        /// </summary>
        public override void Start()
        {
            base.Start();

            // Create an Label with text and size specific and adds it to the Stack.
            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "This is a label";
            lblLabel.Height = 30;
            stack.Children.Add(lblLabel);

            // Create the ListPicker lstFont with the specific items, here can change the fontfamily of the label and adds it to the Stack.
            IListPicker lstFont = Platform.Current.Create <IListPicker>();

            lstFont.Items         = new string[] { "Arial", "Verdana", "Times new roman", "Helvetica" };
            lstFont.ValueChanged += (object sender, string e) => lblLabel.FontFamily = lstFont.Value;
            stack.Children.Add(lstFont);

            // Create the ListPicker lstColor with the specific items and adds it to Stack
            lstColor       = Platform.Current.Create <IListPicker>();
            lstColor.Items = new string[] { "Red", "Green", "Blue" };
            stack.Children.Add(lstColor);

            // Create the button cmdColor with specific text, with the event also click and adds it to the stack.
            IButton cmdColor = Platform.Current.Create <IButton>();

            cmdColor.Text   = "Set Color";
            cmdColor.Click += CmdSetColor_Click;
            stack.Children.Add(cmdColor);

            // 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 label";
            Platform.Current.Page.Content = stack;
        }
Esempio n. 9
0
        /// <summary>
        /// Start this instance.
        /// <para xml:lang="es">
        /// Inicia una instancia de este objeto.
        /// </para>
        /// </summary>
        public override void Start()
        {
            base.Start();

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

            // Create an Label with text and size specific and adds it to the Stack.
            ILabel lblLabel = Platform.Current.Create <ILabel>();

            lblLabel.Text   = "This is a label";
            lblLabel.Height = 30;
            stack.Children.Add(lblLabel);

            // Create a textbox with a specific value, here can change the text of the label and adds it to the Stack.
            ITextBox txtText = Platform.Current.Create <ITextBox>();

            txtText.Value         = "Update label text here";
            txtText.ValueChanged += (object sender, string e) => lblLabel.Text = txtText.Value;
            stack.Children.Add(txtText);

            // Create a textbox with the specific items, here can change the fontfamily of the label and adds it to the Stack.
            IListPicker lstFont = Platform.Current.Create <IListPicker>();

            lstFont.Items         = new string[] { "Arial", "Verdana", "Times new roman", "Helvetica" };
            lstFont.ValueChanged += (object sender, string e) => lblLabel.FontFamily = lstFont.Value;
            stack.Children.Add(lstFont);

            // 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 label";
            Platform.Current.Page.Content = stack;
        }
		/// <summary>
		/// Start this instance.
		/// <para xml:lang="es">
		/// Inicia una instancia de este objeto
		/// </para>
		/// </summary>
		public override void Start()
		{
			base.Start();

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

			// Create the ListPicker lstFont with the specific items, here can change the fontfamily of the label and adds it to the Stack.
			IListPicker lstFont = Platform.Current.Create<IListPicker>();
			lstFont.Items = new string[] { "Arial", "Verdana", "Times new roman", "Helvetica" };
			lstFont.ValueChanged += (object sender, string e) => lblLabel.FontFamily = lstFont.Value;
			stack.Children.Add(lstFont);

			// Create the ListPicker lstColor with the specific items and adds it to Stack  
			lstColor = Platform.Current.Create<IListPicker>();
			lstColor.Items = new string[] { "Red", "Green", "Blue" };
			stack.Children.Add(lstColor);

			// Create the button cmdColor with specific text, with the event also click and adds it to the stack.
			IButton cmdColor = Platform.Current.Create<IButton>();
			cmdColor.Text = "Set Color";
			cmdColor.Click += CmdSetColor_Click;
			stack.Children.Add(cmdColor);

			// 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 label";
			Platform.Current.Page.Content = stack;
		}
Esempio n. 11
0
		/// <summary>
		/// Starts this instance and call the method sends Refresh ().
		/// </summary>
		/// <summary xml:alng="es">
		/// Inicia esta instancia y manda llamar al metodo Refresh().
		/// </summary>
		public override void Start()
		{
			base.Start();

			Grid = new ObjectGrid();
			Grid.Sorted += Grid_Sorted;
			SelectChecks = new List<ICheckBox>();
			lblTotal = Platform.Current.Create<ILabel>();

			//page size
			ILabel lblPageSize = Platform.Current.Create<ILabel>();
			lblPageSize.Text = "Page size:";

			IListPicker lstPageSize = Platform.Current.Create<IListPicker>();
			lstPageSize.Items = new List<string>() { "20", "50", "100", "200", "500", "1000" };
			lstPageSize.Value = "20";
			lstPageSize.ValueChanged += LstPageSize_ValueChanged;

			//current page
			ILabel lblCurrentPage = Platform.Current.Create<ILabel>();
			lblCurrentPage.Text = "Current page:";

			lstCurrentPage = Platform.Current.Create<IListPicker>();
			lstCurrentPage.ValueChanged += LstCurrentPage_ValueChanged;

			//add New button
			IListPicker cmdNewRecord = Platform.Current.Create<IListPicker>();
			cmdNewRecord.Items = new List<string>();
			cmdNewRecord.Items.Add(Resources.Strings.OKHOSTING_ORM_UI_SelectController_New);
			cmdNewRecord.Items.Add(Translator.Translate(DataSource.DataType.InnerType));

			foreach(DataType dtype in DataSource.DataType.SubDataTypesRecursive)
			{
				cmdNewRecord.Items.Add(Translator.Translate(dtype.InnerType));
			}

			cmdNewRecord.ValueChanged += cmdNewRecord_ValueChanged;

			//add Back button
			IButton cmdBack = Platform.Current.Create<IButton>();
			cmdBack.Text = Resources.Strings.OKHOSTING_ORM_UI_SelectController_Back;
			cmdBack.Click += Back_Click;
			
			//grid.content is created here
			Refresh();

			//now create  the filters form with the same number of columns as the grid
			frmFilters = new FilterDataForm();
			frmFilters.RepeatColumns = Grid.DataSource.Members.Count;

			foreach (var memberInfo in DataSource.DataType.AllMemberInfos)
			{
				frmFilters.AddFields(memberInfo);
			}

			frmFilters.DataBind();

			foreach (Filters.Filter filter in DataSource.Where)
			{
				frmFilters.ApplyFilter(filter);
			}

			//buton to apply filter
			IButton cmdRefresh = Platform.Current.Create<IButton>();
			cmdRefresh.Text = "Refresh";
			cmdRefresh.Click += cmdFilter_Click;

			//buton to delete selected objects
			IButton cmdDelete = Platform.Current.Create<IButton>();
			cmdDelete.Text = "Delete";
			cmdDelete.Click += cmdDelete_Click;

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

			container.SetContent(0, 0, frmFilters.Content);
			container.SetColumnSpan(7, frmFilters.Content);

			container.SetContent(2, 0, cmdRefresh);
			container.SetContent(2, 1, cmdNewRecord);
			container.SetContent(2, 2, cmdBack);
			container.SetContent(2, 3, cmdDelete);

			container.SetContent(2, 4, lblPageSize);
			container.SetContent(2, 5, lstPageSize);
			container.SetContent(2, 6, lblCurrentPage);
			container.SetContent(2, 7, lstCurrentPage);
			container.SetContent(2, 8, lblTotal);

			container.SetContent(3, 0, Grid.Content);
			container.SetColumnSpan(container.ColumnCount, Grid.Content);

			Platform.Current.Page.Title = Resources.Strings.OKHOSTING_ORM_UI_SelectController_List + ' ' + Translator.Translate(DataSource.DataType.InnerType);
			Platform.Current.Page.Content = container;
		}
Esempio n. 12
0
        /// <summary>
        /// Constructs the grid and populates it with data
        /// </summary>
        public void DataBind()
        {
            Content = Platform.Current.Create <IGrid>();
            var db = DataBase.CreateDataBase();

            //if DataSource has no members defined, we will use the default members
            if (DataSource.Members.Count == 0)
            {
                var defaultMembers = DataSource.DataType.DataMembers.Where(dm => dm.SelectByDefault);

                //if there are no default members, we use all f*****g members
                if (defaultMembers.Count() == 0)
                {
                    defaultMembers = DataSource.DataType.DataMembers;
                }

                foreach (var defaultDataMember in defaultMembers)
                {
                    DataSource.Members.Add(new SelectMember(defaultDataMember));
                }
            }

            //find out the total number of records
            SelectAggregate count = new SelectAggregate();

            count.DataType = DataSource.DataType;
            count.Joins.AddRange(DataSource.Joins);
            count.Where.AddRange(DataSource.Where);
            count.AggregateMembers.Add(new SelectAggregateMember(DataSource.DataType.PrimaryKey.First(), SelectAggregateFunction.Count));

            long totalrecordsCount = (long)db.SelectScalar(count);
            int  pageSize          = DataSource.Limit == null ? 0 : DataSource.Limit.Count;
            int  currentPage       = DataSource.Limit == null ? 0 : DataSource.Limit.From / pageSize;
            int  pagesCount        = DataSource.Limit == null ? 1 : (int)Math.Ceiling((decimal)totalrecordsCount / pageSize);

            Content.ColumnCount = DataSource.Members.Count; //one column per member
            Content.RowCount    = 1;                        //create header first

            //create header row
            int column = 0;

            foreach (DataMember member in DataSource.Members.Select(dm => dm.DataMember))
            {
                ILabelButton header = Platform.Current.Create <ILabelButton>();
                header.Text   = Translator.Translate(member.Member.FinalMemberInfo);
                header.Click += Header_Click;

                Content.SetContent(0, column, header);
                column++;
            }

            //create data rows
            var result = db.Select(DataSource);

            db.Dispose();

            foreach (object instance in result)
            {
                column = 0;
                Content.RowCount++;

                foreach (DataMember member in DataSource.Members.Select(dm => dm.DataMember))
                {
                    ILabelButton content = Platform.Current.Create <ILabelButton>();
                    content.Text   = member.Member.GetValue(instance).ToString();
                    content.Tag    = instance;
                    content.Click += Content_Click;

                    Content.SetContent(Content.RowCount - 1, column++, content);
                }
            }

            //create footer and pagination
            if (pageSize != 0)
            {
                Content.RowCount++;
                IGrid pagination = Platform.Current.Create <IGrid>();
                pagination.RowCount    = 1;
                pagination.ColumnCount = 2;

                //add page size picker
                IListPicker pageSizeOptions = Platform.Current.Create <IListPicker>();
                pageSizeOptions.Items = new List <string>();

                //handle page size change
                pageSizeOptions.ValueChanged += PageSizeOptions_ValueChanged;

                //create 5 options for page sizes
                for (int i = 1; i < 6; i++)
                {
                    pageSizeOptions.Items.Add((pageSize * i).ToString());
                }

                //add current page picker
                IListPicker pageNumbers = Platform.Current.Create <IListPicker>();
                pageNumbers.Items = new List <string>();

                //handle paging
                pageNumbers.ValueChanged += PageNumbers_ValueChanged;

                //add all pages
                for (int i = 1; i < pagesCount; i++)
                {
                    pageNumbers.Items.Add(i.ToString());
                }

                //set current page
                pageNumbers.Value = currentPage.ToString();

                Content.SetContent(Content.RowCount - 1, 0, pagination);
                Content.SetColumnSpan(Content.ColumnCount, pagination);
            }
        }