예제 #1
0
        public override bool OnLoad(Gui.MainWindow window)
        {
            Config = Configuration.Load();

            Window = window;

            var loginWindow = new LoginWindow {
                txtUsername = { Text = Config.Email }
            };

            if (!loginWindow.ShowDialog().HasValue || LoginData == null)
            {
                return(false);
            }

            Config.Email = loginWindow.Username;

            if (loginWindow.chkRemember.IsChecked != null && loginWindow.chkRemember.IsChecked.Value)
            {
                Config.Save();
            }

            SelfJid = new Jid(Nickname + "@chat.hipchat.com");

            window.Title = "Chatterbox - " + GroupName;

            HipchatClient = new XmppClientConnection("chat.hipchat.com");
            HipchatClient.Open(Nickname, loginWindow.Password);
            HipchatClient.Status = "Chatterbox";
            HipchatClient.Show   = ShowType.chat;
            HipchatClient.AutoResolveConnectServer = false;
            HipchatClient.OnLogin += HipchatClient_OnLogin;

            MucManager = new MucManager(HipchatClient);

            HipchatClient.OnRosterStart += sender => Users.Clear();
            HipchatClient.OnRosterItem  += HipchatClient_OnRosterItem;
            HipchatClient.OnMessage     += HipchatClient_OnMessage;
            HipchatClient.OnPresence    += HipchatClient_OnPresence;

            Lobby             = new LobbyControl();
            Lobby.OnRoomJoin += Lobby_OnRoomJoin;


            Window.SetLobbyRoom(Lobby);

            return(true);
        }
        static void Lobby_OnRoomJoin(object sender, LobbyControl.RoomJoinEventArgs e)
        {
            MucManager.JoinRoom(new Jid(e.HipchatRoom.RoomId), Name);

            Window.CreateRoom(e.HipchatRoom.Name);
        }
        public override bool OnLoad(Gui.MainWindow window)
        {
            Config = Configuration.Load();

            Window = window;

            var loginWindow = new LoginWindow { txtUsername = { Text = Config.Email } };
            if (!loginWindow.ShowDialog().HasValue || LoginData == null)
            {
                return false;
            }

            Config.Email = loginWindow.Username;

            if (loginWindow.chkRemember.IsChecked != null && loginWindow.chkRemember.IsChecked.Value)
            {
                Config.Save();
            }

            SelfJid = new Jid(Nickname + "@chat.hipchat.com");

            window.Title = "Chatterbox - " + GroupName;

            HipchatClient = new XmppClientConnection("chat.hipchat.com");
            HipchatClient.Open(Nickname, loginWindow.Password);
            HipchatClient.Status = "Chatterbox";
            HipchatClient.Show = ShowType.chat;
            HipchatClient.AutoResolveConnectServer = false;
            HipchatClient.OnLogin += HipchatClient_OnLogin;

            MucManager = new MucManager(HipchatClient);

            HipchatClient.OnRosterStart += sender => Users.Clear();
            HipchatClient.OnRosterItem += HipchatClient_OnRosterItem;
            HipchatClient.OnMessage += HipchatClient_OnMessage;
            HipchatClient.OnPresence += HipchatClient_OnPresence;

            Lobby = new LobbyControl();
            Lobby.OnRoomJoin += Lobby_OnRoomJoin;

            Window.SetLobbyRoom(Lobby);

            return true;
        }