Ejemplo n.º 1
0
 public ActionResult StartGame(string playerId)
 {
     lock (_game)
     {
         return(_game.Start(playerId));
     }
 }
Ejemplo n.º 2
0
        private void StartService(
            IStartable service,
            string serviceName)
        {
            try
            {
                #region Logging

                _log.Info($"{serviceName} is starting.");

                #endregion

                service.Start();

                #region Logging

                _log.Info($"{serviceName} has been started.");

                #endregion
            }
            catch (Exception e)
            {
                #region Logging

                _log.Critical(e, $"{serviceName} starting failed.");

                #endregion

                throw;
            }
        }
Ejemplo n.º 3
0
        private void StartStopDisposeLifecycleComps(IStartable start, IStartable stop, IDisposable disp, One one)
        {
            start.Start();

            // post instantiation startup
            Assert.AreEqual(4, one.getStarting().Count);
            Assert.AreEqual("One", one.getStarting()[0]);
            Assert.AreEqual("Two", one.getStarting()[1]);
            Assert.AreEqual("Three", one.getStarting()[2]);
            Assert.AreEqual("Four", one.getStarting()[3]);

            stop.Stop();

            // post instantiation shutdown - REVERSE order.
            Assert.AreEqual(4, one.getStopping().Count);
            Assert.AreEqual("Four", one.getStopping()[0]);
            Assert.AreEqual("Three", one.getStopping()[1]);
            Assert.AreEqual("Two", one.getStopping()[2]);
            Assert.AreEqual("One", one.getStopping()[3]);

            disp.Dispose();

            // post instantiation shutdown - REVERSE order.
            Assert.AreEqual(4, one.getDisposing().Count);
            Assert.AreEqual("Four", one.getDisposing()[0]);
            Assert.AreEqual("Three", one.getDisposing()[1]);
            Assert.AreEqual("Two", one.getDisposing()[2]);
            Assert.AreEqual("One", one.getDisposing()[3]);
        }
Ejemplo n.º 4
0
        public void Update()
        {
            for (int i = 0; i < behaviours.Count; i++)
            {
                Behaviour b = behaviours[i];

                if (!b.Enabled)
                {
                    continue;
                }

                if (b is IStartable)
                {
                    IStartable startable = b as IStartable;
                    if (!startable.IsStarted)
                    {
                        startable.Start();
                        startable.IsStarted = true;
                    }
                }

                if (b is IUpdatable)
                {
                    IUpdatable updatable = b as IUpdatable;
                    updatable.Update();
                }
            }
        }
Ejemplo n.º 5
0
        internal static void SafeStart(this IStartable startable, Tracer tracer)
        {
            Contract.Requires <ArgumentNullException>(tracer != null);

            if (startable == null)
            {
                return;
            }

            if (startable.IsStarted)
            {
                tracer.Info("{0} already started, not restarting it.", startable);
                return;
            }

            try
            {
                tracer.Verbose("Starting {0} ...", startable);
                startable.Start();
                tracer.Info("Successfully started {0}.", startable);
            }
            catch (Exception excp)
            {
                tracer.Severe(excp, "Exception Start()ing {0}", startable);
            }
        }
Ejemplo n.º 6
0
 public override void Start()
 {
     if (_streamer == null)
     {
         InitResult();
     }
     _parent.Start();
 }
Ejemplo n.º 7
0
 private static void StartNewTask(int number, IStartable testClass)
 {
     Console.WriteLine($"Start Multithreading Task{number} \n");
     testClass.Start();
     Console.WriteLine("Press key to continue");
     Console.ReadKey();
     Console.WriteLine();
 }
Ejemplo n.º 8
0
        public void Start(string asmName)
        {
            InitailizeBus(asmName);

            startable.Start();

            bootStrapper.EndStart();
        }
Ejemplo n.º 9
0
        private void Run(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("No startup assembly given.");
                Environment.Exit(-1);
            }

            var assbly = args[0];
            var param  = args.Skip(1);

            try
            {
                AssemblyCatalog      cat  = new AssemblyCatalog(Assembly.LoadFrom(assbly));
                CompositionContainer cont = new CompositionContainer(cat);
                cont.ComposeParts(this);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error while loading assembly.");
                Console.WriteLine(ex);
                Environment.Exit(-1);
            }

            if (_node == null)
            {
                Console.WriteLine("Assembly loaded, but no IStartable found.");
                Environment.Exit(-1);
            }

            ManualResetEvent ev = new ManualResetEvent(false);

            try
            {
                _node.Start(param).Wait();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error while starting ...");
                Console.WriteLine(ex);
            }

            Console.CancelKeyPress += (sender, eventArgs) =>
            {
                _node.Stop();
                ev.Set();
            };

            ev.WaitOne();
        }
Ejemplo n.º 10
0
 public void Start()
 {
     _parent.Start();
     _haveBeenStarted = true;
 }
Ejemplo n.º 11
0
 static void Kaynnista(IStartable laite)
 {
     laite.Start();
 }
Ejemplo n.º 12
0
 static void Start(IStartable machine)
 {
     machine.Start();
 }
        private void StartStopDisposeLifecycleComps(IStartable start, IStartable stop, IDisposable disp, One one)
        {
            start.Start();

            // post instantiation startup
            Assert.AreEqual(4, one.getStarting().Count);
            Assert.AreEqual("One", one.getStarting()[0]);
            Assert.AreEqual("Two", one.getStarting()[1]);
            Assert.AreEqual("Three", one.getStarting()[2]);
            Assert.AreEqual("Four", one.getStarting()[3]);

            stop.Stop();

            // post instantiation shutdown - REVERSE order.
            Assert.AreEqual(4, one.getStopping().Count);
            Assert.AreEqual("Four", one.getStopping()[0]);
            Assert.AreEqual("Three", one.getStopping()[1]);
            Assert.AreEqual("Two", one.getStopping()[2]);
            Assert.AreEqual("One", one.getStopping()[3]);

            disp.Dispose();

            // post instantiation shutdown - REVERSE order.
            Assert.AreEqual(4, one.getDisposing().Count);
            Assert.AreEqual("Four", one.getDisposing()[0]);
            Assert.AreEqual("Three", one.getDisposing()[1]);
            Assert.AreEqual("Two", one.getDisposing()[2]);
            Assert.AreEqual("One", one.getDisposing()[3]);
        }
Ejemplo n.º 14
0
 protected TOut GetResult()
 {
     IsInit = true;
     _parent.Start();
     return(_accumulator);
 }