示例#1
0
        public StatisticViewModel(
            StatisticService statistic,
            ConfigService config,
            TomatoService tomato)
        {
            this.statistic = statistic;
            this.config    = config;
            this.tomato    = tomato;

            yearmonth = DateTime.Now.Year + DateTime.Now.Month;

            CloseOnboardingCommand        = new Command(new Action <object>(OnCloseOnboardingCommand));
            GenerateMonthlyDataImgCommand = new Command(new Action <object>(OnGenerateMonthlyDataImgCommand));
            Data               = new StatisticModel();
            Data.Year          = DateTime.Now.Year;
            Data.Month         = DateTime.Now.Month;
            Data.MonthRestData = new List <ChartDataModel>();
            Data.MonthWorkData = new List <ChartDataModel>();
            Data.MonthSkipData = new List <ChartDataModel>();

            Data.WeekRestData = new List <ChartDataModel>();
            Data.WeekWorkData = new List <ChartDataModel>();
            Data.WeekSkipData = new List <ChartDataModel>();

            Data.TomatoWeekData = new List <ChartDataModel>();

            Data.PropertyChanged += Data_PropertyChanged;

            Data.IsAnimation = config.options.Style.IsAnimation;

            MigrateCheck();
            HandleMonthData();
            HandleWeekData();
            Analysis();
        }
 public Boolean endTomato(long userId, DateTime endTime, DateTime startTime, String taskName, bool needAssociation)
 {
     if (needAssociation)
     {
         TomatoService.setTomatoAssociation(userId, startTime, taskName);
     }
     return(TomatoService.setTomatoState(userId, startTime, endTime, TomatoState.endState));
 }
 public Boolean breakTomato(long userId, DateTime breakTime, DateTime startTime)
 {
     return(TomatoService.setTomatoState(userId, startTime, breakTime, TomatoState.breakState));
 }
 public Boolean startTomato(long userId, String taskName, DateTime startTime)
 {
     return(TomatoService.addTomato(userId, taskName, startTime));
 }