private void StartRecording() { //temp.text += " Called start recording "; if (m_RecordingRoutine == 0) { //temp.text += " Recording Routine len is 0 - calling recording handler "; UnityObjectUtil.StartDestroyQueue(); m_RecordingRoutine = Runnable.Run(RecordingHandler()); } showUtterance = true; //temp.text += "outside if"; Debug.Log("Set showUtterance to false in start recording"); }
internal async Task Execute() { SetStepText(); await Task.Run(async() => { try { StartTime = DateTime.Now; if (ShouldSkip()) { StepText = $"[Skipped] {StepText}"; Status = Status.Skipped; return; } await Runnable.Run(); Status = Status.Passed; } catch (NotImplementedException e) { Status = Status.NotImplemented; Exception = new ExceptionWrapper(e); throw; } catch (Exception e) when(BDTestSettings.CustomExceptionSettings.SuccessExceptionTypes.Contains(e.GetType())) { Status = Status.Passed; throw; } catch (Exception e) when(BDTestSettings.CustomExceptionSettings.InconclusiveExceptionTypes.Contains(e.GetType())) { Status = Status.Inconclusive; throw; } catch (Exception e) { Status = Status.Failed; Exception = new ExceptionWrapper(e); throw; } finally { EndTime = DateTime.Now; TimeTaken = EndTime - StartTime; Output = TestOutputData.Instance.ToString().Trim(); TestOutputData.ClearCurrentTaskData(); } }); }
public Object Run(Environment e) { Object oi = i.Run(e); if (oi == null || !((oi is Boolean) && (((Boolean)oi)))) { if (f != null) { return(f.Run(e)); } return(null); } return(t.Run(e)); }
public IEnumerator ConcurrentTilesetInsert() { ued.LogFormat("about to insert {0} tiles for each tileset", _tileIds.Count); int rIdCr1 = Runnable.Run(InsertCoroutine(TS_CONCURRENT1, false, _tileIds)); int rIdCr2 = Runnable.Run(InsertCoroutine(TS_CONCURRENT2, false, _tileIds)); int rIdCr3 = Runnable.Run(InsertCoroutine(TS_CONCURRENT3, false, _tileIds)); int rIdCr4 = Runnable.Run(InsertCoroutine(TS_CONCURRENT4, false, _tileIds)); while (Runnable.IsRunning(rIdCr1) || Runnable.IsRunning(rIdCr2) || Runnable.IsRunning(rIdCr3) || Runnable.IsRunning(rIdCr4)) { yield return(null); } }
private void Start() { // Enable TLS 1.2 //ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; // Disable old protocols //ServicePointManager.SecurityProtocol &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11); counter = 0; LogSystem.InstallDefaultReactors(); Runnable.Run(CreateService()); processStatus = "Idle"; source = gameObject.GetComponent <AudioSource>(); }
void Start() { LogSystem.InstallDefaultReactors(); // Create credential and instantiate service Credentials credentials = new Credentials(_username, _password, _url); _personalityInsights = new PersonalityInsights(credentials); _personalityInsights.VersionDate = _personalityInsightsVersionDate; _dataPath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/personalityInsights.json"; Runnable.Run(Examples()); }
private void OnEnable() { #if UNITY_5 titleContent.text = "Config Editor"; #endif m_WatsonIcon = (Texture2D)Resources.Load(Constants.Resources.WATSON_ICON, typeof(Texture2D)); m_StatusUnknown = (Texture2D)Resources.Load("status_unknown", typeof(Texture2D)); m_StatusDown = (Texture2D)Resources.Load("status_down", typeof(Texture2D)); m_StatusUp = (Texture2D)Resources.Load("status_up", typeof(Texture2D)); m_WizardMode = PlayerPrefs.GetInt("WizardMode", 1) != 0; Runnable.EnableRunnableInEditor(); m_CheckServiceRoutine = Runnable.Run(CheckServices()); }
private void ShouldThrow(Type ecls, Runnable runnable) { try { runnable.Run(); } catch (Exception e) { NUnit.Framework.Assert.AreSame(ecls, e.GetType()); Log.Info("got expected: " + e); return; } NUnit.Framework.Assert.IsTrue("Should've thrown " + ecls.Name, false); }
public void OnGlobalLayout() { if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBean) { #pragma warning disable 618 _view.ViewTreeObserver.RemoveGlobalOnLayoutListener(this); #pragma warning restore 618 } else { _view.ViewTreeObserver.RemoveOnGlobalLayoutListener(this); } _runnable.Run(); }
private IEnumerator CreateService() { IamAuthenticator authenticator = new IamAuthenticator(apikey: "{iamApikey}"); // Wait for tokendata while (!authenticator.CanAuthenticate()) { yield return(null); } service = new PersonalityInsightsService("2019-02-18", authenticator); Runnable.Run(Examples()); }
private void Start() { LogSystem.InstallDefaultReactors(); // Create credential and instantiate service Credentials credentials = new Credentials(_username, _password, _url); _discovery = new Discovery(credentials); _discovery.VersionDate = _versionDate; _filePathToIngest = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/watson_beats_jeopardy.html"; _documentFilePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/watson_beats_jeopardy.html"; Runnable.Run(Examples()); }
/// <summary> /// Downloads an image from the URL and returns the results as callbacks /// </summary> /// <param name="path">The URL/path</param> /// <param name="onSuccess">Callback when the download is successful</param> /// <param name="onFailure">Callback for when the download is unsuccessful</param> public void Download(string path, Action <Texture2D> onSuccess, Action <Exception> onFailure) { var req = new Request(path, onSuccess, onFailure); if (CanSendNewRequest) { Runnable.Run(SendRequest(req)); return; } else { pending.Add(req); } }
public void Speak(string text) { if (!_disable_watson) { Runnable.Run(RunnableSpeak(text)); } else { print("WatsonTTS : " + text); _agent_output.GetComponentInChildren <Text>().text = text; ReactivateListener(); } }
public void textToSpeech(string gender, string text, bool goodNews) { //StopAllCoroutines(); LogSystem.InstallDefaultReactors(); if (goodNews) { Runnable.Run(Examples(gender, expressAsGoodNews(text))); } else { Runnable.Run(Examples(gender, neutral(text))); } }
private static void Main(string[] args) { Runnable runnable = new Runnable(); runnable.RequireStart(); Thread outer = new Thread(() => { try { while (IsProgramActive) { Console.WriteLine("Outer Thread Running..."); Thread.Sleep(2000); Thread inner = new Thread(() => runnable.Run()) { IsBackground = true }; inner.Start(); } } catch (ThreadInterruptedException e) { Console.WriteLine(e.Message); } catch (Exception e) { Console.WriteLine(e.Message); } finally { Console.WriteLine("Outer Thread Stopped."); } }) { IsBackground = true }; outer.Start(); string command = Console.ReadLine(); if (command == "") { runnable.RequireStop(); } Console.ReadLine(); }
public void Process() { if (!processing) { //Debug.Log("Process, currentAction: " + currentAction); if (currentAction != null) { // Action was interrupted before complete (e.g. due to an assembly reload). RequeueCurrentAction(); } processId = Runnable.Run(ProcessQueue()); } }
// Start is called before the first frame update void Start() { SpeechToText stt = GetComponentInChildren <SpeechToText>(); TextToSpeech tts = GetComponentInChildren <TextToSpeech>(); SimpleBot chat = GetComponentInChildren <SimpleBot>(); stt.settings = settings; Runnable.Run(stt.CreateService()); tts.settings = settings; Runnable.Run(tts.CreateService()); chat.settings = settings; Runnable.Run(chat.CreateService()); }
public void PostAfterLayout(Runnable runnable) { if (attached && !IsLayoutRequested) { runnable.Run(); } else { if (null == afterLayoutRunnableList) { afterLayoutRunnableList = new LinkedList <Runnable>(); } afterLayoutRunnableList.AddLast(runnable); } }
private IEnumerator CreateService() { IamAuthenticator authenticator = new IamAuthenticator(apikey: "{iamApikey}"); // Wait for tokendata while (!authenticator.CanAuthenticate()) { yield return(null); } service = new AssistantService("2019-02-18", authenticator); workspaceId = Environment.GetEnvironmentVariable("CONVERSATION_WORKSPACE_ID"); Runnable.Run(Examples()); }
void Start() { LogSystem.InstallDefaultReactors(); // Create credential and instantiate service Credentials credentials = new Credentials(_username, _password, _url); _speechToText = new SpeechToText(credentials); _customCorpusFilePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/test-stt-corpus.txt"; _customWordsFilePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/test-stt-words.json"; _wavFilePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/test-audio.wav"; _audioClip = WaveFile.ParseWAV("testClip", File.ReadAllBytes(_wavFilePath)); Runnable.Run(Examples()); }
void Start() { LogSystem.InstallDefaultReactors(); if (string.IsNullOrEmpty(iamApikey)) { throw new IBMException("Please set the Speech to Text iamApikey in the inspector."); } if (languageTranslatorSample == null) { throw new IBMException("Please set the languageTranslatorSample in the inspector."); } Runnable.Run(CreateService()); }
private void StartRecording() { if (m_RecordingRoutine == 0) { UnityObjectUtil.StartDestroyQueue(); m_RecordingRoutine = Runnable.Run(RecordingHandler()); m_ActivateOutput.SendData(new BooleanData(true)); if (m_StatusText != null) { m_StatusText.text = "RECORDING"; } } }
private IEnumerator CheckEnvironmentState(float waitTime) { yield return(new WaitForSeconds(waitTime)); Log.Debug("TestDiscovery.CheckEnvironmentState()", "Attempting to get environment state"); try { _discovery.GetEnvironment(HandleCheckEnvironmentState, OnFail, _environmentId); } catch (System.Exception e) { Log.Debug("TestDiscovery.CheckEnvironmentState()", string.Format("Failed to get environment state: {0}", e.Message)); Runnable.Run(CheckEnvironmentState(10f)); } }
/** * Main thread execution loop. * <p> * The main loop will run, waiting for tasks to be added to the queue, executing * those tasks and looping until shutdown has been requested. */ private void ThreadMainLoop() { Logger.Debug("Main loop starts"); // Run the main loop until a shutdown is requested while (!shutdownRequested) { // Synchronise on the queue lock... lock (queueLock) { // Loop waiting for items to be added to the queue, looping is necessary // due to potential spurious wake-ups while (queue.Count == 0 && !shutdownRequested) { // Wait for a notification of a new item (or items) added to the queue Logger.Trace("Waiting for queue notification..."); Monitor.Wait(queueLock); Logger.Trace("...got queue notification."); } } // Process all current items in the queue sequentially... while (queue.Count > 0) { Runnable task = null; // Synchronise on the queue since we are going to manipulate it lock (queueLock) { // If the queue is not empty dequeue the next item if (queue.Count > 0) { task = queue.Dequeue(); } } Logger.Trace("task={}", task); // Execute the task... if (task != null) { // Ensure that an exception in the task does not break the executor try { task.Run(); } catch (Exception e) { Logger.Error("Runnable task threw an exception", e); } } } } // Thread main loop exits Logger.Debug("Main loop exits"); shutdownCompleted = true; }
private void Start() { //getFileNames(); //spawner spawner1 = new spawner(); //var spawnableItemsList = new string[] { "bed", "table", "ball", "bottle", "carpet" }; //foreach (string item in spawnableItemsList) //{ // spawnableItems.Add(item); //} // Enable TLS 1.2 //ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; // Disable old protocols //ServicePointManager.SecurityProtocol &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11); LogSystem.InstallDefaultReactors(); Runnable.Run(CreateService()); chatStatus = ProcessingStatus.Idle; // Since coroutines can't return values I use the onValueChanged listener // to trigger an action after waiting for an input to arrive. // I originally used enums or flags to keep track if a process such // as obtaining a chat response from IBM Assistant was still being processed // or was finished processing but this was cumbersome. if (externalInputField != null) { if (externalTriggerType == InputFieldTrigger.onEndEdit) { externalInputField.onEndEdit.AddListener(delegate { Runnable.Run(ProcessChat(externalInputField.text)); }); } else { externalInputField.onValueChanged.AddListener(delegate { Runnable.Run(ProcessChat(externalInputField.text)); }); } } inputField = gameObject.AddComponent <InputField>(); inputField.textComponent = gameObject.AddComponent <Text>(); inputField.onValueChanged.AddListener(delegate { Runnable.Run(ProcessChat(inputField.text)); }); }
private void InternalRun() { wrapperThread = this; try { runnable.Run(); } catch (Exception ex) { Loon.Utils.Debug.Log.Exception(ex); } finally { tgroup.Remove(this); } }
private void HandleDeleteEnvironment(bool success, string data) { if (success) { Log.Debug("ExampleDiscoveryV1", "Delete environment successful"); m_CreatedEnvironmentID = default(string); Test(success); } else { Log.Debug("ExampleDiscoveryV1", "Failed to delete environment... making another attempt"); Runnable.Run(DeleteEnvironment()); } m_DeleteEnvironmentTested = true; }
private void HandleDeleteConfiguration(bool success, string data) { if (success) { Log.Debug("ExampleDiscoveryV1", "Delete configuration successful"); m_CreatedConfigurationID = default(string); Test(success); } else { Log.Debug("ExampleDiscoveryV1", "Failed to delete configuration... making another attempt"); Runnable.Run(DeleteConfiguration()); } m_DeleteConfigurationTested = true; }
public Object Run(Environment env) { Object oo = env.getVariable(variableName); Object ret = null; if (oo is VarStore) { ret = code.Run(env); ((VarStore)oo).o = ret; } else { throw new Exception(); } return(ret); }
private void InternalRun() { wrapperThread = this; try { runnable.Run(); } catch (Exception exception) { Console.WriteLine(exception); } finally { tgroup.Remove(this); } }
public void Post(Runnable runnable) { runnable.Run(); }
void ExecutorDelivery_BlinkPoster(object sender, Runnable e) { e.Run(); }
private int ExecuteRunner() { Runner = new BasicProcessor().Create(configuration.GetItem<Settings>().Runner, new TreeList<string>()).GetValue<Runnable>(); return Runner.Run(extraArguments.ToArray(), configuration, progressReporter); }