using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.Framework.Core;
using VIZ.Package.Domain;

namespace VIZ.TVP.CBA.Module
{
    /// <summary>
    /// Interaction logic for MainView.xaml
    /// </summary>
    public partial class MainView : UserControl
    {
        MainViewModel vm = MainViewModel.CreateInstance;

        //SinglePlayerViewModel singlePlayVM = SinglePlayerViewModel.CreateInstance;

        //PlayerCompareViewModel PlayerCompareViewModel = PlayerCompareViewModel.CreateInstance;  

        //TeamStatsViewModel teamStatsViewModel=TeamStatsViewModel.CreateInstance;    

        //public string ScheduleID = "";

        public MainView()
        {
            InitializeComponent();
            WPFHelper.BindingViewModel(this,vm);
        }

        //private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    if(vm.SelectMatchItems!=null&&vm.SetMatchDict.ContainsKey(vm. SelectMatchItems))
        //    {
        //        ScheduleID = vm.SetMatchDict[vm. SelectMatchItems];
        //        vm.onAirDataModel = JsonModel.OnAirData_Path(ScheduleID);

        //        vm.ScheduleID = ScheduleID;

        //        if (vm.onAirDataModel != null)
        //        {

        //            if (vm.onAirDataModel.liveTeamInfo.StatusCNName == "")
        //            {
        //                vm.MatchStatus = "未开始";
        //            }
        //            else if (vm.onAirDataModel.liveTeamInfo.StatusCNName != "")
        //            {
        //                vm.MatchStatus = vm.onAirDataModel.liveTeamInfo.StatusCNName;
        //            }
        //        }
        //        else
        //        {
        //            vm.MatchStatus = "未开始";
        //        }

        //        singlePlayVM.TeamItems=new System.Collections.ObjectModel.ObservableCollection<string>();
        //        singlePlayVM.TeamItems.Add(vm.onAirDataModel.liveTeamInfo.HomeTeamCNAlias);
        //        singlePlayVM.TeamItems.Add(vm.onAirDataModel.liveTeamInfo.VisitingTeamCNAlias);

        //        PlayerCompareViewModel.HName = vm.onAirDataModel.liveTeamInfo.HomeTeamCNAlias;

        //        PlayerCompareViewModel.AName = vm.onAirDataModel.liveTeamInfo.VisitingTeamCNAlias;



        //        teamStatsViewModel.HomeTeam = vm.onAirDataModel.liveTeamInfo.HomeTeamCNAlias;

        //        teamStatsViewModel.AwayTeam = vm.onAirDataModel.liveTeamInfo.VisitingTeamCNAlias;


        //        PlayerCompareViewModel.SetPlayer();

        //        vm.PlayerSeasonData = JsonModel.PlayerSeasonData_Path(vm.Matchtypeid);

        //        vm.TeamSeasonData = JsonModel.TeamSeasonData_Path(vm.Matchtypeid);

        //        SetTeamCompare();

        //    }
        //}


        //private void SetTeamCompare()
        //{
        //    //SetHomeTeamDictionary();
        //    //SetVisitTeamDictionary();
        //    SetTeamSeasonDictionary();
        //    //SetHData();
        //    //SetAData();

        //    //Utils.SetHomeTeamDictionary(vm);
        //    //Utils.SetVisitTeamDictionary(vm);
        //    //Utils.SetHData(vm, teamStatsViewModel);
        //    //Utils.SetAData(vm, teamStatsViewModel);

        //}




        //private void SetTeamSeasonDictionary()
        //{
        //    vm.CNAliasVisitSportsDictionary.Clear();

        //    foreach (var teamSeasonData in vm.TeamSeasonData.teamstats)
        //    {

        //        Dictionary<string, string> CompareItemToNumber = new Dictionary<string, string>();

        //        CompareItemToNumber.Add("Goal", teamSeasonData.PointsAverage);
        //        CompareItemToNumber.Add("Rebounds", teamSeasonData.ReboundsAverage);
        //        CompareItemToNumber.Add("Assists", teamSeasonData.AssistsAverage);
        //        CompareItemToNumber.Add("Steals", teamSeasonData.BlockedAverage);
        //        CompareItemToNumber.Add("Blocks", teamSeasonData.StealsAverage);
        //        CompareItemToNumber.Add("Error", teamSeasonData.TurnoversAverage);
        //        CompareItemToNumber.Add("Foul", teamSeasonData.PersonalFoulsAverage);
        //        //HomeTeamCompareOptionDictionary.Add(TeamDataCompareOptionChinese[7], Json_OnAirData.liveTeamStatH.FlagrantFouls);
        //        CompareItemToNumber.Add("FreeThrowP", (teamSeasonData.FreeThrowsPercentageAverage ).ToString("F1") + "%");
        //        CompareItemToNumber.Add("TwoShootingGoalP", (teamSeasonData.TwoPointPercentageAverage ).ToString("F1") + "%");
        //        CompareItemToNumber.Add("ThreeShootingGoalP", (teamSeasonData.ThreePointPercentageAverage ).ToString("F1") + "%");
        //        CompareItemToNumber.Add("ShootingGoalP", (teamSeasonData.FieldGoalsPercentageAverage ).ToString("F1") + "%");
        //        CompareItemToNumber.Add("ShootingUnderBaketP", (teamSeasonData.FieldGoalsAtRimPercentageAverage * 100).ToString("F1") + "%");
        //        CompareItemToNumber.Add("MidShootingP", (teamSeasonData.FieldGoalsMidRangePercentageAverage * 100).ToString("F1") + "%");

        //        vm.CNAliasVisitSportsDictionary.Add(teamSeasonData.TeamCNAlias, CompareItemToNumber);
        //    }


        //}


        //private void Date_MatchDateInfo_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    vm.GetSchedule();

        //    vm.PlayerSeasonData = JsonModel.PlayerSeasonData_Path(vm.Matchtypeid);

        //    vm.TeamSeasonData = JsonModel.TeamSeasonData_Path(vm.Matchtypeid);

        //    vm.CNAliasPlayerSportsDictionary.Clear();
        //    foreach (var tempSeasonData in vm.PlayerSeasonData.playerstats)
        //    {
        //        Dictionary<string, string> CompareItemToNumber = new Dictionary<string, string>();

        //        CompareItemToNumber.Add("Goal", tempSeasonData.PointsAverage);
        //        CompareItemToNumber.Add("Rebounds", tempSeasonData.ReboundsAverage);
        //        CompareItemToNumber.Add("Assists", tempSeasonData.AssistsAverage);
        //        CompareItemToNumber.Add("Steals", tempSeasonData.StealsAverage);
        //        CompareItemToNumber.Add("Blocks", tempSeasonData.BlockedAverage);
        //        CompareItemToNumber.Add("PlayTime",tempSeasonData.MinutesAverage);
        //        CompareItemToNumber.Add("ShootingGoalP", (tempSeasonData. FieldGoalsPercentageAverage).ToString("F1")+"%");
        //        CompareItemToNumber.Add("TwoShootingGoalP", (tempSeasonData.TwoPointPercentageAverage).ToString("F1") + "%");

        //        CompareItemToNumber.Add("ThreeShootingGoalP", (tempSeasonData.ThreePointPercentageAverage).ToString("F1") + "%");
        //        CompareItemToNumber.Add("FreeThrowP", (tempSeasonData.FreeThrowsPercentageAverage).ToString("F1") + "%");
        //        CompareItemToNumber.Add("ShootingUnderBaketP", (tempSeasonData.FieldGoalsAtRimPercentageAverage*100).ToString("F1") + "%");
        //        CompareItemToNumber.Add("MidShootingP", (tempSeasonData.FieldGoalsMidRangePercentageAverage * 100).ToString("F1") + "%");
        //        CompareItemToNumber.Add("ThreeScore", tempSeasonData.ThreePointGoalsAverage + "/"
        //                    + tempSeasonData.ThreePointAttemptedAverage);


        //        CompareItemToNumber.Add("TwoScore", tempSeasonData.TwoPointGoalsAverage + "/"
        //                    + tempSeasonData.TwoPointAttemptedAverage);


        //        CompareItemToNumber.Add("TwoArea", tempSeasonData.TwoPointGoalsAverage + "/"
        //                    + tempSeasonData.TwoPointAttemptedAverage);
        //        CompareItemToNumber.Add("ThreeArea", tempSeasonData.ThreePointGoalsAverage + "/"

        //     + tempSeasonData.ThreePointAttemptedAverage);
        //       //CompareItemToNumber.Add("ThreeArea",);

        //        CompareItemToNumber.Add("FreeThrow", tempSeasonData.FreeThrowsAverage + "/"
        //                    + tempSeasonData.FreeThrowsAttemptedAverage);
        //        CompareItemToNumber.Add("Error",tempSeasonData.TurnoversAverage);

        //        if (!vm.CNAliasPlayerSportsDictionary.ContainsKey(tempSeasonData.CNAlias))
        //        {
        //            vm.CNAliasPlayerSportsDictionary.Add(tempSeasonData.CNAlias, CompareItemToNumber);
        //        }

        //    }


        //}
    }
}
