private void button2_Click(object sender, EventArgs e) { if (listBox1.SelectedItem != null && listBoxhatalilokasyonlar.SelectedItem != null) { MessageBox.Show(mngr.GetOPCItemSyncRead(listBoxhatalilokasyonlar.SelectedItem.ToString(), listBox1.SelectedItem.ToString())); } }
void frmCihazTanim_ButtonClick2(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { object adres = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TagAdresi"); if (adres != null && adres != string.Empty) { //OpcManager mngr; //OPCServer opcserver = Persistence.Read<OPCServer>(new Condition("Aktif", Operator.Equal, 1)); //if (opcserver != null && opcserver.Id > 0) //{ List <string> adreslist = new List <string>(); adreslist.Add(adres.ToString()); mngr = new OpcManager(opcserver.Groups[0].OPCGroupName, adreslist); mngr.OPCServerConnect(opcserver.OpcServerName, opcserver.OPCNodeName); //mngr.AddOpcGroupServer(opcserver.OPCGroupName, (opcserver.GroupUpdateRate), (opcserver.GroupActiveState), (float)opcserver.GroupDeadBand); mngr.AddOpcGroupServer(opcserver.Groups[0].OPCGroupName, opcserver.Groups[0].GroupUpdateRate, opcserver.Groups[0].GroupActiveState, (float)opcserver.Groups[0].GroupDeadBand); mngr.OPCAddItems(this.editButtonLokasyon.Text); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "OkunanDeger", mngr.GetOPCItemSyncRead(this.editButtonLokasyon.Text, adres.ToString())); mngr.DisConnectServer(); mngr = null; //} } else { MessageBox.Show("Hata:Tag Degeri boş ya da adres seçmediniz !!!", "Uyarı..", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button2_Click(object sender, EventArgs e) { if (listBox1.SelectedItem != null) { MessageBox.Show(mngr.GetOPCItemSyncRead("power", listBox1.SelectedItem.ToString())); } }
void frmCihazTanim_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { object value = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "YazilacakDeger"); object adres = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TagAdresi"); if (value != null && value != System.DBNull.Value && adres != null && adres != string.Empty) { //OpcManager mngr; //OPCServer opcserver = Persistence.Read<OPCServer>(new Condition("Aktif", Operator.Equal, 1)); //if (opcserver != null && opcserver.Id > 0) //{ // OPCServerGroup groups=OPCServer.ReadGroups(opcserver.Id,editButtonLokasyon.Text); // if (groups != null) // { // opcserver.Groups.Add(groups); // } // else // { // MessageBox.Show("Hata:Bu Lokasyona ait OPCServerGroup ismi boş !!!", "Uyarı..", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } mymodel.Adres[] adresler = Persistence.ReadList <Adres>(); List <string> adreslist = new List <string>(); adreslist.Add(adres.ToString()); mngr = new OpcManager(opcserver.Groups[0].OPCGroupName, adreslist); mngr.OPCServerConnect(opcserver.OpcServerName, opcserver.OPCNodeName); mngr.AddOpcGroupServer(opcserver.Groups[0].OPCGroupName, opcserver.Groups[0].GroupUpdateRate, opcserver.Groups[0].GroupActiveState, (float)opcserver.Groups[0].GroupDeadBand); mngr.OPCAddItems(this.editButtonLokasyon.Text); mngr.OPCItemWrite(this.editButtonLokasyon.Text, adres.ToString(), value.ToString()); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "OkunanDeger", mngr.GetOPCItemSyncRead(this.editButtonLokasyon.Text, adres.ToString())); mngr.DisConnectServer(); mngr = null; } //} // else // MessageBox.Show("Hata:Tag Degeri boş ya da adres seçmediniz !!!", "Uyarı..", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
void frmCihazTanim_ButtonClick3(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { object adres = gridViewAlarmAdresler.GetRowCellValue(gridViewAlarmAdresler.FocusedRowHandle, "TagAdresi"); if (adres != null && adres != string.Empty) { //OpcManager mngr; //OPCServer opcserver = Persistence.Read<OPCServer>(new Condition("Aktif", Operator.Equal, 1)); //if (opcserver != null && opcserver.Id > 0) //{ List<string> adreslist = new List<string>(); adreslist.Add(adres.ToString()); mngr = new OpcManager(opcserver.Groups[0].OPCGroupName,adreslist); mngr.OPCServerConnect(opcserver.OpcServerName, opcserver.OPCNodeName); //mngr.AddOpcGroupServer(opcserver.OPCGroupName, (opcserver.GroupUpdateRate), (opcserver.GroupActiveState), (float)opcserver.GroupDeadBand); mngr.AddOpcGroupServer(opcserver.Groups[0].OPCGroupName, opcserver.Groups[0].GroupUpdateRate, opcserver.Groups[0].GroupActiveState, (float)opcserver.Groups[0].GroupDeadBand); mngr.OPCAddItems(this.editButtonLokasyon.Text); gridViewAlarmAdresler.SetRowCellValue(gridViewAlarmAdresler.FocusedRowHandle, "OkunanDeger", mngr.GetOPCItemSyncRead(this.editButtonLokasyon.Text,adres.ToString())); mngr.DisConnectServer(); mngr = null; //} } else MessageBox.Show("Hata:Tag Degeri boş ya da adres seçmediniz !!!", "Uyarı..", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
void frmCihazTanim_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { object value = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "YazilacakDeger"); object adres = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TagAdresi"); if (value != null && value != System.DBNull.Value && adres != null && adres!=string.Empty) { //OpcManager mngr; //OPCServer opcserver = Persistence.Read<OPCServer>(new Condition("Aktif", Operator.Equal, 1)); //if (opcserver != null && opcserver.Id > 0) //{ // OPCServerGroup groups=OPCServer.ReadGroups(opcserver.Id,editButtonLokasyon.Text); // if (groups != null) // { // opcserver.Groups.Add(groups); // } // else // { // MessageBox.Show("Hata:Bu Lokasyona ait OPCServerGroup ismi boş !!!", "Uyarı..", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } mymodel.Adres[] adresler = Persistence.ReadList<Adres>(); List<string> adreslist = new List<string>(); adreslist.Add(adres.ToString()); mngr = new OpcManager(opcserver.Groups[0].OPCGroupName,adreslist); mngr.OPCServerConnect(opcserver.OpcServerName, opcserver.OPCNodeName); mngr.AddOpcGroupServer(opcserver.Groups[0].OPCGroupName, opcserver.Groups[0].GroupUpdateRate, opcserver.Groups[0].GroupActiveState, (float)opcserver.Groups[0].GroupDeadBand); mngr.OPCAddItems(this.editButtonLokasyon.Text); mngr.OPCItemWrite(this.editButtonLokasyon.Text,adres.ToString(), value.ToString()); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, "OkunanDeger", mngr.GetOPCItemSyncRead(this.editButtonLokasyon.Text,adres.ToString())); mngr.DisConnectServer(); mngr = null; } //} // else // MessageBox.Show("Hata:Tag Degeri boş ya da adres seçmediniz !!!", "Uyarı..", MessageBoxButtons.OK, MessageBoxIcon.Warning); }