Exemple #1
0
        public static SharedView[] ReadBadgeViews(Dictionary<byte, object> badgeViews, out UserCursor cursor)
        {
            int count = (int) badgeViews[(byte) DiscussionParamKey.NumArrayEntries];
            double[] Xs = (double[]) badgeViews[(byte) DiscussionParamKey.ArrayOfX];
            double[] Ys = (double[]) badgeViews[(byte) DiscussionParamKey.ArrayOfY];
            double[] Orientations = (double[]) badgeViews[(byte) DiscussionParamKey.ArrayOfOrientations];
            int[] argPointIds = (int[]) badgeViews[(byte) DiscussionParamKey.ArrayOfIds];
            bool[] viewTypes = (bool[]) badgeViews[(byte) DiscussionParamKey.ArrayOfViewTypes];

            if (!badgeViews.ContainsKey((byte) DiscussionParamKey.UserCursorName))
            {
                Console.WriteLine("No key");
            }

            cursor = new UserCursor((string) badgeViews[(byte) DiscussionParamKey.UserCursorName],
                                    (CursorInputState) badgeViews[(byte) DiscussionParamKey.UserCursorState]);

            var res = new SharedView[count];
            for (int i = 0; i < count; ++i)
            {
                SharedView ap = new SharedView(i, viewTypes[i]);
                ap.badgeGeometry.CenterX = Xs[i];
                ap.badgeGeometry.CenterY = Ys[i];
                ap.badgeGeometry.Orientation = Orientations[i];
                ap.ViewId = argPointIds[i];
                res[i] = ap;
            }

            return res;
        }
Exemple #2
0
        public static SharedView[] ReadBadgeViews(Dictionary <byte, object> badgeViews, out UserCursor cursor)
        {
            int count = (int)badgeViews[(byte)DiscussionParamKey.NumArrayEntries];

            double[] Xs           = (double[])badgeViews[(byte)DiscussionParamKey.ArrayOfX];
            double[] Ys           = (double[])badgeViews[(byte)DiscussionParamKey.ArrayOfY];
            double[] Orientations = (double[])badgeViews[(byte)DiscussionParamKey.ArrayOfOrientations];
            int[]    argPointIds  = (int[])badgeViews[(byte)DiscussionParamKey.ArrayOfIds];
            bool[]   viewTypes    = (bool[])badgeViews[(byte)DiscussionParamKey.ArrayOfViewTypes];

            if (!badgeViews.ContainsKey((byte)DiscussionParamKey.UserCursorName))
            {
                Console.WriteLine("No key");
            }

            cursor = new UserCursor((string)badgeViews[(byte)DiscussionParamKey.UserCursorName],
                                    (CursorInputState)badgeViews[(byte)DiscussionParamKey.UserCursorState]);

            var res = new SharedView[count];

            for (int i = 0; i < count; ++i)
            {
                SharedView ap = new SharedView(i, viewTypes[i]);
                ap.badgeGeometry.CenterX     = Xs[i];
                ap.badgeGeometry.CenterY     = Ys[i];
                ap.badgeGeometry.Orientation = Orientations[i];
                ap.ViewId = argPointIds[i];
                res[i]    = ap;
            }

            return(res);
        }
Exemple #3
0
        public static Dictionary<byte, object> WriteBadgeViews(UserCursor cursor,
                                                               SharedView[] badgeViews)
        {
            //serialize badge geometry 
            // number of badges 
            // array of x's  
            // array of y's 
            // array of orientations
            // array of Ids (DB Ids of points)
            double[] Xs = new double[badgeViews.Length];
            double[] Ys = new double[badgeViews.Length];
            double[] Orientations = new double[badgeViews.Length];
            bool[] ViewTypes = new bool[badgeViews.Length];
            int[] Ids = new int[badgeViews.Count()];

            for (int i = 0; i < badgeViews.Count(); ++i)
            {
                Xs[i] = badgeViews[i].badgeGeometry.CenterX;
                Ys[i] = badgeViews[i].badgeGeometry.CenterY;
                Orientations[i] = badgeViews[i].badgeGeometry.Orientation;
                ViewTypes[i] = badgeViews[i].viewType;
                Ids[i] = badgeViews[i].ViewId;
            }
            Dictionary<byte, object> data = new Dictionary<byte, object>();
            data.Add((byte) DiscussionParamKey.NumArrayEntries, badgeViews.Length);
            data.Add((byte) DiscussionParamKey.ArrayOfX, Xs);
            data.Add((byte) DiscussionParamKey.ArrayOfY, Ys);
            data.Add((byte) DiscussionParamKey.ArrayOfOrientations, Orientations);
            data.Add((byte) DiscussionParamKey.ArrayOfIds, Ids);
            data.Add((byte) DiscussionParamKey.ArrayOfViewTypes, ViewTypes);
            data.Add((byte) DiscussionParamKey.UserCursorName, cursor.Name);
            data.Add((byte) DiscussionParamKey.UserCursorState, (int) cursor.State);

            return data;
        }
Exemple #4
0
        public static UserCursor ReadUserCursor(Dictionary <byte, object> dict)
        {
            var res = new UserCursor((string)dict[(byte)DiscussionParamKey.UserCursorName])
            {
                State = (CursorInputState)dict[(byte)DiscussionParamKey.UserCursorState],
                usrId = (int)dict[(byte)DiscussionParamKey.UserCursorUsrId],
                x     = (double)dict[(byte)DiscussionParamKey.UserCursorX],
                y     = (double)dict[(byte)DiscussionParamKey.UserCursorY]
            };

            return(res);
        }
Exemple #5
0
        public static Dictionary <byte, object> WriteUserCursor(UserCursor c)
        {
            Dictionary <byte, object> res = new Dictionary <byte, object>();

            res[(byte)DiscussionParamKey.UserCursorName]  = c.Name;
            res[(byte)DiscussionParamKey.UserCursorState] = c.State;
            res[(byte)DiscussionParamKey.UserCursorUsrId] = c.usrId;
            res[(byte)DiscussionParamKey.UserCursorX]     = c.x;
            res[(byte)DiscussionParamKey.UserCursorY]     = c.y;

            return(res);
        }
Exemple #6
0
        public static Dictionary <byte, object> WriteBadgeViews(UserCursor cursor,
                                                                SharedView[] badgeViews)
        {
            //serialize badge geometry
            // number of badges
            // array of x's
            // array of y's
            // array of orientations
            // array of Ids (DB Ids of points)
            double[] Xs           = new double[badgeViews.Length];
            double[] Ys           = new double[badgeViews.Length];
            double[] Orientations = new double[badgeViews.Length];
            bool[]   ViewTypes    = new bool[badgeViews.Length];
            int[]    Ids          = new int[badgeViews.Count()];

            for (int i = 0; i < badgeViews.Count(); ++i)
            {
                Xs[i]           = badgeViews[i].badgeGeometry.CenterX;
                Ys[i]           = badgeViews[i].badgeGeometry.CenterY;
                Orientations[i] = badgeViews[i].badgeGeometry.Orientation;
                ViewTypes[i]    = badgeViews[i].viewType;
                Ids[i]          = badgeViews[i].ViewId;
            }
            Dictionary <byte, object> data = new Dictionary <byte, object>();

            data.Add((byte)DiscussionParamKey.NumArrayEntries, badgeViews.Length);
            data.Add((byte)DiscussionParamKey.ArrayOfX, Xs);
            data.Add((byte)DiscussionParamKey.ArrayOfY, Ys);
            data.Add((byte)DiscussionParamKey.ArrayOfOrientations, Orientations);
            data.Add((byte)DiscussionParamKey.ArrayOfIds, Ids);
            data.Add((byte)DiscussionParamKey.ArrayOfViewTypes, ViewTypes);
            data.Add((byte)DiscussionParamKey.UserCursorName, cursor.Name);
            data.Add((byte)DiscussionParamKey.UserCursorState, (int)cursor.State);

            return(data);
        }
Exemple #7
0
 public static UserCursor ReadUserCursor(Dictionary<byte, object> dict)
 {
     var res = new UserCursor((string) dict[(byte) DiscussionParamKey.UserCursorName])
     {
         State = (CursorInputState) dict[(byte) DiscussionParamKey.UserCursorState],
         usrId = (int) dict[(byte) DiscussionParamKey.UserCursorUsrId],
         x = (double) dict[(byte) DiscussionParamKey.UserCursorX],
         y = (double) dict[(byte) DiscussionParamKey.UserCursorY]
     };
     return res;
 }
Exemple #8
0
        public static Dictionary<byte, object> WriteUserCursor(UserCursor c)
        {
            Dictionary<byte, object> res = new Dictionary<byte, object>();

            res[(byte) DiscussionParamKey.UserCursorName] = c.Name;
            res[(byte) DiscussionParamKey.UserCursorState] = c.State;
            res[(byte) DiscussionParamKey.UserCursorUsrId] = c.usrId;
            res[(byte) DiscussionParamKey.UserCursorX] = c.x;
            res[(byte) DiscussionParamKey.UserCursorY] = c.y;

            return res;
        }
 //cc like ScatterViewItem
 void SetUserCursor(DependencyObject cc, UserCursor cursor)
 {
     UserCursorUC cursorUC = Utils.FindChild<UserCursorUC>(cc, "usrCursor");
     if (cursorUC != null)
     {
         cursorUC.Visibility = Visibility.Visible;
         cursorUC.DataContext = cursor;
     }
 }
        public void OnReceivedBadgeGeometry(UserCursor cursor, SharedView[] badges)
        {
            Dictionary<int, SharedView> argPointsDict = Serializers.ArrToDict(badges.Where(sv => sv.viewType));
            Dictionary<int, SharedView> groupDict = Serializers.ArrToDict(badges.Where(sv => !sv.viewType));

            Utils.EnumSVIs(unsolved, (ScatterViewItem svi) =>
            {
                bool viewType;
                int Id = SviContentToId(svi, out viewType);

                SharedView sv = null;
                if (viewType)
                {
                    if (argPointsDict.ContainsKey(Id))
                        sv = argPointsDict[Id];
                }
                else
                {
                    if (groupDict.ContainsKey(Id))
                        sv = groupDict[Id];
                }

                if (sv != null)
                {
                    svi.Center = new Point(sv.badgeGeometry.CenterX,
                                           sv.badgeGeometry.CenterY);
                    svi.Orientation = sv.badgeGeometry.Orientation;

                    SetUserCursor(svi, cursor);
                }
                else
                {
                    //hide previous cursors of the user 
                    HideUserCursor(svi, cursor.usrId);
                }
            });
        }
        void onUserCursorChanged(UserCursor c)
        {
            UserCursorUC cuc = null;
            if (!userCursors.ContainsKey(c.usrId))
            {
                cuc = new UserCursorUC();
                cuc.DataContext = c;
                overlay.Children.Add(cuc);
                userCursors.Add(c.usrId, cuc);
            }
            else
            {
                cuc = userCursors[c.usrId];
            }

            Canvas.SetLeft(cuc, c.x);
            Canvas.SetTop(cuc, c.y);
        }
        public DiscussionDashboard(UISharedRTClient sharedClient,
                                   StatusWnd stWnd,
                                   Discussions.Main.OnDiscFrmClosing closing)
        {
            this._discussion = SessionInfo.Get().discussion;
            _sharedClient = sharedClient;
            _closing = closing;
            _stWnd = stWnd;
            
            InitializeComponent();

            userCursor = new UserCursor(SessionInfo.Get().person.Name, CursorInputState.None);
            userCursor.usrId = SessionInfo.Get().person.Id;

            SetListeners(sharedClient, true);
            if(sharedClient.clienRt.IsConnected())
                OnJoin();

            ToLayerModeNoLayer();
        }