//close Com port connection public void Disconnect() { if (client == null) { client = new CommunicationProtocolClient(); client.Open(); } //close Com port connection client.Disconnect(); }
public bool Connect(string comPortName) { if (client == null) { client = new CommunicationProtocolClient(); client.Open(); } return(client.Connect(comPortName)); }
private void button2_Click(object sender, EventArgs e) { client = new TeslaCommunication.CommunicationProtocolClient(); client.Open(); updateView(); timerAlive = new Timer(); timerAlive.Interval = 100; timerAlive.Tick += TimerAlive_Tick; timerAlive.Start(); button2.Enabled = false; freqChanger1.setEnvoirnment("#1 Несущая", 1, client); }
internal void setEnvoirnment(string featureName, int featureNumber, CommunicationProtocolClient client) { this.client = client; this.groupBox2.Text = featureName; this.featureNumber = featureNumber; WindowState ws = WindowState.Load(); textBoxStart.DataBindings.Add("Text", ws, "FromF" + featureNumber.ToString(), false, DataSourceUpdateMode.OnPropertyChanged); textBoxStop.DataBindings.Add("Text", ws, "ToF" + featureNumber.ToString(), false, DataSourceUpdateMode.OnPropertyChanged); textBoxPeriod.DataBindings.Add("Text", ws, "CurrentF" + featureNumber.ToString(), false, DataSourceUpdateMode.OnPropertyChanged); textBoxDuty.DataBindings.Add("Text", ws, "DutyF" + featureNumber.ToString(), false, DataSourceUpdateMode.OnPropertyChanged); updateTrackBarFreqRanges(); onFreqChange(); }
public Main() { string assemblyLoc = GetType().Assembly.Location; string configName = assemblyLoc + ".config"; AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", configName); try { if (client == null) { client = new CommunicationProtocolClient(); client.Open(); } } catch (Exception ex) { } }
private void buttonService_Click(object sender, RibbonControlEventArgs e) { try { if (client.State == System.ServiceModel.CommunicationState.Faulted) { client = new CommunicationProtocolClient(); } client.Open(); timerAlive = new Timer(); timerAlive.Interval = 500; timerAlive.Tick += TimerAlive_Tick; timerAlive.Start(); } catch (Exception ex) { showMessage(ex.ToString()); } updateView(); }
private void ToolBox_Load(object sender, RibbonUIEventArgs e) { client = new CommunicationProtocolClient(); this.Close += ToolBox_Close; updateView(); }