Beispiel #1
0
 private void Timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (WorkFlow != null)
     {
         WorkFlow.QuantityOfSecond--;
         WorkFlow.TimeLeftPercent = (WorkFlow.QuantityOfSecond / (WorkFlow.IniticalQuantityOfSecond / 100D)) * (385D / 100D);
         WorkFlow.KeysActivity    = KeyboardActivity.GetPercent();
         WorkFlow.MouseActivity   = MouseActivity.GetPercent();
         if (ServiceContract != null)
         {
             if (Authorization == false && User != null)
             {
                 ServiceContract.Login(new CredentialsClass()
                 {
                     Name = User.Name
                 });
                 Authorization = true;
             }
             if (Authorization == true)
             {
                 ServiceContract.SendPingStatistics(new PingStatisticsClass()
                 {
                     Name = User.Name, PingTime = DateTime.Now, ActiveLevel = PingStatisticsGenerator.Get(Loger)
                 });
             }
         }
         if (WorkFlow.QuantityOfSecond == 0)
         {
             var Timer = sender as Timer;
             Timer.Stop();
         }
     }
 }
 public MainWindow()
 {
     InitializeComponent();
     User     = UserClass.GetInstance();
     Settings = SettingsClass.GetInstance();
     Loger    = new LogerClass();
     KeyboardActivity.SetLog(Loger.LogKeyItems);
     MouseActivity.SetLog(Loger.LogMouseItems);
     KeyboardHook                       = new KeyboardHookClass(Loger);
     MouseHookClass                     = new MouseHookClass(Loger);
     Statistic                          = new StatisticClass(Loger);
     Worker                             = new WorkerClass(User, Loger);
     RemoteServer                       = new RemoteServerClass();
     CurrentWorkFlow                    = WorkFlowClass.GetWorkFlow(TypeOfWorkFlow.Custom, Convert.ToInt32(Settings.PomodorSize));
     PrimePanel.DataContext             = Statistic.CommonPrimeWindowProperty;
     LeftTimeIndicator.DataContext      = CurrentWorkFlow;
     KeysActivityIndicator.DataContext  = CurrentWorkFlow;
     MouseActivityIndicator.DataContext = CurrentWorkFlow;
     KeyboardHook.StartCapture();
     MouseHookClass.StartCapture();
 }