Beispiel #1
0
        protected override void OnDisabled()
        {
            base.OnDisabled();

            RegisteredChatCommands.Clear();
            ChatButtonHighlighted = false;
            LeaveEventHandled     = true;
            SendEventHandled      = true;

            RegisteredChatCommands.Clear();
            ChannelMessages.Clear();
            PrivateMessages.Clear();
            ConsoleMessages.Clear();
            PlayerChannels.Clear();
            JoinedChannels.Clear();
            JoinedPmChannels.Clear();
            HighlightChannel.Clear();
            HighlightPm.Clear();

            SelectedChannel   = null;
            SelectedPmChannel = null;

            SelectTextBox = false;
            SendText      = "";

            Queuer.Clear();

            if (ChatLocked)
            {
                InputLockManager.RemoveControlLock(LmpChatLock);
                ChatLocked = false;
            }
        }
        private void Connect()
        {
            var rabbitHost     = ConfigurationManager.AppSettings["RabbitMqHost"];
            var rabbitUsername = ConfigurationManager.AppSettings["RabbitMqUsername"];
            var rabbitPassword = ConfigurationManager.AppSettings["RabbitMqPassword"];

            var factory = new ConnectionFactory
            {
                HostName = rabbitHost,
                UserName = rabbitUsername,
                Password = rabbitPassword,
                AutomaticRecoveryEnabled = true,
                RequestedHeartbeat       = 30
            };

            Connection = factory.CreateConnection();
            Connection.ConnectionShutdown += Connection_ConnectionShutdown;
            ChannelVariableList            = Connection.CreateModel();
            ChannelInfo               = Connection.CreateModel();
            ChannelState              = Connection.CreateModel();
            ChannelMessages           = Connection.CreateModel();
            ChannelTool               = Connection.CreateModel();
            ChannelHistoryJobPieceBar = Connection.CreateModel();


            ChannelVariableList.QueueDeclare("VariableList",
                                             true,
                                             false,
                                             false,
                                             null);
            ChannelInfo.QueueDeclare("Info",
                                     true,
                                     false,
                                     false,
                                     null);
            ChannelState.QueueDeclare("State",
                                      true,
                                      false,
                                      false,
                                      null);
            ChannelMessages.QueueDeclare("Messages",
                                         true,
                                         false,
                                         false,
                                         null);
            ChannelTool.QueueDeclare("Tool",
                                     true,
                                     false,
                                     false,
                                     null);
            ChannelHistoryJobPieceBar.QueueDeclare("HistoryJobPieceBar",
                                                   true,
                                                   false,
                                                   false,
                                                   null);
        }
        private void Cleanup()
        {
            ChannelVariableList       = Connection.CreateModel();
            ChannelInfo               = Connection.CreateModel();
            ChannelState              = Connection.CreateModel();
            ChannelMessages           = Connection.CreateModel();
            ChannelTool               = Connection.CreateModel();
            ChannelHistoryJobPieceBar = Connection.CreateModel();


            if (ChannelVariableList != null && ChannelVariableList.IsOpen)
            {
                ChannelVariableList.Close();
                ChannelVariableList.Dispose();
                ChannelVariableList = null;
            }


            if (ChannelInfo != null && ChannelInfo.IsOpen)
            {
                ChannelInfo.Close();
                ChannelInfo.Dispose();
                ChannelInfo = null;
            }

            if (ChannelState != null && ChannelState.IsOpen)
            {
                ChannelState.Close();
                ChannelState.Dispose();
                ChannelState = null;
            }

            if (ChannelMessages != null && ChannelMessages.IsOpen)
            {
                ChannelMessages.Close();
                ChannelMessages.Dispose();
                ChannelMessages = null;
            }

            if (ChannelTool != null && ChannelTool.IsOpen)
            {
                ChannelTool.Close();
                ChannelTool.Dispose();
                ChannelTool = null;
            }

            if (ChannelHistoryJobPieceBar != null && ChannelHistoryJobPieceBar.IsOpen)
            {
                ChannelHistoryJobPieceBar.Close();
                ChannelHistoryJobPieceBar.Dispose();
                ChannelHistoryJobPieceBar = null;
            }


            if (Connection != null && Connection.IsOpen)
            {
                Connection.Close();
                Connection.Dispose();
                Connection = null;
            }
        }
Beispiel #4
0
 /// <summary>
 /// Sets the control's ChannelMessage MSB and LSB.
 /// </summary>
 protected MidiControl(int channel, ChannelCommand command, byte msb, byte lsb)
 {
     ChannelMessages.Add(BuildMessage(command, channel, msb, lsb));
 }
Beispiel #5
0
 /// <summary>
 /// Sets the control's ChannelMessage MSB. LSBs are not used.
 /// </summary>
 protected MidiControl(int channel, ChannelCommand command, byte value)
 {
     ChannelMessages.Add(BuildMessage(command, channel, value, 0));
 }
Beispiel #6
0
 /// <summary>
 /// Used by controllers which only need to set their coarse controller.
 /// </summary>
 protected MidiControl(int channel, ControllerType coarseController, byte msb)
 {
     ChannelMessages.Add(BuildMessage(ChannelCommand.Controller, channel, (int)coarseController, msb));
 }