private void getMatch(string pattern) { try { RichTextBoxController.GetMatch(richTextBox_main, pattern); } catch (ParadigmException pe) { richTextBox_error.Text = pe.Message; } }
private void bt_AcceptAdd_Click(object sender, RoutedEventArgs e) { if (this.dp_Date.SelectedDate != null && this.dp_Date.SelectedDate <= DateTime.Now) { string about = RichTextBoxController.ConvertFlowDocumentToString(rtb_Description.Document); this.NewCalamity = new Calamity(about, this.dp_Date.SelectedDate.Value); this.DialogResult = true; } else { MessageBox.Show("Select a valid date"); } }
/// <summary> /// Initialize a new instance of the ViewDrawRibbonGroupRichTextBox class. /// </summary> /// <param name="ribbon">Reference to owning ribbon control.</param> /// <param name="ribbonRichTextBox">Reference to source richtextbox.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public ViewDrawRibbonGroupRichTextBox(KryptonRibbon ribbon, KryptonRibbonGroupRichTextBox ribbonRichTextBox, NeedPaintHandler needPaint) { Debug.Assert(ribbon != null); Debug.Assert(ribbonRichTextBox != null); Debug.Assert(needPaint != null); // Remember incoming references _ribbon = ribbon; GroupRichTextBox = ribbonRichTextBox; _needPaint = needPaint; _currentSize = GroupRichTextBox.ItemSizeCurrent; // Hook into the richtextbox events GroupRichTextBox.MouseEnterControl += OnMouseEnterControl; GroupRichTextBox.MouseLeaveControl += OnMouseLeaveControl; // Associate this view with the source component (required for design time selection) Component = GroupRichTextBox; if (_ribbon.InDesignMode) { // At design time we need to know when the user right clicks the textbox ContextClickController controller = new(); controller.ContextClick += OnContextClick; MouseController = controller; } // Create controller needed for handling focus and key tip actions _controller = new RichTextBoxController(_ribbon, GroupRichTextBox, this); SourceController = _controller; KeyController = _controller; // We need to rest visibility of the richtextbox for each layout cycle _ribbon.ViewRibbonManager.LayoutBefore += OnLayoutAction; _ribbon.ViewRibbonManager.LayoutAfter += OnLayoutAction; // Define back reference to view for the rich text box definition GroupRichTextBox.RichTextBoxView = this; // Give paint delegate to richtextbox so its palette changes are redrawn GroupRichTextBox.ViewPaintDelegate = needPaint; // Hook into changes in the ribbon custom definition GroupRichTextBox.PropertyChanged += OnRichTextBoxPropertyChanged; NULL_CONTROL_WIDTH = (int)(50 * FactorDpiX); }
private void bt_Accept_Click(object sender, RoutedEventArgs e) { if (this.dp_Date.SelectedDate != null && this.dp_Date.SelectedDate >= this.Calamity.Date) { this.Calamity.IsSolvedDate = this.dp_Date.SelectedDate.Value; string solution = RichTextBoxController.ConvertFlowDocumentToString(rtb_Solution.Document); this.Calamity.IsSolvedSolution = solution; this.DialogResult = true; } else { MessageBox.Show("Select a valid date"); } }
public CalamityView(Window _Owner, Calamity _Calamity) { this.Owner = _Owner; InitializeComponent(); this.calamity = _Calamity; //https://msdn.microsoft.com/en-us/library/system.string.isnullorempty(v=vs.110).aspx if (!string.IsNullOrEmpty(this.calamity.IsSolvedSolution)) { this.rtb_Solution.Document = RichTextBoxController.ConvertStringToFlowDocument(this.calamity.IsSolvedSolution); } if (!string.IsNullOrEmpty(this.calamity.About)) { this.rtb_About.Document = RichTextBoxController.ConvertStringToFlowDocument(this.calamity.About); } //if (this.calamity.IsSolvedDate != null) // this.lbl_Solved.Content = this.calamity.IsSolvedDate.Value.ToString("dd-MM-yyyy"); DataContext = calamity; }