Exemplo n.º 1
0
 void userJoins(DiscUser usr)
 {
     if (usr.usrDbId == loginInfo.person.Id && wndCtx == null)
     {
         var topic = DbCtx.Get().Topic.FirstOrDefault(t0 => t0.Name.StartsWith("d-editor"));            
         wndCtx = new EditorWndCtx(scene,
                                   inkCanv,
                                   palette,
                                   inkPalette,  
                                   this,//surface window for focus fix                                      
                                   topic.Id,
                                   topic.Discussion.Id);
         DataContext = this;   
         rt.clienRt.SendInitialSceneLoadRequest(topic.Id);     
     }
 }
Exemplo n.º 2
0
        public void OnOperationResponse(OperationResponse operationResponse)
        {
            switch (operationResponse.OperationCode)
            {
                case (byte)DiscussionOpCode.Test:
                    //Console.WriteLine(operationResponse.Parameters[(byte)DiscussionParamKey.Message]);
                    break;

                case (byte)LiteOpCode.Join:
                    Console.WriteLine("OpResp: Join " + operationResponse.Parameters);
                    if (operationResponse.Parameters.ContainsKey((byte)LiteOpKey.ActorNr))
                        this.localUsr.ActNr = (int)operationResponse.Parameters[(byte)LiteOpKey.ActorNr];
                    if (onJoin != null)
                        onJoin();
                    break;

                case (byte)LiteOpCode.Leave:
                    ResetConnState();
                    break;

                case (byte)OperationCode.GetProperties:
                    const byte magic = 249;
                    Hashtable resp = (Hashtable)operationResponse.Parameters[(byte)magic];

                    foreach (var k in resp.Keys)
                    {
                        int ActorNr = (int)k;
                        Hashtable props = (Hashtable)resp[k];
                        string name = (string)props[(byte)ActProps.Name];
                        int usrDbId = (int)props[(byte)ActProps.DbId];

                        DiscUser usr;
                        if (usersOnline.ContainsKey(ActorNr))
                        {
                            usr = usersOnline[ActorNr];
                            usr.Name = name;
                            usr.usrDbId = usrDbId;
                        }
                        else
                        {
                            usr = new DiscUser(name, ActorNr);
                            usr.usrDbId = usrDbId;
                            usersOnline.Add(ActorNr, usr);

                            if (userJoins != null)
                                userJoins(usr);
                        }

                        DbgPrintOnlineList();
                    }
                    break;

                case (byte)DiscussionOpCode.ScreenshotRequest:
                    if (onScreenshotResponse != null)
                        onScreenshotResponse(ScreenshotResponse.Read(operationResponse.Parameters).screenshots);
                    break;
                default:
                    //Console.WriteLine("Unhandled OnOperationResponse " + operationResponse.OperationCode);
                    break;
            }
        }
Exemplo n.º 3
0
 private void userLeaves(DiscUser u)
 {
     chatArea.Text += string.Format("{0} leaves\n", u.Name);
 }
Exemplo n.º 4
0
 private void userJoins(DiscUser u)
 {
     chatArea.Text += string.Format("{0} joins\n", u.Name);
 }
Exemplo n.º 5
0
 public void UserLeave(DiscUser usr)
 {
     if (userCursors.ContainsKey(usr.usrDbId))
     {
         UserCursorUC cuc = userCursors[usr.usrDbId];
         userCursors.Remove(usr.usrDbId);
         overlay.Children.Remove(cuc);
         overlay.InvalidateVisual();
     }
 }