Ejemplo n.º 1
0
        }         //implemented for command-line use

        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void innovativeConnectBox_Click(object sender, EventArgs e)
        {
            //m_formMacomRegs.Enabled = false;
            string connection = null;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (innovativeConnectBox.Checked)
                {
                    connection = InnovativeICEConnection.Text;

                    if (connection.Length == 0)
                    {
                        MessageBox.Show("Cannot connect without connection selection.");

                        //throw new Exception("Cannot connect without Ember connection type selection.");
                    }

                    if (m_innovative_remoteConnections.ContainsKey(connection))
                    {
                        m_innovative_interface = new InnovativeIceInterface(m_innovative_remoteConnections[connection]);
                        connection             = connection + ";" + m_innovative_remoteConnections[connection];
                    }

                    if (m_innovative_interface == null)
                    {
                        throw new Exception("ERROR: Unknown connection type.");
                    }
                    m_innovative_hal      = new Innovative_HAL(m_innovative_interface);
                    m_innovativeConnected = true;

                    EnableInnovativeWidgets(true);
                }
                else
                {
                    system_InnovativeExceptionCleanUp();
                }
            }
            catch (Exception ex)
            {
                system_InnovativeExceptionCleanUp();
                if (ex.Message.StartsWith("Access is denied"))
                {
                    MessageBox.Show(string.Format("Exception raised - Can't open {0} (Already in use by another program?).", connection), "");
                }
                else
                {
                    MessageBox.Show(string.Format("Exception raised - ({0}).", ex.Message.Trim()), "");
                }
            }

            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 2
0
        private void call_innovative_clickbox()
        {
            string connection = null;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (innovativeConnectBox.Checked)
                {
                    connection = InnovativeICEConnection.Text;
                    //Console.WriteLine(connection);
                    if (connection.Length == 0)
                    {
                        throw new Exception("Cannot connect without Ember connection type selection.");
                    }

                    if (m_innovative_remoteConnections.ContainsKey(connection))
                    {
                        m_innovative_interface = new InnovativeIceInterface(m_innovative_remoteConnections[connection]);
                        connection             = connection + ";" + m_innovative_remoteConnections[connection];
                    }

                    if (m_innovative_interface == null)
                    {
                        throw new Exception("ERROR: Unknown connection type.");
                    }
                    m_innovative_hal      = new Innovative_HAL(m_innovative_interface);
                    m_innovativeConnected = true;

                    EnableInnovativeWidgets(true);
                }
                else
                {
                    system_InnovativeExceptionCleanUp();
                }
            }
            catch (Exception ex)
            {
                system_InnovativeExceptionCleanUp();
                if (ex.Message.StartsWith("Access is denied"))
                {
                    MessageBox.Show(string.Format("Exception raised - Can't open {0} (Already in use by another program?).", connection), "");
                }
                else
                {
                    MessageBox.Show(string.Format("Exception raised - ({0}).", ex.Message.Trim()), "");
                }
            }
        }        //manual call of clickbox funct for command line use
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        private void system_InnovativeExceptionCleanUp() // Clean up the app when an exception is thrown
        {
            if (m_innovative_interface != null)          // For interface
            {
                m_innovative_interface = null;
            }

            // Non specific clean-up
            m_innovative_hal = null;

            innovativeConnectBox.Checked = false;
            m_innovativeConnected        = false;

            EnableInnovativeWidgets(false);
        }