コード例 #1
0
        /// <summary>
        /// Called when activating.
        /// </summary>
        protected override async void OnActivate()
        {
            using (var service = new DatabaseService())
            {
                await service.CheckPledgeStatus();

                this._allTradres = service.Get().OrderBy(t => t.Date).ToArray();

                var leagues = this._allTradres.GroupBy(t => t.LeagueName).Select(grp => grp.Key);
                this.Leagues = this.FilterLeagueNames(leagues);

                if (this._allTradres.Any())
                {
                    var lastTrade  = this._allTradres.Last();
                    var lastLeague = this.Leagues.FirstOrDefault(l => l.PossibleNames.Contains(lastTrade.LeagueName));
                    this.SetLeagueTrades(lastLeague);
                }
            }

            this.ItemClassChart = this.CreateItemClassChart();
            this.ItemClassChart.OnSerieClick += this.ItemClassChart_OnSerieClick;
            this.NetworthChart            = this.CreateNetworthChart();
            this.TotalChart               = this.CreateTotalChart();
            this.TotalChart.OnSerieClick += this.OnSerieClick;
            base.OnActivate();
        }
コード例 #2
0
 /// <summary>
 /// Backs this instance.
 /// </summary>
 public void Back()
 {
     if (ActiveChart is ColumnChartViewModel)
     {
         this._pieChart             = this.GetPieChart();
         this._pieChart.OnPieClick += this.PieChartViewModel_OnPieClick;
         this.ActiveChart           = this._pieChart;
     }
 }
コード例 #3
0
        /// <summary>
        /// Gets the pie chart.
        /// </summary>
        /// <returns></returns>
        private PieChartViewModel GetPieChart()
        {
            var pieChart = new PieChartViewModel();

            var groups = this._trades.GroupBy(i => i.Price.CurrencyType).Select(g => new { Type = g.First().Price.CurrencyType, Sum = g.Sum(i => i.Price.NumberOfCurrencies) });

            foreach (var group in groups)
            {
                pieChart.Add(group.Type.ToString(), group.Sum);
            }

            return(pieChart);
        }
コード例 #4
0
        /// <summary>
        /// Called when activating.
        /// </summary>
        protected override async void OnActivate()
        {
            using (var service = new DatabaseService())
            {
                await service.CheckPledgeStatus();

                this._trades = service.Get().Where(t => !t.IsOutgoing).ToArray();
            }

            this._pieChart             = this.GetPieChart();
            this._pieChart.OnPieClick += this.PieChartViewModel_OnPieClick;
            this.ActiveChart           = this._pieChart;
            base.OnActivate();
        }
コード例 #5
0
        /// <summary>
        /// Creates the item class chart.
        /// </summary>
        /// <returns>The PieChart.</returns>
        private PieChartViewModel CreateItemClassChart()
        {
            var pieChart = new PieChartViewModel()
            {
                InnerRadius = 85,
                FontSize    = 18,
            };

            var groups = this._leagueTrades.GroupBy(i => i.ItemClass).Select(g => new { Type = g.First().ItemClass, Sum = g.Sum(i => i.Price.CalculateValue()) });

            foreach (var group in groups.OrderByDescending(g => g.Sum).Take(5))
            {
                pieChart.Add(group.Type.ToString(), group.Sum);
            }

            return(pieChart);
        }
コード例 #6
0
        /// <summary>
        /// Gets the pie chart.
        /// </summary>
        /// <returns>The PieChart.</returns>
        private PieChartViewModel CreateTotalChart()
        {
            var pieChart = new PieChartViewModel()
            {
                FontSize      = 12,
                LabelPosition = LiveCharts.PieLabelPosition.InsideSlice,
            };

            var groups = this._leagueTrades.GroupBy(i => i.Price.CurrencyType).Select(g => new { Type = g.First().Price.CurrencyType, Sum = g.Sum(i => i.Price.CalculateValue()) });

            foreach (var group in groups)
            {
                pieChart.Add(group.Type.ToString(), group.Sum);
            }

            return(pieChart);
        }
コード例 #7
0
        /// <summary>
        /// Called when activating.
        /// </summary>
        protected override async void OnActivate()
        {
            using (var service = new DatabaseService())
            {
                await service.CheckPledgeStatus();

                this._trades     = service.Get().Where(t => !t.IsOutgoing).OrderBy(t => t.Date).ToArray();
                this._allTradres = this._trades;
            }

            this.ItemClassChart = this.CreateItemClassChart();
            this.ItemClassChart.OnSerieClick += this.ItemClassChart_OnSerieClick;
            this.NetworthChart            = this.GetNetworthChart();
            this.TotalChart               = this.CreateTotalChart();
            this.TotalChart.OnSerieClick += this.OnSerieClick;
            base.OnActivate();
        }
コード例 #8
0
        /// <summary>
        /// Filters the specified league.
        /// </summary>
        /// <param name="league">The league.</param>
        public void Filter(League league)
        {
            this.SetLeagueTrades(league);

            if (this.ItemClassChart != null)
            {
                this.ItemClassChart.OnSerieClick -= this.ItemClassChart_OnSerieClick;
            }

            if (this.TotalChart != null)
            {
                this.TotalChart.OnSerieClick -= this.OnSerieClick;
            }

            this.ItemClassChart = this.CreateItemClassChart();
            this.ItemClassChart.OnSerieClick += this.ItemClassChart_OnSerieClick;
            this.NetworthChart            = this.CreateNetworthChart();
            this.TotalChart               = this.CreateTotalChart();
            this.TotalChart.OnSerieClick += this.OnSerieClick;
        }