Ejemplo n.º 1
0
        public GridManager(ColumnDefinitionCollection colDefCol, RowDefinitionCollection rowDefCol, Grid currentGrid)
        {
            this.ColDefCol = colDefCol;
            this.RowDefCol = rowDefCol;
            this.CurrentGrid = currentGrid;
            this.CurrentGrid.SizeChanged += CurrentGrid_SizeChanged;

            this.ColDefs = new List<ColumnDefinition>();
            this.RowDefs = new List<RowDefinition>();

            foreach (var itemColDefs in this.ColDefCol)
            {
                ColDefs.Add(itemColDefs);
            }
            foreach (var itemRowDefs in this.RowDefCol)
            {
                RowDefs.Add(itemRowDefs);
            }

            this.Player = new Image();
            var bitmapImage = new BitmapImage();
            bitmapImage.UriSource = new Uri("http://www.pokepedia.fr/images/d/d9/Sprite_3_f_Red.png");
            this.Player.Name = "ImagePlayer";
            this.Player.Source = bitmapImage;
            this.CurrentGrid.Children.Add(this.Player);
        }
Ejemplo n.º 2
0
        public Grid Build(int nColumns)
        {
            InitCategoriesIcons(nColumns);
            int nItems = categoriesIcons.Count();
            int nRows  = (int)Math.Ceiling((double)(nItems / nColumns));

            RowDefinitionCollection rowDefinitions = new RowDefinitionCollection();

            for (int i = 0; i < nRows; i++)
            {
                rowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(32.0, GridUnitType.Absolute)
                });
            }

            ColumnDefinitionCollection columnDefinitions = new ColumnDefinitionCollection();

            for (int i = 0; i < nColumns; i++)
            {
                columnDefinitions.Add(new ColumnDefinition {
                    Width = GridLength.Star
                });
            }

            Grid grid = new Grid {
                RowDefinitions    = rowDefinitions,
                ColumnDefinitions = columnDefinitions,
                RowSpacing        = 16.0
            };

            foreach (CategoryIcon categoryIcon in categoriesIcons)
            {
                grid.Children.Add(categoryIcon.IconImage, categoryIcon.Column, categoryIcon.Row);
            }
            outGrid = grid;

            OnCategoryIconClicked(categoriesIcons.FirstOrDefault());

            return(outGrid);
        }
            public ThirdTemplate()
            {
                RowDefinitions = new RowDefinitionCollection()
                {
                    new RowDefinition()
                    {
                        Height = new GridLength(1d, GridUnitType.Star)
                    }
                };

                ColumnDefinitions = new ColumnDefinitionCollection()
                {
                    new ColumnDefinition()
                    {
                        Width = new GridLength(1d, GridUnitType.Star)
                    },
                    new ColumnDefinition()
                    {
                        Width = GridLength.Auto
                    }
                };

                var box = new BoxView()
                {
                    Color = Color.Gray
                };

                var label = new Label()
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    XAlign            = TextAlignment.Center,
                    YAlign            = TextAlignment.End,
                };

                label.SetBinding <MultipleTemplatesViewModel.SimpleItem>(Label.TextProperty, v => v.Title);

                Children.Add(label, 0, 0);
                Children.Add(box, 1, 0);
            }
Ejemplo n.º 4
0
        public TitleView()
        {
            ColumnSpacing = 2;
            RowSpacing    = 8;
            Padding       = new Thickness(0, 8, 0, 0);

            ColumnDefinitions = new ColumnDefinitionCollection
            {
                new ColumnDefinition {
                    Width = 8
                },
                new ColumnDefinition(),
                new ColumnDefinition(),
                new ColumnDefinition(),
                new ColumnDefinition {
                    Width = 8
                }
            };

            RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = GridLength.Auto
                },
                new RowDefinition {
                    Height = 1
                }
            };

            var boxView = new BoxView
            {
                Color = (Color)Application.Current.Resources["Gray-200"]
            };

            Children.Add(LeadingView, 1, 0);
            Children.Add(Content, 2, 0);
            Children.Add(TrailingView, 3, 0);
            Children.Add(boxView, 0, 1);
            SetColumnSpan(boxView, 5);
        }
Ejemplo n.º 5
0
        public CascadeComponent(List <List <ICard> > cards, bool showAll = false)
        {
            _Cards = cards;
            //Padding = 1;
            //Margin = 1;
            //MinimumHeightRequest = 100;
            RowDefinitions = new RowDefinitionCollection()
            {
                new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Star)
                }
            };
            ColumnDefinitions = new ColumnDefinitionCollection();
            ColumnSpacing     = 1;
            RowSpacing        = 1;
            HorizontalOptions = LayoutOptions.FillAndExpand;
            VerticalOptions   = LayoutOptions.FillAndExpand;
            BackgroundColor   = Color.Gray;

            RefreshView();
        }
Ejemplo n.º 6
0
 private void InitilizeGrid()
 {
     RowSpacing     = Spacing;
     ColumnSpacing  = Spacing;
     RowDefinitions = new RowDefinitionCollection
     {
         new RowDefinition
         {
             Height = new GridLength(0.5f, GridUnitType.Star)
         },
         new RowDefinition
         {
             Height = new GridLength(0.5f, GridUnitType.Star)
         }
     };
     ColumnDefinitions = new ColumnDefinitionCollection
     {
         new ColumnDefinition
         {
             Width = new GridLength(0.2f, GridUnitType.Star)
         },
         new ColumnDefinition
         {
             Width = new GridLength(0.2f, GridUnitType.Star)
         },
         new ColumnDefinition
         {
             Width = new GridLength(0.2f, GridUnitType.Star)
         },
         new ColumnDefinition
         {
             Width = new GridLength(0.2f, GridUnitType.Star)
         },
         new ColumnDefinition
         {
             Width = new GridLength(0.2f, GridUnitType.Star)
         }
     };
 }
Ejemplo n.º 7
0
 public static DataTemplate SnapPointsTemplate()
 {
     return(new DataTemplate(() =>
     {
         var templateLayout = new Grid
         {
                 << << << < HEAD
                 RowDefinitions = new RowDefinitionCollection {
                 new RowDefinition(), new RowDefinition {
                     Height = GridLength.Auto
                 }
                 },
                 == == == =
                     RowDefinitions = new RowDefinitionCollection {
                 new RowDefinition(), new RowDefinition {
                     Height = GridLength.Auto
                 }
                 },
                 >> >> >> > Update(#12)
                 WidthRequest = 280,
                 HeightRequest = 310,
         };
Ejemplo n.º 8
0
        private void UpdateInheritedBindingContexts()
        {
            object bindingContext           = base.BindingContext;
            RowDefinitionCollection rowDefs = this.RowDefinitions;

            if (rowDefs != null)
            {
                for (int i = 0; i < rowDefs.Count; i++)
                {
                    BindableObject.SetInheritedBindingContext(rowDefs[i], bindingContext);
                }
            }
            ColumnDefinitionCollection colDefs = this.ColumnDefinitions;

            if (colDefs != null)
            {
                for (int j = 0; j < colDefs.Count; j++)
                {
                    BindableObject.SetInheritedBindingContext(colDefs[j], bindingContext);
                }
            }
        }
Ejemplo n.º 9
0
        protected override void OnPropertyChanged(string propertyName = null)
        {
            base.OnPropertyChanged(propertyName);

            if (propertyName == HandCardsProperty.PropertyName && HandCards.Cards != null && HandCards.Cards.Count > 0)
            {
                var columnDefinitions = new ColumnDefinitionCollection();

                columnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(100, GridUnitType.Absolute)
                });

                for (int i = 0; i < HandCards.Cards.Count; i++)
                {
                    columnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(35, GridUnitType.Absolute)
                    });
                }

                var rowDefinitions = new RowDefinitionCollection();
                rowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(50, GridUnitType.Absolute)
                });

                Hand.ColumnDefinitions = columnDefinitions;
                Hand.RowDefinitions    = rowDefinitions;

                Hand.Children.Add(new Image {
                    Source = HandCards.RoleImage
                }, 0, 0);
                for (int i = 1; i < HandCards.Cards.Count + 1; i++)
                {
                    Hand.Children.Add(new Image {
                        Source = HandCards.Cards[i - 1], Aspect = Aspect.AspectFill
                    }, i, 0);
                }
            }
        }
Ejemplo n.º 10
0
		void UpdateInheritedBindingContexts()
		{
			object bindingContext = BindingContext;
			RowDefinitionCollection rowDefs = RowDefinitions;
			if (rowDefs != null)
			{
				for (var i = 0; i < rowDefs.Count; i++)
				{
					RowDefinition rowdef = rowDefs[i];
					SetInheritedBindingContext(rowdef, bindingContext);
				}
			}

			ColumnDefinitionCollection colDefs = ColumnDefinitions;
			if (colDefs != null)
			{
				for (var i = 0; i < colDefs.Count; i++)
				{
					ColumnDefinition coldef = colDefs[i];
					SetInheritedBindingContext(coldef, bindingContext);
				}
			}
		}
Ejemplo n.º 11
0
        //Grid bat dau voi 3 row.
        //  row dau va row cuoi co chieu cao mac dinh la 30
        //  row thu 2 co chieu cao la auto, row thu 2 nay danh cho 'cau hoi'(textblock)
        private void InitGrid()
        {
            rowDefCollection = LayoutRoot.RowDefinitions;

            RowDefinition rowDef;

            rowDef        = new RowDefinition();
            rowDef.Height = new GridLength(10.00);
            rowDefCollection.Add(rowDef);

            for (int i = 0; i < iNumOption + 1; ++i)
            {
                rowDef = new RowDefinition();
                GridLength gridLength = new GridLength();
                rowDef.Height    = gridLength;
                rowDef.MinHeight = 30.00;
                rowDefCollection.Add(rowDef);
            }

            rowDef        = new RowDefinition();
            rowDef.Height = new GridLength(10.00);
            rowDefCollection.Add(rowDef);
        }
Ejemplo n.º 12
0
        /// <inheritdoc cref="Label.OnBindingContextChanged"/>
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            if (BindingContext is ListData node)
            {
                Children.Clear();

                RowDefinitions = new RowDefinitionCollection();

                int realIndex = 0, visualIndex = 0;

                foreach (var view in node.Views)
                {
                    RowDefinitions.Add(new RowDefinition {
                        Height = GridLength.Auto
                    });

                    // Hide bullet on nested lists.
                    if (!(view is List))
                    {
                        var bullet = GetBulletView(visualIndex);

                        if (bullet != null)
                        {
                            Children.Add(bullet, 0, realIndex);
                        }

                        visualIndex++;
                    }

                    Children.Add(view, 1, realIndex);

                    realIndex++;
                }
            }
        }
Ejemplo n.º 13
0
        private void Build()
        {
            _buttons = new Dictionary <IconButton, ToolbarButton>();

            RowDefinitions = new RowDefinitionCollection()
            {
                new RowDefinition {
                    Height = new GridLength(2, GridUnitType.Star)
                }
            };

            ColumnDefinitionCollection columns = new ColumnDefinitionCollection();

            for (int i = 0; i < Buttons.Count; i++)
            {
                columns.Add(new ColumnDefinition()
                {
                    Width = new GridLength(2, GridUnitType.Star),
                });
            }
            ColumnDefinitions = columns;

            BuildButtons();
        }
Ejemplo n.º 14
0
        private void UpdateLayoutVertical()
        {
            ColumnDefinitionCollection columns = ColumnDefinitions;

            if (columns.Count == 0)
            {
                // For a vertical layout, we have three columns:
                // the Label, LabelSpacing, and the Control

                columns.Add(new ColumnDefinition()
                {
                    Width = new GridLength(0, GridUnitType.Auto)
                });
                columns.Add(new ColumnDefinition()
                {
                    Width = new GridLength(LabelSpacing, GridUnitType.Pixel)
                });
                columns.Add(new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }

            RowDefinitionCollection rows = RowDefinitions;

            rows.Clear();

            int regularSpacing = Spacing;
            int labelSpacing   = LabelSpacing;

            bool hasStretchingElement = false;

            bool spanColumns     = false;
            bool createNewRow    = true;
            bool addSpacing      = false;
            int  verticalSpacing = regularSpacing;

            HorizontalAlignment labelAlignment = HorizontalAlignment.Left;

            if (LabelAlignment == FormPanelLabelAlignment.Right)
            {
                labelAlignment = HorizontalAlignment.Right;
            }

            for (int i = 0; i < Children.Count; i++)
            {
                FrameworkElement element      = (FrameworkElement)Children[i];
                Label            labelElement = element as Label;

                // Create a new row if we know we need to create one or we
                // encountered a label (even if we weren't expecting one)
                if (createNewRow || ((labelElement != null) && (i != 0)))
                {
                    if (addSpacing && (i != 0))
                    {
                        FormPanelSpacing spacingMode = GetSpacingMode(element);

                        if (spacingMode != FormPanelSpacing.Ignore)
                        {
                            if (spacingMode == FormPanelSpacing.Extra)
                            {
                                verticalSpacing += verticalSpacing;
                            }
                            rows.Add(new RowDefinition()
                            {
                                Height = new GridLength(verticalSpacing, GridUnitType.Pixel)
                            });
                        }
                        addSpacing = false;
                    }
                    rows.Add(new RowDefinition()
                    {
                        Height = new GridLength(0, GridUnitType.Auto)
                    });
                }

                Grid.SetRow(element, rows.Count - 1);

                if (labelElement != null)
                {
                    if (GetLabelPosition(labelElement) == FormPanelLabelPosition.Top)
                    {
                        labelElement.HorizontalAlignment = HorizontalAlignment.Left;
                        Grid.SetColumnSpan(labelElement, 3);

                        spanColumns     = true;
                        createNewRow    = true;
                        verticalSpacing = labelSpacing;
                        addSpacing      = true;
                    }
                    else
                    {
                        labelElement.HorizontalAlignment = labelAlignment;
                        if (labelElement.VerticalAlignment != VerticalAlignment.Top)
                        {
                            labelElement.VerticalAlignment = VerticalAlignment.Center;
                        }

                        spanColumns = false;

                        createNewRow    = false;
                        verticalSpacing = regularSpacing;
                    }
                }
                else
                {
                    if (spanColumns || (GetIsLabeled(element) == false))
                    {
                        Grid.SetColumnSpan(element, 3);
                        spanColumns = false;
                    }
                    else
                    {
                        Grid.SetColumn(element, 2);
                        if (Double.IsNaN(element.Width) == false)
                        {
                            element.HorizontalAlignment = HorizontalAlignment.Left;
                        }
                    }

                    if ((hasStretchingElement == false) && GetIsStretched(element))
                    {
                        rows[rows.Count - 1].Height = new GridLength(1, GridUnitType.Star);
                        hasStretchingElement        = true;
                        element.VerticalAlignment   = VerticalAlignment.Stretch;
                    }
                    else
                    {
                        element.VerticalAlignment = VerticalAlignment.Center;
                    }

                    createNewRow    = true;
                    verticalSpacing = regularSpacing;
                    addSpacing      = true;
                }
            }

            if (hasStretchingElement == false)
            {
                // Add the final filler row
                rows.Add(new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }
        }
Ejemplo n.º 15
0
        private void MakeUIStructure()
        {
            //we go through the children and determine the rows, columns and positions in the grid:
            if (this.HasChildren)
            {
                int  amountOfRows    = 1;         // = 1 for the remaining space
                int  amountOfColumns = 1;         // = 1 for the remaining space
                Dock lastChildDock   = Dock.Left; //We only need it to know the amount of rows and columns and to know which row and column are the "remaining space" (sized at star) in the case where LastChildFill is true.

                //first pass: we count the amount of rows and columns.
                foreach (UIElement child in Children)
                {
                    //get the Dock value of the child:
                    Dock dock = DockPanel.GetDock(child);

                    if (dock == Dock.Left || dock == Dock.Right)
                    {
                        ++amountOfColumns;
                    }
                    else
                    {
                        ++amountOfRows;
                    }
                }
                if (LastChildFill) //if the last child fills the remaining space, we "remove" the row/column we "added" for this child.
                {
                    lastChildDock = GetDock(Children[Children.Count - 1]);
                    if (lastChildDock == Dock.Right || lastChildDock == Dock.Left)
                    {
                        --amountOfColumns;
                    }
                    else
                    {
                        --amountOfRows;
                    }
                }

                //second pass: we determine the Grid.Row, Grid.Column, Grid.RowSpan and Grid.ColumnsSpan for each child.
                int amountOfRightPlaced  = 0;
                int amountOfLeftPlaced   = 0;
                int amountOfTopPlaced    = 0;
                int amountOfBottomPlaced = 0;

                foreach (UIElement child in Children)
                {
                    //get the Dock value of the child:
                    Dock dock = DockPanel.GetDock(child);

                    switch (dock)
                    {
                    case Dock.Left:
                        Grid.SetRow(child, amountOfTopPlaced);
                        Grid.SetColumn(child, amountOfLeftPlaced);
                        Grid.SetRowSpan(child, amountOfRows - amountOfTopPlaced - amountOfBottomPlaced);
                        Grid.SetColumnSpan(child, 1);
                        ++amountOfLeftPlaced;
                        break;

                    case Dock.Top:
                        Grid.SetRow(child, amountOfTopPlaced);
                        Grid.SetColumn(child, amountOfLeftPlaced);
                        Grid.SetRowSpan(child, 1);
                        Grid.SetColumnSpan(child, amountOfColumns - amountOfLeftPlaced - amountOfRightPlaced);
                        ++amountOfTopPlaced;
                        break;

                    case Dock.Right:
                        Grid.SetRow(child, amountOfTopPlaced);
                        Grid.SetColumn(child, amountOfColumns - amountOfRightPlaced - 1);
                        Grid.SetRowSpan(child, amountOfRows - amountOfTopPlaced - amountOfBottomPlaced);
                        Grid.SetColumnSpan(child, 1);
                        ++amountOfRightPlaced;
                        break;

                    case Dock.Bottom:
                        Grid.SetRow(child, amountOfRows - amountOfBottomPlaced - 1);
                        Grid.SetColumn(child, amountOfLeftPlaced);
                        Grid.SetRowSpan(child, 1);
                        Grid.SetColumnSpan(child, amountOfColumns - amountOfLeftPlaced - amountOfRightPlaced);
                        ++amountOfBottomPlaced;
                        break;

                    default:
                        break;
                    }
                }

                //we remove the grid because we will change its structure A LOT, and we want to avoid redrawing everything on each change:
                INTERNAL_VisualTreeManager.DetachVisualChildIfNotNull(_grid, this);

                ColumnDefinitionCollection columnsDefinitions = _grid.ColumnDefinitions;
                columnsDefinitions.Clear();
                for (int i = 0; i < amountOfColumns; ++i)
                {
                    columnsDefinitions.Add(new ColumnDefinition()
                    {
                        Width = GridLength.Auto
                    });
                }
                RowDefinitionCollection rowsDefinitions = _grid.RowDefinitions;
                rowsDefinitions.Clear();
                for (int i = 0; i < amountOfRows; ++i)
                {
                    rowsDefinitions.Add(new RowDefinition()
                    {
                        Height = GridLength.Auto
                    });
                }

                if (!LastChildFill)
                {
                    columnsDefinitions.ElementAt(amountOfLeftPlaced).Width = new GridLength(1, GridUnitType.Star);
                    rowsDefinitions.ElementAt(amountOfTopPlaced).Height    = new GridLength(1, GridUnitType.Star);
                }
                else
                {
                    //the position of the "remaining space" depends on the last child's dock:
                    if (lastChildDock == Dock.Left)
                    {
                        columnsDefinitions.ElementAt(amountOfLeftPlaced - 1).Width = new GridLength(1, GridUnitType.Star); //minus 1 because the column index of the last child placed left is also the column index of the "remaining space".
                    }
                    else
                    {
                        columnsDefinitions.ElementAt(amountOfLeftPlaced).Width = new GridLength(1, GridUnitType.Star);
                    }

                    if (lastChildDock == Dock.Top)
                    {
                        rowsDefinitions.ElementAt(amountOfTopPlaced - 1).Height = new GridLength(1, GridUnitType.Star); //minus 1 because the column index of the last child placed left is also the column index of the "remaining space".
                    }
                    else
                    {
                        rowsDefinitions.ElementAt(amountOfTopPlaced).Height = new GridLength(1, GridUnitType.Star); //minus 1 because the column index of the last child placed left is also the column index of the "remaining space".
                    }
                }
                //the changes on the grid's structure are over so we can put it back.
                INTERNAL_VisualTreeManager.AttachVisualChildIfNotAlreadyAttached(_grid, this);
            }
        }
Ejemplo n.º 16
0
        private void PopulateItems()
        {
            try
            {
                var items = ItemsSource;
                if (items == null || ItemTemplate == null)
                {
                    return;
                }

                var children = Children;
                children?.Clear();

                if (ColumnCount > 0)
                {
                    var ViewCollection = items.ToList();

                    ColumnDefinitionCollection columnDefinitions = new ColumnDefinitionCollection();
                    RowDefinitionCollection    rowDefinitions    = new RowDefinitionCollection();

                    for (int i = 0; i < ColumnCount; i++)
                    {
                        columnDefinitions.Add(new ColumnDefinition()
                        {
                            Width = new GridLength(1, GridWidthUnitType)
                        });
                    }

                    for (int i = 0; i < ViewCollection.Count; i++)
                    {
                        rowDefinitions.Add(new RowDefinition()
                        {
                            Height = new GridLength(1, GridHeightUnitType)
                        });
                    }

                    var grd = new Grid()
                    {
                        ColumnSpacing = this.Spacing,
                        RowSpacing    = this.Spacing,
                        Padding       = 0
                    };

                    if (GridHeightUnitType == GridUnitType.Auto)
                    {
                        grd.RowDefinitions = rowDefinitions;
                    }

                    if (GridWidthUnitType == GridUnitType.Auto)
                    {
                        grd.ColumnDefinitions = columnDefinitions;
                    }

                    var row = 0;
                    for (int i = 0; i < ViewCollection.Count; i++)
                    {
                        for (int j = 0; j < ColumnCount; j++)
                        {
                            if (i < ViewCollection.Count && ViewCollection[i] != null)
                            {
                                var item = ViewCollection[i];
                                grd.Children.Add(InflateView(item), j, row);

                                if (j != ColumnCount - 1)
                                {
                                    i++;
                                }
                            }
                        }
                        row++;
                    }
                    children.Add(grd);
                }
                else
                {
                    foreach (var item in items)
                    {
                        children.Add(InflateView(item));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 17
0
        public GridMainScreen()
        {
            var label1 = new Label {
                Text = "Process payments from your tablet.",
                HorizontalOptions = LayoutOptions.Center
            };
            var label2 = new Label {
                Text = "Quickly and securely.",
                HorizontalOptions = LayoutOptions.Center
            };
            var label3 = new Label {
                Text = "Bolletta",
                VerticalOptions = LayoutOptions.Center
            };
            var label4 = new Label {
                Text = "Mobile Cashier",
                VerticalOptions = LayoutOptions.Center
            };
            var label5 = new Label {
                Text = "Please enter your Username and Password to sign in"
            };
            var label6 = new Label {
                Text = "Forgot"
            };
            var label7 = new Label {
                Text = "Sign"
            };
            var usernameEntry = new Entry {
                Placeholder = "Username"
            };
            var passwordEntry = new Entry {
                Placeholder = "Password",
                IsPassword = true
            };

            var bolettaImage = new Image {
                                Source = "http://a4.mzstatic.com/us/r30/Purple4/v4/02/8d/e2/028de2c0-0a91-9e68-0b61-5a7f7fae4577/icon175x175.png"
            };

            Button button1 = new Button {
                Text = "Forgot Password",
                TextColor = Color.Black,
                BorderColor = Color.Black,
                BorderWidth = 1
            };

            Button button2 = new Button {
                Text = "Sign In",
                TextColor = Color.Black,
                BorderColor = Color.Black,
                BorderWidth = 1
            };

            var bg = Color.White;

            StackLayout st = new StackLayout { BackgroundColor = Color.White,
            };

            // Grid Attributes
            RowSpacing = 2;

            RowDefinitions = new RowDefinitionCollection {
                new RowDefinition (),	// Row 0-1
                new RowDefinition (),	// Row 1-2
                new RowDefinition (),	// Row 2-3
                new RowDefinition (),	// Row 3-4
                new RowDefinition (),	// Row 4-5
                new RowDefinition (),	// Row 5-6
                new RowDefinition (),	// Row 6-7
                new RowDefinition (),	// Row 7-8
                new RowDefinition (),	// Row 8-9
                new RowDefinition (),	// Row 9-10
                new RowDefinition (),	// Row 10-11
                new RowDefinition (),	// Row 11-12
                new RowDefinition (),	// Row 12-13
            };
            ColumnDefinitions = new ColumnDefinitionCollection {
                new ColumnDefinition { Width = new GridLength(5) },	// Column 0-1
                new ColumnDefinition { Width = new GridLength(10)},	// Column 1-2
                new ColumnDefinition (),							// Column 2-3
                new ColumnDefinition (),							// Column 3-4
                new ColumnDefinition (),							// Column 4-5
                new ColumnDefinition { Width = new GridLength(10)},	// Column 5-6
                new ColumnDefinition { Width = new GridLength(5) },	// Column 6-7
            };
            // Specify in format (column start, column end, row start, row end);
            Children.Add (st,1,6,4,12);
            Children.Add (label1,2,6,1,2);
            Children.Add (label2,2,6,2,3);
            Children.Add (bolettaImage,2,3,5,7);
            Children.Add (label3,3,6,5,6);
            Children.Add (label4,3,6,6,7);
            Children.Add (label5,2,6,7,8);
            Children.Add (usernameEntry,2,5,8,9);
            Children.Add (passwordEntry,2,5,9,10);
            Children.Add (button1,3,4,10,11);
            Children.Add (button2,4,5,10,11);
        }
Ejemplo n.º 18
0
        public async Task <StackLayout> DayView(Inspector inspector, DateTime dateTime)
        {
            int columnSpan = 60;
            int rowCount   = 1;
            RowDefinitionCollection rowDefinitions = new RowDefinitionCollection();
            RowDefinition           rowDefinition  = new RowDefinition {
                Height = 80
            };

            if (inspector.Admin)
            {
                loggedInAdmin = true;
                columnSpan    = 100;
                rowCount      = 6;
            }
            for (int x = 0; x < rowCount; x++)
            {
                rowDefinitions.Add(rowDefinition);
            }
            Grid newGrid = new Grid {
                Padding           = 10,
                HorizontalOptions = LayoutOptions.Fill,

                RowDefinitions = rowDefinitions,

                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = columnSpan
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    },
                    new ColumnDefinition {
                        Width = 60
                    }
                }
            };

            GridView = newGrid;

            StackLayout Dayview = new StackLayout
            {
                BackgroundColor = Color.Gray
            };

            if (inspector.Admin)
            {
                Label InspectorsLabel = new Label
                {
                    Text     = "Inspectors",
                    FontSize = 20
                };
                GridView.Children.Add(InspectorsLabel, 0, 0);
            }
            List <Label> labels = new List <Label>();

            Label Eight = new Label
            {
                Text     = "8:00",
                FontSize = 20
            };

            labels.Add(Eight);
            Label Nine = new Label
            {
                Text     = "9:00",
                FontSize = 20
            };

            labels.Add(Nine);

            Label Ten = new Label
            {
                Text     = "10:00",
                FontSize = 20
            };

            labels.Add(Ten);

            Label Eleven = new Label
            {
                Text     = "11:00",
                FontSize = 20
            };

            labels.Add(Eleven);

            Label Twelve = new Label
            {
                Text     = "12:00",
                FontSize = 20
            };

            labels.Add(Twelve);

            Label One = new Label
            {
                Text     = "1:00",
                FontSize = 20
            };

            labels.Add(One);

            Label Two = new Label
            {
                Text     = "2:00",
                FontSize = 20
            };

            labels.Add(Two);

            Label Three = new Label
            {
                Text     = "3:00",
                FontSize = 20
            };

            labels.Add(Three);

            Label Four = new Label
            {
                Text     = "4:00",
                FontSize = 20
            };

            labels.Add(Four);

            Label Five = new Label
            {
                Text     = "5:00",
                FontSize = 20
            };

            labels.Add(Five);

            Label Six = new Label
            {
                Text     = "6:00",
                FontSize = 20
            };

            labels.Add(Six);

            Label Seven = new Label
            {
                Text     = "7:00",
                FontSize = 20
            };

            labels.Add(Seven);

            Label EightPm = new Label
            {
                Text     = "8:00",
                FontSize = 20
            };

            labels.Add(EightPm);

            int i = 0;

            if (inspector.Admin)
            {
                i++;
            }

            foreach (var l in labels)
            {
                GridView.Children.Add(l, i, 0);
                i++;
            }

            if (inspector.Admin)
            {
                Label RobertLabel = new Label
                {
                    Text     = "Robert",
                    FontSize = 20
                };
                Label TedLabel = new Label
                {
                    Text     = "Ted",
                    FontSize = 20
                };
                Label TimLabel = new Label
                {
                    Text     = "Tim",
                    FontSize = 20
                };
                Label BillLabel = new Label
                {
                    Text     = "Bill",
                    FontSize = 20
                };
                Label JayLabel = new Label
                {
                    Text     = "Jay",
                    FontSize = 20
                };

                if (inspector.Admin)
                {
                    GridView.Children.Add(RobertLabel, 0, 1);
                    GridView.Children.Add(TedLabel, 0, 2);
                    GridView.Children.Add(TimLabel, 0, 3);
                    GridView.Children.Add(BillLabel, 0, 4);
                    GridView.Children.Add(JayLabel, 0, 5);
                }
            }

            await AddDayAppointments(inspector, dateTime);

            ScrollView Scroll = new ScrollView
            {
                HorizontalOptions = LayoutOptions.Fill,
                Orientation       = ScrollOrientation.Horizontal,

                Content = new StackLayout
                {
                    Children = { GridView }
                }
            };

            Dayview.Children.Add(Scroll);
            return(Dayview);
        }
        /// <summary>
        /// Constructor for <see cref="CreateRealMatrixPage"/>
        /// </summary>
        public RealMatrixEntryPage(string matrix_name, int _rows, int _columns)
        {
            InitializeComponent();
            BindingContext = this;
            MatrixName     = matrix_name;
            Rows           = _rows;
            Columns        = _columns;

            // Here we define the parent StackLayout
            StackLayout main_stack = new StackLayout
            {
                Spacing = 20,
                Padding = new Thickness {
                    Bottom = 0, Top = 20, Left = 0, Right = 0
                }
            };

            // Here we define a horizontal StackLayout that will contain the left bracket(as a grid), the matrix(as a grid), and the right bracket(as a grid)
            StackLayout matrix = new StackLayout
            {
                Padding           = new Thickness(20, 0),
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Center
            };


            RowDefinitionCollection rowDefinitions = new RowDefinitionCollection();

            for (int i = 0; i < _rows; i++)
            {
                rowDefinitions.Add(new RowDefinition());
            }

            ColumnDefinitionCollection columnDefinitions = new ColumnDefinitionCollection();

            for (int j = 0; j < _columns; j++)
            {
                columnDefinitions.Add(new ColumnDefinition());
            }

            // Here we define the Grid that contains the entries for the matrix elements.We then add this grid to the StackLayout matrix

            Grid entries = new Grid
            {
                RowDefinitions    = rowDefinitions,
                ColumnDefinitions = columnDefinitions,
                VerticalOptions   = LayoutOptions.Start,
            };

            // Initialises the 2d array storing the Matrix Entries
            matrix_entries = new Entry[_rows, _columns];

            for (int i = 0; i < _rows; i++)
            {
                for (int j = 0; j < _columns; j++)
                {
                    Entry entry_ij = new Entry
                    {
                        Keyboard                = Keyboard.Numeric,
                        TextColor               = Color.WhiteSmoke,
                        FontAttributes          = FontAttributes.Bold,
                        FontSize                = 20,
                        HorizontalOptions       = LayoutOptions.Center,
                        HorizontalTextAlignment = TextAlignment.Center,
                        WidthRequest            = 70
                    };

                    entries.Children.Add(entry_ij, j, i);
                    matrix_entries[i, j] = entry_ij;
                }
            }

            matrix.Children.Add(entries);

            //The matrix name at the top of the page
            main_stack.Children.Add(new Label
            {
                Text              = "Matrix " + matrix_name,
                TextColor         = Color.WhiteSmoke,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Start,
                FontSize          = 50,
            });

            main_stack.Children.Add(matrix);

            Button create = new Button
            {
                Text            = "Create",
                TextColor       = Color.WhiteSmoke,
                BackgroundColor = Color.Red,
                VerticalOptions = LayoutOptions.EndAndExpand
            };

            create.Clicked += Create_Button_Clicked;
            main_stack.Children.Add(create);


            Content = main_stack;
        }
Ejemplo n.º 20
0
        public QuoteView()
        {
            Padding = new Thickness(5);

            Bubble.BackgroundImage = new Forms9Patch.Image();
            Bubble.Content = _label;

            RowDefinitions = new RowDefinitionCollection {
                new RowDefinition { Height = GridLength.Auto },
                new RowDefinition { Height = new GridLength(10) },
            };

            _label.SetBinding(Label.TextProperty,"QuoteText");
        }
Ejemplo n.º 21
0
        private RowDefinitionCollection CreateRowDefinitions()
        {
            var rowDefinitions = new RowDefinitionCollection();

            if(this.VerticalContentAlignment == TemplatedTableViewContentAlignment.Center)
            {
                rowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
            }

            foreach(var row in this.ItemsSource.First())
            {
                rowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
            }

            if(this.VerticalContentAlignment == TemplatedTableViewContentAlignment.Center)
            {
                rowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
            }

            return rowDefinitions;
        }
		public SimplePushAlertView()
		{
			RowDefinitions = new RowDefinitionCollection
			{
				new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)}
			};

			// Allow taps to pass through
			InputTransparent = true;

			if (Device.Idiom == TargetIdiom.Phone)
			{
				ColumnDefinitions = new ColumnDefinitionCollection
				{
					// Content
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
				};
			}
			else
			{
				ColumnDefinitions = new ColumnDefinitionCollection
				{
					// Spacer
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
					// Content
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)},
					// Spacer
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
				};
			}

			_contentGrid = new Grid
			{
				RowDefinitions = new RowDefinitionCollection
				{
					new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)},
					new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)},
					new RowDefinition {Height = new GridLength(1, GridUnitType.Auto)}
				},
				ColumnDefinitions = new ColumnDefinitionCollection
				{
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)},
					new ColumnDefinition {Width = new GridLength(1, GridUnitType.Auto)}
				},
				BackgroundColor = Color.Teal,
				InputTransparent = InputTransparent
			};

			// No spacers needed on phone
			_contentGrid.SetGridProperties(0, Device.Idiom == TargetIdiom.Phone ? 0 : 1);

			Children.Add(_contentGrid);

			_image = new Image
			{
				HeightRequest = 32,
				WidthRequest = 32,
				InputTransparent = InputTransparent
			};
			_contentGrid.Children.Add(_image
				.WithPadding(10)
				.SetGridProperties(0, 0, 2));

			_titleLabel = new Label
			{
				TextColor = Color.White,
				FontSize = 16,
				InputTransparent = InputTransparent
			};
			_contentGrid.Children.Add(_titleLabel
				.WithPadding(10, 10, 0, 0)
				.SetGridProperties(0, 1));

			_bodyLabel = new Label
			{
				TextColor = Color.White,
				FontSize = 12,
				WidthRequest = 320,
				InputTransparent = InputTransparent
			};
			_contentGrid.Children.Add(_bodyLabel
				.WithPadding(0, 10, 0, 0)
				.SetGridProperties(1, 1));

		}
Ejemplo n.º 23
0
	public LoginGridView ()
	{
		var label1 = new Label {
			Text = "Process payments from your tablet.",
			HorizontalOptions = LayoutOptions.Center,
			VerticalOptions = LayoutOptions.End,
			TextColor = Color.White,
			Font = Font.SystemFontOfSize (NamedSize.Large),
			FontAttributes = FontAttributes.Bold
		};
		var label2 = new Label {
			Text = "Quickly and securely.",
			HorizontalOptions = LayoutOptions.Center,
			VerticalOptions = LayoutOptions.Start,
			TextColor = Color.White,
			Font = Font.SystemFontOfSize (NamedSize.Medium),
		};
		var label3 = new Label {
			Text = "Bolletta",
			VerticalOptions = LayoutOptions.Center,
			HorizontalOptions = LayoutOptions.Start,
			TextColor = Color.FromHex ("FF9800"),
			Font = Font.SystemFontOfSize (NamedSize.Medium),

		};
		var label4 = new Label {
			Text = "MOBILE CASHIER",
			VerticalOptions = LayoutOptions.Center,
			HorizontalOptions = LayoutOptions.Start,
			TextColor = Color.Gray,
			Font = Font.SystemFontOfSize (NamedSize.Micro),
		};
		var label5 = new Label {
			Text = "Please enter your Username and Password to sign in",
			TextColor = Color.Gray,
			VerticalOptions = LayoutOptions.End,
		};

//		var label6 = new Label {
//			Text = "Forgot"
//		};
//		var label7 = new Label {
//			Text = "Sign"
//		};

		var usernameEntry = new Entry {
			Placeholder = "Username"
		};
		var passwordEntry = new Entry {
			Placeholder = "Password",
			IsPassword = true
		};

		var bolettaImage = new Image {
			Source = "http://a4.mzstatic.com/us/r30/Purple4/v4/02/8d/e2/028de2c0-0a91-9e68-0b61-5a7f7fae4577/icon175x175.png",
			HeightRequest = 10,
			WidthRequest = 10,
		};

		Button buttonForgotPass = new Button {
			Text = "Forgot Password",
			TextColor = Color.White,
			BorderColor = Color.Black,
			BackgroundColor = Color.FromHex ("2196F3"),
			BorderWidth = 1
		};
		buttonForgotPass.Clicked += OnForgotPassClicked;
//		buttonForgotPass.Clicked += async (sender, e) => {
//			var action = await Page.DisplayActionSheet ("ActionSheet: Save Photo?", "Cancel", "Delete", "Photo Roll", "Email");
//			Debug.WriteLine("Action: " + action); // writes true or false to the console
//		};

		Button buttonSignIn = new Button {
			Text = "Sign In",
			TextColor = Color.White,
			BorderColor = Color.Black,
			BackgroundColor = Color.FromHex ("2196F3"),
			BorderWidth = 1,
			Command = new Command (() => Navigation.PushModalAsync (new RootPage ()))
		};
//		buttonSignIn.Clicked += OnSignInClicked;
//			var bg = Color.White;

		StackLayout loginSquare = new StackLayout { BackgroundColor = Color.FromHex ("E3F2FD"),
		};


		// Grid Attributes
		RowSpacing = 2;

		RowDefinitions = new RowDefinitionCollection {
			new RowDefinition (),	// Row 0-1
			new RowDefinition (),	// Row 1-2
			new RowDefinition (),	// Row 2-3
			new RowDefinition (),	// Row 3-4
			new RowDefinition { Height = new GridLength (30) },	// Row 4-5
			new RowDefinition { Height = new GridLength (30) },	// Row 5-6
			new RowDefinition { Height = new GridLength (30) },	// Row 6-7
			new RowDefinition { Height = new GridLength (30) },	// Row 7-8
			new RowDefinition { Height = new GridLength (30) },	// Row 8-9
			new RowDefinition { Height = new GridLength (30) },	// Row 9-10
			new RowDefinition { Height = new GridLength (30) },	// Row 10-11
			new RowDefinition (),	// Row 11-12
			new RowDefinition (),	// Row 12-13
		};
		ColumnDefinitions = new ColumnDefinitionCollection {
			new ColumnDefinition { Width = new GridLength (5) },	// Column 0-1
			new ColumnDefinition { Width = new GridLength (10) },	// Column 1-2
			new ColumnDefinition (),							// Column 2-3
			new ColumnDefinition (),							// Column 3-4
			new ColumnDefinition (),							// Column 4-5
			new ColumnDefinition { Width = new GridLength (10) },	// Column 5-6
			new ColumnDefinition { Width = new GridLength (5) },	// Column 6-7
		};
		// Specify in format (column start, column end, row start, row end);
		Children.Add (loginSquare, 1, 6, 4, 12);
		Children.Add (label1, 2, 6, 1, 2);
		Children.Add (label2, 2, 6, 2, 3);
		Children.Add (bolettaImage, 2, 3, 5, 7);
		Children.Add (label3, 3, 6, 5, 6);
		Children.Add (label4, 3, 6, 6, 7);
		Children.Add (label5, 2, 6, 7, 8);
		Children.Add (usernameEntry, 2, 5, 8, 9);
		Children.Add (passwordEntry, 2, 5, 9, 10);
		Children.Add (buttonForgotPass, 3, 4, 10, 11);
		Children.Add (buttonSignIn, 4, 5, 10, 11);
	}
Ejemplo n.º 24
0
        public GridCreator(int rows, int cols)
        {
            Grid grid = new Grid()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.Black,
                RowSpacing        = 1,
                ColumnSpacing     = 1,
                Margin            = new Thickness(10, 10, 10, 20),
                Padding           = new Thickness(1, 1, 1, 1)
            };


            RowDefinitionCollection rowsList = new RowDefinitionCollection();

            for (int index = 0; index < rows; index++)
            {
                rowsList.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }
            grid.RowDefinitions = rowsList;


            ColumnDefinitionCollection colsList = new ColumnDefinitionCollection();

            for (int index = 0; index < cols; index++)
            {
                colsList.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }
            grid.ColumnDefinitions = colsList;

            Color testColor = Color.Red;


            for (int colIndex = 0; colIndex < cols; colIndex++)
            {
                for (int rowIndex = 0; rowIndex < rows; rowIndex++)
                {
                    grid.Children.Add(new Label
                    {
                        TextColor               = Color.Red,
                        HorizontalOptions       = LayoutOptions.FillAndExpand,
                        VerticalOptions         = LayoutOptions.FillAndExpand,
                        HorizontalTextAlignment = TextAlignment.Center,
                        VerticalTextAlignment   = TextAlignment.Center,
                        Text = rowIndex.ToString() + " , " + colIndex.ToString()
                    }, rowIndex, colIndex);
                }
            }


            // Row 0
            // The BoxView and Label are in row 0 and column 0, and so only needs to be added to the
            // Grid.Children collection to get default row and column settings.
            //grid.Children.Add(new BoxView
            //{
            //    Color = Color.Green
            //},);
            //grid.Children.Add(new Label
            //{
            //    Text = "Row 0, Column 0",
            //    HorizontalOptions = LayoutOptions.FillAndExpand,
            //    VerticalOptions = LayoutOptions.FillAndExpand
            //});

            //// This BoxView and Label are in row 0 and column 1, which are specified as arguments
            //// to the Add method.
            //grid.Children.Add(new BoxView
            //{
            //    Color = Color.Blue
            //}, 1, 0);
            //grid.Children.Add(new Label
            //{
            //    Text = "Row 0, Column 1",
            //    HorizontalOptions = LayoutOptions.Center,
            //    VerticalOptions = LayoutOptions.Center
            //}, 1, 0);

            //// Row 1
            //// This BoxView and Label are in row 1 and column 0, which are specified as arguments
            //// to the Add method overload.
            //grid.Children.Add(new BoxView
            //{
            //    Color = Color.Teal
            //}, 0, 1, 1, 2);
            //grid.Children.Add(new Label
            //{
            //    Text = "Row 1, Column 0",
            //    HorizontalOptions = LayoutOptions.Center,
            //    VerticalOptions = LayoutOptions.Center
            //}, 0, 1, 1, 2); // These arguments indicate that that the child element goes in the column starting at 0 but ending before 1.
            //                // They also indicate that the child element goes in the row starting at 1 but ending before 2.

            //grid.Children.Add(new BoxView
            //{
            //    Color = Color.Purple
            //}, 1, 2, 1, 2);
            //grid.Children.Add(new Label
            //{
            //    Text = "Row1, Column 1",
            //    HorizontalOptions = LayoutOptions.Center,
            //    VerticalOptions = LayoutOptions.Center
            //}, 1, 2, 1, 2);

            //// Row 2
            //// Alternatively, the BoxView and Label can be positioned in cells with the Grid.SetRow
            //// and Grid.SetColumn methods.
            //BoxView boxView = new BoxView { Color = Color.Red };
            //Grid.SetRow(boxView, 2);
            //Grid.SetColumnSpan(boxView, 2);
            //Label label = new Label
            //{
            //    Text = "Row 2, Column 0 and 1",
            //    HorizontalOptions = LayoutOptions.Center,
            //    VerticalOptions = LayoutOptions.Center
            //};
            //Grid.SetRow(label, 2);
            //Grid.SetColumnSpan(label, 2);

            //grid.Children.Add(boxView);
            //grid.Children.Add(label);

            Content = grid;
        }
Ejemplo n.º 25
0
        public App()
        {
            var RowDefinitions = new RowDefinition[CellCount];
            var RowCollections = new RowDefinitionCollection();

            for (int i = 0; i < CellCount; i++)
            {
                RowDefinitions[i] = new RowDefinition {
                    Height = CellSize
                };
                RowCollections.Add(RowDefinitions[i]);
            }

            var ColumnDefinitions = new ColumnDefinition[CellCount];
            var ColumnCollections = new ColumnDefinitionCollection();

            for (int i = 0; i < CellCount; i++)
            {
                ColumnDefinitions[i] = new ColumnDefinition {
                    Width = CellSize
                };
                ColumnCollections.Add(ColumnDefinitions[i]);
            }

            var CellBoard = new Grid
            {
                Padding           = new Thickness(5, Device.OnPlatform(20, 0, 0), 5, 0),
                RowDefinitions    = RowCollections,
                ColumnDefinitions = ColumnCollections
            };

            Cells = new Cell[CellCount, CellCount];

            var tgr = new TapGestureRecognizer();

            tgr.Tapped += (sender, e) => CellClicked(sender, e);

            for (int i = 0; i < CellCount; i++)
            {
                for (int j = 0; j < CellCount; j++)
                {
                    Cells[i, j] = new Cell
                    {
                        HorizontalTextAlignment = TextAlignment.Center,
                        VerticalTextAlignment   = TextAlignment.Center,
                        State  = 0,
                        IndexX = i,
                        IndexY = j
                    };
                    CellBoard.Children.Add(Cells[i, j], i, j);

                    Cells[i, j].GestureRecognizers.Add(tgr);
                }
            }

            var StartButton = new Button
            {
                Text            = "START",
                WidthRequest    = 100,
                BackgroundColor = Color.White
            };
            var StopButton = new Button
            {
                Text            = "STOP",
                WidthRequest    = 100,
                BackgroundColor = Color.White
            };

            StartButton.Clicked += ControlButtonClicked;
            StartButton.Clicked += ControlButtonClicked;
            StopButton.Clicked  += ControlButtonClicked;

            // The root page of your application
            var content = new ContentPage
            {
                Title   = "XamarinSample2",
                Content = new StackLayout
                {
                    Children =
                    {
                        new Label {
                            Text              = "Life Game",
                            WidthRequest      = 200,
                            HeightRequest     = 50,
                            HorizontalOptions = LayoutOptions.CenterAndExpand,
                            VerticalOptions   = LayoutOptions.CenterAndExpand,
                            BackgroundColor   = Color.White
                        },
                        CellBoard,
                        StartButton,
                        StopButton
                    }
                },
                BackgroundColor = Color.Gray
            };

            MainPage = content;
        }
Ejemplo n.º 26
0
        public void InitialiseQueuePage()
        {
            InitializeComponent();
            QueueList.Children.Clear();
            songs = new List <Song>(MusicQueue.songQueue);

            Thickness       SongBlockThickness = new Thickness(5, 2, 0, 0);
            SolidColorBrush whiteText          = new SolidColorBrush(System.Windows.Media.Colors.White);

            for (int i = 0; i < songs.Count; i++)
            {
                Song          song   = songs[i];
                RowDefinition rowDef = new RowDefinition();
                rowDef.Name = $"Row_{i}";
                QueueList.RowDefinitions.Add(rowDef);
                RowDefinitionCollection RowNames = QueueList.RowDefinitions;
                Array RowArray = RowNames.ToArray();

                // Add the play button to the Songlist grid
                var PlayButton = new Button
                {
                    Name     = $"__{song.SongID}",
                    Content  = "Play",
                    Margin   = new Thickness(5, 0, 0, 5),
                    FontSize = 15,
                    Tag      = song
                };
                Grid.SetRow(PlayButton, i);
                Grid.SetColumn(PlayButton, 0);
                PlayButton.Click += PlaySongFromQueue;

                // Add the Songname text block to the Songlist grid
                var SongBlockName = new TextBlock
                {
                    Name       = $"_{song.SongID}",
                    Text       = $"{song.SongName}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockName, i);
                Grid.SetColumn(SongBlockName, 1);

                // Add the artist text block to the Songlist grid
                var SongBlockArtist = new TextBlock
                {
                    Name       = $"_{song.SongID}",
                    Text       = $"{song.Artist}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockArtist, i);
                Grid.SetColumn(SongBlockArtist, 2);

                // Add the album text block to the Songlist grid
                var SongBlockAlbum = new TextBlock
                {
                    Name       = $"_{song.SongID}",
                    Text       = $"{song.Album}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockAlbum, i);
                Grid.SetColumn(SongBlockAlbum, 3);

                // Add the year text block to the Songlist grid
                var SongBlockYear = new TextBlock
                {
                    Name       = $"_{song.SongID}",
                    Text       = $"{song.Year}",
                    Foreground = whiteText,
                    Margin     = SongBlockThickness,
                    FontSize   = 15
                };
                Grid.SetRow(SongBlockYear, i);
                Grid.SetColumn(SongBlockYear, 4);

                // Add the elements to the Songlist grid Children collection
                QueueList.Children.Add(PlayButton);
                QueueList.Children.Add(SongBlockName);
                QueueList.Children.Add(SongBlockArtist);
                QueueList.Children.Add(SongBlockAlbum);
                QueueList.Children.Add(SongBlockYear);
                QueueToPlaylist.MouseLeftButtonUp += AddQueueToPlaylist;
            }
        }
        public AtomNavigatorListViewItemStyle()
        {
            ColumnDefinitions = new ColumnDefinitionCollection();
            var iconColumn = new ColumnDefinition {
                Width = GridLength.Auto
            };

            ColumnDefinitions.Add(iconColumn);
            ColumnDefinitions.Add(new ColumnDefinition {
            });

            RowDefinitions = new RowDefinitionCollection();
            var iconHeight = new RowDefinition {
                Height = GridLength.Auto
            };

            RowDefinitions.Add(iconHeight);
            RowDefinitions.Add(new RowDefinition {
            });


            SetBinding(BackgroundColorProperty, new TemplateBinding(nameof(BackgroundColor)));

            //ContentView cv = new ContentView();
            //cv.SetBinding(ContentView.WidthRequestProperty,
            //    new TemplateBinding("OwnerListView." + nameof(AtomListView.ItemIconWidth)));



            AtomCheckBoxImage img = new AtomCheckBoxImage
            {
                AutomationId      = "ListViewCheckBox",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Start
            };

            img.SetBinding(Image.WidthRequestProperty, new Binding($"{nameof(AtomListViewCell.OwnerListView)}.{nameof(AtomListView.ItemIconWidth)}")
            {
                Source = this
            });
            img.SetBinding(Image.MarginProperty, new Binding($"{nameof(OwnerListView)}.{nameof(AtomListView.ItemIconMargin)}")
            {
                Source = this
            });
            img.SetBinding(AtomCheckBoxImage.UncheckedSourceProperty, new Binding($"{nameof(OwnerListView)}.{nameof(AtomListView.ItemIcon)}")
            {
                Source = this
            });

            img.SetBinding(AtomCheckBoxImage.CheckedSourceProperty, new Binding($"{nameof(OwnerListView)}.{nameof(AtomListView.SelectedItemIcon)}")
            {
                Source = this
            });
            img.SetBinding(AtomCheckBoxImage.IsCheckedProperty, new Binding(nameof(IsSelected))
            {
                Source = this
            });
            var tp = new TapGestureRecognizer {
            };

            tp.SetBinding(TapGestureRecognizer.CommandProperty, new Binding(nameof(ToggleSelectionCommand))
            {
                Source = this
            });
            img.GestureRecognizers.Add(tp);
            //img.ToggleOnTouch = true;


            //cv.Content = img;



            Children.Add(img);

            //var v = new ContentPresenter();

            //Grid.SetColumn(v, 1);
            //Grid.SetRowSpan(v, 2);
            //Children.Add(v);

            ContentRowSpan = 2;
            ContentColumn  = 1;


            //cv.GestureRecognizers.Add(new TapGestureRecognizer
            //{
            //    Command = new AtomCommand(() =>
            //    {
            //        var avc = this.Parent as AtomListViewCell;
            //        avc.IsSelected = !avc.IsSelected;
            //    })
            //});
        }
Ejemplo n.º 28
0
        //*************************************************************************
        //  Constructor: NodeXLWithAxesControl()
        //
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeXLWithAxesControl" />
        /// class with a specified <see cref="NodeXLControl" />.
        /// </summary>
        ///
        /// <param name="nodeXLControl">
        /// The <see cref="NodeXLControl" /> to embed within the control.
        /// </param>
        //*************************************************************************

        public NodeXLWithAxesControl
        (
            NodeXLControl nodeXLControl
        )
        {
            Debug.Assert(nodeXLControl != null);

            m_oNodeXLControl = nodeXLControl;

            // Create a 1x1 grid.  The y-axis is in (0,0), the x-axis is in (1,1),
            // the embedded NodeXLControl is in (0,1), and a Rectangle control is
            // in (1,0).
            //
            // The x-axis sizes itself vertically and the y-axis sizes itself
            // horizontally, so their row or column definition uses
            // GridLength.Auto.

            RowDefinitionCollection oRowDefinitions = this.RowDefinitions;

            oRowDefinitions.Add(new RowDefinition());
            RowDefinition oSecondRowDefinition = new RowDefinition();

            oSecondRowDefinition.Height = GridLength.Auto;
            oRowDefinitions.Add(oSecondRowDefinition);

            ColumnDefinitionCollection oColumnDefinitions = this.ColumnDefinitions;

            ColumnDefinition oFirstColumnDefinition = new ColumnDefinition();

            oFirstColumnDefinition.Width = GridLength.Auto;
            oColumnDefinitions.Add(oFirstColumnDefinition);
            oColumnDefinitions.Add(new ColumnDefinition());

            UIElementCollection oChildren = this.Children;

            Grid.SetColumn(m_oNodeXLControl, 1);
            oChildren.Add(m_oNodeXLControl);

            // The Rectangle in cell (1,0) exists only to cover up the
            // NodeXLControl's contents when it is zoomed, because the Grid does
            // not clip the NodeXLControl.  What is the correct way to force the
            // Grid to clip the NodeXLControl's contents?  Setting
            // NodeXLControl.ClipToBounds to true does not do anything.

            Rectangle oRectangle = new Rectangle();

            oRectangle.Fill = SystemColors.WindowBrush;
            Grid.SetRow(oRectangle, 1);
            oChildren.Add(oRectangle);

            m_oXAxis = new Axis();
            Grid.SetRow(m_oXAxis, 1);
            Grid.SetColumn(m_oXAxis, 1);
            oChildren.Add(m_oXAxis);

            m_oYAxis         = new Axis();
            m_oYAxis.IsXAxis = false;
            oChildren.Add(m_oYAxis);

            // Allow the Axis controls to adjust themselves when the graph is
            // zoomed or translated.

            m_oXAxis.DockedControlRenderTransform     =
                m_oYAxis.DockedControlRenderTransform =
                    m_oNodeXLControl.RenderTransform;

            m_oNodeXLControl.GraphZoomChanged +=
                new EventHandler(this.m_oNodeXLControl_GraphZoomChanged);

            m_oNodeXLControl.GraphTranslationChanged +=
                new EventHandler(this.m_oNodeXLControl_GraphTranslationChanged);

            AssertValid();
        }
Ejemplo n.º 29
0
        private void CreateSelectedArmorGrid(CharacterSheet.ArmorClassItem item, int itemIndex)
        {
            if (item == null)
            {
                return;
            }
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            if (selectedArmorGridsPool.Count > 0)
            {
                var armorGrid = selectedArmorGridsPool[0];
                selectedArmorGridsPool.RemoveAt(0);
                UpdateArmorGrid(armorGrid, item, itemIndex);
                var pos = selectedArmorGrids.Count;
                selectedArmorGrids.Add(armorGrid);
                Armor.Children.Insert(pos, armorGrid.container);
                return;
            }
            var grid = new Grid()
            {
                ColumnSpacing   = 5,
                RowSpacing      = 5,
                BackgroundColor = Color.LightGray,
            };

            grid.ColumnDefinitions = new ColumnDefinitionCollection()
            {
                new ColumnDefinition()
                {
                    Width = GridLength.Auto
                },
                new ColumnDefinition()
                {
                    Width = GridLength.Star
                },
            };
            const int count          = 14;
            var       rowDefinitions = new RowDefinitionCollection();

            for (var i = 0; i < count; i++)
            {
                rowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
            }
            grid.RowDefinitions = rowDefinitions;
#if EXPAND_CHECKBOX
            var selectedcb = new CheckBox()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                IsChecked         = item.selected,
            };
            EventHandler <CheckedChangedEventArgs> selectedHandler = (s, e) => ArmorSelected_CheckedChanged(item, e.Value);
            selectedcb.CheckedChanged += selectedHandler;
#endif
            var nameTitle = CreateLabel("Name:");
            var nameStack = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
            };
#if EXPAND_CHECKBOX
            nameStack.Children.Add(selectedcb);
#endif
            nameStack.Children.Add(nameTitle);

            var row       = 0;
            var nameValue = CreateFrame(item.name);
            grid.Children.Add(nameStack, 0, row);
            grid.Children.Add(nameValue, 1, row);
            row += 1;

            var activeTitle = CreateLabel("Active:");
            var activecb    = new CheckBox()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                IsChecked         = item.active,
                IsEnabled         = false,
            };
            EventHandler <CheckedChangedEventArgs> activeHandler = (s, e) => ArmorActive_CheckedChanged(item, e.Value);
            activecb.CheckedChanged += activeHandler;
            grid.Children.Add(activeTitle, 0, row);
            grid.Children.Add(activecb, 1, row);
            row += 1;

            var armorBonusTitle = CreateLabel("Armor Bonus:");
            var armorBonusValue = CreateFrame(item.ArmorBonus(sheet));
            grid.Children.Add(armorBonusTitle, 0, row);
            grid.Children.Add(armorBonusValue, 1, row);
            row += 1;

            var armorTypeTitle = CreateLabel("Armor Type:");
            var armorTypeValue = CreateFrame(item.ArmorType.ToString());
            grid.Children.Add(armorTypeTitle, 0, row);
            grid.Children.Add(armorTypeValue, 1, row);
            row += 1;

            var maxDexBonusTitle = CreateLabel("Max Dex Bonus:");
            var maxDexBonusValue = CreateFrame(item.MaxDexBonus(sheet));
            grid.Children.Add(maxDexBonusTitle, 0, row);
            grid.Children.Add(maxDexBonusValue, 1, row);
            row += 1;

            var checkPenaltyTitle = CreateLabel("Check Penalty:");
            var checkPenaltyValue = CreateFrame(item.CheckPenalty(sheet));
            grid.Children.Add(checkPenaltyTitle, 0, row);
            grid.Children.Add(checkPenaltyValue, 1, row);
            row += 1;

            var spellFailureTitle = CreateLabel("Spell Failure:");
            var spellFailureValue = CreateFrame(item.SpellFailure(sheet));
            grid.Children.Add(spellFailureTitle, 0, row);
            grid.Children.Add(spellFailureValue, 1, row);
            row += 1;

            var propertiesTitle = CreateLabel("Properties:");
            var propertiesValue = CreateFrame(item.properties);
            grid.Children.Add(propertiesTitle, 0, row);
            grid.Children.Add(propertiesValue, 1, row);
            row += 1;

            var weightTitle = CreateLabel("Weight:");
            var weightValue = CreateFrame(item.weight.GetTotal(sheet).ToString());
            grid.Children.Add(weightTitle, 0, row);
            grid.Children.Add(weightValue, 1, row);
            row += 1;

            var descriptionTitle = CreateLabel("Description:");
            grid.Children.Add(descriptionTitle, 0, 2, row, row + 1);
            row += 1;

            var descriptionValue = CreateFrame(item.description);
            grid.Children.Add(descriptionValue, 0, 2, row, row + 1);
            row += 1;

            MainPage.AddTapHandler(grid, (s, e) => Armor_DoubleTap(item), 2);
#if EXPAND_WITH_TAP
#if EXPAND_CHECKBOX
            MainPage.AddTapHandler(grid, (s, e) => Armor_Tap(selectedcb), 1);
#else
            MainPage.AddTapHandler(grid, (s, e) => Armor_Tap(item), 1);
#endif
#endif

            var newArmorGrid = new SelectedArmorGrid()
            {
                container = grid,
#if EXPAND_CHECKBOX
                selectedHandler = selectedHandler,
                selected        = selectedcb,
#endif
                activeHandler     = activeHandler,
                active            = activecb,
                nameTitle         = nameTitle,
                name              = nameValue.Content as Label,
                armorBonusTitle   = armorBonusTitle,
                armorBonus        = armorBonusValue.Content as Label,
                armorTypeTitle    = armorTypeTitle,
                armorType         = armorTypeValue.Content as Label,
                maxDexBonusTitle  = maxDexBonusTitle,
                maxDexBonus       = maxDexBonusValue.Content as Label,
                checkPenaltyTitle = checkPenaltyTitle,
                checkPenalty      = checkPenaltyValue.Content as Label,
                spellFailureTitle = spellFailureTitle,
                spellFailure      = spellFailureValue.Content as Label,
                propertiesTitle   = propertiesTitle,
                properties        = propertiesValue.Content as Label,
                weightTitle       = weightTitle,
                weight            = weightValue.Content as Label,
                descriptionTitle  = descriptionTitle,
                description       = descriptionValue.Content as Label,
            };

            var newpos = selectedArmorGrids.Count;
            selectedArmorGrids.Add(newArmorGrid);
            Armor.Children.Insert(newpos, newArmorGrid.container);
        }
Ejemplo n.º 30
0
        public CodeWip()
        {
            var g = new Grid();


            Observable.Interval(TimeSpan.FromSeconds(1)).ObserveOn(UIScheduler).Do(x =>
            {
                //if ((x % 2) == 0)
                //{
                //    Grid.SetColumnSpan(_v2, 1);
                //}
                //else
                //{
                //    Grid.SetColumnSpan(_v2, 2);
                //}
            }).Subscribe();


            var row = new RowDefinition()
            {
                Height = new GridLength(120)
            };
            var row2 = new RowDefinition()
            {
                Height = new GridLength(60)
            };

            var rowCollection = new RowDefinitionCollection()
            {
                row, row2
            };

            g.RowDefinitions = rowCollection;

            var column = new ColumnDefinition()
            {
                Width = new GridLength(200, GridUnitType.Auto)
            };
            var column2 = new ColumnDefinition()
            {
                Width = new GridLength(200, GridUnitType.Auto)
            };

            var columnDefinition = new ColumnDefinitionCollection()
            {
                column, column2
            };

            g.ColumnDefinitions = columnDefinition;

            _v1 = new Frame
            {
                Content = new BoxView()
                {
                    BackgroundColor = Color.Pink
                },
                BorderColor  = Color.Chocolate,
                CornerRadius = 4.0f
            };

            _v2 = new BoxView()
            {
                BackgroundColor = Color.Blue
            };

            Content = g;

            g.Children.Add(_v1);

            g.Children.Add(_v2);

            Grid.SetColumn(_v1, 0);
            Grid.SetRow(_v1, 0);

            Grid.SetColumn(_v2, 0);
            Grid.SetRow(_v2, 1);

            // now then, I think we can use a standard collection, BUT we perhaps need to consider the update cycle (not initial)

            // so the object could be considered changed due to the colspan changing.
            // similarly the attached property updater is also fine for this..
            // BUT we will think the primitive has changed and force an update cycle for it,when infact it directly hasn't.
            // BUT we need the update to occur to force the attributes to be updated.... f**kin marvellous !

            // for the children, we need to retain them , as usual, i think this potentially just works?
        }
Ejemplo n.º 31
0
        public Grid10Cartas(MemoramaViewModel ViewModel)
        {
            double ancho = App.Width / 4;
            ViewModel.CardSize = (int)Device.OnPlatform((ancho * .6), (ancho * 1.3), (ancho * 1.3));

            RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) },
                    new RowDefinition { Height = new GridLength(ancho, GridUnitType.Absolute) }
                };
            ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition { Width = new GridLength(ancho, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(ancho, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(ancho, GridUnitType.Absolute) },
                    new ColumnDefinition { Width = new GridLength(ancho, GridUnitType.Absolute) }
                };

            int col = 0;
            int ren = 0;
            for (int i = 0; i < ViewModel.CardCount * 2; i++)
            {
                if (col == 4)
                {
                    col = 0;
                    ren++;
                }
                var imgTmp = new ImageButton
                {
                    BackgroundColor = Color.White,
                    BorderWidth = 0,
                    BorderColor = Color.White,
                    BindingContext = ViewModel.MemoryCardList[i],
                    Command = ViewModel.SeleccionaCartaCommnad,
                    CommandParameter = i,
                    Orientation = ImageOrientation.ImageToLeft,
                    ImageWidthRequest = ViewModel.CardSize,
                    ImageHeightRequest = ViewModel.CardSize
                };
                imgTmp.SetBinding(ImageButton.SourceProperty, new Binding("Imagen", BindingMode.OneWay, new ImageConverter()));
                Children.Add(imgTmp, col, ren);
                col++;
            }

        }
Ejemplo n.º 32
0
        public SearchResults(string input, User us, MainWindow main)
        {
            InitializeComponent();

            mainWindow = main;
            user       = us;
            Thickness       SongBlockThickness = new Thickness(5, 2, 0, 0);
            SolidColorBrush whiteText          = new SolidColorBrush(System.Windows.Media.Colors.White);
            Database        db = new Database();

            stackResults.Children.Clear();
            resultList = db.GetSearchResults(input);
            TextBlock tbMessage = new TextBlock();

            tbMessage.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);
            tbMessage.FontSize   = 20;

            if (resultList.Count > 0)
            {
                // trim search criteria
                if (input.Trim() != "" && !input.Trim().Contains("_"))
                {
                    // here it shows the search results, shown like the screen design in FO
                    TextBlock tbTitle = new TextBlock();
                    tbTitle.Text       = "Top results for " + input;
                    tbTitle.FontSize   = 18;
                    tbTitle.FontWeight = FontWeights.Bold;
                    tbTitle.Margin     = new Thickness(10, 5, 10, 10);
                    tbTitle.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);
                    stackResults.Children.Add(tbTitle);

                    bool artistMatched = resultList.Where(item => item.Artist == input).Count() > 0 ? true : false;

                    TextBlock tbArtists = new TextBlock();
                    tbArtists.Text       = "Artists";
                    tbArtists.FontSize   = 18;
                    tbArtists.FontWeight = FontWeights.Bold;
                    tbArtists.Margin     = new Thickness(10, 0, 10, 10);
                    tbArtists.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);
                    stackResults.Children.Add(tbArtists);

                    // display matched artist
                    if (artistMatched)
                    {
                        // show hardcoded metallica picture
                        if (input == "Metallica")
                        {
                            Image image = new Image();
                            image.Width  = 100;
                            image.Height = 100;
                            image.HorizontalAlignment = HorizontalAlignment.Left;
                            image.Stretch             = Stretch.UniformToFill;
                            image.Source = new BitmapImage(new Uri(@"https://upload.wikimedia.org/wikipedia/commons/0/07/Metallica_at_The_O2_Arena_London_2008.jpg"));

                            TextBlock label = new TextBlock();
                            label.Text                = input;
                            label.FontSize            = 15;
                            label.Foreground          = new SolidColorBrush(System.Windows.Media.Colors.White);
                            label.HorizontalAlignment = HorizontalAlignment.Left;

                            image.Margin = new Thickness(10, 5, 0, 0);
                            label.Margin = new Thickness(10, 5, 0, 0);
                            stackResults.Children.Add(image);
                            stackResults.Children.Add(label);
                            SearchScroller.Margin = new Thickness(-10, 200, 0, 0);
                            SearchScroller.Height = 400;
                        }
                        else
                        {
                            Rectangle image = new Rectangle();
                            image.Width  = 100;
                            image.Height = 100;
                            image.HorizontalAlignment = HorizontalAlignment.Left;
                            image.Fill = new SolidColorBrush(System.Windows.Media.Colors.ForestGreen);

                            TextBlock label = new TextBlock();
                            label.Text                = input;
                            label.FontSize            = 15;
                            label.Foreground          = new SolidColorBrush(System.Windows.Media.Colors.White);
                            label.HorizontalAlignment = HorizontalAlignment.Left;

                            image.Margin = new Thickness(10, 5, 0, 0);
                            label.Margin = new Thickness(10, 5, 0, 0);
                            stackResults.Children.Add(image);
                            stackResults.Children.Add(label);
                            SearchScroller.Margin = new Thickness(-10, 200, 0, 0);
                            SearchScroller.Height = 400;
                        }
                    }
                    else
                    {
                        TextBlock tbNoArtistsFound = new TextBlock();
                        tbNoArtistsFound.Text       = "No artists found";
                        tbNoArtistsFound.FontSize   = 14;
                        tbNoArtistsFound.FontWeight = FontWeights.Bold;
                        tbNoArtistsFound.Margin     = new Thickness(10, 0, 10, 10);
                        tbNoArtistsFound.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);
                        stackResults.Children.Add(tbNoArtistsFound);
                    }

                    // show search results
                    for (int i = 0; i < resultList.Count; i++)
                    {
                        Song          playlistSong = resultList[i];
                        RowDefinition rowDef       = new RowDefinition();
                        rowDef.Name = $"Row_{i}";
                        SearchList.RowDefinitions.Add(rowDef);
                        RowDefinitionCollection RowNames = SearchList.RowDefinitions;
                        Array RowArray = RowNames.ToArray();

                        // Add the play button to the Songlist grid
                        var PlayButton = new Button
                        {
                            Name     = $"__{playlistSong.SongID}",
                            Content  = "Play",
                            Margin   = new Thickness(5, 0, 0, 5),
                            FontSize = 15,
                            Tag      = playlistSong
                        };
                        Grid.SetRow(PlayButton, i);
                        Grid.SetColumn(PlayButton, 0);
                        PlayButton.Click += PlaySongFromSearch;

                        // Add the Songname text block to the Songlist grid
                        var SongBlockName = new TextBlock
                        {
                            Name       = $"_{playlistSong.SongID}",
                            Text       = $"{playlistSong.SongName}",
                            Foreground = whiteText,
                            Margin     = SongBlockThickness,
                            FontSize   = 15
                        };
                        Grid.SetRow(SongBlockName, i);
                        Grid.SetColumn(SongBlockName, 1);

                        // Add the artist text block to the Songlist grid
                        var SongBlockArtist = new TextBlock
                        {
                            Name       = $"_{playlistSong.SongID}",
                            Text       = $"{playlistSong.Artist}",
                            Foreground = whiteText,
                            Margin     = SongBlockThickness,
                            FontSize   = 15
                        };
                        Grid.SetRow(SongBlockArtist, i);
                        Grid.SetColumn(SongBlockArtist, 2);

                        // Add the album text block to the Songlist grid
                        var SongBlockAlbum = new TextBlock
                        {
                            Name       = $"_{playlistSong.SongID}",
                            Text       = $"{playlistSong.Album}",
                            Foreground = whiteText,
                            Margin     = SongBlockThickness,
                            FontSize   = 15
                        };
                        Grid.SetRow(SongBlockAlbum, i);
                        Grid.SetColumn(SongBlockAlbum, 3);

                        // Add the year text block to the Songlist grid
                        var SongBlockYear = new TextBlock
                        {
                            Name       = $"_{playlistSong.SongID}",
                            Text       = $"{playlistSong.Year}",
                            Foreground = whiteText,
                            Margin     = SongBlockThickness,
                            FontSize   = 15
                        };
                        Grid.SetRow(SongBlockYear, i);
                        Grid.SetColumn(SongBlockYear, 4);

                        // Add the elements to the Songlist grid Children collection
                        SearchList.Children.Add(PlayButton);
                        SearchList.Children.Add(SongBlockName);
                        SearchList.Children.Add(SongBlockArtist);
                        SearchList.Children.Add(SongBlockAlbum);
                        SearchList.Children.Add(SongBlockYear);

                        ContextMenu menu = new ContextMenu();
                        menu.Background = new SolidColorBrush(System.Windows.Media.Colors.Black);
                        menu.Foreground = new SolidColorBrush(System.Windows.Media.Colors.White);

                        SearchList.MouseRightButtonDown += new MouseButtonEventHandler(SongContextMenuOpening);
                    }
                }
                else
                {
                    tbMessage.Text = "Please type in search criteria";
                    stackResults.Children.Add(tbMessage);
                }
            }
            else
            {
                tbMessage.Text = "No results found";
                stackResults.Children.Add(tbMessage);
            }
        }
Ejemplo n.º 33
0
        private static RowDefinitionCollection InitRowDefinitionCollectionByCount(int trailsCount)
        {
            var rowDefinitionsCollection = new RowDefinitionCollection();
            for (int i = 0; i < trailsCount; i++)
            {
                rowDefinitionsCollection.Add(new RowDefinition { Height = 200 });
            }
            rowDefinitionsCollection.Add(new RowDefinition { Height = 50 });

            return rowDefinitionsCollection;
        }
Ejemplo n.º 34
0
        private void DrawGrid()
        {
            UIElementCollection childs = ControlHandler.GetPropertyValue(this.NumberRectangle, "Children") as UIElementCollection;

            ControlHandler.ExecuteMethod(childs, "Clear");

            RowDefinitionCollection rowdefs = ControlHandler.GetPropertyValue(this.NumberRectangle, "RowDefinitions") as RowDefinitionCollection;

            ControlHandler.ExecuteMethod(rowdefs, "Clear");

            ColumnDefinitionCollection coldefs = ControlHandler.GetPropertyValue(this.NumberRectangle, "ColumnDefinitions") as ColumnDefinitionCollection;

            ControlHandler.ExecuteMethod(coldefs, "Clear");

            for (int i = 0; i < this.Rows + this.Rows - 1; i++)
            {
                GridLength gl = GridLength.Auto;
                if (i % 2 == 0)
                {
                    gl = (GridLength)ControlHandler.CreateObject(typeof(GridLength), new Type[] { typeof(double), typeof(GridUnitType) }, new object[] { 1.0 / this.Rows, GridUnitType.Star });
                }
                else
                {
                    gl = (GridLength)ControlHandler.CreateObject(typeof(GridLength), new Type[] { typeof(double), typeof(GridUnitType) }, new object[] { 1, GridUnitType.Pixel });
                    //rd.Height = new GridLength();
                    //Rectangle rect = new Rectangle();
                    //rect.Height = 1.0;
                    //rect.Fill = Brushes.Black;
                    //Grid.SetColumnSpan(rect, this.Columns + this.Columns - 1);
                    //Grid.SetRow(rect, i);
                    //this.NumberRectangle.Children.Add(rect);
                }
                RowDefinition rd = ControlHandler.CreateObject(typeof(RowDefinition)) as RowDefinition;
                ControlHandler.SetPropertyValue(rd, "Height", gl);
                ControlHandler.ExecuteMethod(rowdefs, "Add", new object[] { rd });

                //this.NumberRectangle.RowDefinitions.Add(rd);
            }

            for (int i = 0; i < this.Columns + this.Columns - 1; i++)
            {
                GridLength gl = GridLength.Auto;
                if (i % 2 == 0)
                {
                    gl = (GridLength)ControlHandler.CreateObject(typeof(GridLength), new Type[] { typeof(double), typeof(GridUnitType) }, new object[] { 1.0 / this.Columns, GridUnitType.Star });
                }
                else
                {
                    gl = (GridLength)ControlHandler.CreateObject(typeof(GridLength), new Type[] { typeof(double), typeof(GridUnitType) }, new object[] { 1, GridUnitType.Pixel });
                    //Rectangle rect = new Rectangle();
                    //rect.Width = 1.0;
                    //rect.Fill = Brushes.Black;
                    //Grid.SetRowSpan(rect, this.Rows + this.Rows - 1);
                    //Grid.SetColumn(rect, i);
                    //this.NumberRectangle.Children.Add(rect);
                }
                ColumnDefinition cd = ControlHandler.CreateObject(typeof(ColumnDefinition)) as ColumnDefinition;
                ControlHandler.SetPropertyValue(cd, "Width", gl);

                ControlHandler.ExecuteMethod(coldefs, "Add", new object[] { cd });
            }
        }
Ejemplo n.º 35
0
        public void BuildDisplay()
        {
            Grid commodityMarketGrid = new Grid();
            Grid marketContentGrid   = new Grid();

            commodityMarketGrid.Width  = 1186;
            commodityMarketGrid.Height = 792;

            marketContentGrid.Width  = 1186;
            marketContentGrid.Height = 720;

            double[] rowSize    = { 1, 10 };
            double[] columnSize = { 360, 90, 90, 90, 145, 30, 145, 30, 175 };

            RowDefinitionCollection    contentRowDefCollection = marketContentGrid.RowDefinitions;
            ColumnDefinitionCollection contentColDefCollection = marketContentGrid.ColumnDefinitions;

            RowDefinitionCollection    marketRowDefCollection = commodityMarketGrid.RowDefinitions;
            ColumnDefinitionCollection marketColDefCollection = commodityMarketGrid.ColumnDefinitions;

            Rectangle[] backFill = new Rectangle[18];

            TextBox[] commodityName = new TextBox[18];
            TextBox[] sellPrice     = new TextBox[18];
            TextBox[] buyPrice      = new TextBox[18];
            TextBox[] amount        = new TextBox[18];
            TextBox[] demand        = new TextBox[18];
            TextBox[] supply        = new TextBox[18];

            TextBox commodityNameTitle = new TextBox();
            TextBox sellTitle          = new TextBox();
            TextBox buyTitle           = new TextBox();
            TextBox amountTitle        = new TextBox();
            TextBox demandTitle        = new TextBox();
            TextBox supplyTitle        = new TextBox();
            TextBox dropTitle          = new TextBox();

            TextBox commodityItem  = new TextBox();
            TextBox commodityGroup = new TextBox();

            TextBox sellToMarket  = new TextBox();
            TextBox buyFromMarket = new TextBox();

            TextBox sellDisplay = new TextBox();
            TextBox buyDisplay  = new TextBox();

            TextBox time = new TextBox();
            TextBox date = new TextBox();

            commodityNameTitle.Height = 70;
            commodityNameTitle.Width  = 360;
            commodityNameTitle.Margin = new Thickness(0, 0, 0, 0);
            commodityNameTitle.VerticalContentAlignment   = VerticalAlignment.Bottom;
            commodityNameTitle.HorizontalContentAlignment = HorizontalAlignment.Left;
            commodityNameTitle.Padding         = new Thickness(2, 0, 0, 0);
            commodityNameTitle.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
            commodityNameTitle.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            commodityNameTitle.BorderThickness = new Thickness(0);
            commodityNameTitle.IsReadOnly      = true;
            commodityNameTitle.Focusable       = false;

            commodityNameTitle.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            commodityNameTitle.FontWeight = FontWeights.Bold;
            commodityNameTitle.FontSize   = 18.75;

            commodityNameTitle.Text = "GOODS";

            stage.Children.Add(commodityNameTitle);

            sellTitle.Height = 70;
            sellTitle.Width  = 90;
            sellTitle.Margin = new Thickness(370, 0, 0, 0);
            sellTitle.VerticalContentAlignment   = VerticalAlignment.Bottom;
            sellTitle.HorizontalContentAlignment = HorizontalAlignment.Left;
            sellTitle.Padding         = new Thickness(2, 0, 0, 0);
            sellTitle.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
            sellTitle.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            sellTitle.BorderThickness = new Thickness(0);
            sellTitle.IsReadOnly      = true;
            sellTitle.Focusable       = false;

            sellTitle.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            sellTitle.FontWeight = FontWeights.Bold;
            sellTitle.FontSize   = 18.75;

            sellTitle.Text = "SELL";

            Line gridline = new Line();

            gridline.StrokeThickness = 1;
            gridline.Stroke          = new SolidColorBrush(Color.FromArgb(0xFF, 0x7E, 0x2F, 0x0B));

            gridline.X1 = gridline.X2 = 370;
            gridline.Y1 = 70;
            gridline.Y2 = 796;

            stage.Children.Add(gridline);
            stage.Children.Add(sellTitle);

            buyTitle.Height = 70;
            buyTitle.Width  = 90;
            buyTitle.Margin = new Thickness(465, 0, 0, 0);
            buyTitle.VerticalContentAlignment   = VerticalAlignment.Bottom;
            buyTitle.HorizontalContentAlignment = HorizontalAlignment.Left;
            buyTitle.Padding         = new Thickness(2, 0, 0, 0);
            buyTitle.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
            buyTitle.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            buyTitle.BorderThickness = new Thickness(0);
            buyTitle.IsReadOnly      = true;
            buyTitle.Focusable       = false;

            buyTitle.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            buyTitle.FontWeight = FontWeights.Bold;
            buyTitle.FontSize   = 18.75;

            buyTitle.Text = "BUY";

            gridline = new Line();
            gridline.StrokeThickness = 1;
            gridline.Stroke          = new SolidColorBrush(Color.FromArgb(0xFF, 0x7E, 0x2F, 0x0B));

            gridline.X1 = gridline.X2 = 465;
            gridline.Y1 = 70;
            gridline.Y2 = 796;

            stage.Children.Add(gridline);
            stage.Children.Add(buyTitle);

            amountTitle.Height = 70;
            amountTitle.Width  = 90;
            amountTitle.Margin = new Thickness(555, 0, 0, 0);
            amountTitle.VerticalContentAlignment   = VerticalAlignment.Bottom;
            amountTitle.HorizontalContentAlignment = HorizontalAlignment.Left;
            amountTitle.Padding         = new Thickness(2, 0, 0, 0);
            amountTitle.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
            amountTitle.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            amountTitle.BorderThickness = new Thickness(0);
            amountTitle.IsReadOnly      = true;
            amountTitle.Focusable       = false;

            amountTitle.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            amountTitle.FontWeight = FontWeights.Bold;
            amountTitle.FontSize   = 18.75;

            amountTitle.Text = "CARGO";

            gridline = new Line();
            gridline.StrokeThickness = 1;
            gridline.Stroke          = new SolidColorBrush(Color.FromArgb(0xFF, 0x7E, 0x2F, 0x0B));

            gridline.X1 = gridline.X2 = 555;
            gridline.Y1 = 70;
            gridline.Y2 = 796;

            stage.Children.Add(gridline);
            stage.Children.Add(amountTitle);

            demandTitle.Height = 70;
            demandTitle.Width  = 90;
            demandTitle.Margin = new Thickness(650, 0, 0, 0);
            demandTitle.VerticalContentAlignment   = VerticalAlignment.Bottom;
            demandTitle.HorizontalContentAlignment = HorizontalAlignment.Left;
            demandTitle.Padding         = new Thickness(2, 0, 0, 0);
            demandTitle.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
            demandTitle.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            demandTitle.BorderThickness = new Thickness(0);
            demandTitle.IsReadOnly      = true;
            demandTitle.Focusable       = false;

            demandTitle.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            demandTitle.FontWeight = FontWeights.Bold;
            demandTitle.FontSize   = 18.75;

            demandTitle.Text = "DEMAND";

            gridline = new Line();
            gridline.StrokeThickness = 1;
            gridline.Stroke          = new SolidColorBrush(Color.FromArgb(0xFF, 0x7E, 0x2F, 0x0B));

            gridline.X1 = gridline.X2 = 650;
            gridline.Y1 = 70;
            gridline.Y2 = 796;

            stage.Children.Add(gridline);
            stage.Children.Add(demandTitle);

            supplyTitle.Height = 70;
            supplyTitle.Width  = 90;
            supplyTitle.Margin = new Thickness(830, 0, 0, 0);
            supplyTitle.VerticalContentAlignment   = VerticalAlignment.Bottom;
            supplyTitle.HorizontalContentAlignment = HorizontalAlignment.Left;
            supplyTitle.Padding         = new Thickness(2, 0, 0, 0);
            supplyTitle.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
            supplyTitle.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            supplyTitle.BorderThickness = new Thickness(0);
            supplyTitle.IsReadOnly      = true;
            supplyTitle.Focusable       = false;

            supplyTitle.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            supplyTitle.FontWeight = FontWeights.Bold;
            supplyTitle.FontSize   = 18.75;

            supplyTitle.Text = "supply";

            gridline = new Line();
            gridline.StrokeThickness = 1;
            gridline.Stroke          = new SolidColorBrush(Color.FromArgb(0xFF, 0x7E, 0x2F, 0x0B));

            gridline.X1 = gridline.X2 = 830;
            gridline.Y1 = 70;
            gridline.Y2 = 796;

            stage.Children.Add(gridline);
            stage.Children.Add(supplyTitle);

            gridline = new Line();
            gridline.StrokeThickness = 1;
            gridline.Stroke          = new SolidColorBrush(Color.FromArgb(0xFF, 0x7E, 0x2F, 0x0B));

            gridline.X1 = gridline.X2 = 1010;
            gridline.Y1 = 70;
            gridline.Y2 = 796;

            stage.Children.Add(gridline);

            for (int column = 0; column < columnSize.Length; column++)
            {
                ColumnDefinition columnDefinition = new ColumnDefinition();
                columnDefinition.Width = new GridLength(columnSize[column], GridUnitType.Star);

                contentColDefCollection.Add(columnDefinition);
            }

            for (int row = 0; row < 18; row++)
            {
                RowDefinition rowDefinition = new RowDefinition();
                rowDefinition.Height = new GridLength(1.0, GridUnitType.Star);

                contentRowDefCollection.Add(rowDefinition);

                commodityName[row] = new TextBox();
                sellPrice[row]     = new TextBox();
                buyPrice[row]      = new TextBox();
                amount[row]        = new TextBox();
                demand[row]        = new TextBox();
                supply[row]        = new TextBox();

                backFill[row]        = new Rectangle();
                backFill[row].Fill   = new SolidColorBrush(Color.FromArgb(0x7F, 0x4F, 0x1A, 0x0B));
                backFill[row].Height = 30;

                Grid.SetRow(backFill[row], row);
                Grid.SetColumnSpan(backFill[row], 9);

                marketContentGrid.Children.Add(backFill[row]);

                commodityName[row].Height = 30;
                commodityName[row].Width  = 370;

                commodityName[row].VerticalContentAlignment = VerticalAlignment.Center;
                commodityName[row].Padding = new Thickness(45, 0, 0, 0);

                commodityName[row].FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
                commodityName[row].FontSize   = 20.75;

                commodityName[row].Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
                commodityName[row].Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
                commodityName[row].BorderThickness = new Thickness(0);
                commodityName[row].IsReadOnly      = true;
                commodityName[row].Focusable       = false;
                commodityName[row].Text            = "commodity name";

                Grid.SetRow(commodityName[row], row);
                Grid.SetColumn(commodityName[row], 0);

                marketContentGrid.Children.Add(commodityName[row]);

                sellPrice[row].Height = 30;
                sellPrice[row].Width  = 90;

                sellPrice[row].VerticalContentAlignment   = VerticalAlignment.Center;
                sellPrice[row].HorizontalContentAlignment = HorizontalAlignment.Right;
                sellPrice[row].Padding = new Thickness(0, 0, 5, 0);

                sellPrice[row].FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
                sellPrice[row].FontSize   = 20.75;

                sellPrice[row].Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
                sellPrice[row].Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
                sellPrice[row].BorderThickness = new Thickness(0);
                sellPrice[row].IsReadOnly      = true;
                sellPrice[row].Focusable       = false;
                sellPrice[row].Text            = "000";

                Grid.SetRow(sellPrice[row], row);
                Grid.SetColumn(sellPrice[row], 1);

                marketContentGrid.Children.Add(sellPrice[row]);

                buyPrice[row].Height = 30;
                buyPrice[row].Width  = 90;

                buyPrice[row].VerticalContentAlignment   = VerticalAlignment.Center;
                buyPrice[row].HorizontalContentAlignment = HorizontalAlignment.Right;
                buyPrice[row].Padding = new Thickness(0, 0, 5, 0);

                buyPrice[row].FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
                buyPrice[row].FontSize   = 20.75;

                buyPrice[row].Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
                buyPrice[row].Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
                buyPrice[row].BorderThickness = new Thickness(0);
                buyPrice[row].IsReadOnly      = true;
                buyPrice[row].Focusable       = false;
                buyPrice[row].Text            = "000";

                Grid.SetRow(buyPrice[row], row);
                Grid.SetColumn(buyPrice[row], 2);

                marketContentGrid.Children.Add(buyPrice[row]);

                amount[row].Height = 30;
                amount[row].Width  = 90;

                amount[row].VerticalContentAlignment   = VerticalAlignment.Center;
                amount[row].HorizontalContentAlignment = HorizontalAlignment.Right;
                amount[row].Padding = new Thickness(0, 0, 5, 0);

                amount[row].FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
                amount[row].FontSize   = 20.75;

                amount[row].Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
                amount[row].Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
                amount[row].BorderThickness = new Thickness(0);
                amount[row].IsReadOnly      = true;
                amount[row].Focusable       = false;
                amount[row].Text            = "-";

                Grid.SetRow(amount[row], row);
                Grid.SetColumn(amount[row], 3);

                marketContentGrid.Children.Add(amount[row]);

                demand[row].Height = 30;
                demand[row].Width  = 145;

                demand[row].VerticalContentAlignment   = VerticalAlignment.Center;
                demand[row].HorizontalContentAlignment = HorizontalAlignment.Right;
                demand[row].Padding = new Thickness(0, 0, 5, 0);

                demand[row].FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
                demand[row].FontSize   = 20.75;

                demand[row].Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
                demand[row].Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
                demand[row].BorderThickness = new Thickness(0);
                demand[row].IsReadOnly      = true;
                demand[row].Focusable       = false;
                demand[row].Text            = "000,000";

                Grid.SetRow(demand[row], row);
                Grid.SetColumn(demand[row], 4);

                marketContentGrid.Children.Add(demand[row]);

                Rectangle RecD1 = new Rectangle();
                Rectangle RecD2 = new Rectangle();
                Rectangle RecD3 = new Rectangle();

                RecD1.Width  = RecD2.Width = RecD3.Width = 20;
                RecD1.Height = RecD2.Height = RecD3.Height = 6;

                RecD1.Margin = new Thickness(0, 0, 5, 18);
                RecD2.Margin = new Thickness(0, 0, 5, 0);
                RecD3.Margin = new Thickness(0, 18, 5, 0);

                RecD1.Stroke = RecD2.Stroke = RecD3.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
                RecD1.Fill   = RecD2.Fill = RecD3.Fill = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
                Grid.SetRow(RecD1, row);
                Grid.SetColumn(RecD1, 5);

                Grid.SetRow(RecD2, row);
                Grid.SetColumn(RecD2, 5);

                Grid.SetRow(RecD3, row);
                Grid.SetColumn(RecD3, 5);

                marketContentGrid.Children.Add(RecD1);
                marketContentGrid.Children.Add(RecD2);
                marketContentGrid.Children.Add(RecD3);

                supply[row].Height = 30;
                supply[row].Width  = 145;

                supply[row].VerticalContentAlignment   = VerticalAlignment.Center;
                supply[row].HorizontalContentAlignment = HorizontalAlignment.Right;
                supply[row].Padding = new Thickness(0, 0, 5, 0);

                supply[row].FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
                supply[row].FontSize   = 20.75;

                supply[row].Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
                supply[row].Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
                supply[row].BorderThickness = new Thickness(0);
                supply[row].IsReadOnly      = true;
                supply[row].Focusable       = false;
                supply[row].Text            = "000,000";

                Grid.SetRow(supply[row], row);
                Grid.SetColumn(supply[row], 6);

                marketContentGrid.Children.Add(supply[row]);

                Rectangle RecS1 = new Rectangle();
                Rectangle RecS2 = new Rectangle();
                Rectangle RecS3 = new Rectangle();

                RecS1.Width  = RecS2.Width = RecS3.Width = 20;
                RecS1.Height = RecS2.Height = RecS3.Height = 6;

                RecS1.Margin = new Thickness(0, 0, 5, 18);
                RecS2.Margin = new Thickness(0, 0, 5, 0);
                RecS3.Margin = new Thickness(0, 18, 5, 0);

                RecS1.StrokeThickness = RecS2.StrokeThickness = RecS3.StrokeThickness = 0.5;
                RecS1.Stroke          = RecS2.Stroke = RecS3.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
                RecS1.Fill            = RecS2.Fill = RecS3.Fill = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));

                Grid.SetRow(RecS1, row);
                Grid.SetColumn(RecS1, 7);

                Grid.SetRow(RecS2, row);
                Grid.SetColumn(RecS2, 7);

                Grid.SetRow(RecS3, row);
                Grid.SetColumn(RecS3, 7);

                marketContentGrid.Children.Add(RecS1);
                marketContentGrid.Children.Add(RecS2);
                marketContentGrid.Children.Add(RecS3);
            }


            commodityItem.Height = 45;
            commodityItem.Width  = 400;

            commodityItem.VerticalContentAlignment = VerticalAlignment.Center;
            commodityItem.Padding    = new Thickness(5, 0, 0, 0);
            commodityItem.Margin     = new Thickness(1320, 0, 0, 0);
            commodityItem.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            commodityItem.FontSize   = 32.75;

            commodityItem.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
            commodityItem.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            commodityItem.BorderThickness = new Thickness(0);
            commodityItem.FontWeight      = FontWeights.Bold;
            commodityItem.IsReadOnly      = true;
            commodityItem.Focusable       = false;
            commodityItem.Text            = "commodities Item";

            stage.Children.Add(commodityItem);

            commodityGroup.Height = 45;
            commodityGroup.Width  = 400;

            commodityGroup.VerticalContentAlignment = VerticalAlignment.Center;
            commodityGroup.Padding    = new Thickness(5, 0, 0, 0);
            commodityGroup.Margin     = new Thickness(1320, 35, 0, 0);
            commodityGroup.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            commodityGroup.FontSize   = 21.5;

            commodityGroup.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));
            commodityGroup.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            commodityGroup.BorderThickness = new Thickness(0);
            commodityGroup.IsReadOnly      = true;
            commodityGroup.Focusable       = false;
            commodityGroup.Text            = "industrial materials";

            stage.Children.Add(commodityGroup);

            sellToMarket.Height = 45;
            sellToMarket.Width  = 400;

            sellToMarket.VerticalContentAlignment = VerticalAlignment.Center;
            sellToMarket.Padding    = new Thickness(5, 0, 0, 0);
            sellToMarket.Margin     = new Thickness(1265, 85, 0, 0);
            sellToMarket.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            sellToMarket.FontSize   = 21.5;

            sellToMarket.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0x66, 0x2A, 0x0B));
            sellToMarket.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            sellToMarket.BorderThickness = new Thickness(0);
            sellToMarket.IsReadOnly      = true;
            sellToMarket.Focusable       = false;
            sellToMarket.Text            = "sell to market";

            stage.Children.Add(sellToMarket);

            sellDisplay.Height = 45;
            sellDisplay.Width  = 215;

            sellDisplay.VerticalContentAlignment   = VerticalAlignment.Center;
            sellDisplay.HorizontalContentAlignment = HorizontalAlignment.Right;

            sellDisplay.Padding    = new Thickness(0, 0, 0, 0);
            sellDisplay.Margin     = new Thickness(1260, 120, 0, 0);
            sellDisplay.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            sellDisplay.FontSize   = 32.75;

            sellDisplay.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0x4F, 0x4F, 0x4F));
            sellDisplay.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            sellDisplay.BorderThickness = new Thickness(0);
            sellDisplay.FontWeight      = FontWeights.Bold;
            sellDisplay.IsReadOnly      = true;
            sellDisplay.Focusable       = false;
            sellDisplay.Text            = "000,000 cr";

            stage.Children.Add(sellDisplay);

            buyFromMarket.Height = 45;
            buyFromMarket.Width  = 400;

            buyFromMarket.VerticalContentAlignment = VerticalAlignment.Center;
            buyFromMarket.Padding    = new Thickness(5, 0, 0, 0);
            buyFromMarket.Margin     = new Thickness(1500, 85, 0, 0);
            buyFromMarket.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            buyFromMarket.FontSize   = 21.5;

            buyFromMarket.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0x66, 0x2A, 0x0B));
            buyFromMarket.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            buyFromMarket.BorderThickness = new Thickness(0);
            buyFromMarket.IsReadOnly      = true;
            buyFromMarket.Focusable       = false;
            buyFromMarket.Text            = "buy from market";

            stage.Children.Add(buyFromMarket);

            buyDisplay.Height = 45;
            buyDisplay.Width  = 215;

            buyDisplay.VerticalContentAlignment   = VerticalAlignment.Center;
            buyDisplay.HorizontalContentAlignment = HorizontalAlignment.Right;

            buyDisplay.Padding    = new Thickness(0, 0, 0, 0);
            buyDisplay.Margin     = new Thickness(1500, 120, 0, 0);
            buyDisplay.FontFamily = new FontFamily(new Uri("pack://application:,,,/Resources/"), "./#Euro Caps");
            buyDisplay.FontSize   = 32.75;

            buyDisplay.Foreground      = new SolidColorBrush(Color.FromArgb(0xFF, 0x4F, 0x4F, 0x4F));
            buyDisplay.Background      = new SolidColorBrush(Color.FromArgb(0x00, 0x00, 0x00, 0x00));
            buyDisplay.BorderThickness = new Thickness(0);
            buyDisplay.FontWeight      = FontWeights.Bold;
            buyDisplay.IsReadOnly      = true;
            buyDisplay.Focusable       = false;
            buyDisplay.Text            = "000,000 cr";

            stage.Children.Add(buyDisplay);

            Line topLine    = new Line();
            Line bottomLine = new Line();

            topLine.X1 = 0;
            topLine.Y1 = 0;

            topLine.Y2 = topLine.Y1;
            topLine.X2 = 1184;

            topLine.StrokeThickness = 2;

            topLine.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));

            bottomLine.X1 = 0;
            bottomLine.Y1 = 70;

            bottomLine.Y2 = bottomLine.Y1;
            bottomLine.X2 = 1184;

            bottomLine.StrokeThickness = 2;

            bottomLine.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xF4, 0x6B, 0x0B));

            Line panelTopLine = new Line();

            panelTopLine.X1 = 1250;
            panelTopLine.X2 = 1730;

            panelTopLine.Y1              = panelTopLine.Y2 = 0;
            panelTopLine.Stroke          = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x76, 0x10));
            panelTopLine.StrokeThickness = 2;

            stage.Children.Add(panelTopLine);

            stage.Children.Add(topLine);
            stage.Children.Add(bottomLine);

            Grid.SetRow(marketContentGrid, 1);

            MasterGrid.Children.Add(marketContentGrid);
        }
Ejemplo n.º 36
0
        public FinalPage(MainModel mainModel)
        {
            _MainModel = mainModel;
            BindingContext = _MainModel;

            Title = "Итоговое обращение";

            var photosCount = _MainModel.selectedPhotos.Count();
            var rows = new RowDefinitionCollection() { };

            for (var i = 0; i < photosCount; i += 3)
                rows.Add(new RowDefinition { Height = 80 });

            Grid photoGrid = new Grid
            {
                RowDefinitions = rows,
                ColumnDefinitions =
                {
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }
                }
            };
                

            var photosId = 0;
            for (var i = 0; i < photoGrid.RowDefinitions.Count(); i++)
                for (var j = 0; j < photoGrid.ColumnDefinitions.Count(); j++)
                {
                    var tapGestureRecognizer = new TapGestureRecognizer();
                    tapGestureRecognizer.Tapped += async (s, e) => {
                        Pages.FullImagePage fullImagePage = new Pages.FullImagePage(new Photo() { Image = ((Image)s).Source });
                        await Navigation.PushAsync(fullImagePage);
                    };

                    Image image = new Image { Source = _MainModel.selectedPhotos[photosId].Image };
                    image.GestureRecognizers.Add(tapGestureRecognizer);

                    photoGrid.Children.Add(new Frame { Content = image, BorderColor = Color.FromRgb(10, 10, 10), Padding = 1 }, j, i );
                    photosId++;
                    if (photosId == photosCount) break;
                }

            photoGrid.RowSpacing = 0;
            photoGrid.ColumnSpacing = 0;

            Button finalButton = new Button() { Text = "Сохранить и продолжить" };
            finalButton.Clicked += FinalButtonClicked;

            Content = new StackLayout
            {
                Children =
                {
                    new ScrollView
                    {
                        Content = new StackLayout
                        {
                            Children =
                            {
                                new Label { Text = "ФИО:", Margin = 0, Padding = 0, FontSize = 22, TextColor = Color.Black },
                                new Label { Text = "Имя: " + _MainModel.selectedProfile.Name, Margin = 0, Padding = 0, FontSize = 22 },
                                new Label { Text = "Фамилия: " + _MainModel.selectedProfile.Surname, Margin = 0, Padding = 0, FontSize = 22 },
                                new Label { Text = "Отчество: " + _MainModel.selectedProfile.Patronymic, Margin = new Thickness(0, 0, 0, 15), Padding = 0, FontSize = 22 },
                                new Label { Text = "Контактная информация:", Margin = 0, Padding = 0, FontSize = 22, TextColor = Color.Black },
                                new Label { Text = "Email: " + _MainModel.selectedProfile.Email, Margin = 0, Padding = 0, FontSize = 18 },
                                new Label { Text = "Телефон: " + _MainModel.selectedProfile.Phone, Margin = new Thickness(0, 0, 0, 10), Padding = 0, FontSize = 18 },
                                new Label { Text = "Регион: " + _MainModel.selectedProfile.Region, Margin = 0, Padding = 0, FontSize = 18 },
                                new Label { Text = "Отделение: " + _MainModel.selectedProfile.Division, Margin = 0, Padding = 0, FontSize = 18 },
                                new Label { Text = "Регион происшествия: " + _MainModel.selectedProfile.EvsRegion, Margin = 0, Padding = 0, FontSize = 18 },
                                new Label { Text = "Текст обращения:", Margin = new Thickness(0, 15, 0, 0), Padding = 0, FontSize = 22, TextColor = Color.Black },
                                new Label { Text = _MainModel.selectedAppeal.Text, Margin = new Thickness(0, 5, 0, 15), Padding = 0, FontSize = 20 },
                                new Label { Text = "Загруженные изображения:", Margin = new Thickness(0, 15, 0, 5), Padding = 0, FontSize = 22, TextColor = Color.Black },
                                photoGrid
                            },
                            Spacing = 0
                        }
                    },
                    finalButton
                },
                Padding = 15
            };
        }
Ejemplo n.º 37
0
 /// <summary>
 /// Initializes a new instance of Grid.
 /// </summary>
 public Grid()
 {
     this.columnDefinitions = new ColumnDefinitionCollection(this);
     this.rowDefinitions = new RowDefinitionCollection(this);
     this.Children.CollectionChanged += this.Children_CollectionChanged;
 }
Ejemplo n.º 38
0
 public TablePage()
 {
     InitializeComponent();
     GridTable.Padding = new Thickness(1);
     ColumnCollection  = new ColumnDefinitionCollection();
     RowCollection     = new RowDefinitionCollection();
     for (int i = 0; i < 20; i++)
     {
         ColumnCollection.Add(new ColumnDefinition()
         {
             Width = 80
         });
         RowCollection.Add(new RowDefinition()
         {
             Height = 40
         });
     }
     GridTable.ColumnDefinitions = ColumnCollection;
     GridTable.RowDefinitions    = RowCollection;
     for (int i = 0; i < 20; i++)
     {
         for (int j = 0; j < 20; j++)
         {
             if (i == 0 && j == 0)
             {
                 GridTable.Children.Add(new Label()
                 {
                     BackgroundColor = Color.FromHex("#f6f0ec"),
                 }, i, j);
             }
             else if (i == 0)
             {
                 var month = DateTime.Now.Month + j;
                 if (month % 12 > 0)
                 {
                     month = month % 12;
                 }
                 else
                 {
                     month = 12;
                 }
                 var date = new DateTime(2016, month, 17);
                 GridTable.Children.Add(new Label()
                 {
                     Text              = date.ToString("MMM-dd"),
                     BackgroundColor   = Color.FromHex("#f6f0ec"),
                     VerticalOptions   = LayoutOptions.Fill,
                     HorizontalOptions = LayoutOptions.Fill,
                 }, i, j);
             }
             else if (j == 0)
             {
                 GridTable.Children.Add(new Entry()
                 {
                     Text              = string.Format("test{0}_{1}", i, j),
                     BackgroundColor   = Color.FromHex("#f6f0ec"),
                     VerticalOptions   = LayoutOptions.Fill,
                     HorizontalOptions = LayoutOptions.Fill,
                 }, i, j);
             }
             else
             {
                 GridTable.Children.Add(new Entry()
                 {
                     Text              = (i + j).ToString(),
                     Keyboard          = Keyboard.Numeric,
                     BackgroundColor   = Color.White,
                     VerticalOptions   = LayoutOptions.Fill,
                     HorizontalOptions = LayoutOptions.Fill,
                 }, i, j);
             }
         }
     }
 }
Ejemplo n.º 39
0
 static void \u202E‪‎‏‭‏​‌‬‪‌‪‍‌‌​‬‌‌‫‬‪‏‍‮([In] RowDefinitionCollection obj0)
 {
     obj0.Clear();
 }