Пример #1
0
        /// <summary>
        /// Moves the virtual machine to the specified new state
        /// </summary>
        /// <param name="newState">New machine state</param>
        protected void MoveToState(VmState newState)
        {
            var oldState = VmState;

            VmState = newState;
            VmStateChanged?.Invoke(this, new VmStateChangedEventArgs(oldState, newState));
        }
Пример #2
0
        /// <summary>
        /// Moves the virtual machine to the specified new state
        /// </summary>
        /// <param name="newState">New machine state</param>
        protected void MoveToState(VmState newState)
        {
            CheckMainThread();
            var oldState = VmState;

            VmState = newState;
            OnVmStateChanged(oldState, VmState);
            VmStateChanged?.Invoke(this, new VmStateChangedEventArgs(oldState, VmState));
            if (oldState == VmState.BeforeRun && newState == VmState.Running)
            {
                // --- We have just got the notification from the execution cycle
                // --- about the successful start.
                _vmStarterCompletionSource.SetResult(true);
            }
        }
Пример #3
0
 /// <summary>
 /// Invokes the VmStateChanged event
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnVmStateChanged(VmStateChangedEventArgs e)
 {
     VmStateChanged?.Invoke(this, e);
 }