Pickaxe.Runtime.Runable.Run C# (CSharp) Method

Run() public method

public Run ( ) : void
return void
        public void Run()
        {
            ServicePointManager.DefaultConnectionLimit = int.MaxValue;
            ServicePointManager.SecurityProtocol |= (SecurityProtocolType)3072; //TLS 1.2

            var cultureInfo = new CultureInfo("en-US");
            cultureInfo.DateTimeFormat.LongTimePattern = "HH:mm:ss.fff";
            cultureInfo.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
            Thread.CurrentThread.CurrentCulture = cultureInfo;

            _instance.ExecutingThread = Thread.CurrentThread;
            var method = _runType.GetMethod("Run");
            method.Invoke(_instance, null);
        }

Usage Example

Esempio n. 1
0
        private void Compile(string source)
        {
            ThreadContext.Properties[Config.LogKey] = _logValue;
            ThreadedDownloadTable.LogValue = _logValue;

            DoInvoke(new Action(() =>
            {
                messagesTextBox.Clear();
                statusLabel.Text = "Running...";

                //var highlightingStrategy = textEditorControl1.Document.HighlightingStrategy as DefaultHighlightingStrategy;
                //highlightingStrategy.SetColorFor("Selection", _executionHighlight);
            }));

            var compiler = new Compiler(source);
            var generatedAssembly = compiler.ToAssembly();

            if (compiler.Errors.Any())
                ListErrors(compiler.Errors.Select(x => x.Message).ToArray());

            if (!compiler.Errors.Any())
            {
                _runable = new Runable(generatedAssembly);
                _runable.Select += OnSelectResults;
                _runable.Progress += OnProgress;
                _runable.Highlight += OnHighlight;

                try
                {
                    _runable.Run();
                }
                catch (ThreadAbortException)
                {
                    Log.Info("Program aborted");
                }
                catch (Exception e)
                {
                    Log.Fatal("Unexpected Exception", e);
                }
            }

            ProgramFinished();
        }
All Usage Examples Of Pickaxe.Runtime.Runable::Run