Esempio n. 1
0
        public DataVisualization()
        {
            DataInteractionV2 div2 = new DataInteractionV2();

            //Toast.DisplayText(div2.showCurrWeekNum().ToString());
            KeyValuePair <string, double>[] show  = div2.readWeeklyTagPercentage(DateTime.Now.Year, div2.showCurrWeekNum());
            CircleProgressBarSurfaceItem    first = new CircleProgressBarSurfaceItem()
            {
                Value               = 0.5,
                BarLineWidth        = 20,
                BackgroundLineWidth = 20,
                BarColor            = Color.Crimson,
                BackgroundColor     = Color.Transparent,
                BarRadius           = 60,
            };
            CircleProgressBarSurfaceItem second = new CircleProgressBarSurfaceItem()
            {
                Value               = show[1].Value,
                BarLineWidth        = 20,
                BackgroundLineWidth = 20,
                BarColor            = Color.Magenta,
                BackgroundColor     = Color.Transparent,
                BarRadius           = 80,
            };

            CircleSurfaceItems.Add(first);
            CircleSurfaceItems.Add(second);
        }
        public CircleProgressBarSurfaceItemImplements(CircleProgressBarSurfaceItem item, EvasObject parent, ElmSharp.Wearable.CircleSurface surface) : base(parent, surface)
        {
            _item = item;
            item.PropertyChanged += ItemPropertyChanged;

            BackgroundAngle       = item.BackgroundAngle;
            BackgroundAngleOffset = item.BackgroundAngleOffset;
            if (item.BackgroundColor != default(Xamarin.Forms.Color))
            {
                BackgroundColor = item.BackgroundColor.ToNative();
            }
            if (item.BackgroundLineWidth != -1)
            {
                BackgroundLineWidth = item.BackgroundLineWidth;
            }
            if (item.BackgroundRadius != -1)
            {
                BackgroundRadius = item.BackgroundRadius;
            }

            BarAngle        = item.BarAngle;
            BarAngleOffset  = item.BarAngleOffset;
            BarAngleMaximum = item.BarAngleMaximum;
            BarAngleMinimum = item.BarAngleMinimum;
            if (item.BarColor != default(Xamarin.Forms.Color))
            {
                BarColor = item.BarColor.ToNative();
            }
            if (item.BarLineWidth != -1)
            {
                BarLineWidth = item.BarLineWidth;
            }
            if (item.BarRadius != -1)
            {
                BarRadius = item.BarRadius;
            }

            Minimum = 0;
            Maximum = 1;

            Value     = item.Value;
            IsEnabled = item.IsEnabled;

            if (item.IsVisible)
            {
                Show();
            }
            else
            {
                Hide();
            }
        }
        /// <summary>
        /// Initialize main page.
        /// Add components and events.
        /// </summary>
        private void InitializeComponent()
        {
            downloadButton = CreateDownloadButton();
            progressBar    = CreateProgressbar();

            urlEntryLabel = CreateEntryLabel();
            urlEntry      = CreateEntry();
            progressLabel = CreateProgressLabel();
            headerLabel   = CreateHeaderLabel();

            headerLabel.SetValue(Grid.RowProperty, 0);
            headerLabel.SetValue(Grid.ColumnSpanProperty, 2);

            urlEntryLabel.SetValue(Grid.RowProperty, 1);
            urlEntryLabel.SetValue(Grid.ColumnProperty, 0);

            urlEntry.SetValue(Grid.RowProperty, 1);
            urlEntry.SetValue(Grid.ColumnProperty, 1);

            progressLabel.SetValue(Grid.RowProperty, 2);
            progressLabel.SetValue(Grid.ColumnSpanProperty, 2);

            Content = new Grid()
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition()
                    {
                        Width = new GridLength(2, GridUnitType.Star)
                    },
                    new ColumnDefinition()
                    {
                        Width = new GridLength(12, GridUnitType.Star)
                    },
                },
                RowDefinitions =
                {
                    new RowDefinition()
                    {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition()
                    {
                        Height = new GridLength(100, GridUnitType.Absolute)
                    },
                    new RowDefinition()
                    {
                        Height = new GridLength(50, GridUnitType.Absolute)
                    }
                },
                Children =
                {
                    headerLabel,
                    urlEntryLabel,
                    urlEntry,
                    progressLabel
                },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
            };

            CircleSurfaceItems.Add(progressBar);
            ActionButton = downloadButton;

            AddEvent();
        }