Exemplo n.º 1
0
 public void OnSetVipStatusCommand()
 {
     if (t != null)
     {
         t.Stop();
         t.Close();
     }
     IsAddCommandVisible = false;
     ProgressBarValue    = 1;
     ProgressBarMaxValue = 1;
     PlayMinute          = 0;
     PlayHours           = 0;
     TotalValue          = 0;
     Cash             = 0;
     monitoringNumber = 0;
     TimePassed       = 0;
     IsVisible        = true;
     TimeLeft         = "VIP";
     StartTime        = DateTime.Now;
     MainPageViewModel.SendMsg("false", ID);
     IsSetTimeReadOnly = true;
     JsonUser.AddUserToWokingTimeHistory(this);
     VipTimeMonitoring();
     OnPropertyChanged(nameof(TimeLeft));
     OnPropertyChanged(nameof(TotalValue));
     OnPropertyChanged(nameof(StartTime));
     OnPropertyChanged(nameof(PlayMinute));
     OnPropertyChanged(nameof(PlayHours));
     OnPropertyChanged(nameof(TimePassed));
     OnPropertyChanged(nameof(Cash));
 }
Exemplo n.º 2
0
 public void t_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (TimePassed >= int.Parse(PlayTime) || TimePassed < 0)
     {
         Cash = TotalValue;
         t.Stop();
         t.Close();
         OnStopCommand();
         return;
     }
     monitoringNumber++;
     TimeLeft         = (int.Parse(PlayTime) - monitoringNumber).ToString();
     TimePassed       = monitoringNumber;
     ProgressBarValue = monitoringNumber;
     Cash             = TimePassed * Math.Floor(CashForHour / 60);
     if (TimePassed >= int.Parse(PlayTime) || TimePassed < 0)
     {
         Cash = TotalValue;
         t.Stop();
         t.Close();
         OnStopCommand();
         return;
     }
     if (TimePassed % 5 == 0)
     {
         MainPageViewModel.SendMsg(TimePassed.ToString(), ID);
     }
     JsonUser.AddUserToWokingTimeHistory(this);
     OnPropertyChanged(nameof(TimeLeft));
     OnPropertyChanged(nameof(Cash));
     OnPropertyChanged(nameof(TimePassed));
     OnPropertyChanged(nameof(ProgressBarValue));
     t.Interval = 60_000;
     t.Start();
 }
Exemplo n.º 3
0
 public void OnEnterCommand()
 {
     PlayTime = ((PlayHours * 60) + PlayMinute).ToString();
     if (string.IsNullOrEmpty(PlayTime) || PlayTime == "0")
     {
         return;
     }
     if (IsSetTimeReadOnly)
     {
         return;
     }
     TotalValue = Math.Floor(int.Parse(PlayTime) * CashForHour / 60);
     MainPageViewModel.SendMsg(PlayTime, ID);
     ProgressBarValue    = 0;
     IsVisible           = true;
     IsAddCommandVisible = true;
     IsSetTimeReadOnly   = true;
     StartTime           = DateTime.Now;
     TimeLeft            = PlayTime;
     TimePassed          = 0;
     Cash                = 0;
     monitoringNumber    = 0;
     ProgressBarMaxValue = int.Parse(PlayTime);
     EndTime             = DateTime.Now.AddMinutes(double.Parse(PlayTime));
     JsonUser.AddUserToWokingTimeHistory(this);
     TimeMonitoring();
     OnPropertyChanged(nameof(StartTime));
     OnPropertyChanged(nameof(TimeLeft));
     OnPropertyChanged(nameof(Cash));
     OnPropertyChanged(nameof(EndTime));
     OnPropertyChanged(nameof(TotalValue));
     OnPropertyChanged(nameof(TimePassed));
 }
Exemplo n.º 4
0
 private void t_VipStatus(object sender, ElapsedEventArgs e)
 {
     monitoringNumber++;
     TimePassed = monitoringNumber;
     Cash       = TimePassed * Math.Floor(CashForHour / 60);
     TotalValue = Cash;
     JsonUser.AddUserToWokingTimeHistory(this);
     OnPropertyChanged(nameof(Cash));
     OnPropertyChanged(nameof(TimePassed));
     OnPropertyChanged(nameof(TotalValue));
     t.Interval = 60_000;
     t.Start();
 }
Exemplo n.º 5
0
 public void OnStopCommand()
 {
     ProgressBarValue    = 0;
     ProgressBarMaxValue = 1;
     EndTime             = DateTime.Now;
     JsonUser.AddUserToHistory(this);
     if (t != null)
     {
         t.Stop();
         t.Close();
     }
     OnEnding();
     JsonUser.RemoveUserFromWorkingTimeHistory(this);
 }