Example #1
0
 /// <summary>
 /// Constructor with null value
 /// </summary>
 /// <param name="id"></param>
 public TextAttributeViewModel(int id)
 {
     this.Id   = id;
     this.Name = TextAttributeType.GetInstance().GetNameById(id);
     this.Text = null;
     this.DetailsVisibility = Visibility.Collapsed;
 }
Example #2
0
 public TextRangeFindDialog(TextRangeViewModel trvm)
 {
     this.ViewModel = trvm;
     InitializeComponent();
     this.cbAttributes.ItemsSource = TextAttributeType.GetInstance().GetTemplate();
     this.Hilighter = new TextRangeHilighter(HighlighterColor.GreenTextBrush); // green color
 }
        public void TextAttributeTemplate_HasExpectedEntries()
        {
            var templateList = TextAttributeTemplate.GetTemplate();
            var ids          = TextAttributeType.GetInstance().Values;

            foreach (var id in ids)
            {
                if (_ignoreIds.Contains(id))
                {
                    continue;
                }

                Assert.IsTrue(templateList.Any(data => data.Item1 == id), $"{TextAttributeType.GetInstance().GetNameById(id)} was not found in the TextAttribute template");
            }
        }
Example #4
0
        private static int[] InitChangeTypes()
        {
            // Ids based on expected values for UiaChangeInfo.uiaId
            // https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/ns-uiautomationcore-uiachangeinfo
            // Note: property ids are not included as they are already handled by the property changed event handler.

            var changeTypes = new List <int>();

            changeTypes.Add(ChangeInfoType.UIA_SummaryChangeId);
            changeTypes.AddRange(TextAttributeType.GetInstance().Values);
            changeTypes.AddRange(AnnotationType.GetInstance().Values);
            changeTypes.AddRange(Styles.StyleId.GetInstance().Values);

            return(changeTypes.ToArray());
        }
        /// <summary>
        /// Text Range Attributes
        /// </summary>
        public List <TextAttributeViewModel> GetAttributes(bool collapse)
        {
            var list = new List <TextAttributeViewModel>();

            var kvl = TextAttributeType.GetInstance().GetKeyValuePairList();

            foreach (var kv in kvl)
            {
                var kvp = GetTextRangeAttributeKeyValuePair(this.TextRange, kv, collapse);
                if (kvp != null)
                {
                    list.AddRange(kvp);
                }
            }

            return(list);
        }
Example #6
0
        /// <summary>
        /// Configure attributes to show
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mniConfig_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new PropertyConfigDialog(ConfigurationManager.GetDefaultInstance().AppConfig.CoreTPAttributes, TextAttributeType.GetInstance(), "Attributes");

            dlg.Owner = Window.GetWindow(this);
            dlg.ShowDialog();

            if (dlg.DialogResult == true)
            {
                ConfigurationManager.GetDefaultInstance().AppConfig.CoreTPAttributes = dlg.ctrlPropertySelect.SelectedList.Select(v => v.Id).ToList();
                UpdateAttributeList();
            }
        }