Esempio 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..");
        }
Esempio n. 2
0
        public ChatModule(Session session, string name, string realm)
        {
            this.session = session;
            this.name = name;
            this.realm = realm;

            keepAliveTimer.Elapsed += new ElapsedEventHandler(keepAliveTimer_Elapsed);

            session.OnResponseReceived += new Connection.OnResponseReceivedDelegate(OnResponseReceived);
            session.OnSessionEstablished += new Session.OnSessionEstablishedDelegate(OnSessionEstablished);
            session.OnSessionClosed += new Session.OnSessionClosedDelegate(OnSessionClosed);
            session.OnError += new Session.OnErrorDelegate(OnError);
        }