/// <summary>Queues the given delegate in order to run it on the main Unity thread.</summary> public static void MainThread(MainThreadDelegate toRun) { #if UNITY_METRO && UNITY_EDITOR toRun(); return; #elif UNITY_METRO if (Environment.CurrentManagedThreadId == Callbacks.MainThread) { toRun(); return; } // Enqueue: Callbacks.Add(new Callback(toRun)); #else if (Thread.CurrentThread == Callbacks.MainThread) { toRun(); return; } // Enqueue: Callbacks.Add(new Callback(toRun)); #endif }
public Callback(MainThreadDelegate mtd) { if (mtd == null) { throw new ArgumentNullException("Callbacks must have a method to run."); } ToRun = mtd; }
/// <summary>Queues the given delegate in order to run it on the main Unity thread.</summary> public static void MainThread(MainThreadDelegate toRun) { if (Thread.CurrentThread == Callbacks.MainThread) { toRun(); return; } // Enqueue: Callbacks.Add(new Callback(toRun)); }
private void Mainform_Shown(object sender, EventArgs e) { if (!PersistentState.Setup) { SetupForm setupForm = new SetupForm(); DialogResult result = setupForm.ShowDialog(); if (result != DialogResult.OK) { Application.Exit(); return; } PersistentState.Initialize(setupForm.Id, setupForm.Key, setupForm.BulkData); } _loader = new DynamoDbLoader(); _loader.StatusChanged += OtherThreadNotificationHandler; _downloader = new DownloaderWorker(); _downloader.StatusChanged += OtherThreadNotificationHandler; _mainThreadDelegate = MainThreadAction; //lstCrashes.View = View.Details; foreach (CrashReport crashReport in PersistentState.Database.GetAllCrashes()) { _crashReports.Add(crashReport); } _bldCrashReports = new BindingListDisplay <CrashReport>(_crashReports, c => new CrashReportView(c, _downloader)) { Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left, Location = new Point(12, 69), Size = new Size(863, 277), }; _bldCrashReports.Sort(new CrashReportTimeStampFilter()); tabReports.Controls.Add(_bldCrashReports); string automation = PersistentState.Database.GetKey("autodownload_automation"); if (automation != null) { cboAutomation.SelectedIndex = int.Parse(automation); } UpdateDBDependantControls(); }
public static CompileContext CompileGMLText(string input, UndertaleData data, UndertaleCode code, MainThreadDelegate mainThreadDelegate) { var ctx = new CompileContext(data, code); ctx.MainThreadDelegate = mainThreadDelegate; return(CompileGMLText(input, ctx)); }