public SharedPropertiesController(IWin32Window parentFrame, Label labelCategory, CategoryDropDownControlM1 categoryDropDown, Label labelTags, AutoCompleteTextbox textTags,
            Label labelPageOrder, NumericTextBox textPageOrder, Label labelPageParent, PageParentComboBox comboPageParent, Label labelPublishDate, PublishDateTimePicker datePublishDate, List<PropertyField> fields,
            CategoryContext categoryContext)
        {
            this.parentFrame = parentFrame;
            this.labelCategory = labelCategory;
            this.categoryDropDown = categoryDropDown;
            this.labelPublishDate = labelPublishDate;
            this.datePublishDate = datePublishDate;
            this.fields = fields;
            this.labelTags = labelTags;
            this.textTags = textTags;
            this.labelPageOrder = labelPageOrder;
            this.textPageOrder = textPageOrder;
            this.labelPageParent = labelPageParent;
            this.comboPageParent = comboPageParent;

            this.categoryDropDown.AccessibleName = Res.Get(StringId.CategoryControlCategories).Replace("{0}", " ").Trim();
            this.datePublishDate.AccessibleName = Res.Get(StringId.PropertiesPublishDate);

            textTags.TextChanged += MakeDirty;
            textTags.ButtonClicked += (sender, args) =>
            {
                _targetBlog.RefreshKeywords();
                LoadTagValues();
            };

            comboPageParent.SelectedIndexChanged += MakeDirty;
            textPageOrder.TextChanged += MakeDirty;

            datePublishDate.ValueChanged += MakeDirty;

            DATETIME_PICKER_PROMPT = "'" + Res.Get(StringId.PublishDatePrompt).Replace("'", "''") + "'";
            // HACK ALERT - WinLive 209226: For RTL languages, we need to reverse the string, so it displays in the right direction
            // when right aligned. We need this hack because we are essentially using the CustomFormat string to display
            // the cue text. The control assumes this to be a valid format string and does a blind reverse on RTL languages
            // to mirror the date formatting. Unfortunately we don't need that mirroring for the cue text.
            // We reverse only if either the system (control panel setting) or UI is RTL, not if both are RTL.
            bool isUIRightToLeft = BidiHelper.IsRightToLeft;
            bool isSystemRightToLeft = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.IsRightToLeft;
            if ((isUIRightToLeft && !isSystemRightToLeft) || (!isUIRightToLeft && isSystemRightToLeft))
            {
                // Reverse the string
                char[] charArray = DATETIME_PICKER_PROMPT.ToCharArray();
                Array.Reverse(charArray);
                DATETIME_PICKER_PROMPT = new string(charArray);
            }
            datePublishDate.CustomFormat = DATETIME_PICKER_PROMPT;

            categoryDropDown.Initialize(parentFrame, categoryContext);

            InitializeFields();
            InitializeSync();
        }
Esempio n. 2
0
        public virtual string GetPrefix(AutoCompleteTextbox tstb, out int pos, out int segmentLength)
        {
            if (tstb.SelectionLength == 0)
            {
                string s      = tstb.Text;
                int    selPos = tstb.SelectionStart;
                Match  m      = Regex.Match(s, @"[^,\s][^,]*");
                while (m.Success)
                {
                    if (m.Index <= selPos && m.Index + m.Length >= selPos)
                    {
                        pos           = m.Index;
                        segmentLength = m.Length;
                        return(s.Substring(m.Index, selPos - m.Index));
                    }

                    m = m.NextMatch();
                }
            }
            pos           = -1;
            segmentLength = -1;
            return(null);
        }
        public virtual string GetPrefix(AutoCompleteTextbox tstb, out int pos, out int segmentLength)
        {
            if (tstb.SelectionLength == 0)
            {
                string s = tstb.Text;
                int selPos = tstb.SelectionStart;
                Match m = Regex.Match(s, @"[^,\s][^,]*");
                while (m.Success)
                {
                    if (m.Index <= selPos && m.Index + m.Length >= selPos)
                    {
                        pos = m.Index;
                        segmentLength = m.Length;
                        return s.Substring(m.Index, selPos - m.Index);
                    }

                    m = m.NextMatch();
                }
            }
            pos = -1;
            segmentLength = -1;
            return null;
        }