public static Dictionary<byte, object> Write(int userId, int color, string name, int topicId, double x, double y, LaserPointerTargetSurface targetSurface) { var lp = new LaserPointer { Color = color, Name = name, TopicId = topicId, UserId = userId, X = x, Y = y, TargetSurface = targetSurface }; return lp.ToDict(); }
public static Dictionary <byte, object> Write(int userId, int color, string name, int topicId, double x, double y, LaserPointerTargetSurface targetSurface) { var lp = new LaserPointer { Color = color, Name = name, TopicId = topicId, UserId = userId, X = x, Y = y, TargetSurface = targetSurface }; return(lp.ToDict()); }
public static LaserPointer Read(Dictionary<byte, object> par) { var res = new LaserPointer { UserId = (int)par[(byte)DiscussionParamKey.UserId], Color = (int)par[(byte)DiscussionParamKey.Color], Name = (string)par[(byte)DiscussionParamKey.UserCursorName], TopicId = (int)par[(byte)DiscussionParamKey.ChangedTopicId], X = (double)par[(byte)DiscussionParamKey.UserCursorX], Y = (double)par[(byte)DiscussionParamKey.UserCursorY], TargetSurface = (LaserPointerTargetSurface)par[(byte)DiscussionParamKey.IntParameter1], }; return res; }
public static LaserPointer Read(Dictionary <byte, object> par) { var res = new LaserPointer { UserId = (int)par[(byte)DiscussionParamKey.UserId], Color = (int)par[(byte)DiscussionParamKey.Color], Name = (string)par[(byte)DiscussionParamKey.UserCursorName], TopicId = (int)par[(byte)DiscussionParamKey.ChangedTopicId], X = (double)par[(byte)DiscussionParamKey.UserCursorX], Y = (double)par[(byte)DiscussionParamKey.UserCursorY], TargetSurface = (LaserPointerTargetSurface)par[(byte)DiscussionParamKey.IntParameter1], }; return(res); }
public void SendLaserPointerMoved(LaserPointer ptr) { if (peer == null || peer.PeerState != PeerStateValue.Connected) return; peer.OpCustom((byte)DiscussionOpCode.LaserPointerMovedRequest, ptr.ToDict(), true); }
private void OnLaserPointerMoved(LaserPointer ptr) { if (ptr.TopicId != _topicId || ptr.TargetSurface!=_targetSurface) return; _laserCursorMgr.UpdatePointerLocation(ptr.UserId, new System.Windows.Point(ptr.X, ptr.Y)); }
private void OnDetachLaserPointer(LaserPointer ptr) { if (ptr.TopicId != _topicId || ptr.TargetSurface != _targetSurface) return; _laserCursorMgr.DetachLaserPointer(ptr.UserId); }
private void OnAttachLaserPointer(LaserPointer ptr) { if (ptr.TopicId != _topicId || ptr.TargetSurface != _targetSurface) return; _laserCursorMgr.AttachLaserPointer(ptr.UserId, Utils.IntToColor(ptr.Color), ptr.Name); _laserCursorMgr.UpdatePointerLocation(ptr.UserId, new System.Windows.Point(ptr.X, ptr.Y)); }
public void HandleLaserPointerMoved(LitePeer peer, LaserPointer ptr, OperationRequest operationRequest, SendParameters sendParameters) { if (_doc.MoveLaserPointer(ptr)) { _room.Broadcast(peer, operationRequest, sendParameters, (byte)DiscussionEventCode.LaserPointerMovedEvent, BroadcastTo.RoomExceptSelf); } }
public bool MoveLaserPointer(LaserPointer ptr) { var p = LaserPointers.FirstOrDefault(l0 => l0.UserId == ptr.UserId && l0.TopicId == ptr.TopicId); if (p != null) { p.X = ptr.X; p.Y = ptr.Y; return true; } return false; }
public bool DetachLaserPointer(LaserPointer ptr) { var p = LaserPointers.FirstOrDefault(l0 => l0.UserId == ptr.UserId && l0.TopicId == ptr.TopicId); if (p == null) return false; return LaserPointers.Remove(p); }
public bool AttachLaserPointer(LaserPointer ptr) { if (LaserPointers.FirstOrDefault(l0 => l0.UserId == ptr.UserId && l0.TopicId == ptr.TopicId) != null) return false; LaserPointers.Add(ptr); return true; }
void DetachLaserPointerFormAnyTopic(LitePeer peer, int ptrId) { foreach (var kv in _vectEditors) { var topicId = kv.Key; var lp = new LaserPointer {TopicId = topicId, UserId = ptrId}; kv.Value.HandleDetachLaserPointer(peer, lp, new OperationRequest((byte)DiscussionOpCode.DetachLaserPointerRequest, lp.ToDict()), new SendParameters()); } }