Esempio n. 1
0
        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;
            }
        }