public VideoModule( IScoreKeeperService scoreKeeperService, IStopWatchService stopWatchService) { this.scoreKeeperService = scoreKeeperService; this.stopWatchService = stopWatchService; this.pipeCommandService = null; }
private void NamedPipesBegin() { UseThisThreadForEvents(); PipeSender.begin("FromArduino"); PipeListener.begin("ToArduino", new NewMessageDelegate(PipesMessageHandler)); connectionTestTimer = new DispatcherTimer(); connectionTestTimer.Tick += ConnectionTestTimer_Tick; connectionTestTimer.Interval = new TimeSpan(0, 0, 2); connectionTestTimer.Start(); }
/// <summary> /// Event: Triggered when the Choose Image button is clicked /// </summary> private void itsButtonChoose_Click(object sender, EventArgs e) { OpenFileDialog anOpenDialog = new OpenFileDialog() { Filter = "PNG (*.png)|*.png", Title = "Choose An Image To Send", }; if (anOpenDialog.ShowDialog() == DialogResult.OK && File.Exists(anOpenDialog.FileName)) { Image anImageToSend = Image.FromFile(anOpenDialog.FileName); string aFileSize = Utilities.GetFileSizeBytesReadable(anOpenDialog.FileName); PipeMessageImageShare aPipeMessageImageShare = new PipeMessageImageShare(anImageToSend, Path.GetFileName(anOpenDialog.FileName), aFileSize); //OnSend(this, new PipeMessageEventArgs(aPipeMessageImageShare)); PipeSender.SendPipeMessage(aPipeMessageImageShare); aPipeMessageImageShare.ImageSenderName = "Me"; HandleMessage(aPipeMessageImageShare); } }
/// <summary> /// Notifies the video capture process. /// </summary> /// <param name="command">The command.</param> /// <param name="p">The p.</param> private void NotifyVideoCapture(string command, params string[] p) { Process videoCaptureProcess = this.GetVideoCaptureProcess(); if (videoCaptureProcess != null && videoCaptureProcess.Responding) { try { if (this.pipeCommandService == null) { this.pipeCommandService = new PipeSender <ICommandService>(); } this.pipeCommandService.Instance.Execute(command, p); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("VideoModule: " + ex.GetBaseException()); this.pipeCommandService = null; } } }
/// <summary> /// Notifies the video capture process. /// </summary> /// <param name="command">The command.</param> /// <param name="p">The p.</param> private void NotifyVideoCapture(string command, params string[] p) { Process videoCaptureProcess = this.GetVideoCaptureProcess(); if (videoCaptureProcess != null && videoCaptureProcess.Responding) { try { if (this.pipeCommandService == null) { this.pipeCommandService = new PipeSender<ICommandService>(); } this.pipeCommandService.Instance.Execute(command, p); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("VideoModule: " + ex.GetBaseException()); this.pipeCommandService = null; } } }
/// <summary> /// Event: Triggered when the - button is clicked /// </summary> private void itsButtonMinus_Click(object sender, EventArgs e) { PipeMessageNumberGameAdd aMessageSubtract1 = new PipeMessageNumberGameAdd(-1); PipeSender.SendPipeMessage(aMessageSubtract1); }
/// <summary> /// Event: Triggered when the + button is clicked /// </summary> private void itsButtonPlus_Click(object sender, EventArgs e) { PipeMessageNumberGameAdd aMessageAdd1 = new PipeMessageNumberGameAdd(1); PipeSender.SendPipeMessage(aMessageAdd1); }
private void dispose() { PipeSender.dispose(); PipeListener.dispose(new NewMessageDelegate(PipesMessageHandler)); }
private void Send(string inMessage) { PipeSender.Send(inMessage, 1000); }