public bool OfferToRestore(string projectPath, string backupPath) { return(SynchronizeInvoke.Invoke(() => MessageBox.Show( String.Format(Strings.ksOfferToRestoreText, projectPath, File.GetLastWriteTime(projectPath), backupPath, File.GetLastWriteTime(backupPath)), Strings.ksOfferToRestoreCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)); }
public object Invoke(Delegate method, object[] args) { if (SynchronizeInvoke != null) { SynchronizeInvoke.Invoke(method, args); } return(null); }
public object EndInvoke(IAsyncResult result) { if (SynchronizeInvoke != null) { return(SynchronizeInvoke.EndInvoke(result)); } return(null); }
public IAsyncResult BeginInvoke(Delegate method, object[] args) { if (SynchronizeInvoke != null) { return(SynchronizeInvoke.BeginInvoke(method, args)); } return(new AsyncResult()); }
private void OnStateChanged(object sender, EventArgs e) { if (SynchronizeInvoke.InvokeRequired) { SynchronizeInvoke.BeginInvoke(new MethodInvoker(UpdateState), null); } else { UpdateState(); } }
public YesNoCancel CannotRestoreLinkedFilesToOriginalLocation() { DialogResult result = SynchronizeInvoke.Invoke(() => MessageBox.Show( Strings.ksCannotRestoreLinkedFilesToOriginalLocationText, Strings.ksCannotRestoreLinkedFilesToOriginalLocationCaption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)); switch (result) { case DialogResult.Yes: return(YesNoCancel.OkYes); case DialogResult.No: return(YesNoCancel.OkNo); } return(YesNoCancel.Cancel); }
private void OnStatusChanged(object sender, EventArgs e) { if (SynchronizeInvoke.InvokeRequired) { try { SynchronizeInvoke.BeginInvoke(new MethodInvoker(UpdateStatus), null); } catch (ObjectDisposedException) { } } else { UpdateStatus(); } }
private void OnHeadChanged(object sender, RevisionPointerChangedEventArgs e) { if (SynchronizeInvoke.InvokeRequired) { try { SynchronizeInvoke.BeginInvoke(new MethodInvoker(UpdateCurrentBranchLabel), null); } catch (ObjectDisposedException) { } } else { UpdateCurrentBranchLabel(); } }
private void OnRemoteRemoved(object sender, RemoteEventArgs e) { if (SynchronizeInvoke.InvokeRequired) { try { SynchronizeInvoke.BeginInvoke(new Action <Remote>(OnRemoteRemoved), new object[] { e.Object }); } catch (ObjectDisposedException) { } } else { OnRemoteRemoved(e.Object); } }
void DebugMonitor_OnOutputDebugString(int pid, string text) { if (_Process != null && pid == _Process.Id) { Match tMatchResult = _Regex.Match(text); DateTime tTime = DateTime.Now; LogType tLogType = LogType.Information; string tDetail = tMatchResult.Groups[3].Value.ToString().Trim(); if (tMatchResult.Groups[2].Length > 0) { switch (tMatchResult.Groups[2].Value) { case "INFO": tLogType = LogType.Information; break; case "WARN": tLogType = LogType.Warning; break; case "ERRO": tLogType = LogType.Error; break; } } if (OnProcessTrace != null) { if (SynchronizeInvoke != null) { SynchronizeInvoke.Invoke((Action)(() => { OnProcessTrace(tTime, tLogType, tDetail); }), null); } else { OnProcessTrace(tTime, tLogType, tDetail); } } } }
void Process_Exited(object sender, EventArgs e) { DebugMonitor.Stop(); if (OnProcessExit != null) { if (SynchronizeInvoke != null) { SynchronizeInvoke.Invoke((Action)(() => { OnProcessExit(_Process.ExitCode); }), null); } else { OnProcessExit(_Process.ExitCode); } } }
private void OnBranchRenamed(object sender, BranchRenamedEventArgs e) { if (e.Object.IsCurrent) { if (SynchronizeInvoke.InvokeRequired) { try { SynchronizeInvoke.BeginInvoke(new MethodInvoker(UpdateCurrentBranchLabel), null); } catch (ObjectDisposedException) { } } else { UpdateCurrentBranchLabel(); } } }
public void DisplayMessage(MessageType type, string message, string caption, string helpTopic) { var icon = MessageBoxIcon.Information; switch (type) { case MessageType.Error: icon = MessageBoxIcon.Error; break; case MessageType.Info: icon = MessageBoxIcon.Information; break; case MessageType.Warning: icon = MessageBoxIcon.Warning; break; } SynchronizeInvoke.Invoke(() => MessageBox.Show(message, caption, MessageBoxButtons.OK, icon)); }
public bool RestoreLinkedFilesInProjectFolder() { return(SynchronizeInvoke.Invoke(() => MessageBox.Show( Strings.ksRestoreLinkedFilesInProjectFolderText, Strings.ksRestoreLinkedFilesInProjectFolderCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)); }
/// <summary> /// Inform the user of a lost connection /// </summary> /// <returns>True if user wishes to attempt reconnect. False otherwise.</returns> public bool ConnectionLost() { return(SynchronizeInvoke.Invoke(() => MessageBox.Show(Strings.ksConnectionLostText, Strings.ksConnectionLostCaption, MessageBoxButtons.YesNo) == DialogResult.Yes)); }
public void AsyncOpenProject(string path) { SynchronizeInvoke.Invoke((Action)(() => this.OpenProjectSynchronized(path)), null); }
public bool Retry(string msg, string caption) { return(SynchronizeInvoke.Invoke(() => MessageBox.Show(msg, caption, MessageBoxButtons.RetryCancel, MessageBoxIcon.None) == DialogResult.Retry)); }
void UDP_OnDataReceived(IAsyncResult ar) { try { IPEndPoint tEndPoint = new IPEndPoint(IPAddress.Any, 0); Byte[] tBytesReceived = _UdpClient.EndReceive(ar, ref tEndPoint); Dictionary <string, object> tData = Bencode.BencodeUtility.DecodeDictionary(tBytesReceived); if (_Process != null && (long)tData["processId"] == _Process.Id) { Dictionary <string, object> tArgs = (Dictionary <string, object>)tData["args"]; ResourceType tResourceType; ResourcePoolType tResourcePoolType; string tResourceName; string tResourcePath; float tResourceTime; switch ((UdpMessageType)(long)tData["msgType"]) { case UdpMessageType.PerformanceUpdate: lock (this) { _FPS = ((long)tArgs["fps"]) / 1000.0f; _Objects = ((long)tArgs["objects"]) / 1000.0f; _FrameTime = ((long)tArgs["frametime"]) / 1000.0f / 1000.0f; _RenderTime = ((long)tArgs["rendertime"]) / 1000.0f / 1000.0f; } break; case UdpMessageType.ResourceLoaded: tResourceType = (ResourceType)(long)tArgs["type"]; tResourcePoolType = (ResourcePoolType)(long)tArgs["pool"]; tResourceName = Encoding.UTF8.GetString((Byte[])tArgs["name"]); tResourcePath = Encoding.UTF8.GetString((Byte[])tArgs["path"]); tResourceTime = ((long)tArgs["time"] / 1000.0f); if (OnResourceLoaded != null) { if (SynchronizeInvoke != null) { SynchronizeInvoke.Invoke((Action)(() => { OnResourceLoaded(tResourceType, tResourcePoolType, tResourceName, tResourcePath, tResourceTime); }), null); } else { OnResourceLoaded(tResourceType, tResourcePoolType, tResourceName, tResourcePath, tResourceTime); } } break; case UdpMessageType.ResourceRemoved: tResourceType = (ResourceType)(long)tArgs["type"]; tResourcePoolType = (ResourcePoolType)(long)tArgs["pool"]; tResourceName = Encoding.UTF8.GetString((Byte[])tArgs["name"]); if (OnResourceRemoved != null) { if (SynchronizeInvoke != null) { SynchronizeInvoke.Invoke((Action)(() => { OnResourceRemoved(tResourceType, tResourcePoolType, tResourceName); }), null); } else { OnResourceRemoved(tResourceType, tResourcePoolType, tResourceName); } } break; case UdpMessageType.ResourceCleared: tResourcePoolType = (ResourcePoolType)(long)tArgs["pool"]; if (OnResourceCleared != null) { if (SynchronizeInvoke != null) { SynchronizeInvoke.Invoke((Action)(() => { OnResourceCleared(tResourcePoolType); }), null); } else { OnResourceCleared(tResourcePoolType); } } break; } } } catch (ObjectDisposedException) { // 操作被取消 return; } catch (Exception) { } // 接收下一个数据包 _UdpClient.BeginReceive(new AsyncCallback(UDP_OnDataReceived), null); }
public bool ConflictingSave() { SynchronizeInvoke.Invoke(() => MessageBox.Show(Strings.ksConflictingSaveText, Strings.ksConflictingSaveCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning)); return(true); }
public void DisplayCircularRefBreakerReport(string report, string caption) { var icon = MessageBoxIcon.Information; SynchronizeInvoke.Invoke(() => MessageBox.Show(report, caption, MessageBoxButtons.OK, icon)); }