Exemple #1
0
        private void UnlockDeleteBroadcast(int shapeId, int indirectOwner)
        {
            var shape = _doc.TryGetShape(shapeId);

            _doc.UnlockAndRemoveShape(shape);

            //single shape removal includes initiator
            _room.BroadcastReliableToRoom((byte)DiscussionEventCode.DeleteSingleShapeEvent,
                                          DeleteSingleShapeEvent.Write(shapeId, _topicId, indirectOwner));

            if (shape.ShapeCode() == VdShapeType.FreeForm)
            {
                EventLogger.LogAndBroadcast(
                    new DiscCtx(Discussions.ConfigManager.ConnStr),
                    _room,
                    StEvent.FreeDrawingRemoved,
                    shape.InitialOwner(),
                    _topicId);
            }

            //possible deletion of a cluster caption
            if (shape.ShapeCode() == VdShapeType.FreeForm || shape.ShapeCode() == VdShapeType.Text)
            {
                var clusterHost = _doc.GetShapes().Where(sh => sh.ShapeCode() == VdShapeType.Cluster)
                                  .FirstOrDefault(sh => sh.GetState().ints[0] == shape.Id() ||
                                                  sh.GetState().ints[1] == shape.Id());

                if (clusterHost != null)
                {
                    EventLogger.LogAndBroadcast(
                        new DiscCtx(Discussions.ConfigManager.ConnStr),
                        _room,
                        StEvent.ClusterTitleRemoved,
                        indirectOwner,
                        _topicId);
                }
            }

            _pendingChanges = true;
        }
Exemple #2
0
        public static bool LogAndBroadcast(DiscCtx ctx, DiscussionRoom room, StEvent ev, int usrId, int topicId)
        {
            var res = EventLogger.Log(ctx,
                                      ev,
                                      usrId,
                                      room.DiscId,
                                      topicId,
                                      DeviceType.Wpf);

            if (res)
            {
                room.BroadcastReliableToRoom((byte)DiscussionEventCode.StatsEvent,
                                             Serializers.WriteStatEventParams(ev,
                                                                              usrId,
                                                                              room.DiscId,
                                                                              topicId,
                                                                              DeviceType.Wpf)
                                             );
            }
            return(res);
        }
Exemple #3
0
        public static bool LogAndBroadcast(DiscCtx ctx, DiscussionRoom room, StEvent ev, int usrId, int topicId)
        {
            var res = EventLogger.Log(ctx,
                                      ev,
                                      usrId,
                                      room.DiscId,
                                      topicId,
                                      DeviceType.Wpf);

            if (res)
            {
                room.BroadcastReliableToRoom((byte) DiscussionEventCode.StatsEvent,
                                             Serializers.WriteStatEventParams(ev,
                                                                              usrId,
                                                                              room.DiscId,
                                                                              topicId,
                                                                              DeviceType.Wpf)
                    );
            }
            return res;
        }