示例#1
0
        protected override void OnBindingContextChanged()
        {
            if (Model == null)
            {
                return;
            }

            UpdateCalendarGraph();

            PieGraph.Title   = AppResources.TestStatusPieGraphScore;
            PieGraph.Members = new List <PieGraphView.PieItem>()
            {
                new PieGraphView.PieItem()
                {
                    Color = new SkiaSharp.SKColor(0x52, 0xb2, 0xff), Rate = (float)Model.Total.AnswerCountCorrectRate
                },
                new PieGraphView.PieItem()
                {
                    Color = new SkiaSharp.SKColor(0xe8, 0x6d, 0x6b), Rate = (1 - (float)Model.Total.AnswerCountCorrectRate)
                }
            };
            PieGraph.InvalidateSurface();

            base.OnBindingContextChanged();
        }
        public QuizResultPage()
        {
            InitializeComponent();

            this.BindingContextChanged += (s, e) =>
            {
                PieGraph.Title   = AppResources.StatisticsPieGraphScore;
                PieGraph.Members = new List <PieGraphView.PieItem>()
                {
                    new PieGraphView.PieItem()
                    {
                        Color = new SkiaSharp.SKColor(0x52, 0xb2, 0xff), Rate = (float)Model.AnswerCorrectPercentage / 100.0f
                    },
                    new PieGraphView.PieItem()
                    {
                        Color = new SkiaSharp.SKColor(0xe8, 0x6d, 0x6b), Rate = (1 - (float)Model.AnswerCorrectPercentage / 100.0f)
                    }
                };
                PieGraph.InvalidateSurface();
            };
        }