예제 #1
0
 public void Decompress()
 {
     if (IsPumpActive)
     {
         return;
     }
     if (IsCompressed)
     {
         Console.WriteLine("Pump decompression initiated");
         DecompressionStartedEvent?.Invoke(this, EventArgs.Empty);
         IsPumpActive = true;
         Task.Factory.StartNew(() =>
         {
             while (IsCompressed)
             {
                 _stocking.Pressure -= 1;
                 Thread.Sleep(1);
             }
             Console.WriteLine("Pump decompression complete");
             IsPumpActive = false;
             DecompressionFinishedEvent?.Invoke(this, EventArgs.Empty);
         });
     }
     else
     {
         Console.WriteLine("The stocking is already relaxed.");
     }
 }
예제 #2
0
 public void Decompress()
 {
     if (IsLaceCtrlActive)
     {
         return;
     }
     if (IsCompressed)
     {
         Console.WriteLine("Lace decompression initiated");
         DecompressionStartedEvent?.Invoke(this, EventArgs.Empty);
         IsLaceCtrlActive = true;
         Task.Factory.StartNew(() =>
         {
             for (int i = 0; i < ClicksToTighten; i++)
             {
                 Console.WriteLine("Click " + (i + 1));
                 Thread.Sleep(100);
             }
             IsLaceCtrlActive = false;
             IsCompressed     = false;
             Console.WriteLine("Lace decompression complete");
             DecompressionFinishedEvent?.Invoke(this, EventArgs.Empty);
         });
     }
     else
     {
         Console.WriteLine("The stocking is already relaxed.");
     }
 }