public FunapiHttpDownloader(string target_path, bool enable_verify,
                              UpdateEventHandler on_update, FinishEventHandler on_finished)
     : this(target_path, enable_verify)
 {
     UpdateCallback = new UpdateEventHandler(on_update);
     FinishedCallback = new FinishEventHandler(on_finished);
 }
Exemple #2
0
        public override bool Drive(int second, Func <int, Car, bool> func)
        {
            Distance += Speed * second;

            FinishEvent = new FinishEventHandler(func);

            return(FinishEvent(Distance, this));
        }
        public void StartSimulation()
        {
            SimulationStart = DateTime.Now;
            TickSecond      = new Timer(new TimerCallback(Second), null, 1000, 2000);
            TickFiveSecond  = new Timer(new TimerCallback(OnceADay), null, 6000, 6000);

            while (hospital.GetCountOfPatient() != 0 || IVADept.GetCountOfPatient() != 0 || sanatoriumDept.GetCountOfPatient() != 0)
            {
                Thread.Sleep(1000);
            }

            TickSecond.Dispose();
            Thread.Sleep(4000);
            TickFiveSecond.Dispose();
            AssignValueToFinished();
            FinishEventHandler?.Invoke(this, finishedInfo);
        }
Exemple #4
0
        protected virtual void OnFinished(IntPtr converter, int success)
        {
            if (_log.IsTraceEnabled)
            {
                _log.Trace("T:" + Thread.CurrentThread.Name + " Conversion Finished: " + (success != 0 ? "Succeede" : "Failed"));
            }

            FinishEventHandler handler = Finished;

            try
            {
                handler?.Invoke(this, success != 0);
            }
            catch (Exception e)
            {
                _log.Warn("T:" + Thread.CurrentThread.Name + " Exception in Finish event handler", e);
            }
        }
Exemple #5
0
        protected virtual void OnFinished(IntPtr converter, int success)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Conversion Finished: " + (success != 0 ? "Succeede" : "Failed"));

            FinishEventHandler handler = this.Finished;

            try
            {
                if (handler != null)
                {
                    handler(this, success != 0);
                }
            }
            catch (Exception e)
            {
                Tracer.Warn("T:" + Thread.CurrentThread.Name + " Exception in Finish event handler", e);
            }
        }
Exemple #6
0
        protected virtual void OnFinished(IntPtr converter, int success)
        {
            Tracer.Trace(string.Format("T:{0} Conversion Finished: {1}", Thread.CurrentThread.Name, success != 0 ? "Succeeded" : "Failed"));

            FinishEventHandler handler = this.Finished;

            try
            {
                if (handler != null)
                {
                    handler(this, success != 0);
                }
            }
            catch (Exception e)
            {
                Tracer.Warn(string.Format("T:{0} Exception in Finish event handler", Thread.CurrentThread.Name), e);
            }
        }