private async Task GetChannels()
        {
            var channelGroupList = await _channelSerivce.GetAppChannels();

            if (channelGroupList != null)
            {
                ChannelList.Clear();
                foreach (var group in channelGroupList.Groups)
                {
                    foreach (var channel in group.Channels)
                    {
                        ChannelList.Add(channel);
                    }
                }
            }
            this.CurrentChannel = ChannelList.FirstOrDefault();
        }
예제 #2
0
        public void Initialize()
        {
            //watch Ctrl down to switch click-through
#if !DEBUG
            keyboardListener          = new KeyboardListener();
            keyboardListener.KeyDown += keyboardListener_KeyDown;
            keyboardListener.KeyUp   += keyboardListener_KeyUp;
#endif
            if (AppConfig.IsReplyBoxPersistent)
            {
                IsOverlayVisible = true;
                SendTextEditMode = true;
            }


            AppConfig.PropertyChanged += AppConfig_PropertyChanged;

            Win.ShowStatus();

            EnableMouseTransparency = AppConfig.MouseTransparency && Keyboard.Modifiers != ModifierKeys.Control;

            _generalDataService.Start();

            ChannelList         = _dataService.ChatChannels;
            SelectedChatChannel = ChannelList[0];


            MessengerInstance.Register <bool>(this, "ReopenMainWindow", (message) => {
                if (message)
                {
                    IsWindowReopen = true;
                }
            });

            MessengerInstance.Register <ChatMessage>(this, "SetChannel", (message) =>
            {
                SelectedChatChannel = ChannelList.FirstOrDefault(channel =>
                                                                 channel.ChatName == message.ChatName &&
                                                                 channel.ChannelName == message.Channel) ?? ChannelList[0];
            });

            MessengerInstance.Register <ChatMessage>(this, "SetReplyTo", (message) =>
            {
                SelectedChatChannel = ChannelList.FirstOrDefault(channel =>
                                                                 channel.ChatName == message.ChatName &&
                                                                 channel.ChannelName == message.Channel) ?? ChannelList[0];
                ReplyCarretPos = 0;
                SendText       = message.FromUserName + ", ";
                ReplyCarretPos = Int32.MaxValue;
            });

            var steamChat = _dataService.GetChat(SettingsRegistry.ChatTitleSteam);
            if (steamChat != null)
            {
                steamChat.RequestData = (what) => {
                    if (what.Equals("SteamGuardCode", StringComparison.InvariantCultureIgnoreCase))
                    {
                        UI.Dispatch(() =>
                        {
                            steamGuardWindow.Show();
                        });
                    }
                    return(null);
                };
            }
        }