コード例 #1
0
        private void BtnConnect_Click(object sender, RoutedEventArgs e)
        {
            Connection.ConnectionString = TxtConnectionString.Text;

            if (!Connection.IsConnected)
            {
                if (Connection.Connect())
                {
                    BtnConnect.Background       = Brushes.Green;
                    BtnSend.IsEnabled           = true;
                    BtnReloadSections.IsEnabled = true;

                    if (CmbLoadedSections.SelectedIndex > -1)
                    {
                        BtnWriteSection.IsEnabled = true;
                    }
                    else
                    {
                        BtnWriteSection.IsEnabled = false;
                    }
                    return;
                }
            }
            else
            {
                Connection.Close();
            }

            BtnConnect.Background       = Brushes.Red;
            BtnSend.IsEnabled           = false;
            BtnReloadSections.IsEnabled = false;
            BtnWriteSection.IsEnabled   = false;

            CmbAvailableSections.Items.Clear();
        }
コード例 #2
0
 //------------------------- Em Comms
 private void Em_Restart()
 {
     Connection = new ARCLConnection(EmConString);
     Connection.ConnectState += Connection_ConnectState;
     Connection.Connect();
 }