Exemplo n.º 1
0
        private bool FiltersAreValid()
        {
            #if DEBUG
            Debug.Assert(
                !Debug_DuplicateFiltersExist(_filterList.TvList.Nodes),
                "UI failed to prevent duplicate filters from being created."
                );
            #endif

            ArrayList filtersInErrorList = new ArrayList();
            foreach (DeviceFilterTreeNode filterNode in _filterList.TvList.Nodes)
            {
                DeviceFilterNode filter = filterNode.DeviceFilter;
                if (!FilterIsLegal(filter))
                {
                    filtersInErrorList.Add(filter.Name);
                }
            }
            if (filtersInErrorList.Count != 0)
            {
                GenericUI.ShowWarningMessage(
                    SR.GetString(SR.DeviceFilterEditorDialog_Title),
                    SR.GetString(
                        SR.DeviceFilterEditorDialog_InvalidFilter,
                        GenericUI.BuildCommaDelimitedList(
                            filtersInErrorList
                            )
                        )
                    );
                return(false);
            }
            return(true);
        }
        private bool ValidateAppliedFilters()
        {
            StringCollection duplicateChoices =
                DesignerUtility.GetDuplicateChoiceTreeNodes(
                    _appliedFiltersList.TvList.Nodes
                    );

            if (duplicateChoices.Count > 0)
            {
                GenericUI.ShowWarningMessage(
                    SR.GetString(SR.AppliedDeviceFiltersDialog_Title),
                    SR.GetString(SR.AppliedDeviceFiltersDialog_DuplicateChoices,
                                 GenericUI.BuildCommaDelimitedList(duplicateChoices))
                    );
                return(false);
            }
            return(true);
        }
Exemplo n.º 3
0
        private bool ValidateLoadedChoices()
        {
            StringCollection duplicateChoices =
                DesignerUtility.GetDuplicateChoiceTreeNodes(
                    _cbChoices.Items
                    );

            if (duplicateChoices.Count > 0)
            {
                if (!_ignoreSelectionChanged)
                {
                    GenericUI.ShowWarningMessage(
                        SR.GetString(SR.PropertyOverridesDialog_Title),
                        SR.GetString(SR.PropertyOverridesDialog_DuplicateChoices,
                                     GenericUI.BuildCommaDelimitedList(duplicateChoices))
                        );
                }
                return(false);
            }
            return(true);
        }
Exemplo n.º 4
0
        protected override String GetDesignTimeNormalHtml()
        {
            String    curStyle, message;
            ArrayList lstStylesInCycle = null;

            if (null == CurrentStyle)
            {
                curStyle = SR.GetString(SR.StyleSheet_PropNotSet);
            }
            else
            {
                curStyle = HttpUtility.HtmlEncode(CurrentStyle.Name);
            }

            String curChoice;

            if (null == CurrentChoice)
            {
                curChoice = SR.GetString(SR.StyleSheet_PropNotSet);
            }
            else
            {
                if (CurrentChoice.Filter.Length == 0)
                {
                    curChoice = SR.GetString(SR.DeviceFilter_DefaultChoice);
                }
                else
                {
                    curChoice = HttpUtility.HtmlEncode(DesignerUtility.ChoiceToUniqueIdentifier(CurrentChoice));
                }
            }

            message = SR.GetString(SR.StyleSheet_DefaultMessage);

            bool   renderErrorMsg = false;
            String errorMsg       = null;
            String errorIconUrl   = null;

            if (_isDuplicate)
            {
                renderErrorMsg = true;
                errorMsg       = SR.GetString(SR.StyleSheet_DuplicateWarningMessage);
                errorIconUrl   = MobileControlDesigner.errorIcon;
            }
            else if (_styleSheet.DuplicateStyles.Count > 0)
            {
                renderErrorMsg = true;
                errorMsg       = SR.GetString(
                    SR.StyleSheet_DuplicateStyleNamesMessage,
                    GenericUI.BuildCommaDelimitedList(
                        GetDuplicateStyleNames()
                        )
                    );
                errorIconUrl = MobileControlDesigner.errorIcon;
            }
            else if (null != CurrentStyle && null != CurrentChoice)
            {
                if (IsHTMLSchema(CurrentChoice))
                {
                    message = SR.GetString(SR.StyleSheet_TemplateEditingMessage);
                }
                else
                {
                    // User has selected non-html schema
                    renderErrorMsg = true;
                    errorMsg       = SR.GetString(SR.MobileControl_NonHtmlSchemaErrorMessage);
                    errorIconUrl   = MobileControlDesigner.infoIcon;
                }
            }

            if (renderErrorMsg)
            {
                Debug.Assert(errorMsg != null && errorIconUrl != null);
                return(String.Format(CultureInfo.CurrentCulture, _specialCaseDesignTimeHTML,
                                     new Object[]
                {
                    _styleSheet.Site.Name,
                    curStyle,
                    curChoice,
                    message,
                    errorIconUrl,
                    errorMsg
                }));
            }
            else
            {
                lstStylesInCycle = DetectCycles();

                //

                if (lstStylesInCycle != null && lstStylesInCycle.Count > 0)
                {
                    String cycledStyles = String.Empty;
                    //

                    foreach (Object obj in lstStylesInCycle)
                    {
                        Style cycledStyle = (Style)obj;
                        if (cycledStyles.Length > 0)
                        {
                            cycledStyles += ", ";
                        }
                        cycledStyles += cycledStyle.Name;
                    }
                    return(String.Format(CultureInfo.CurrentCulture, _specialCaseDesignTimeHTML,
                                         new Object[]
                    {
                        _styleSheet.Site.Name,
                        curStyle,
                        curChoice,
                        message,
                        MobileControlDesigner.errorIcon,
                        SR.GetString(SR.StyleSheet_RefCycleErrorMessage, cycledStyles)
                    }));
                }
                else
                {
                    return(String.Format(CultureInfo.CurrentCulture, _designTimeHTML,
                                         new Object[]
                    {
                        _styleSheet.Site.Name,
                        curStyle,
                        curChoice,
                        message
                    }));
                }
            }
        }