private void loadFile_callback(object state) { lock(fileLock) { try { file = new EU2.Edit.File(); file.ReadFrom((string)state); } catch { file = null; } } System.Threading.Thread.Sleep(100); this.Invoke(new InvokeDelegate(loadFile_done)); }
private void LoadFile() { Cursor = Cursors.WaitCursor; ReloadButton.Enabled = false; sbpStatus.Text = "Loading file..."; Application.DoEvents(); file = null; rootPanel.Enabled = false; mapView1.ShowLoading = true; System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(loadFile_callback), fileLabel.ToolTipText); }