Exemple #1
0
        protected override PropertyManagerPagePage Create(IAttributeSet atts)
        {
            int err = -1;

            swPropertyManagerPageOptions_e opts;

            TitleIcon titleIcon = null;

            IconAttribute commIconAtt;

            if (atts.ContextType.TryGetAttribute(out commIconAtt))
            {
                if (commIconAtt.Icon != null)
                {
                    titleIcon = new TitleIcon(commIconAtt.Icon);
                }
            }

            if (atts.Has <PageOptionsAttribute>())
            {
                var optsAtt = atts.Get <PageOptionsAttribute>();

                //TODO: implement conversion
                opts = (swPropertyManagerPageOptions_e)optsAtt.Options;
            }
            else
            {
                //TODO: implement conversion
                opts = (swPropertyManagerPageOptions_e)(PageOptions_e.OkayButton | PageOptions_e.CancelButton);
            }

            var helpLink     = "";
            var whatsNewLink = "";

            if (atts.Has <HelpAttribute>())
            {
                var helpAtt = atts.Get <HelpAttribute>();

                if (!string.IsNullOrEmpty(helpAtt.WhatsNewLink))
                {
                    if (!opts.HasFlag(swPropertyManagerPageOptions_e.swPropertyManagerOptions_WhatsNew))
                    {
                        opts |= swPropertyManagerPageOptions_e.swPropertyManagerOptions_WhatsNew;
                    }
                }

                helpLink     = helpAtt.HelpLink;
                whatsNewLink = helpAtt.WhatsNewLink;
            }

            var page = m_App.CreatePropertyManagerPage(atts.Name,
                                                       (int)opts,
                                                       m_Handler, ref err) as IPropertyManagerPage2;

            if (titleIcon != null)
            {
                var iconPath = m_IconsConv.ConvertIcon(titleIcon).First();
                page.SetTitleBitmap2(iconPath);
            }

            if (atts.Has <MessageAttribute>())
            {
                var msgAtt = atts.Get <MessageAttribute>();
                page.SetMessage3(msgAtt.Text, (int)msgAtt.Visibility,
                                 (int)msgAtt.Expanded, msgAtt.Caption);
            }
            else if (!string.IsNullOrEmpty(atts.Description))
            {
                page.SetMessage3(atts.Description, (int)swPropertyManagerPageMessageVisibility.swMessageBoxVisible,
                                 (int)swPropertyManagerPageMessageExpanded.swMessageBoxExpand, "");
            }

            return(new PropertyManagerPagePage(page, m_Handler, m_App, helpLink, whatsNewLink));
        }
Exemple #2
0
 internal PageOptionsAttribute(TitleIcon icon, swPropertyManagerPageOptions_e opts) : this(opts)
 {
     Icon = icon;
 }