Ejemplo n.º 1
0
 /// <summary>
 /// Indicator for VM connection status
 /// </summary>
 private System.Collections.IEnumerator UpdateVMConnectionStatus() // TODO move to emulation toolbar
 {
     while (true)
     {
         if (EmulatorManager.IsVMConnected())
         {
             VMConnectionStatusImage.sprite = EmulatorConnection;
             if (EmulatorNetworkConnection.Instance.IsConnected())
             {
                 VMConnectionStatusMessage.text = "Connected";
             }
             else
             {
                 VMConnectionStatusMessage.text = "Ready";
                 RobotDisabled();
             }
             if (!EmulatorManager.IsRunningRobotCodeRunner() && !EmulatorManager.IsTryingToRunRobotCode() && !EmulatorManager.IsRobotCodeRestarting())
             {
                 EmulatorManager.RestartRobotCode();
             }
         }
         else
         {
             if (!EmulatorManager.IsVMInstalled())
             {
                 VMConnectionStatusImage.sprite = EmulatorNotInstalled;
                 VMConnectionStatusMessage.text = "Not Installed";
             }
             else if (!EmulatorManager.IsVMRunning())
             {
                 VMConnectionStatusImage.sprite = StartEmulator;
                 VMConnectionStatusMessage.text = "Start Emulator";
             }
             else
             {
                 VMConnectionStatusImage.sprite = EmulatorConnection;
                 VMConnectionStatusMessage.text = "Starting";
             }
             RobotDisabled();
         }
         yield return(new WaitForSeconds(1.0f)); // s
     }
 }
Ejemplo n.º 2
0
        public void OnVMConnectionStatusClicked()
        {
            if (EmulationWarnings.CheckRequirement((EmulationWarnings.Requirement.VMInstalled)) && !EmulatorManager.IsVMRunning() && !EmulatorManager.IsVMConnected())
            {
                AnalyticsManager.GlobalInstance.LogEventAsync(AnalyticsLedger.EventCatagory.EmulationTab,
                                                              AnalyticsLedger.EventAction.Clicked,
                                                              "Emulation Start",
                                                              AnalyticsLedger.getMilliseconds().ToString());

                if (EmulatorManager.StartEmulator()) // If successful
                {
                    EmulationDriverStation.Instance.SetActive(true);
                }
                else
                {
                    UserMessageManager.Dispatch("Emulator failed to start.", EmulationWarnings.WARNING_DURATION);
                }
            }
            else if (EmulatorManager.IsVMRunning())
            {
                EmulationDriverStation.Instance.SetKillEmulatorDialogActive(true);
            }
        }