示例#1
0
        /// <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
        }
示例#2
0
        public Callback(MainThreadDelegate mtd)
        {
            if (mtd == null)
            {
                throw new ArgumentNullException("Callbacks must have a method to run.");
            }

            ToRun = mtd;
        }
示例#3
0
        /// <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));
        }
示例#4
0
        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();
        }
示例#5
0
        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));
        }