public void generateChannelRequest(string channelName) { Entities.ChannelRequest req = new Entities.ChannelRequest(); req.type = "get_channel"; req.name = channelName; req.@from = Config.userName; l.log("try send get channel " + channelName + " request"); if (Utils.sendRequest(req, w.wsController)) { l.log("sended"); } else { l.log("sending aborted"); } }
/// <summary> /// runs after rendering window; /// send request for all channels /// </summary> private void Window_Loaded(object sender, RoutedEventArgs e) { globalChannel = new GlobalChannel(this); globalMessages = new GlobalMessages(this); // center Window after loaded this.Top = Utils.getCenter(SystemParameters.PrimaryScreenHeight, ActualHeight); this.Left = Utils.getCenter(SystemParameters.PrimaryScreenWidth, ActualWidth); // отправляем запрос всех доступных каналов // возвращается массив объектов {name, fullname, admin} var ws = wsController.getWs(); if (ws != null) { var getChannels = new Entities.ChannelRequest(); getChannels.type = "get_channel"; getChannels.name = "*"; getChannels.from = Config.userName; string getAllCh = JsonConvert.SerializeObject(getChannels); ws.Send(getAllCh); } }