예제 #1
0
        /// <summary>
        /// Edits the currently selected element in the list.
        /// </summary>
        private void EditMI_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (AreaSourceLV.SelectedItems.Count != 1)
                {
                    return;
                }

                if (typeof(OpcClientSdk.Ae.TsCAeBrowseElement).IsInstanceOfType(AreaSourceLV.SelectedItems[0].Tag))
                {
                    OpcClientSdk.Ae.TsCAeBrowseElement element = (OpcClientSdk.Ae.TsCAeBrowseElement)AreaSourceLV.SelectedItems[0].Tag;

                    string qualifiedName = new QualifiedNameEditDlg().ShowDialog(element.QualifiedName);

                    if (qualifiedName == null)
                    {
                        return;
                    }

                    element.QualifiedName = qualifiedName;
                    AdjustColumns(AreaSourceLV);
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// Prompts the user to enter the qualified name for a source.
        /// </summary>
        private void AddSourceMI_Click(object sender, System.EventArgs e)
        {
            try
            {
                string qualifiedName = new QualifiedNameEditDlg().ShowDialog(null);

                if (qualifiedName == null)
                {
                    return;
                }

                OpcClientSdk.Ae.TsCAeBrowseElement element = new OpcClientSdk.Ae.TsCAeBrowseElement();

                element.QualifiedName = qualifiedName;
                element.NodeType      = OpcClientSdk.Ae.TsCAeBrowseType.Source;

                Add(element);
                AdjustColumns(AreaSourceLV);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }