private void update(TextInformation info)
        {
            Dispatcher.adopt(delegate
            {
                fontSize.SelectionChanged -= fontSizeSelected;
                fontFamily.SelectionChanged -= fontFamilySelected;
                TextBoldButton.IsChecked = info.Bold;
                TextItalicButton.IsChecked = info.Italics;
                TextUnderlineButton.IsChecked = info.Underline;
                TextStrikethroughButton.IsChecked = info.Strikethrough;
                ColourPickerBorder.BorderBrush = new SolidColorBrush(info.Color);
                fontSize.SelectedItem = info.Size;
                fontFamily.SelectedItem = info.Family.ToString();
                fontSize.SelectionChanged += fontSizeSelected;
                fontFamily.SelectionChanged += fontFamilySelected;

                Globals.currentTextInfo = new TextInformation(info);
            });
        }
 private void sendValues()
 {
     if (fontSize == null || fontFamily == null || fontFamily.SelectedItem == null || ColourPickerBorder == null || ColourPickerBorder.BorderBrush == null || TextBoldButton == null || TextItalicButton == null || TextUnderlineButton == null || TextStrikethroughButton == null) return;
     var info = new TextInformation
     {
         Size = (double)fontSize.SelectedItem,
         Family = new FontFamily(fontFamily.SelectedItem.ToString()),
         Bold = TextBoldButton.IsChecked == true,
         Italics = TextItalicButton.IsChecked == true,
         Underline = TextUnderlineButton.IsChecked == true,
         Strikethrough = TextStrikethroughButton.IsChecked == true,
         Color = ((SolidColorBrush)ColourPickerBorder.BorderBrush).Color
     };
     Globals.currentTextInfo = new TextInformation(info);
     Commands.UpdateTextStyling.Execute(info);
 }