Beispiel #1
0
        public Form8()
        {
            InitializeComponent();

            adsPlcServer = MainApp.GetDoc().AdsPlcServer;
            adsNcServer  = MainApp.GetDoc().AdsNcServer;
        }
Beispiel #2
0
 /// <summary>
 /// Writes the symbol to the Plc.
 /// </summary>
 /// <param name="symbol">The symbol.</param>
 /// <param name="value">The value.</param>
 public void WriteSymbolToPlc(string symbol, string value)
 {
     Beckhoff.Forms.TcAdsPlcServer adsPlcServer = MainApp.GetDoc().AdsPlcServer;
     if (adsPlcServer != null && adsPlcServer.PlcIsRunning)
     {
         try
         {
             adsPlcServer.PlcClient.WriteSymbol(symbol, value);
         }
         catch (Exception ex)
         {
             MainApp.log.Error(this, ex);
         }
     }
 }
Beispiel #3
0
        private void OPModeAuto_Load(object sender, System.EventArgs e)
        {
            if (MainApp.GetDoc() != null)
            {
                adsPlcServer = MainApp.GetDoc().AdsPlcServer;
                adsNcServer  = MainApp.GetDoc().AdsNcServer;
                tcNcProgramSection1.AdsNcServer = adsNcServer;
                selectFile1.FileName            = MainApp.appSettings.batchProcess[4];

                TypeConverter tc      = TypeDescriptor.GetConverter(typeof(Font));
                Font          newFont = (Font)tc.ConvertFromString(MainApp.appSettings.ncFontName);
                tcNcProgramSection1.Font = newFont;

                int[] stops = { MainApp.appSettings.ncTabWidth };
                SendMessage(tcNcProgramSection1.RichTextBoxHandle, EM_SETTABSTOPS, 1, stops);
            }
        }
Beispiel #4
0
 private void buttonTargetSystem_Click(object sender, EventArgs e)
 {
     Beckhoff.Forms.TcAdsPlcServer adsPlcServer = MainApp.GetDoc().AdsPlcServer;
     Beckhoff.Forms.TcRemoteDialog remoteDlg    = new Beckhoff.Forms.TcRemoteDialog();
     remoteDlg.LocalAmsNetId = adsPlcServer.PlcClient.TcAdsSystemClient.ClientNetID.ToString();
     remoteDlg.ShowDialog();
     if (remoteDlg.DialogResult == DialogResult.OK)
     {
         if (remoteDlg.IsLocal)
         {
             textBoxAmsNetId.Clear();
         }
         else
         {
             textBoxAmsNetId.Text = remoteDlg.AmsNetId;
         }
         Application.DoEvents();
         if (adsPlcServer.ClientNetId != textBoxAmsNetId.Text)
         {
             adsPlcServer.ClientNetId = textBoxAmsNetId.Text;
             adsPlcServer.PlcClient.Reconnect();
         }
     }
 }