protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); if (string.IsNullOrEmpty(SiteUrl)) return; if (settings != null) { chkAppLists.Checked = settings.ShowApplicationLists; chkHidden.Checked = settings.ShowHiddenLists; chkGallery.Checked = settings.ShowGalleryLists; } tsLabel.Text = string.Format(tsLabel.Text, SiteUrl); UpdateControlsState(false); if (SelectedList != null) { IList<SPColumn> codeCols = SelectedList.GetColumnsForCode(); if (codeCols != null && codeCols.Count > 0) { originalColumns = new List<SPColumn>(codeCols.Count); foreach (SPColumn col in codeCols) { originalColumns.Add(SPColumn.Clone(col)); } } } System.Threading.ThreadStart starter = new System.Threading.ThreadStart(RetrieveLists); _listThread = new System.Threading.Thread(starter); _listThread.SetApartmentState(System.Threading.ApartmentState.STA); _listThread.IsBackground = true; _listThread.Start(); this.Cursor = Cursors.WaitCursor; }
/// <summary> /// Clicking the back button will close the current application thread and reopen the movie selection form on a seperate thread /// This will ensure a clean exit of all current forms and variable /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void backControl_Click(object sender, EventArgs e) { System.Threading.ThreadStart main = new System.Threading.ThreadStart(openNewApp); System.Threading.Thread sys2 = new System.Threading.Thread(main); sys2.Start(); Application.ExitThread(); }
public MainForm() { InitializeComponent(); try { foreach (IPAddress ip in Dns.GetHostEntry(Dns.GetHostName()).AddressList) { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { localIP = ip; break; } } udpListen = new UDPListen(new IPEndPoint(localIP, localPort)); System.Threading.ThreadStart threadStartListen; threadStartListen = new System.Threading.ThreadStart(udpListen.open); udpListen.msgReceiptEvent += new msgReceiptHandler(listen_msgReceiptEvent); threadListen = new System.Threading.Thread(threadStartListen); threadListen.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void loadDeviceInfo() { System.Threading.ThreadStart ts = new System.Threading.ThreadStart (() => { DeviceInfo di = DeviceInfo.CurrentDevice; }); ts.BeginInvoke (null, null); }
/// <summary> /// コンストラクタ /// </summary> public FFXIVLogWatcher() { ts = new System.Threading.ThreadStart(ReadThread); Enable = false; LogReadIntervalSec = 1.0; RetryIntervalSec = 5.0; }
internal WidcommBluetoothRadio(WidcommBluetoothFactoryBase factory) { System.Threading.ThreadStart handleError = delegate { }; #if !NETCF // On my old iPAQ the radio info functions fail sometimes even though // the stack is working fine so we ignored the errors in the first // release. On Win32 this is a problem when the stack is installed // but no radio is attached, so fail in that case. handleError = delegate { throw new PlatformNotSupportedException( "Widcomm Bluetooth stack not supported (Radio)."); }; #endif // Debug.Assert(factory != null); _factory = factory; var tmp = BtIf; bool ret; ret = BtIf.GetLocalDeviceVersionInfo(ref m_dvi); Debug.Assert(ret, "GetLocalDeviceVersionInfo failed"); if (!ret) { handleError(); // Call handleError first so that one Win32 we don't get the Assert if there's no stack present. Debug.Assert(ret, "GetLocalDeviceVersionInfo failed"); m_dvi = new DEV_VER_INFO(HciVersion.Unknown); // Reset to overwrite any garbage returned by GetLocalDeviceVersionInfo. } byte[] bdName = new byte[WidcommStructs.BD_NAME_LEN]; ret = BtIf.GetLocalDeviceName(bdName); Debug.Assert(ret, "GetLocalDeviceName failed"); if (ret) { m_name = WidcommUtils.BdNameToString(bdName); } else { bdName = null; handleError(); } // // Did GetLocalDeviceVersionInfo get the address? It doesn't work on // my iPAQ, but then again this way doesn't work either! if (LocalAddress == null || LocalAddress.ToInt64() == 0) { Utils.MiscUtils.Trace_WriteLine("GetLocalDeviceVersionInfo's bd_addr is empty, trying GetLocalDeviceInfoBdAddr..."); if (m_dvi.bd_addr == null) { m_dvi.bd_addr = new byte[WidcommStructs.BD_ADDR_LEN]; } ret = BtIf.GetLocalDeviceInfoBdAddr(m_dvi.bd_addr); Debug.Assert(ret, "GetLocalDeviceInfoBdAddr failed"); if (!ret) { m_dvi.bd_addr = new byte[WidcommStructs.BD_ADDR_LEN]; handleError(); } } }
private void btnIniciar_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtRutaEntrada.Text) == false && string.IsNullOrEmpty(txtRutaSalida.Text) == false) { System.Threading.ThreadStart p = new System.Threading.ThreadStart(this.procesarSalida); System.Threading.Thread t = new System.Threading.Thread(p); t.Start(); } }
/// <summary> /// Start a run of the tests in the loaded TestPackage. The tests are run /// asynchronously and the listener interface is notified as it progresses. /// </summary> /// <param name="listener">An ITestEventHandler to receive events</param> /// <param name="filter">A TestFilter used to select tests</param> public override void BeginRun(ITestEventHandler listener, TestFilter filter) { _listener = listener; _filter = filter; var threadStart = new System.Threading.ThreadStart(RunnerProc); System.Threading.Thread runnerThread = new System.Threading.Thread(threadStart); runnerThread.Start(); }
private void buttonTest1_Click(object sender, EventArgs e) { buttonPause.Enabled = true; state = DashboardState.running; MonitorThreadStart = new System.Threading.ThreadStart(CGRmonitor); MonitorThread = new System.Threading.Thread(MonitorThreadStart); MonitorThread.IsBackground = true; MonitorThread.Start(); }
private void test2_Click(object sender, EventArgs e) { System.Threading.ThreadStart writeThreadStart; System.Threading.Thread writeThread; writeThreadStart = new System.Threading.ThreadStart(writer); writeThread = new System.Threading.Thread(writeThreadStart); writeThread.IsBackground = true; writeThread.Start(); }
private void logFinder_DoWork(object sender, DoWorkEventArgs e) { while (logmemoryInfo == null && !logFinder.CancellationPending) { logmemoryInfo = FFXIVLogMemoryInfo.Create(); if (logmemoryInfo == null) { SetStatus(String.Format("ログイン確認中...")); SetProgress(0, false); for (int i = 10; i >= 0 && !logFinder.CancellationPending; i--) { System.Threading.Thread.Sleep(10000); //SetStatus(String.Format("プロセス確認中...", i)); } continue; } //SetStatus("ログイン確認中..."); SetProgress(0, false); bool success = false; System.Threading.ThreadStart action = () => { success = logmemoryInfo.SearchLogMemoryInfo(); }; System.Threading.Thread th = new System.Threading.Thread(action); th.Start(); while (th.IsAlive) { if (logFinder.CancellationPending) {//キャンセルされた SetStatus("停止中..."); logmemoryInfo.CancelSearching(); th.Join(); logmemoryInfo = null; SetProgress(0, false); return; } SetProgress(logmemoryInfo.Progress, true); System.Threading.Thread.Sleep(100); } SetProgress(0, false); //ログのサーチに成功したか if (!success) { logmemoryInfo = null; for (int i = 10; i >= 0 && !logFinder.CancellationPending; i--) { System.Threading.Thread.Sleep(10000); SetStatus("ログイン確認中..."); } } else { InitializeData(); } } }
public void handleError(int[] iErrorNumber, bool bAutoRun) { if (threadProcess == null || !threadProcess.IsAlive) { processZS = delegate { handleErrorThread(iErrorNumber, bAutoRun); }; threadProcess = new System.Threading.Thread(processZS); threadProcess.Start(); } }
private void TimerProgramador_Tick(object sender, EventArgs e) { TimerProgramador.Stop(); if (this.Visible) { //Ejecuto tareas del programador Lfx.Services.Task ProximaTarea = null; // En conexiones lentas, 1 vez por minuto // En conexiones rápidas, cada 5 segundos if (Lfx.Workspace.Master.SlowLink) { if (Lfx.Workspace.Master.DefaultScheduler.LastGetTask == System.DateTime.MinValue || (DateTime.Now - Lfx.Workspace.Master.DefaultScheduler.LastGetTask).Minutes >= 1) { ProximaTarea = Lfx.Workspace.Master.DefaultScheduler.GetNextTask("lazaro"); } } else { if (Lfx.Workspace.Master.DefaultScheduler.LastGetTask == System.DateTime.MinValue || (DateTime.Now - Lfx.Workspace.Master.DefaultScheduler.LastGetTask).Seconds >= 5) { ProximaTarea = Lfx.Workspace.Master.DefaultScheduler.GetNextTask("lazaro"); } } if (ProximaTarea != null) { // Lanzo la tarea en un nuevo thread System.Threading.ThreadStart ParamInicio = delegate { Ejecutor.Exec(ProximaTarea.Command, ProximaTarea.ComputerName); }; new System.Threading.Thread(ParamInicio).Start(); } if (YaSubiEstadisticas == false && Lfx.Workspace.Master.DebugMode == false) { YaSubiEstadisticas = true; System.Threading.ThreadStart ParamInicio = delegate { Aplicacion.EnviarEstadisticas(); }; System.Threading.Thread Thr = new System.Threading.Thread(ParamInicio); Thr.IsBackground = true; Thr.Start(); } if (YaPregunteReiniciar == false && Lfx.Updates.Updater.Master != null && Lfx.Updates.Updater.Master.UpdatesPending() && ActiveForm == this) { YaPregunteReiniciar = true; Lui.Forms.YesNoDialog Pregunta = new Lui.Forms.YesNoDialog("Existe una nueva versión de Lázaro. Debe reiniciar la aplicación para instalar la actualización.", "¿Desea reiniciar ahora?"); Pregunta.DialogButtons = Lui.Forms.DialogButtons.YesNo; DialogResult Respuesta = Pregunta.ShowDialog(); if (Respuesta == DialogResult.OK) { Ejecutor.Exec("REBOOT"); } } } TimerProgramador.Start(); }
public void Post(string apiRoute, ApiRequestContext context, int timeout) { var request = System.Net.WebRequest.Create(_domain + '/' + apiRoute); request.Method = "POST"; request.ContentType = "application/json"; request.Timeout = timeout; using (var sw = new System.IO.StreamWriter(request.GetRequestStream())) { var serializer = new JsonSerializer(); serializer.Serialize(sw, context); } var ts = new System.Threading.ThreadStart(() => { try { var response = request.GetResponse() as System.Net.HttpWebResponse; using (var stream = response.GetResponseStream()) { using (var reader = new System.IO.StreamReader(stream, Encoding.UTF8)) { var responseString = reader.ReadToEnd(); var responseObject = JObject.Parse(responseString); Code = responseObject.Get <int>("Code"); Message = responseObject.Get <string>("Message"); if (Code >= 0) { Value = responseObject.SelectToken("Value"); } } } } catch (Exception e) { Code = -505; Message = e.Message; } finally { Responsed?.Invoke(this); } if (Code < 0) { ResponseError?.Invoke(this); } else { ResponseOK?.Invoke(this); } }); new System.Threading.Thread(ts).Start(); }
//-------- internal void DoBeginInquiry(int maxDevices, TimeSpan inquiryLength, AsyncCallback callback, object state, BluetoothClient.LiveDiscoveryCallback liveDiscoHandler, object liveDiscoState, DiscoDevsParams args) { System.Threading.ThreadStart startInquiry = DoStartInquiry; base.BeginInquiry(maxDevices, inquiryLength, callback, state, liveDiscoHandler, liveDiscoState, startInquiry, args); }
public static void Start(ref System.Threading.Thread thread, System.Threading.ThreadStart threadDelegate, System.Threading.ThreadPriority priority, bool isBackground) { Abort(ref thread, true); thread = new System.Threading.Thread(threadDelegate); thread.Priority = priority; thread.IsBackground = isBackground; thread.Start(); }
/// <summary> /// 多线程异步运行 /// </summary> /// <param name="p_ThreadStart"></param> private void MutilThreadRun(System.Threading.ThreadStart p_ThreadStart) { this.btnMailTest.Enabled = false; System.Threading.Thread schedulerThread = new System.Threading.Thread(p_ThreadStart); schedulerThread.IsBackground = true; schedulerThread.Start(); this.btnMailTest.Enabled = true; }
/// <summary> /// 区块排它锁 /// </summary> /// <param name="action">进入锁之后的回调。</param> public void Block(System.Threading.ThreadStart action) { Symbol.CommonException.CheckArgumentNull(action, "action"); Begin(); try { ThreadHelper.Block(_sync, action); } finally { End(); } }
public void Start() { watch.Restart(); IsStopping = false; var ts = new System.Threading.ThreadStart(RefreshAll); var t = new System.Threading.Thread(ts); t.IsBackground = true; t.Start(); }
static bool RunTest(System.Threading.ThreadStart testThreadStart, System.Threading.ApartmentState apartmentState) { testsRan++; System.Threading.Thread testThread = new System.Threading.Thread(testThreadStart); succeeded = false; testThread.SetApartmentState(apartmentState); testThread.Start(); testThread.Join(); return(succeeded); }
/// <summary> /// 应用程序的主入口点。 /// </summary> static void Main(string[] args) { for (int i = 0; i < 100; i++) { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(RunThread); System.Threading.Thread cc = new System.Threading.Thread(ts); cc.Start(); } }
private void DetectarConfig() { if (this.ThreadBuscar != null) { this.ThreadBuscar.Abort(); this.ThreadBuscar = null; } switch (Lfx.Environment.SystemInformation.Platform) { case Lfx.Environment.SystemInformation.Platforms.Windows: Lfx.Types.OperationProgress Progreso = new Lfx.Types.OperationProgress("Buscando un servidor", "Por favor aguarde mientras Lázaro busca un servidor en la red para utilizar como almacén de datos."); ProgresoBuscar.Visible = true; Progreso.Modal = false; Progreso.Advertise = false; Progreso.Begin(); System.Threading.ThreadStart Buscar = delegate { this.BuscarServidor(Progreso); }; this.ThreadBuscar = new System.Threading.Thread(Buscar); this.ThreadBuscar.IsBackground = true; this.ThreadBuscar.Start(); EtiquetaBuscarEspere.Visible = true; while (Progreso != null && Progreso.IsRunning) { System.Threading.Thread.Sleep(100); EtiquetaBuscando.Text = Progreso.Status; System.Windows.Forms.Application.DoEvents(); if (this.ThreadBuscar == null) { return; } } EtiquetaBuscarEspere.Visible = false; ProgresoBuscar.Visible = false; if (ServidorDetectado == null) { CheckInstalarAhora.Checked = true; EtiquetaBuscando.Text = "Lázaro no pudo encontrar un servidor SQL en la red. Si desea, puede instalar un servidor SQL en este equipo. Haga clic en 'Siguiente' para continuar."; } else { EtiquetaBuscando.Text = "Lázaro detectó un servidor SQL en la red. Haga clic en el botón 'Siguiente' para revisar la configuración detectada."; CheckOtroEquipo.Checked = true; EntradaServidor.Text = ServidorDetectado; } break; default: // No es Windows CheckInstalarAhora.Enabled = false; break; } }
private void loadObjects() { //Coleccion Canonica System.Threading.ThreadStart FStart1 = showCollection; System.Threading.Thread ThreadCC = new System.Threading.Thread(FStart1); ThreadCC.Start(); loadTable(); }
public static void Main(string[] args) { Console.WriteLine("INFO: You may use a custom server ip as a parameter to connect to a n4d-server. Ex.: llum 172.25.25.54"); Application.Init(); llum.Core.getCore(); if (args.Length > 0) { llum.Core.getCore().server = "https://" + args[0] + ":9779"; llum.Core.getCore().user_ip = true; llum.Core.getCore().xmlrpc = new XmlrpcClient(); Application.Run(); } else { llum.Core.getCore().server = "https://server:9779"; llum.Core.getCore().xmlrpc = new XmlrpcClient(); System.Threading.Thread thread; System.Threading.ThreadStart tstart = delegate { string master_server_ip; master_server_ip = llum.Core.getCore().xmlrpc.get_master_ip(); if (master_server_ip != null && master_server_ip != "FUNCTION NOT SUPPORTED") { llum.Core.getCore().server = "https://" + master_server_ip + ":9779"; llum.Core.getCore().xmlrpc = new XmlrpcClient(); try{ if (!System.IO.File.Exists("/etc/auto.lliurex")) { throw new Exception("Forcing fallback to local server. N4D will handle remote ldap connection"); } llum.Core.getCore().xmlrpc.get_methods(); Gtk.Application.Invoke(delegate { llum.Core.getCore().mw.enableIcon(true); }); } catch { // Connection failed, reverting to local server llum.Core.getCore().server = "https://server:9779"; llum.Core.getCore().xmlrpc = new XmlrpcClient(); } } else { llum.Core.getCore().server = "https://server:9779"; llum.Core.getCore().xmlrpc = new XmlrpcClient(); } }; Gdk.Threads.Init(); //thread=new System.Threading.Thread(tstart); //thread.Start(); Application.Run(); } }
/// <summary> /// 启动站点垃圾回收程序 /// </summary> /// <param name="Server"></param> public static void StartRecycling(HttpServerUtility Server) { //TODO:图片垃圾回收 //string root = SheetUtility.GetTempImageRoot(null); //TempImagePath = Server.MapPath(root); TempImagePath = Path.Combine(Server.MapPath("."), "TempImages"); // 启动 System.Threading.ThreadStart start = new System.Threading.ThreadStart(RecycleImages); System.Threading.Thread thread = new System.Threading.Thread(start); thread.Start(); }
private void TestLoadRemotingSockets() { int n = 0; for (int i = 0; i < 100; i++) { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(this.TestLoadRemotingSocketsMethod); System.Threading.Thread t = new System.Threading.Thread(ts); t.Start(); } }
protected virtual void Process(System.Net.Sockets.Socket socket) { // This is unlimited threaded. HttpServerWorker worker = CreateWorker(socket, this._preProcessor); System.Threading.ThreadStart threadStart = new System.Threading.ThreadStart(worker.Execute); System.Threading.Thread thread = new System.Threading.Thread(threadStart); thread.Start(); //TODO }
protected override void Process(System.Net.Sockets.Socket socket) { // This is unlimited threaded. HttpServerWorker worker = CreateWorker(socket, this._preProcessor, this.Certificate, this.PrivateKey); System.Threading.ThreadStart threadStart = new System.Threading.ThreadStart(worker.Execute); System.Threading.Thread thread = new System.Threading.Thread(threadStart); thread.Start(); //TODO }
private void GUI_Check_List_FormClosed(object sender, FormClosedEventArgs e) { System.Threading.ThreadStart starter = new System.Threading.ThreadStart(form_closed); System.Threading.Thread thread = new System.Threading.Thread(starter); thread.IsBackground = true; thread.Start(); }
public void StartProcess(string path, ProcessorSettings settings) { Output.PrintMethod = this.Print; this.path = path; this.sett = settings; System.Threading.ThreadStart ts = new System.Threading.ThreadStart(this.Run); System.Threading.Thread t = new System.Threading.Thread(ts); t.Start(); }
public void OnMenuButtonClicked(object sender, System.EventArgs e) { llum.Core.getCore().freeze_wid = new FreezeWidget(); llum.Core.getCore().mw.setCurrentWidget(llum.Core.getCore().freeze_wid); System.Threading.ThreadStart tstart = delegate { llum.Core.getCore().freeze_wid.group_list = llum.Core.getCore().xmlrpc.get_available_groups_info(); llum.Core.getCore().freeze_wid.group_list_str = new System.Collections.Generic.List <string>(); foreach (llum.LdapGroup grp in llum.Core.getCore().freeze_wid.group_list) { llum.Core.getCore().freeze_wid.group_list_str.Add(grp.gid); } llum.Core.getCore().freeze_wid.user_list = llum.Core.getCore().xmlrpc.get_user_list(); llum.Core.getCore().freeze_wid.user_list_str = new System.Collections.Generic.List <string>(); foreach (llum.LdapUser user in llum.Core.getCore().freeze_wid.user_list) { if (user.main_group == "students") { llum.Core.getCore().freeze_wid.user_list_str.Add(user.uid); } } Gtk.Application.Invoke(delegate { if (llum.Core.getCore().freeze_wid.user_list == null) { llum.Core.getCore().freeze_wid.msgLabel.Markup = "<span foreground='red'>" + Mono.Unix.Catalog.GetString("There was an error connecting to the n4d(XMLRPC) server") + "</span>"; } else { llum.Core.getCore().freeze_wid.msgLabel.Text = ""; } llum.Core.getCore().freeze_wid.enable_gui(); llum.Core.getCore().freeze_wid.searchImage.Visible = false; try { llum.Core.getCore().freeze_wid.populate_available_groups_treeview(); llum.Core.getCore().freeze_wid.populate_available_users_treeview(); } catch (Exception ex) { Console.WriteLine(ex); } }); }; System.Threading.Thread thread = new System.Threading.Thread(tstart); thread.Start(); }
private Types.Object EvaluateAsync(Node.Async node) { Interpreter i = new Interpreter(this.Environment.Copy()); System.Threading.ThreadStart s = new System.Threading.ThreadStart(delegate() { i.Evaluate(node.E); // ! Not yet thread safe }); System.Threading.Thread t = new System.Threading.Thread(s); t.Start(); return(new Types.Undefined()); }
public void Update() { if (textBoxDetails.InvokeRequired) { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(Update); textBoxDetails.Invoke(ts); } else { textBoxDetails.Text = ai.Summary; } }
public void Start() { if (timerthread != null) { return; } System.Threading.ThreadStart ts = new System.Threading.ThreadStart(CountdownThread); ct = cts.Token; this.timerthread = new System.Threading.Thread(ts); this.timerthread.Start(); //OnMessageEvent(string.Format("Counting down to {0} in {1}",Title, countdowntimer)); }
public static void Pack(DTE2 dte2) { Dte2 = dte2; if (string.IsNullOrEmpty(Dte2.Solution.FullName)) { throw new Exception("Before publish please save solution file..."); } SolutionPath = Path.GetDirectoryName(Dte2.Solution.FullName); NugetExe = Path.Combine(SolutionPath, NUGET_FILE_NAME); if (!File.Exists(NugetExe)) { throw new Exception($"nuget.exe not found {NugetExe} - it is based on solution directory"); } ApiKey = File.ReadAllText(API_KEY_CONTAINING_FILE); NugetPackagesFolder = Path.Combine(SolutionPath, OUTPUT_FOLDER); var start = new System.Threading.ThreadStart(() => { var completed = new List <string>(); var failed = new List <string>(); try { foreach (var item in GetSelectedProjectPath()) { if (PackSingleProject(item)) { completed.Add(item.Name); } else { failed.Add(item.Name); } } } catch (Exception exception) { InvokeException(exception); } OnCompleted?.Invoke(null, completed.ToArray()); }); Thread = new System.Threading.Thread(start) { IsBackground = true }; Thread.Start(); }
public void UpdateText() { if (textBoxDetails.InvokeRequired) { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(UpdateText); textBoxDetails.Invoke(ts); } else { textBoxDetails.Text = ai.Summary; } }
private void TreeDetails_Load(object sender, EventArgs e) { loadFunctions(); loadFollows(); loadTransitions(); System.Threading.ThreadStart FStart = loadTree; System.Threading.Thread MyThread = new System.Threading.Thread(FStart); MyThread.Start(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); EvaluateDisplayMode(); //Evaluate incoming request and update Display Mode table System.Threading.ThreadStart archiveThread = new System.Threading.ThreadStart(TaskLoop); System.Threading.Thread myTask = new System.Threading.Thread(archiveThread); myTask.Start(); }
public ServicePool(System.Threading.ThreadStart callback, int numThreads, string name, System.Threading.ThreadPriority priority) { this.threadDelegate = callback; this.threads = new System.Threading.Thread[numThreads]; this.runnning = numThreads; for (int i = 0; i <= this.threads.Length - 1; i++) { var th = new System.Threading.Thread(this.Execute); th.Name = string.Concat(name, " #", i + 1); th.Priority = priority; th.Start(); this.threads[i] = th; } }
private void UpdateCurrentView() { if (textBoxMessages.InvokeRequired) { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(UpdateCurrentView); textBoxMessages.Invoke(ts); } else { textBoxMessages.Text = mc.GetChanText(currentServer, currentChan); textBoxMessages.SelectionStart = textBoxMessages.Text.Length - 1; textBoxMessages.ScrollToCaret(); } }
public SplashAppContext(DevExpress.XtraEditors.XtraForm loginForm, Form splashForm) : base(splashForm) { Cursor.Current = Cursors.WaitCursor; this.loginForm = loginForm; splashTimer.Interval = 100; splashTimer.Tick += new EventHandler(SplashTimeUp); splashTimer.Enabled = true; try { System.Threading.ThreadStart thread = new System.Threading.ThreadStart(FrameworkParams.Custom.InitResourceForApplication); System.Threading.Thread thread1 = new System.Threading.Thread(thread); thread1.Start(); } catch { } }
void saap_UpdatedArpCache() { if (listBox1.InvokeRequired) { cache = saap.GetCache(); System.Threading.ThreadStart ts = new System.Threading.ThreadStart(saap_UpdatedArpCache); listBox1.Invoke(ts); } else { listBox1.Items.Clear(); foreach (KeyValuePair<IPAddress, byte[]> i in cache) { listBox1.Items.Add(BitConverter.ToString(i.Value).Replace("-", "") + " -> " + i.Key.ToString()); } } }
public BackgroundCancelDialogWpf(System.Threading.ThreadStart threadstart, IExternalDrivenBackgroundMonitor monitor) { _monitor = monitor; _threadStart = threadstart; _threadException = null; _thread = new System.Threading.Thread(MonitoredThreadEntryPoint); _thread.Start(); // // Required for Windows Form Designer support // InitializeComponent(); _btCancel.Visibility = monitor != null ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed; _btInterrupt.Visibility = monitor == null ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed; _btAbort.Visibility = System.Windows.Visibility.Collapsed; }
public static void SampleMain() { // ファイルを開くダイアログを使ってるため、STAThreadである必要がある。 if (System.Threading.Thread.CurrentThread.GetApartmentState() == System.Threading.ApartmentState.STA) { // STAThreadならそのまま実行。 Main_(); } else { // 違ったらスレッドを起こしてそっちで実行させて自分は終了待機。 System.Threading.ThreadStart main = new System.Threading.ThreadStart(Main_); System.Threading.Thread staThread = new System.Threading.Thread(main); staThread.SetApartmentState(System.Threading.ApartmentState.STA); staThread.Start(); staThread.Join(); } }
public static DialogResult Show(Control owner, string caption, string text, string filter, ref string filePath, string folder, MessageBoxButtons button, MessageBoxIcon icon) { Caption = caption; TextValue = text; FilePath = filePath; FilterValue = filter; FolderValue = folder; Button = button; IconValue = icon; System.Threading.ThreadStart ts = new System.Threading.ThreadStart(ShowMessageBox); System.Threading.Thread th = new System.Threading.Thread(ts); th.SetApartmentState(System.Threading.ApartmentState.STA); th.Start(); th.Join(); filePath = Filepath; return Result; }
public void ShowFirebwallUpdate() { if (this.InvokeRequired) { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(ShowFirebwallUpdate); this.Invoke(ts); } else { this.Visible = true; meta = UpdateChecker.availableFirebwall; this.Text = "New Version: fireBwall " + meta.version; textBox1.Text = "New Version: fireBwall " + meta.version + "\r\n" + meta.Description + "\r\n\r\nChange Log:\r\n"; foreach (string s in meta.changelog) { textBox1.Text += "\t- " + s + "\r\n"; } ColorScheme_ThemeChanged(); } }
void UpdateView() { if (this.checkedListBoxModules.InvokeRequired) { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(UpdateView); this.checkedListBoxModules.Invoke(ts); } else { lock (this) { loading = true; checkedListBoxModules.Items.Clear(); for (int x = 0; x < moduleOrder.Count; x++) { checkedListBoxModules.Items.Add(moduleOrder[x].Value, moduleOrder[x].Key); } loading = false; } } }
void Application_Start(object sender, EventArgs e) { RegisterRoutes(); SchedulerConfiguration config = new SchedulerConfiguration(1000 * 3); config.Jobs.Add(new SampleJob()); Scheduler scheduler = new Scheduler(config); System.Threading.ThreadStart myThreadStart = new System.Threading.ThreadStart(scheduler.Start); System.Threading.Thread schedulerThread = new System.Threading.Thread(myThreadStart); schedulerThread.Start(); }
public ReFreshThread() { Timer t = new Timer(300000); t.Elapsed += new ElapsedEventHandler(ReFreshThread2); t.AutoReset = true; t.Enabled = true; //实例化调度配置 SchedulerConfiguration config = new SchedulerConfiguration(1000 * 60 * 60); //一小时刷新一次 //添加任务 config.Jobs.Add(new SchedulerJob()); Scheduler scheduler = new Scheduler(config); //创建 ThreadStart 委托 System.Threading.ThreadStart myThreadStart = new System.Threading.ThreadStart(scheduler.Start); //实例化线程 schedulerThread = new System.Threading.Thread(myThreadStart); //启动线程 schedulerThread.Start(); }
private void InitListener() { var ts = new System.Threading.ThreadStart(ListenerAction); var t = new System.Threading.Thread(ts) { IsBackground = true }; t.Start(); }
public void start() { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(run); System.Threading.Thread t = new System.Threading.Thread(ts); t.Start(); }
void TouchRunButton(object sender, EventArgs e) { if(_runButton.Title (UIControlState.Normal) == "Running") return; _runButton.SetTitle ("Running", UIControlState.Normal); UIApplication.SharedApplication.IdleTimerDisabled = true; System.Threading.ThreadStart ts = new System.Threading.ThreadStart (() => { MatrixTestEngine engine = new MatrixTestEngine (); _currentTests[0] = engine.RunCSTest (); _currentTests[1] = engine.RunCTest (false); _currentTests[2] = engine.RunCTest (true); this.InvokeOnMainThread ( () => { this.TableView.ReloadData (); _runButton.SetTitle ("Run", UIControlState.Normal); UIApplication.SharedApplication.IdleTimerDisabled = false; }); postResults (); }); ts.BeginInvoke (null, null); }
private void refreshTextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(LoadVideoList); System.Threading.Thread t = new System.Threading.Thread(ts); t.Start(); }
public void StartWatch(System.Threading.ThreadStart proc) { this.proc = proc; nextHandle = SetClipboardViewer(this.Handle); }
private void TestLoadRemotingSockets() { int n=0; for(int i=0;i<100;i++) { System.Threading.ThreadStart ts=new System.Threading.ThreadStart(this.TestLoadRemotingSocketsMethod); System.Threading.Thread t=new System.Threading.Thread(ts); t.Start(); } }
/// <summary> /// Handler dell'evento di pressione del bottone UPDATE. /// </summary> /// <param name="sender"> /// Chi scatena l'evento. /// </param> /// <param name="e"> /// Parametri dell'evento. /// </param> private void AlmaStyleFixUpdateCallback(object sender, EventArgs e) { var ts = new System.Threading.ThreadStart(this.CheckForUpdates); var t = new System.Threading.Thread(ts); t.Priority = System.Threading.ThreadPriority.Lowest; t.Start(); }
private void btnFetchEmails_Click(object sender, EventArgs e) { if (ValidateUI()) { btnFetchEmails.Enabled = false; IMailClient client = null; if (rdbImap.Checked) client = new ImapClient(tbHostName.Text.Trim(), Convert.ToInt32(tbPortNo.Text.Trim()), cbIsSecure.Checked); else client = new PopClient(tbHostName.Text.Trim(), Convert.ToInt32(tbPortNo.Text.Trim()), cbIsSecure.Checked); EmailAutomation emailAutomation = new EmailAutomation(client, tbUserName.Text.Trim(), tbPassword.Text.Trim()); emailAutomation.ProgressValueChanged += new ProgressValueChangedEventHandler(emailAutomation_ProgressValueChanged); emailAutomation.StatusChanged += new StatusChangedEventHandler(emailAutomation_StatusChanged); System.Threading.ThreadStart start = new System.Threading.ThreadStart(emailAutomation.PlayEmailAutomation); System.Threading.Thread t = new System.Threading.Thread(start); t.Start(); while (t.IsAlive) { Application.DoEvents(); System.Threading.Thread.Sleep(200); } emailAutomation.ProgressValueChanged -= new ProgressValueChangedEventHandler(emailAutomation_ProgressValueChanged); emailAutomation.StatusChanged -= new StatusChangedEventHandler(emailAutomation_StatusChanged); btnFetchEmails.Enabled = true; } }
private void UpdateTreeView() { if (treeViewServers.InvokeRequired) { System.Threading.ThreadStart ts = new System.Threading.ThreadStart(UpdateTreeView); treeViewServers.Invoke(ts); } else { treeViewServers.Nodes.Clear(); TreeNode root = mc.GetServerList(); foreach (TreeNode tn in root.Nodes) { treeViewServers.Nodes.Add(tn); } treeViewServers.ExpandAll(); } }
private void Form1_Load(object sender, EventArgs e) { textBox1.Text = @"c:\WINDOWS\Web\Wallpaper"; ProcessoInicio = new System.Threading.ThreadStart(Iniciar); }
/// <summary> /// The surface data is analysed. The generation of the corresponding bitmap starts here . /// </summary> public void ActivatePictureArt() { try { if (_iterate != null && !_iterate.InAbort) { if (_inPaint) { _needRepaintPictureArt = true; } else { if (_currentParameterHashWithoutPictureArt == GetParameterHashWithoutPictureArt()) { System.Threading.ThreadStart tStart = new System.Threading.ThreadStart(DrawPicture); System.Threading.Thread thread = new System.Threading.Thread(tStart); Scheduler.GrandScheduler.Exemplar.AddThread(thread); thread.Start(); } } } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } }