public static void SpringEventSafelyAsyn <T1, T2>(IAgileLogger agileLogger, string eventPath, Delegate theEvent, T1 t1, T2 t2) { if (theEvent == null) { return; } CbGeneric <IAgileLogger, string, Delegate, T1, T2> cb = new CbGeneric <IAgileLogger, string, Delegate, T1, T2>(EventHelper.SpringEventSafely <T1, T2>); cb.BeginInvoke(agileLogger, eventPath, theEvent, t1, t2, null, null); }
public static void PlayAudioAsyn() { if (!SystemSettings.Singleton.PlayAudio4Message) { return; } var cbPlayAudio = new CbGeneric <string, int>(PlayAudio); cbPlayAudio.BeginInvoke(audioFilePath, 1, null, null); }
public static void SpringEventSafelyAsyn(IAgileLogger agileLogger, string eventPath, Delegate theEvent) { if (theEvent == null) { return; } CbGeneric <IAgileLogger, string, Delegate> cb = new CbGeneric <IAgileLogger, string, Delegate>(EventHelper.SpringEventSafely); cb.BeginInvoke(agileLogger, eventPath, theEvent, null, null); }
public DignosticLogger(IDiagnosticsViewer viewer, string logFilePath, int logSpanInSecs) { this.diagnosticsViewer = viewer; this.agileLogger = new FileAgileLogger(logFilePath); this.spanInSecs = logSpanInSecs; if (this.diagnosticsViewer != null) { CbGeneric cb = new CbGeneric(this.LogThread); cb.BeginInvoke(null, null); } }
//停止声卡采集、停止录制 private void button2_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; CbGeneric cb = new CbGeneric(this.StopRecordAsyn); cb.BeginInvoke(null, null); } catch (Exception ee) { MessageBox.Show(ee.Message); } }
private void button2_Click(object sender, EventArgs e) { //停止采集 this.capturer.Stop(); this.button2.Enabled = false; this.button1.Enabled = true; this.comboBox1.Enabled = true; //清除最后一帧的显示 CbGeneric cb = new CbGeneric(this.AfterStop); cb.BeginInvoke(null, null); }
public AsynDelayActor(int delayMSecs, CbGeneric<object> action, object arg) { if (delayInMSecs < 0) { throw new ArgumentException("The value of delayMSecs is invalid. "); } this.handler = action; this.delayInMSecs = delayMSecs; this.argument = arg; CbGeneric cb = new CbGeneric(this.Action); cb.BeginInvoke(null, null); }
public AsynDelayActor(int delayMSecs, CbGeneric <object> action, object arg) { if (delayInMSecs < 0) { throw new ArgumentException("The value of delayMSecs is invalid. "); } this.handler = action; this.delayInMSecs = delayMSecs; this.argument = arg; CbGeneric cb = new CbGeneric(this.Action); cb.BeginInvoke(null, null); }
/// <summary> /// Start. /// </summary> /// <param name="serverIP">server ip</param> /// <param name="serverPort">server port</param> /// <param name="callerExe">callerExe</param> public void Start(string serverIP, int serverPort, string callerExe) { try { Random random = new Random(); for (int i = 0; i < 100; i++) { string userID = random.Next(1000000).ToString("00000"); string logonPassword = string.Empty; LogonResponse logonResponse = mRapidPassiveEngine.Initialize(userID, logonPassword, serverIP, serverPort, null); if (logonResponse.LogonResult == LogonResult.Succeed) { break; } } if (!File.Exists(UpdateConfiguration.ConfigurationPath)) { mUpdateConfiguration.Save(); } else { mUpdateConfiguration = (UpdateConfiguration)AgileConfiguration.Load(UpdateConfiguration.ConfigurationPath); } GetUpdateInfo(out mFileRelativePathListNeedDownloaded, out mFileListNeedRemoved); mFileCountNeedUpdated = mFileRelativePathListNeedDownloaded.Count; Event_FileCountNeedUpdated?.Invoke(mFileCountNeedUpdated); if (mFileCountNeedUpdated == 0 && mFileListNeedRemoved.Count == 0) { return; } Event_UpdateStarted?.Invoke(); Process[] processes = Process.GetProcessesByName(callerExe.Substring(0, callerExe.Length - 4)); foreach (Process process in processes) { process.Kill(); } CbGeneric cbGeneric = new CbGeneric(UdpateThread); cbGeneric.BeginInvoke(null, null); } catch (Exception e) { Console.WriteLine(e.ToString()); Event_UpdateDisruptted?.Invoke(Resources.ConnectionFailed); } }
public void Start() { //配置文件中记录着各个文件的版本信息。 if (!File.Exists(UpdateConfiguration.ConfigurationPath)) { this.updateConfiguration.Save(); } else { this.updateConfiguration = (UpdateConfiguration)UpdateConfiguration.Load(UpdateConfiguration.ConfigurationPath); } //启动升级线程 CbGeneric cb = new CbGeneric(this.UdpateThread); cb.BeginInvoke(null, null); }
//开始操作按钮 private void btnOpreat_Click(object sender, EventArgs e) { try { CbGeneric cb = new CbGeneric(this.DoShowUnCheck); cb.BeginInvoke(null, null); ShowProgressForm(); } catch (Exception ex) { ShowError(ex); } finally { CompleteProgress(); UnLockPage(); ShowMessage("保存成功"); } }
//初始化录像设备,并开始录制。 public void Initialize(string filePath) { if (!this.dynamicCameraConnector2Friend.Connected) { throw new Exception("连接器尚未连接到对方的摄像头!"); } this.videoSize = this.dynamicCameraConnector2Friend.VideoSize; Size myVideoSize = new Size(this.videoSize.Width / 3, this.videoSize.Height / 3); this.myVideoRect = new Rectangle(this.videoSize.Width - myVideoSize.Width, this.videoSize.Height - myVideoSize.Height, myVideoSize.Width, myVideoSize.Height); this.videoFileMaker = new VideoFileMaker(); this.videoFileMaker.AutoDisposeVideoFrame = true; this.videoFileMaker.Initialize(filePath, VideoCodecType.H264, this.videoSize.Width, this.videoSize.Height, 10, VideoQuality.High, AudioCodecType.AAC, 16000, 1, true); this.audioInOutMixer.Initialize(this.multimediaManager); this.isRecording = true; CbGeneric cb = new CbGeneric(this.RecordThread); cb.BeginInvoke(null, null); }
/// <summary> /// 异步停止引擎。 /// </summary> public void StopAsyn() { CbGeneric cb = new CbGeneric(this.Stop); cb.BeginInvoke(null, null); }
public static void PlayAudioAsyn() { if (!SystemSettings.Singleton.PlayAudio4Message) { return; } CbGeneric<string, int> cbPlayAudio = new CbGeneric<string, int>(PlayAudio); cbPlayAudio.BeginInvoke(audioFilePath, 1, null, null); }
/// <summary> /// 发送图片消息 /// </summary> /// <param name="img">待发送的Img对象</param> /// <param name="imgId">Img对象的ID</param> /// <param name="destUserID">目的ID</param> public void SendImage(Image img,string imgId,string destUserID) { //根据ID和img生成byte数组 byte[] blob = ImageUtil.customizeImg(imgId, img); //通过委托异步调用 CbGeneric<byte[], string> cb = new CbGeneric<byte[], string>(this.SendBlobThread); cb.BeginInvoke(blob, destUserID, null, null); }
/// <summary> /// 处理用户上线事件 /// </summary> /// <param name="userData"></param> private void SomeOneConnect(UserData userData) { //获得UserID string userID = userData.UserID; //转发其离线消息 List<Msg> msgs = userDBManager.queryMsgs(userID); if (msgs.Count > 0) { foreach (Msg s in msgs) { //得到:类型号 SPLIT 内容 int infoType = s.Type; if (infoType == 2) //图片消息 { byte[] info = System.Text.Encoding.UTF8.GetBytes(s.Content); CbGeneric<byte[], string> cb = new CbGeneric<byte[], string>(this.SendBlobThread); cb.BeginInvoke(info, userID, null, null); } else //文本格式消息,不单纯是文本消息 { byte[] info = System.Text.Encoding.UTF8.GetBytes(s.Content); this.engine.CustomizeController.Send(userID, infoType, info); } } //清空未读消息 userDBManager.deleteMsg(userID); } }