Ejemplo n.º 1
0
        private void listView_tag_KeyDown(object sender, KeyEventArgs e)
        {
            // delete operation for tag
            if (e.KeyCode == Keys.Delete && lastSelectedPLC >= 0)
            {
                // check if current user has the authority to do this operation
                if (GPLC.AuthVerify(Security.GPLCAuthority.Administrator))
                {
                    // index of the last selected plc should not be over the list range
                    Debug.Assert(lastSelectedPLC < markers[_shownMarker].ProjectData.plcs.Count);

                    if (listView_tag.SelectedIndices.Count > 0)
                    {
                        // last selected plc
                        PLC plc = markers[_shownMarker].ProjectData.plcs[lastSelectedPLC];
                        // last selected tag
                        int index = listView_tag.SelectedIndices[0];
                        // db operation
                        ModelUtil.deleteTag(plc.tags[index].id);
                        // refresh tag list
                        refreshTagList();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void listView_tag_DoubleClick(object sender, EventArgs e)
 {
     // check if current user has the authority to do this operation
     if (GPLC.AuthVerify(Security.GPLCAuthority.Administrator))
     {
         // get the index of selected plc, -1 if no selection
         int index = listView_tag.SelectedIndices.Count > 0 ? listView_tag.SelectedIndices[0] : -1;
         // show tag edit control
         TagEditControl(index);
     }
 }