Пример #1
0
 private void UruchamianieObliczenPi()
 {
     try
     {
         OutputProvider.ShowStartLabelOneLine();
         double pi = PiCalculator.ObliczPiWithInnerRandomGeneratorAndLockSection(IlośćPrób / IleWatkow, _pi);
         lock (PiCalculator.Random)
             _pi += pi;
         OutputProvider.ShowResultWithThreadNumber(pi);
     }
     catch (ThreadAbortException ex)
     {
         OutputProvider.ShowThreadAbortException(ex.Message);
     }
     catch (Exception ex)
     {
         OutputProvider.ShowErrorMessage(ex.Message);
     }
 }
Пример #2
0
 private void UruchamianieObliczenPi(object parametr)
 {
     try
     {
         int?indeks = parametr as int?;
         OutputProvider.ShowStartLabel(indeks);
         double pi = PiCalculator.ObliczPiWithInnerRandomGeneratorAndLockSection(IlośćPrób / IleWatkow, _pi);
         _pi += pi;
         OutputProvider.ShowResultWithThreadNumber(pi);
     }
     catch (ThreadAbortException ex)
     {
         OutputProvider.ShowThreadAbortException(ex.Message);
     }
     catch (Exception ex)
     {
         OutputProvider.ShowErrorMessage(ex.Message);
     }
 }