private void BackColour_Clicked(object sender, RoutedEventArgs e) { if (this.selectedKey.IsNullEmptyOrWhiteSpace() || Formatters.GetVerseFromKey(this.selectedKey) <= 0) { MessageDisplay.Show("Please select a Verse"); return; } try { ColourPicker picker = new ColourPicker(); if (picker.ShowDialog().IsFalse()) { return; } int verseNumber = Formatters.GetVerseFromKey(this.selectedKey); HighlightRitchTextBox textBox = this.loadedTextBoxDictionary[verseNumber]; int start = textBox.GetSelectionStartIndex(); int length = textBox.GetSelectedTextLength(); textBox.HighlightText(start, length, picker.SelectedColour); string bibleVerseKey = Formatters.IsBiblesKey(this.selectedKey) ? this.selectedKey : $"{this.Bible.BibleId}||{this.selectedKey}"; BiblesData.Database.InsertVerseColour(bibleVerseKey, start, length, ColourConverters.GetHexFromBrush(picker.SelectedColour)); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void BrowseButton_Clicked(object sender, RoutedEventArgs e) { if (this.ModelViewItemBrowse != null) { this.ModelViewItemBrowse(sender, ((ActionButton)sender).Tag.ToString()); } if (this.ObjectType == ModelItemTypeEnum.ColorBox) { Brush brush = this.parent.GetPropertyValue(this.PropertyName) as Brush; this.contentObject.SetPropertyValue("Background", brush); this.contentObject.SetPropertyValue("Foreground", ColourConverters.InvertFromHex(ColourConverters.GetHexFromBrush(brush))); } }