コード例 #1
0
        /// <summary>
        /// Prompts the user to edit an array value.
        /// </summary>
        public Opc.Ua.Security.ListOfSecurityProfiles ShowDialog(Opc.Ua.Security.ListOfSecurityProfiles profiles, string caption)
        {
            if (caption != null)
            {
                this.Text = caption;
            }

            ProfilesLV.Items.Clear();

            if (profiles != null)
            {
                for (int ii = 0; ii < profiles.Count; ii++)
                {
                    ProfilesLV.Items.Add(profiles[ii].ProfileUri, profiles[ii].Enabled);
                }
            }

            if (ShowDialog() != DialogResult.OK)
            {
                return(null);
            }

            Opc.Ua.Security.ListOfSecurityProfiles results = new Opc.Ua.Security.ListOfSecurityProfiles();

            for (int ii = 0; ii < ProfilesLV.Items.Count; ii++)
            {
                Opc.Ua.Security.SecurityProfile profile = new Opc.Ua.Security.SecurityProfile();
                profile.ProfileUri = ProfilesLV.Items[ii] as string;
                profile.Enabled    = ProfilesLV.CheckedIndices.Contains(ii);
                results.Add(profile);
            }

            return(results);
        }
コード例 #2
0
ファイル: SelectProfileDlg.cs プロジェクト: yuriik83/UA-.NET
        /// <summary>
        /// Prompts the user to edit an array value.
        /// </summary>
        public Opc.Ua.Security.ListOfSecurityProfiles ShowDialog(Opc.Ua.Security.ListOfSecurityProfiles profiles, string caption)
        {
            if (caption != null)
            {
                this.Text = caption;
            }

            ProfilesLV.Items.Clear();

            if (profiles != null)
            {
                for (int ii = 0; ii < profiles.Count; ii++)
                {
                    ProfilesLV.Items.Add(profiles[ii].ProfileUri, profiles[ii].Enabled);
                }
            }

            if (ShowDialog() != DialogResult.OK)
            {
                return null;
            }

            Opc.Ua.Security.ListOfSecurityProfiles results = new Opc.Ua.Security.ListOfSecurityProfiles();

            for (int ii = 0; ii < ProfilesLV.Items.Count; ii++)
            {
                Opc.Ua.Security.SecurityProfile profile = new Opc.Ua.Security.SecurityProfile();
                profile.ProfileUri = ProfilesLV.Items[ii] as string;
                profile.Enabled = ProfilesLV.CheckedIndices.Contains(ii);
                results.Add(profile);
            }

            return results;
        }