コード例 #1
0
        /// <summary>
        /// Both cluster and link keep Id of text caption in ints[0]
        /// </summary>
        /// <param name="captionHostSh"></param>
        /// <returns></returns>
        private string TryGetTextCaption(IServerVdShape captionHostSh)
        {
            var st          = captionHostSh.GetState();
            var captionShId = st.ints[0];

            if (captionShId != -1)
            {
                //caption exists
                var captionSh = _doc.TryGetShape(captionShId);
                if (captionSh != null)
                {
                    var st2 = captionSh.GetState();
                    if (st2.bytes != null)
                    {
                        using (var s = new MemoryStream(st2.bytes))
                        {
                            using (var br = new BinaryReader(s))
                            {
                                return(br.ReadString());
                            }
                        }
                    }
                }
            }
            return(null);
        }
コード例 #2
0
ファイル: ServerVdDoc.cs プロジェクト: z-saffarpour/duscusys
        public void RemoveShape(IServerVdShape sh)
        {
            if (sh.GetCursor() != null)
            {
                throw new InvalidOperationException("cannot remove shape locked by cursor!");
            }

            _shapeIdToShape.Remove(sh.Id());
        }
コード例 #3
0
ファイル: ServerVdDoc.cs プロジェクト: z-saffarpour/duscusys
        public void UnlockAndRemoveShape(IServerVdShape sh)
        {
            var curs = sh.GetCursor();

            if (curs != null)
            {
                UnlockShape(sh, curs.OwnerId);
            }
            RemoveShape(sh);
        }
コード例 #4
0
ファイル: ServerVdDoc.cs プロジェクト: z-saffarpour/duscusys
        //returns previously locked shape, caller should broadcast cursor free event if result != null
        public void LockShape(IServerVdShape sh, int owner)
        {
            if (sh.GetCursor() != null)
            {
                throw new InvalidOperationException("cannot lock locked shape");
            }

            var cursor = new ServerCursor(owner);

            sh.SetCursor(cursor);

            _userIdToCursor.Add(owner, sh);
        }
コード例 #5
0
ファイル: ServerVdDoc.cs プロジェクト: z-saffarpour/duscusys
 public bool editingPermission(IServerVdShape sh, int owner)
 {
     if (sh.GetCursor() == null)
     {
         return(true);
     }
     else if (sh.GetCursor().OwnerId == owner)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #6
0
ファイル: ServerVdDoc.cs プロジェクト: z-saffarpour/duscusys
 public void AddShapeAndLock(IServerVdShape sh)
 {
     _shapeIdToShape.Add(sh.Id(), sh);
     LockShape(sh, sh.InitialOwner());
 }
コード例 #7
0
ファイル: ServerVdDoc.cs プロジェクト: z-saffarpour/duscusys
 public void AddShape(IServerVdShape sh)
 {
     _shapeIdToShape.Add(sh.Id(), sh);
 }
コード例 #8
0
ファイル: ServerVdDoc.cs プロジェクト: z-saffarpour/duscusys
 public void UnlockShape(IServerVdShape sh, int owner)
 {
     sh.UnsetCursor();
     _userIdToCursor.Remove(owner);
 }
コード例 #9
0
ファイル: VectProcessor.cs プロジェクト: gdlprj/duscusys
 /// <summary>
 /// Both cluster and link keep Id of text caption in ints[0]
 /// </summary>
 /// <param name="captionHostSh"></param>
 /// <returns></returns>
 private string TryGetTextCaption(IServerVdShape captionHostSh)
 {
     var st = captionHostSh.GetState();
     var captionShId = st.ints[0];
     if (captionShId != -1)
     {
         //caption exists
         var captionSh = _doc.TryGetShape(captionShId);
         if (captionSh != null)
         {
             var st2 = captionSh.GetState();
             if (st2.bytes != null)
             {
                 using (var s = new MemoryStream(st2.bytes))
                 {
                     using (var br = new BinaryReader(s))
                     {
                         return br.ReadString();
                     }
                 }
             }
         }
     }
     return null;
 }
コード例 #10
0
ファイル: ServerVdDoc.cs プロジェクト: gdlprj/duscusys
 public void UnlockAndRemoveShape(IServerVdShape sh)
 {
     var curs = sh.GetCursor();
     if (curs != null)
         UnlockShape(sh, curs.OwnerId);
     RemoveShape(sh);
 }
コード例 #11
0
ファイル: ServerVdDoc.cs プロジェクト: gdlprj/duscusys
 public bool editingPermission(IServerVdShape sh, int owner)
 {
     if (sh.GetCursor() == null)
         return true;
     else if (sh.GetCursor().OwnerId == owner)
         return true;
     else
         return false;
 }
コード例 #12
0
ファイル: ServerVdDoc.cs プロジェクト: gdlprj/duscusys
        public void RemoveShape(IServerVdShape sh)
        {
            if (sh.GetCursor() != null)
                throw new InvalidOperationException("cannot remove shape locked by cursor!");

            _shapeIdToShape.Remove(sh.Id());
        }
コード例 #13
0
ファイル: ServerVdDoc.cs プロジェクト: gdlprj/duscusys
 public void AddShapeAndLock(IServerVdShape sh)
 {
     _shapeIdToShape.Add(sh.Id(), sh);
     LockShape(sh, sh.InitialOwner());
 }
コード例 #14
0
ファイル: ServerVdDoc.cs プロジェクト: gdlprj/duscusys
 public void AddShape(IServerVdShape sh)
 {
     _shapeIdToShape.Add(sh.Id(), sh);
 }
コード例 #15
0
ファイル: ServerVdDoc.cs プロジェクト: gdlprj/duscusys
 public void UnlockShape(IServerVdShape sh, int owner)
 {
     sh.UnsetCursor();
     _userIdToCursor.Remove(owner);
 }
コード例 #16
0
ファイル: ServerVdDoc.cs プロジェクト: gdlprj/duscusys
        //returns previously locked shape, caller should broadcast cursor free event if result != null
        public void LockShape(IServerVdShape sh, int owner)
        {
            if (sh.GetCursor() != null)
                throw new InvalidOperationException("cannot lock locked shape");

            var cursor = new ServerCursor(owner);
            sh.SetCursor(cursor);

            _userIdToCursor.Add(owner, sh);
        }