GetCustomerList() публичный статический Метод

public static GetCustomerList ( int count ) : IList
count int
Результат IList
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.flexGrid.ItemsSource = Customer.GetCustomerList(100);

            this.flexGrid.ColumnHeaderFont  = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);
            this.flexGrid.SelectionChanged += (object sender, Xuni.iOS.FlexGrid.SelectionChangedEventArgs e) =>
            {
                this.selectionCount.Title = "Selected: " + (this.flexGrid.Selection.ColumnSpan * this.flexGrid.Selection.RowSpan);
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.flexGrid.AutoGenerateColumns = false;
            this.flexGrid.ColumnHeaderFont    = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);

            GridColumn[] columns = new[] {
                new GridColumn {
                    Binding   = "Active",
                    Width     = 70,
                    WidthType = GridColumnWidth.Pixel
                }, new GridColumn {
                    Binding   = "Id",
                    Header    = "ID",
                    Width     = 100,
                    WidthType = GridColumnWidth.Pixel
                },
                new GridColumn {
                    Binding = "FirstName"
                },
                new GridColumn {
                    Binding = "LastName"
                },
                new GridColumn {
                    Binding = "OrderTotal", Format = "C2"
                },
                new GridColumn {
                    Binding = "CountryId",
                    Header  = "Country",
                    HeaderHorizontalAlignment = UITextAlignment.Left,
                    HorizontalAlignment       = UITextAlignment.Left,
                    DataMap = new GridDataMap(
                        Array.ConvertAll(Customer._countries, (pair) => new CountryPair {
                        CountryId    = Array.IndexOf(Customer._countries, pair),
                        CountryTitle = pair.Key
                    }), new NSString("CountryId"), new NSString("CountryTitle"))
                },
                new GridColumn {
                    Binding = "LastOrderDate"
                },
                new GridColumn {
                    Binding   = "LastOrderDate",
                    Header    = "Last Order Time",
                    Formatter = new NSDateFormatter {
                        DateFormat = "hh:mm a"
                    }
                }
            };

            this.flexGrid.Columns.AddRange(columns);
            this.flexGrid.IsReadOnly  = false;
            this.flexGrid.ItemsSource = Customer.GetCustomerList(100);
        }
Пример #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // license
            Com.GrapeCity.Xuni.Core.LicenseManager.Key = License.Key;

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            this._flexGrid = FindViewById <FlexGrid>(Resource.Id.flexgrid);

            this._flexGrid.ItemsSource = Customer.GetCustomerList(50);

            this._flexGrid.CellFactory = new CustomCellFactory(this._flexGrid);

            this._flexGrid.Columns.GetColumn("Money").Format = "c";
            this._flexGrid.Columns.GetColumn("Hired").Format = "MM/dd/yyyy";
        }
Пример #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.flexGrid.ColumnHeaderFont = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);
            this.flexGrid.IsReadOnly       = true;
            this.flexGrid.ItemsSource      = Customer.GetCustomerList(100);

            this.flexGrid.SelectionChanged += (sender, e) => this.EditButton.Enabled = true;
            this.flexGrid.CellDoubleTapped += (sender, panel, range) => {
                InvokeInBackground(() => {
                    System.Threading.Thread.Sleep(500);

                    InvokeOnMainThread(() => {
                        if (sender.Selection.Row != -1)
                        {
                            this.doEdit(null);
                        }
                    });
                });
                return(false);
            };
        }
Пример #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.flexGrid.IsReadOnly       = true;
            this.flexGrid.FrozenRows       = 1;
            this.flexGrid.FrozenColumns    = 1;
            this.flexGrid.AllowMerging     = Xuni.iOS.FlexGrid.GridAllowMerging.Cells;
            this.flexGrid.ColumnHeaderFont = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);

            this.flexGrid.AutoGeneratingColumn += (FlexGrid sender, Xuni.iOS.Core.XuniPropertyInfo propertyInfo, GridColumn column) => {
                if (propertyInfo.Name.Equals("Country"))
                {
                    column.AllowMerging = true;
                }
                return(false);
            };

            this.flexGrid.ItemsSource = Customer.GetCustomerList(100);

            this.flexGrid.AutoSizeColumns();
        }
Пример #6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.flexGrid.ColumnHeaderFont    = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);
            this.flexGrid.AutoGenerateColumns = false;
            this.flexGrid.IsReadOnly          = true;

            GridColumn[] columns = new[] {
                new GridColumn {
                    Binding = "Active", WidthType = GridColumnWidth.Star, Width = 2
                },
                new GridColumn {
                    Binding = "FirstName", Header = "Name", WidthType = GridColumnWidth.Star, Width = 4
                },
                new GridColumn {
                    Binding = "OrderTotal", Format = "C", Aggregate = Xuni.iOS.Core.XuniAggregate.Sum, WidthType = GridColumnWidth.Star, Width = 4
                }
            };

            this.flexGrid.Columns.AddRange(columns);

            this.flexGrid.ItemsSource = Customer.GetCustomerList(100);
            this.flexGrid.CollectionView.GroupDescriptions.Add(new Xuni.iOS.Core.XuniPropertyGroupDescription("Country"));
        }
Пример #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.flexGrid.AutoGenerateColumns = false;
            this.flexGrid.ColumnHeaderFont    = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);
            this.flexGrid.IsReadOnly          = true;
            this.flexGrid.HeadersVisibility   = GridHeadersVisibility.Column;

            GridColumn[] columns = new[] { new GridColumn {
                                               Binding   = "FirstName",
                                               Header    = "First Name",
                                               Width     = 1,
                                               WidthType = GridColumnWidth.Star
                                           }, new GridColumn {
                                               Binding   = "LastName",
                                               Header    = "Last Name",
                                               Width     = 1,
                                               WidthType = GridColumnWidth.Star
                                           }, new GridColumn {
                                               Binding   = "OrderTotal",
                                               Header    = "Total",
                                               Width     = 1,
                                               WidthType = GridColumnWidth.Star,
                                               HeaderHorizontalAlignment = UITextAlignment.Center
                                           } };

            Array.ForEach(columns, (c) => this.flexGrid.Columns.Add(c));

            this.flexGrid.FormatItem += (FlexGrid sender, GridPanel panel, GridCellRange range, CoreGraphics.CGContext context) => {
                GridColumn c = sender.Columns[range.Col];
                if (c.Binding.Equals("OrderTotal") && panel.CellType == GridCellType.Cell)
                {
                    XuniRadialGauge rgauge = new XuniRadialGauge()
                    {
                        BackgroundColor = UIColor.Clear,
                        ShowText        = ShowText.None,
                        Thickness       = 0.6,
                        Min             = 0,
                        Max             = 100,
                        LoadAnimation   = null,
                        Value           = double.Parse(panel.GetCellData(range.Row, range.Col, false).ToString()) * (100.0 / 10000.0),
                        ShowRanges      = false
                    };

                    XuniGaugeRange[] ranges = new []
                    {
                        new XuniGaugeRange()
                        {
                            Min   = 0,
                            Max   = 40,
                            Color = new UIColor(0.133f, 0.694f, 0.298f, 1.0f)
                        },
                        new XuniGaugeRange()
                        {
                            Min   = 40,
                            Max   = 80,
                            Color = new UIColor(1.0f, 0.502f, 0.502f, 1.0f)
                        },
                        new XuniGaugeRange()
                        {
                            Min   = 80,
                            Max   = 100,
                            Color = new UIColor(0.0f, 0.635f, 0.91f, 1.0f)
                        }
                    };

                    rgauge.Ranges.AddRange(ranges);

                    CoreGraphics.CGRect rect = panel.GetCellRect(range.Row, range.Col);
                    rgauge.Frame = rect;

                    UIImage img = new UIImage(rgauge.GetImage());
                    img.Draw(rect);

                    return(true);
                }
                return(false);
            };


            this.flexGrid.ItemsSource = Customer.GetCustomerList(100);
        }
Пример #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.flexGrid.IsReadOnly       = true;
            this.flexGrid.ItemsSource      = Customer.GetCustomerList(100);
            this.flexGrid.ColumnHeaderFont = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);

            this.flexGrid.FormatItem += (Xuni.iOS.FlexGrid.FlexGrid sender, Xuni.iOS.FlexGrid.GridPanel panel, Xuni.iOS.FlexGrid.GridCellRange range, CoreGraphics.CGContext context) => {
                if (panel == sender.Cells)
                {
                    if (this.searchText.Text == null || this.searchText.Text.Length == 0 || (sender.EditRange != null && sender.EditRange.Intersects(range)))
                    {
                        return(false);
                    }

                    NSError             error = null;
                    NSRegularExpression regex = new NSRegularExpression(new NSString(this.searchText.Text), NSRegularExpressionOptions.CaseInsensitive, out error);

                    NSString data = new NSString(panel.GetCellData(range.Row, range.Col, true).ToString());


                    if (error == null)
                    {
                        NSMutableAttributedString attributedString = new NSMutableAttributedString(data);

                        regex.EnumerateMatches(data, 0, new NSRange(0, data.Length), (NSTextCheckingResult result, NSMatchingFlags flags, ref bool stop) =>
                        {
                            NSRange thisrange = result.Range;
                            UIStringAttributes stringAttributes = new UIStringAttributes();
                            stringAttributes.Font            = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);
                            stringAttributes.ForegroundColor = UIColor.Red;
                            attributedString.SetAttributes(stringAttributes, thisrange);
                        }
                                               );

                        CoreGraphics.CGRect t     = panel.GetCellRect(range.Row, range.Col);
                        CoreGraphics.CGSize sz    = attributedString.Size;
                        UITextAlignment     align = this.flexGrid.Columns[range.Col].HorizontalAlignment;

                        if (align == UITextAlignment.Right)
                        {
                            nfloat mod = t.Size.Width - sz.Width - 4;
                            if (mod < 4)
                            {
                                mod = 4;
                            }
                            t.Location = new CoreGraphics.CGPoint(t.Location.X + mod, t.Location.Y);
                        }
                        else if (align == UITextAlignment.Center)
                        {
                            nfloat mod = (t.Size.Width - sz.Width) / 2;
                            if (mod < 4)
                            {
                                mod = 4;
                            }
                            t.Location = new CoreGraphics.CGPoint(t.Location.X + mod, t.Location.Y);
                        }
                        else
                        {
                            t.Location = new CoreGraphics.CGPoint(t.Location.X + 4, t.Location.Y);
                        }

                        nfloat mrg = (t.Size.Height - sz.Height) / 2;
                        if (mrg < 4)
                        {
                            mrg = 4;
                        }

                        t.Location = new CoreGraphics.CGPoint(t.Location.X, t.Location.Y + mrg);

                        attributedString.DrawString(t);

                        return(true);
                    }
                }

                return(false);
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.flexGrid.AutoGenerateColumns = false;
            this.flexGrid.IsReadOnly          = true;

            GridColumn id = new GridColumn {
                Binding   = "Id",
                Header    = "ID",
                Width     = 1,
                WidthType = GridColumnWidth.Star
            }, first = new GridColumn {
                Binding   = "FirstName",
                Header    = "First Name",
                Width     = 2,
                WidthType = GridColumnWidth.Star
            }, second = new GridColumn {
                Binding   = "LastName",
                Header    = "Last Name",
                Width     = 2,
                WidthType = GridColumnWidth.Star
            };

            this.flexGrid.Columns.Add(id);
            this.flexGrid.Columns.Add(first);
            this.flexGrid.Columns.Add(second);

            this.flexGrid.ItemsSource = Customer.GetCustomerList(100);

            this.flexGrid.ColumnHeaderFont = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);
            this.flexGrid.DetailProvider.DetailVisibilityMode = Xuni.iOS.FlexGrid.GridDetailVisibilityMode.ExpandSingle;


            this.flexGrid.DetailProvider.DetailCellCreating += (Xuni.iOS.FlexGrid.FlexGridDetailProvider sender, Xuni.iOS.FlexGrid.GridRow row) => {
                MapKit.MKMapView mapView = new MapKit.MKMapView();
                mapView.UserInteractionEnabled = false;

                CoreLocation.CLGeocoder geocoder = new CoreLocation.CLGeocoder();


                geocoder.GeocodeAddress(((Customer)row.DataItem).City, (CoreLocation.CLPlacemark[] placemarks, NSError error) => {
                    CoreLocation.CLPlacemark placemark = placemarks[placemarks.Length - 1];
                    float spanX = 0.0725f;
                    float spanY = 0.0725f;
                    MapKit.MKCoordinateRegion region = new MapKit.MKCoordinateRegion();
                    region.Center.Latitude           = placemark.Location.Coordinate.Latitude;
                    region.Center.Longitude          = placemark.Location.Coordinate.Longitude;
                    region.Span = new MapKit.MKCoordinateSpan(spanX, spanY);
                    mapView.SetRegion(region, false);
                });

                return(mapView);
            };


            this.flexGrid.DetailProvider.GridRowHeaderLoading += (Xuni.iOS.FlexGrid.FlexGridDetailProvider sender, Xuni.iOS.FlexGrid.GridRow row, UIButton DefaultButton) => {
                DefaultButton = new UIButton(UIButtonType.Custom);
                DefaultButton.SetImage(new UIImage("Images/show"), UIControlState.Normal);
                DefaultButton.SetImage(new UIImage("Images/hide"), UIControlState.Selected);
                return(DefaultButton);
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.flexGrid.ColumnHeaderFont    = UIFont.BoldSystemFontOfSize(this.flexGrid.Font.PointSize);
            this.flexGrid.AutoGenerateColumns = false;
            this.flexGrid.IsReadOnly          = true;

            GridColumn[] columns = new[] {
                new GridColumn {
                    Binding = "FirstName"
                },
                new GridColumn {
                    Binding = "LastName"
                },
                new GridColumn {
                    Binding = "OrderTotal", Format = "C"
                },
                new GridColumn {
                    Binding = "OrderCount", Format = "N1"
                },
                new GridColumn {
                    Binding = "CountryId",
                    Header  = "Country",
                    HeaderHorizontalAlignment = UITextAlignment.Left,
                    HorizontalAlignment       = UITextAlignment.Left,
                    DataMap = new GridDataMap(
                        Array.ConvertAll(Customer._countries, (pair) => new CountryPair {
                        CountryId    = Array.IndexOf(Customer._countries, pair),
                        CountryTitle = pair.Key
                    }), new NSString("CountryId"), new NSString("CountryTitle"))
                },
                new GridColumn {
                    Binding = "LastOrderDate"
                },
                new GridColumn {
                    Binding   = "LastOrderDate",
                    Header    = "Last Order Time",
                    Formatter = new NSDateFormatter {
                        DateFormat = "hh:mm a"
                    }
                }
            };

            this.flexGrid.Columns.AddRange(columns);

            List <Customer> dataList = Customer.GetCustomerList(100);


            this.flexGrid.FormatItem += (Xuni.iOS.FlexGrid.FlexGrid sender, Xuni.iOS.FlexGrid.GridPanel panel, Xuni.iOS.FlexGrid.GridCellRange range, CoreGraphics.CGContext context) => {
                if (panel.CellType == Xuni.iOS.FlexGrid.GridCellType.Cell)
                {
                    GridColumn col = sender.Columns[range.Col];
                    if (col.Binding.Equals("OrderTotal"))
                    {
                        double money = dataList[range.Row].OrderTotal;
                        if (money > 5000)
                        {
                            panel.TextAttributes.SetValueForKey(DarkGreen, UIStringAttributeKey.ForegroundColor);
                        }
                        else
                        {
                            panel.TextAttributes.SetValueForKey(UIColor.Red, UIStringAttributeKey.ForegroundColor);
                        }
                    }
                    else if (col.Binding.Equals("OrderCount"))
                    {
                        int orders = dataList[range.Row].OrderCount;
                        if (orders > 50)
                        {
                            context.SetFillColor(DarkGreen.CGColor);
                        }
                        else
                        {
                            context.SetFillColor(UIColor.Red.CGColor);
                        }
                        context.FillRect(panel.GetCellRect(range.Row, range.Col));
                        panel.TextAttributes.SetValueForKey(UIColor.White, UIStringAttributeKey.ForegroundColor);
                    }
                }
                return(false);
            };

            this.flexGrid.ItemsSource = dataList;
        }