Example #1
0
        // Called by the C++ code when a message has been received or a status has changed.
        public void OnMessageReceived(Dota_ChatMessage data)
        {
            switch (data.Type)
            {
            // Hide status has been changed, report to DLL.
            case -2:
            case -1:
                InjectionHelper.SendHideShowMessage(data.Type == -1);

                break;

            // A message has been received, display in main window and send to DLL.
            case 0:
            case 1:
            case 2:
                // Scope is determined by the type value: 0 = All, 1 = Team.
                String scope = (data.Type == 0) ? "ALL" : ((data.Type == 1) ? "TEAM" : "TV");

                // Make sure the data is read as UTF8.
                String sender  = ToUTF(data.Sender);
                String message = ToUTF(data.Message);

                // Translate the message and add it.
                new Thread(new ParameterizedThreadStart(TranslateMessageAndAdd)).Start(new object[] { scope, sender, message });

                break;
            }
        }
        // Called by the C++ code when a message has been received or a status has changed.
        public void OnMessageReceived(Dota_ChatMessage data)
        {
            switch (data.Type)
            {
                // Hide status has been changed, report to DLL.
                case -2:
                case -1:
                    InjectionHelper.SendHideShowMessage(data.Type == -1);

                    break;

                // A message has been received, display in main window and send to DLL.
                case 0:
                case 1:
                case 2:
                    // Scope is determined by the type value: 0 = All, 1 = Team.
                    String scope = (data.Type == 0) ? "ALL" : ((data.Type == 1) ? "TEAM" : "TV");

                    // Make sure the data is read as UTF8.
                    String sender = ToUTF(data.Sender);
                    String message = ToUTF(data.Message);

                    // Translate the message and add it.
                    new Thread(new ParameterizedThreadStart(TranslateMessageAndAdd)).Start(new object[] { scope, sender, message });

                    break;

            }
        }