Ejemplo n.º 1
0
        public IncrementalLoadingViewModel(Context context)
        {
            progress = new SfLinearProgressBar(context);
            popup    = new SfPopupLayout(context);
            string uri = "http://services.odata.org/Northwind/Northwind.svc/";

            if (CheckConnection(uri).Result)
            {
                popup.PopupView.ContentView     = progress;
                popup.PopupView.HeaderTitle     = "Fetching Data... ";
                popup.PopupView.ShowCloseButton = false;
                popup.PopupView.ShowFooter      = false;
                popup.PopupView.HeightRequest   = 125;
                popup.StaysOpen          = true;
                progress.Progress        = 100;
                progress.IsIndeterminate = true;
                popup.Show();

                gridSource = new IncrementalList <Order>(LoadMoreItems)
                {
                    MaxItemsCount = 1000
                };
                northwindEntity = new NorthwindEntities(new Uri(uri));
            }
            else
            {
                NoNetwork = true;
                IsBusy    = false;
            }
        }
Ejemplo n.º 2
0
 public void Dispose()
 {
     northwindEntity = null;
     popup           = null;
     progress.Dispose();
     progress = null;
 }
Ejemplo n.º 3
0
        public YardBlockLists(List <clsYardMapBlock> blocks)
        {
            InitializeComponent();

            Title = "Blocks";

            int column = 0, row = 0;

            foreach (clsYardMapBlock block in blocks)
            {
                if (!(block.Id.Contains("(")))
                {
                    block.Id = block.Id + " " + block.Utilization + "%" + " ";
                }

                grid.RowDefinitions.Add(new RowDefinition {
                    Height = 100
                });

                Label label = new Label
                {
                    Text     = block.Id,
                    FontSize = 20,
                    HorizontalTextAlignment = TextAlignment.Center,
                    Margin = new Thickness(10, 10, 0, 0)
                };

                SfLinearProgressBar linearProgressBar = new SfLinearProgressBar
                {
                    Progress      = Convert.ToInt16(block.Utilization),
                    ProgressColor = Color.CornflowerBlue,
                    TrackColor    = Color.LightBlue,
                    TrackHeight   = 40,
                    Margin        = new Thickness(0, 10, 10, 0),
                    CornerRadius  = 10,
                };

                var recognizer = new TapGestureRecognizer
                {
                    NumberOfTapsRequired = 1
                };

                recognizer.Tapped += async(sender, e) =>
                {
                    await Navigation.PushAsync(new YardBlockDetails(block.Id));
                };
                linearProgressBar.GestureRecognizers.Add(recognizer);


                grid.Children.Add(label, column, row);
                column++;
                grid.Children.Add(linearProgressBar, column, row);
                row++;
                column = 0;
            }

            //listView.ItemsSource = blocks;
            //listView.RowHeight = 130;
        }
Ejemplo n.º 4
0
        private void ProgressBar_ValueChanged(object sender, ProgressValueEventArgs e)
        {
            SfLinearProgressBar progressbar = sender as SfLinearProgressBar;

            if (e.Progress.Equals(100))
            {
                progressbar.Progress          = 0;
                progressbar.AnimationDuration = 1;
            }

            if (e.Progress.Equals(0))
            {
                progressbar.AnimationDuration = 2000;
                progressbar.Progress          = 100;
            }
        }
Ejemplo n.º 5
0
        private View GetLinearCornerRadius()
        {
            LinearLayout linearLayout = new LinearLayout(this.context)
            {
                Orientation = Orientation.Vertical
            };

            linearLayout.AddView(this.GetTextView("Corner radius"));

            SfLinearProgressBar progressBar = new SfLinearProgressBar(this.context)
            {
                AnimationDuration = 10000,
                Progress          = 100,
                CornerRadius      = 10,
                LayoutParameters  = this.layoutParams
            };

            progressBar.ValueChanged += this.ProgressBar_ValueChanged;
            linearLayout.AddView(progressBar);
            return(linearLayout);
        }
Ejemplo n.º 6
0
        private View GetLinearRangeColorsWithGradient()
        {
            LinearLayout linearLayout = new LinearLayout(this.context)
            {
                Orientation = Orientation.Vertical
            };

            linearLayout.AddView(this.GetTextView("Gradient"));

            RangeColorCollection rangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#E9ECF7"), Start = 0, End = 20
                },
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#A0D9EF"), Start = 20, End = 40
                },
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#62C1E5"), Start = 40, End = 60
                },
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#20A7DB"), Start = 60, End = 80
                },
                new RangeColor {
                    IsGradient = true, Color = Color.ParseColor("#1C96C5"), Start = 80, End = 100
                }
            };

            SfLinearProgressBar progressBar = new SfLinearProgressBar(this.context)
            {
                AnimationDuration = 10000,
                Progress          = 100,
                LayoutParameters  = this.layoutParams,
                RangeColors       = rangeColorCollection
            };

            progressBar.ValueChanged += this.ProgressBar_ValueChanged;
            linearLayout.AddView(progressBar);
            return(linearLayout);
        }
Ejemplo n.º 7
0
        private View GetLinearBuffer()
        {
            LinearLayout linearLayout = new LinearLayout(this.context)
            {
                Orientation = Orientation.Vertical
            };

            linearLayout.AddView(this.GetTextView("Buffer"));

            SfLinearProgressBar progressBar = new SfLinearProgressBar(this.context)
            {
                AnimationDuration          = 20000,
                SecondaryAnimationDuration = 10000,
                Progress          = 100,
                SecondaryProgress = 100,
                LayoutParameters  = this.layoutParams
            };

            progressBar.ValueChanged += this.ProgressBar_ValueChanged1;
            linearLayout.AddView(progressBar);
            return(linearLayout);
        }
Ejemplo n.º 8
0
        private View GetLinearRangeColors()
        {
            LinearLayout linearLayout = new LinearLayout(this.context)
            {
                Orientation = Orientation.Vertical
            };

            linearLayout.AddView(this.GetTextView("Range colors"));

            RangeColorCollection rangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    Color = Color.ParseColor("#36BBE1"), Start = 0, End = 25
                },
                new RangeColor {
                    Color = Color.ParseColor("#9AEDE1"), Start = 25, End = 50
                },
                new RangeColor {
                    Color = Color.ParseColor("#FFDC28"), Start = 50, End = 75
                },
                new RangeColor {
                    Color = Color.ParseColor("#E15E0D"), Start = 75, End = 100
                }
            };

            SfLinearProgressBar progressBar = new SfLinearProgressBar(this.context)
            {
                AnimationDuration = 10000,
                Progress          = 100,
                LayoutParameters  = this.layoutParams,
                RangeColors       = rangeColorCollection
            };

            linearLayout.AddView(progressBar);
            progressBar.ValueChanged += this.ProgressBar_ValueChanged;
            return(linearLayout);
        }
Ejemplo n.º 9
0
        private async void ProgressBar_ValueChanged1(object sender, ProgressValueEventArgs e)
        {
            SfLinearProgressBar progressbar = sender as SfLinearProgressBar;

            if (e.Progress.Equals(100))
            {
                progressbar.AnimationDuration          = 0;
                progressbar.Progress                   = 0;
                progressbar.SecondaryAnimationDuration = 0;
                progressbar.SecondaryProgress          = 0;
            }

            if (e.Progress.Equals(0))
            {
                progressbar.AnimationDuration = 20000;
                await Task.Delay(100);

                progressbar.Progress = 100;
                progressbar.SecondaryAnimationDuration = 10000;
                await Task.Delay(100);

                progressbar.SecondaryProgress = 100;
            }
        }
Ejemplo n.º 10
0
        public Linear()
        {
            this.linearDeterminateLable             = this.GetLabel("Determinate");
            this.linearIndeterminateLabel           = this.GetLabel("Indeterminate");
            this.linearCornerRadiusLabel            = this.GetLabel("Corner radius");
            this.linearRangeColorsLabel             = this.GetLabel("Range color");
            this.linearRangeColorsWithGradientLabel = this.GetLabel("Gradient");
            this.linearPaddingLabel = this.GetLabel("Padding");
            this.linearBufferLabel  = this.GetLabel("Buffer");
            this.linearSegmentLable = this.GetLabel("Segment");
            this.linearSegmentedCornerRadiusLabel = this.GetLabel("Segment with corner radius");

            // Determinate progress bar.
            this.linearDeterminate = new SfLinearProgressBar
            {
                Progress = 75,
            };

            // Indeterminate progress bar.
            linearIndeterminate = new SfLinearProgressBar
            {
                IsIndeterminate = true
            };

            // Progres bar with corner radius.
            this.linearCornerRadius = new SfLinearProgressBar
            {
                Progress          = 100,
                AnimationDuration = 2000,
                CornerRadius      = 10,
            };
            this.linearCornerRadius.ValueChanged += this.ProgressBar_ValueChanged;


            // Progress bar with padding.
            this.linearPadding = new SfLinearProgressBar
            {
                Progress          = 100,
                AnimationDuration = 2000,
                IndicatorPadding  = new UIEdgeInsets(1, 1, 1, 1),
                CornerRadius      = 10,
            };
            this.linearPadding.ValueChanged += this.ProgressBar_ValueChanged;

            var rangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    Color = UIColor.FromRGB(54, 187, 225), Start = 0, End = 25
                },
                new RangeColor {
                    Color = UIColor.FromRGB(154, 237, 225), Start = 25, End = 50
                },
                new RangeColor {
                    Color = UIColor.FromRGB(225, 220, 40), Start = 50, End = 75
                },
                new RangeColor {
                    Color = UIColor.FromRGB(225, 94, 13), Start = 75, End = 100
                }
            };

            // Progress bar with range colors customization.
            this.linearRangeColors = new SfLinearProgressBar
            {
                Progress          = 100,
                AnimationDuration = 2000,
                RangeColors       = rangeColorCollection,
            };
            this.linearRangeColors.ValueChanged += this.ProgressBar_ValueChanged;

            var gradianRangeColorCollection = new RangeColorCollection
            {
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(233, 236, 247), Start = 0, End = 20
                },
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(160, 217, 239), Start = 20, End = 40
                },
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(98, 193, 229), Start = 40, End = 60
                },
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(32, 167, 219), Start = 60, End = 80
                },
                new RangeColor {
                    IsGradient = true, Color = UIColor.FromRGB(8, 150, 197), Start = 80, End = 100
                }
            };

            // Progress bar with gradient range colors.
            this.linearRangeColorsWithGradient = new SfLinearProgressBar
            {
                Progress          = 100,
                AnimationDuration = 2000,
                RangeColors       = gradianRangeColorCollection,
            };
            this.linearRangeColorsWithGradient.ValueChanged += this.ProgressBar_ValueChanged;

            // Progress bar with secondary progress.
            this.linearBuffer = new SfLinearProgressBar
            {
                AnimationDuration          = 2000,
                SecondaryAnimationDuration = 1000,
                Progress          = 100,
                SecondaryProgress = 100,
            };

            // Progress bar with segments.
            this.linearSegment = new SfLinearProgressBar
            {
                Progress     = 75,
                SegmentCount = 4
            };

            // Segmented progress bar with corner radius.
            this.linearSegmentedCornerRadius = new SfLinearProgressBar
            {
                Progress          = 100,
                CornerRadius      = 10,
                SegmentCount      = 4,
                GapWidth          = 7,
                AnimationDuration = 2000,
            };
            this.linearSegmentedCornerRadius.ValueChanged += this.ProgressBar_ValueChanged;

            AddSubview(this.linearDeterminate);
            AddSubview(this.linearIndeterminate);
            AddSubview(this.linearCornerRadius);
            AddSubview(this.linearRangeColors);
            AddSubview(this.linearRangeColorsWithGradient);
            AddSubview(this.linearPadding);
            AddSubview(this.linearBuffer);
            AddSubview(this.linearSegment);
            AddSubview(this.linearSegmentedCornerRadius);

            AddSubview(this.linearDeterminateLable);
            AddSubview(this.linearIndeterminateLabel);
            AddSubview(this.linearCornerRadiusLabel);
            AddSubview(this.linearRangeColorsLabel);
            AddSubview(this.linearRangeColorsWithGradientLabel);
            AddSubview(this.linearPaddingLabel);
            AddSubview(this.linearBufferLabel);
            AddSubview(this.linearSegmentLable);
            AddSubview(this.linearSegmentedCornerRadiusLabel);
        }
Ejemplo n.º 11
0
        public void colorTheStatusBars(double process, SfLinearProgressBar bar, string type)
        {
            ready = false;
            double segments = 0;
            double grade    = 0;

            if (type == "CA")
            {
                segments = _subject.CA / 3;
                grade    = _subject.CA;
            }
            else if (type == "FE")
            {
                segments = _subject.FinalExam / 3;
                grade    = _subject.FinalExam;
            }
            else if (type == "GPA")
            {
                segments = 100 / 3;
                grade    = 100;
            }

            RangeColorCollection rangeColors = new RangeColorCollection();

            if (type == "CA" || type == "FE")
            {
                if (process <= grade / 3)
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#ffcccb"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Red, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
                else if ((process > grade / 3) && (process < grade / 3 * 2))
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#FDE8D3"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Orange, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
                else if (process >= grade / 3 * 2)
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#d2f8d2"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Green, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
            }
            else if (type == "GPA")
            {
                if (process < 40)
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#ffcccb"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Red, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
                else if ((process >= 40) && (process < 70))
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#FDE8D3"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.Orange, IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
                else if (process > 70)
                {
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#d2f8d2"), IsGradient = true, Start = 0, End = segments * 2
                    });
                    rangeColors.Add(new RangeColor()
                    {
                        Color = Color.FromHex("#287c37"), IsGradient = true, Start = segments * 2, End = segments * 3
                    });
                    bar.RangeColors = rangeColors;
                }
            }
            ready = true;
        }