예제 #1
0
 public VirtualMachine()
 {
     Thread = new ThreadOfControl()
     {
         WirtualnaMaszyna = this
     };
 }
예제 #2
0
        public VirtualMachineResult <T> Start <T>(string nazwaMetody, params object[] parametet)
        {
            Thread = new ThreadOfControl()
            {
                WirtualnaMaszyna = this
            };
            start(nazwaMetody, parametet);
            if (Thread.Status == VirtualMachineState.Hibernated)
            {
                return(new VirtualMachineResult <T>()
                {
                    State = Thread.Status
                });
            }

            T ret;

            if (typeof(T) == typeof(bool))
            {
                dynamic r = Thread.Result;
                ret = Convert.ToBoolean(r);
            }
            else
            {
                ret = (T)Thread.Result;
            }
            var result = new VirtualMachineResult <T>()
            {
                State = Thread.Status, Result = ret
            };

            return(result);
        }