public PubSubSSSBService(Guid conversationGroup, IServiceProvider services, IPubSubHelper pubSubHelper, HeartBeatTimer heartBeatTimer, ILogger <PubSubSSSBService> logger) { try { this._conversationGroup = conversationGroup; this._services = services; this._pubSubHelper = pubSubHelper; this._heartBeatTimer = heartBeatTimer; this._logger = logger ?? throw new ArgumentNullException(nameof(logger)); this._startDateTime = DateTime.Now; _sssbService = SSSBService.Create(this._services, (options) => { options.ConversationGroup = conversationGroup; options.MaxReadersCount = 1; options.Name = PubSubHelper.SUBSCRIBER_SERVICE_NAME; }); _sssbService.OnStartedEvent += async() => { this._startDateTime = DateTime.Now; await this.OnStarted(_sssbService.QueueName); }; _sssbService.OnStoppedEvent += async() => { await this.OnStopped(_sssbService.QueueName); }; } catch (Exception ex) { _logger.LogCritical(ErrorHelper.GetFullMessage(ex)); throw; } }
private void OnLoginSucceeded(object sender, MessageEventArgs_201 message) { ConnectionManager.Messages.LoginSucceededEvent -= OnLoginSucceeded; OwnUserId = message.UserId; ConnectionManager.Commands.Who(1); //1 = Public Chat ConnectionManager.Commands.Ping(this); //Starts the heart beat pings to the server HeartBeat = new HeartBeatTimer(ConnectionManager); HeartBeat.StartTimer(); PublicChat = new Chat(ConnectionManager.Messages, 1); // 1 = chat id for public chat News = new News.News(ConnectionManager.Messages); FileRoot = new FileTree(); FileRoot.Reload(); Transfers = new Transfers.Transfers(); if (Online != null) { Online(); } }
void OnLoginSucceeded(object sender, MessageEventArgs_201 messageEventArgs) { //TODO: We shouldn't set the user icon here but instead have // some user object so we can change the icon. SharpWired.Gui.Resources.Icons.IconHandler iconHandler = new SharpWired.Gui.Resources.Icons.IconHandler(); connectionManager.Commands.Icon(1, iconHandler.UserImage); //Starts the heart beat pings to the server heartBeatTimer = new HeartBeatTimer(connectionManager); heartBeatTimer.StartTimer(); if (LoggedIn != null) { LoggedIn(server); } }
private void startOffScreenCapture( string aSymbolicLink, uint aStreamIndex, uint aMediaTypeIndex) { mOffScreenCaptureProcess = new Process(); mOffScreenCaptureProcess.StartInfo.FileName = "InterProcessRenderer.exe"; mOffScreenCaptureProcess.EnableRaisingEvents = true; mOffScreenCaptureProcess.Exited += mOffScreenCaptureProcess_Exited; mPipeProcessor = new PipeProcessor( "Server" + mConnectionSignature, "Client" + mConnectionSignature); mPipeProcessor.MessageDelegateEvent += lPipeProcessor_MessageDelegateEvent; mOffScreenCaptureProcess.StartInfo.Arguments = "SymbolicLink=" + aSymbolicLink + " " + "StreamIndex=" + aStreamIndex + " " + "MediaTypeIndex=" + aMediaTypeIndex + " " + "ConnectionSignature=" + mConnectionSignature + " " + "WindowHandler=" + mVideoPanel.Handle.ToInt64(); mConnectionSignature = Guid.NewGuid(); mOffScreenCaptureProcess.StartInfo.UseShellExecute = false; try { mIsStarted = mOffScreenCaptureProcess.Start(); HeartBeatTimer.Start(); } catch (Exception) { mIsStarted = false; } }
private void mLaunchButton_Click(object sender, RoutedEventArgs e) { if (mLaunchButton.Content == "Stop") { if (mIsStarted) { closeOffScreenCapture(); HeartBeatTimer.Stop(); mLaunchButton.Content = "Launch"; } mIsStarted = false; return; } var lSourceNode = mSourcesComboBox.SelectedItem as XmlNode; if (lSourceNode == null) { return; } var lNode = lSourceNode.SelectSingleNode("Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK']/SingleValue/@Value"); if (lNode == null) { return; } string lSymbolicLink = lNode.Value; lSourceNode = mStreamsComboBox.SelectedItem as XmlNode; if (lSourceNode == null) { return; } lNode = lSourceNode.SelectSingleNode("@Index"); if (lNode == null) { return; } uint lStreamIndex = 0; if (!uint.TryParse(lNode.Value, out lStreamIndex)) { return; } lSourceNode = mMediaTypesComboBox.SelectedItem as XmlNode; if (lSourceNode == null) { return; } lNode = lSourceNode.SelectSingleNode("@Index"); if (lNode == null) { return; } uint lMediaTypeIndex = 0; if (!uint.TryParse(lNode.Value, out lMediaTypeIndex)) { return; } string lextendSymbolicLink = lSymbolicLink + " --options=" + "<?xml version='1.0' encoding='UTF-8'?>" + "<Options>" + "<Option Type='Cursor' Visiblity='True'>" + "<Option.Extensions>" + "<Extension Type='BackImage' Height='100' Width='100' Fill='0x7055ff55' />" + "</Option.Extensions>" + "</Option>" + "</Options>"; lextendSymbolicLink += " --normalize=Landscape"; startOffScreenCapture(lextendSymbolicLink, lStreamIndex, lMediaTypeIndex); mLaunchButton.Content = "Stop"; }