Example #1
0
        private WsController initWsController()
        {
            WsController c = new WsController();

            c.setSigninWindow(this);
            return(c);
        }
Example #2
0
        // return true if successfully sended
        public static bool sendRequest(object obj, WsController c)
        {
            var ws = c.getWs();

            if (ws != null)
            {
                ws.Send(JsonConvert.SerializeObject(obj));
                return(true);
            }
            return(false);
        }
Example #3
0
        public static void sendGetOnlineUsersRequest(WsController c)
        {
            var ws = c.getWs();

            if (ws != null)
            {
                l.log("sending online users request");
                Entities.GetOnlineUsers req = new Entities.GetOnlineUsers();
                req.sender = Config.userName;
                req.type   = "get_online_users";
                ws.Send(JsonConvert.SerializeObject(req));
            }
        }
Example #4
0
        public static void sendGetChannelUsersRequest(string channel, WsController c)
        {
            var ws = c.getWs();

            if (ws != null)
            {
                l.log("sending get channel users request");
                Entities.GetChannelUsers req = new Entities.GetChannelUsers();
                req.sender  = Config.userName;
                req.type    = "get_channel_users";
                req.channel = channel;
                ws.Send(JsonConvert.SerializeObject(req));
            }
        }
Example #5
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     //l.logg("", false);
     if (isPosition)
     {
         this.Left = leftPos;
         this.Top  = topPos;
     }
     // первый запуск, надо центрировать
     else
     {
         l.logg("", false);
         this.Top  = getCenter(SystemParameters.PrimaryScreenHeight, ActualHeight);
         this.Left = getCenter(SystemParameters.PrimaryScreenWidth, ActualWidth);
     }
     //init wsController
     wsController = initWsController();
     Visibility   = Visibility.Visible;
 }
Example #6
0
 public void setWsController(WsController c)
 {
     c.setSigninWindow(this);
     wsController = c;
 }
Example #7
0
 public static void sendAddUserRequest(string user, string channel, string fullname, WsController c)
 {
     Entities.AddUser req = new Entities.AddUser();
     req.sender   = Config.userName;
     req.user     = user;
     req.channel  = channel;
     req.fullname = fullname;
     req.type     = "add_user";
     l.log("try send add user " + user + " to " + channel + " request");
     if (Utils.sendRequest(req, c))
     {
         l.log("sended");
     }
     else
     {
         l.log("sending aborted");
     }
 }