Exemplo n.º 1
0
        private void HMITagsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tiaPortal != null)
            {
                if (hmi_dialog == null)
                {
                    hmi_dialog = new SelectHMI(tiaPortal);
                }
                if (hmi_dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string filename = HMIAlarmTags.buildFile(defs, "sDB_LarmDefs", "HMI_Connection");
                    Console.WriteLine("HMI tags file: " + filename);
                    HmiTarget hmi = hmi_dialog.SelectedHMI;
                    Console.WriteLine("HMI name: " + hmi.Name);

                    if (hmi.Connections.Count != 1)
                    {
                        MessageBox.Show(this, "Can only handle exacltly one HMI connection. This device has " + hmi.Connections.Count);
                        System.IO.File.Delete(filename);
                        return;
                    }
                    Connection c = hmi.Connections.First();
                    c.Export(filename, ExportOptions.WithDefaults | ExportOptions.WithReadOnly);
                }
            }
        }
Exemplo n.º 2
0
        private void HMITagsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tiaPortal != null)
            {
                if (hmi_dialog == null)
                {
                    hmi_dialog = new SelectHMI(tiaPortal);

                }
                if (hmi_dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string filename = HMIAlarmTags.buildFile(defs, "sDB_LarmDefs", "HMI_Connection");
                    Console.WriteLine("HMI tags file: " + filename);
                    HmiTarget hmi = hmi_dialog.SelectedHMI;
                    Console.WriteLine("HMI name: " + hmi.Name);

                    if (hmi.Connections.Count != 1) {
                          MessageBox.Show(this, "Can only handle exacltly one HMI connection. This device has "+hmi.Connections.Count);
                            System.IO.File.Delete(filename);
                            return;
                    }
                    Connection c = hmi.Connections.First();
                    c.Export(filename, ExportOptions.WithDefaults | ExportOptions.WithReadOnly);
                }
            }
        }