Exemplo n.º 1
0
        public MainWindow(string accountName, string password, string characterName, string realmName)
        {
            InitializeComponent();

            session = new Session();

            this.Closed += new EventHandler(MainWindow_Closed);

            DataContext = this;

            if (chat == null) {
                chat = new ChatModule(session, characterName, realmName);

                var msgDele = new ChatModule.OnMessageDelegate(OnMessage);
                chat.OnMessageGuildChat += msgDele;
                chat.OnMessageOfficerChat += msgDele;
                chat.OnMessageWhisper += msgDele;
                chat.OnMessageMOTD += msgDele;
                chat.OnPresenceChange += new ChatModule.OnPresenceDelegate(OnPresenceChange);
                chat.OnChatLoggedOut += new ChatModule.OnChatLoggedInOutDelegate(OnChatLoggedOut);
                chat.OnChatLoggedIn += new ChatModule.OnChatLoggedInOutDelegate(OnChatLoggedIn);

                chat.OnLoginFailed += new ChatModule.OnLoginFailedDelegate(OnLoginFailed);
            }

            session.Start(accountName, password);
            session.OnSessionClosed += new Session.OnSessionClosedDelegate(OnSessionClosed);

            var assembly = System.Reflection.Assembly.GetExecutingAssembly();
            var version = assembly.GetName().Version.ToString();
            Title = String.Format("Guild Chat ({0}/{1}) {2}", characterName, realmName, version);

            AppendLine("Logging into chat..");
        }
Exemplo n.º 2
0
        public IRCBridge(ChatModule module)
        {
            this.module = module;

            module.OnMessageMOTD += new ChatModule.OnMessageDelegate(module_OnMessageMOTD);
            module.OnMessageGuildChat += new ChatModule.OnMessageDelegate(module_OnMessageGuildChat);
            module.OnMessageOfficerChat += new ChatModule.OnMessageDelegate(module_OnMessageOfficerChat);
            module.OnMessageWhisper += new ChatModule.OnMessageDelegate(module_OnMessageWhisper);
            module.OnPresenceChange += new ChatModule.OnPresenceDelegate(module_OnPresenceChange);
        }
Exemplo n.º 3
0
        void OnPresenceChange(ChatModule module, Presence presence)
        {
            var arrow = "->";
            if (presence.Offline)
                arrow = "<-";

            AppendLine(String.Format("{0} {1} ({2})", arrow, presence.Name, presence.Type));
            NotifyPropertyChanged("ChatLog");
        }
Exemplo n.º 4
0
        void OnMessage(ChatModule module, Message m)
        {
            if (m.Type == Message.CHAT_MSG_TYPE_GUILD_CHAT || m.Type == Message.CHAT_MSG_TYPE_OFFICER_CHAT) {
                AppendLine(String.Format("<{0}> {1}", m.CharacterName, m.Body));
            } else if (m.Type == Message.CHAT_MSG_TYPE_GUILD_MOTD) {
                AppendLine("MOTD: " + m.Body);
            } else if (m.Type == Message.CHAT_MSG_TYPE_WHISPER) {
                AppendLine(String.Format("whisper <{0}> {1}", m.CharacterName, m.Body));
            }

            NotifyPropertyChanged("ChatLog");
        }
Exemplo n.º 5
0
        void module_OnPresenceChange(ChatModule module, Presence presence)
        {
            var arrow = "->";
            if (presence.Offline)
                arrow = "<-";

            IrcSendMessage(String.Format("{0} {1} ({2})", arrow, presence.Name, presence.Type));
        }
Exemplo n.º 6
0
 void module_OnMessageWhisper(ChatModule module, Message message)
 {
     IrcSendMessage(String.Format("whisper <{0}> {1}", message.CharacterName, message.Body));
 }
Exemplo n.º 7
0
 void module_OnMessageOfficerChat(ChatModule module, Message message)
 {
     IrcSendMessage(String.Format("officer <{0}> {1}", message.CharacterName, message.Body));
 }
Exemplo n.º 8
0
 void module_OnMessageMOTD(ChatModule module, Message message)
 {
     IrcSendMessage("MOTD: " + message.Body);
 }