public async void PrefixInput(RoutedEventArgs args)
        {
            AutoCompleteTextbox control = args.Source as AutoCompleteTextbox;

            if (control == null)
            {
                return;
            }

            var services = IoC.Get <IRootSerivce>();

            var source = await services.QueryRoot(new RootDto()
            {
                Name = args.OriginalSource.ToString()
            });

            var items = source.Select(p => new AutoCompleteRootDisplayModel(p));

            if (control.Tag.ToString() == PrefixString)
            {
                PrefixDataSource.Clear();
                PrefixDataSource.AddRange(items);
            }
            else if (control.Tag.ToString() == RootString)
            {
                RootDataSource.Clear();
                RootDataSource.AddRange(items);
            }
            else if (control.Tag.ToString() == SuffixString)
            {
                SuffixDataSource.Clear();
                SuffixDataSource.AddRange(items);
            }
        }
Exemplo n.º 2
0
        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();
        }
        public void ItemSelected(RoutedEventArgs args)
        {
            AutoCompleteTextbox control = args.Source as AutoCompleteTextbox;

            var item = args.OriginalSource as AutoCompleteRootDisplayModel;

            if (item == null || control == null)
            {
                return;
            }

            if (control.Tag.ToString() == PrefixString)
            {
                this.Model.PrefixId = item.Id;
            }
            else if (control.Tag.ToString() == RootString)
            {
                this.Model.RootId = item.Id;
            }
            else if (control.Tag.ToString() == SuffixString)
            {
                this.Model.SuffixId = item.Id;
            }
        }