示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void furyConnectBox_Click(object sender, EventArgs e)
        {
            //m_formMacomRegs.Enabled = false;
            string connection = null;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (furyConnectBox.Checked)
                {
                    connection = FuryServerConnection.Text;

                    if (connection.Length == 0)
                    {
                        throw new Exception("Cannot connect without Ember connection type selection.");
                    }

                    if (m_fury_remoteConnections.ContainsKey(connection))
                    {
                        m_fury_interface = new FuryIceInterface(m_fury_remoteConnections[connection]);
                        connection       = connection + ";" + m_fury_remoteConnections[connection];
                    }

                    if (m_fury_interface == null)
                    {
                        throw new Exception("ERROR: Unknown connection type.");
                    }
                    m_x80_hal       = new X80QC(m_fury_interface);
                    m_furyConnected = true;

                    EnableFuryWidgets(true);

                    updateFuryInfo();
                }
                else
                {
                    system_FuryExceptionCleanUp();
                }
            }
            catch (Exception ex)
            {
                system_FuryExceptionCleanUp();
                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;
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        private void system_FuryExceptionCleanUp() // Clean up the app when an exception is thrown
        {
            if (m_fury_interface != null)          // For interface
            {
                m_fury_interface = null;
            }

            // Non specific clean-up
            m_x80_hal = null;

            furyConnectBox.Checked = false;
            m_furyConnected        = false;

            EnableFuryWidgets(false);
        }