Provides the properties for creating a tag in SmartPlant Review.
Inheritance: SprDbObject, IDisposable
Ejemplo n.º 1
0
        /// <summary>
        ///     Writes the tag properties to the default tag registry settings used by SmartPlant Review.
        /// </summary>
        /// <param name="tag">The tag used to determine settings values.</param>
        public static void SetTagRegistry(SprTag tag)
        {
            try
            {
                // Open the SmartPlant Review tag registry
                using (var regKey = Registry.CurrentUser.OpenSubKey(SprConstants.SprTagRegistryPath, true))
                {
                    if (regKey == null)
                    {
                        Registry.CurrentUser.CreateSubKey(SprConstants.SprTagRegistryPath);
                        SetTagRegistry(tag);
                        return;
                    }

                    var tagAtts = new List <Tuple <string, object, RegistryValueKind> >
                    {
                        new Tuple <string, object, RegistryValueKind>("BackgndColor", Get0Bgr(tag.BackgroundColor), RegistryValueKind.DWord),
                        new Tuple <string, object, RegistryValueKind>("ComputerName", tag.ComputerName, RegistryValueKind.String),
                        new Tuple <string, object, RegistryValueKind>("Creator", tag.Creator, RegistryValueKind.String),
                        new Tuple <string, object, RegistryValueKind>("Discipline", tag.Discipline, RegistryValueKind.String),
                        new Tuple <string, object, RegistryValueKind>("LeaderColor", Get0Bgr(tag.LeaderColor), RegistryValueKind.DWord),
                        new Tuple <string, object, RegistryValueKind>("Status", tag.Status, RegistryValueKind.String),
                        new Tuple <string, object, RegistryValueKind>("TextColor", Get0Bgr(tag.TextColor), RegistryValueKind.DWord)
                    };

                    foreach (var att in tagAtts)
                    {
                        var valString = string.Format("Default{0}", att.Item1);
                        regKey.SetValue(valString, att.Item2, att.Item3);
                    }
                }
            }
            catch (System.Security.SecurityException)
            {
                throw new SprException("Access to the SmartPlant Review registry denied.\n{0}",
                                       SprConstants.SprTagRegistryPath);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Writes the tag properties to the default tag registry settings used by SmartPlant Review.
        /// </summary>
        /// <param name="tag">The tag used to determine settings values.</param>
        public static void SetTagRegistry(SprTag tag)
        {
            try
            {
                // Open the SmartPlant Review tag registry
                using (var regKey = Registry.CurrentUser.OpenSubKey(SprConstants.SprTagRegistryPath, true))
                {
                    if (regKey == null)
                    {
                        Registry.CurrentUser.CreateSubKey(SprConstants.SprTagRegistryPath);
                        SetTagRegistry(tag);
                        return;
                    }

                    var tagAtts = new List<Tuple<string, object, RegistryValueKind>>
                    {
                        new Tuple<string, object, RegistryValueKind>("BackgndColor", Get0Bgr(tag.BackgroundColor), RegistryValueKind.DWord),
                        new Tuple<string, object, RegistryValueKind>("ComputerName", tag.ComputerName, RegistryValueKind.String),
                        new Tuple<string, object, RegistryValueKind>("Creator", tag.Creator, RegistryValueKind.String),
                        new Tuple<string, object, RegistryValueKind>("Discipline", tag.Discipline, RegistryValueKind.String),
                        new Tuple<string, object, RegistryValueKind>("LeaderColor", Get0Bgr(tag.LeaderColor), RegistryValueKind.DWord),
                        new Tuple<string, object, RegistryValueKind>("Status", tag.Status, RegistryValueKind.String),
                        new Tuple<string, object, RegistryValueKind>("TextColor", Get0Bgr(tag.TextColor), RegistryValueKind.DWord)
                    };

                    foreach (var att in tagAtts)
                    {
                        var valString = string.Format("Default{0}", att.Item1);
                        regKey.SetValue(valString, att.Item2, att.Item3);
                    }
                }
            }
            catch (System.Security.SecurityException)
            {
                throw new SprException("Access to the SmartPlant Review registry denied.\n{0}",
                                       SprConstants.SprTagRegistryPath);
            }
        }