private static WpfRegexDesigner.Model.RegexDesignerScreenData GetDefaultRegexData() { Color backColor = new Color(); Color foreColor = new Color(); backColor.R = 255; foreColor.R = foreColor.G = foreColor.B = 0; Model.RegexDesignerApplicationOptions appOptions = new WpfRegexDesigner.Model.RegexDesignerApplicationOptions { MatchedTextBackgroundColor = backColor, MatchedTextForegroundColor = foreColor, InputBoxTextWrapping = TextWrapping.NoWrap }; Model.RegexOptionsValueList rovl = new WpfRegexDesigner.Model.RegexOptionsValueList(); rovl.Value = RegexOptions.ExplicitCapture; Model.RegexDesignerScreenData rsd = new Model.RegexDesignerScreenData { InputText = "This is some sample text.", RegularExpression = "(?<w>\\w+)", Options = rovl, ReplacementExpression = "${w}\n", ApplicationOptions = appOptions }; return rsd; }
public MainWindow() { InitializeComponent(); regexData = Properties.Settings.Default.RegexData ?? GetDefaultRegexData(); DataContext = regexData; }
private static WpfRegexDesigner.Model.RegexDesignerScreenData GetDefaultRegexData() { Color backColor = new Color(); Color foreColor = new Color(); backColor.R = 255; foreColor.R = foreColor.G = foreColor.B = 0; Model.RegexDesignerApplicationOptions appOptions = new WpfRegexDesigner.Model.RegexDesignerApplicationOptions { MatchedTextBackgroundColor = backColor, MatchedTextForegroundColor = foreColor, InputBoxTextWrapping = TextWrapping.NoWrap }; Model.RegexOptionsValueList rovl = new WpfRegexDesigner.Model.RegexOptionsValueList(); rovl.Value = RegexOptions.ExplicitCapture; Model.RegexDesignerScreenData rsd = new Model.RegexDesignerScreenData { InputText = "This is some sample text.", RegularExpression = "(?<w>\\w+)", Options = rovl, ReplacementExpression = "${w}\n", ApplicationOptions = appOptions }; return(rsd); }
/// <summary> /// Initializes a new instance of the OptionsDialog class. /// </summary> /// <param name="options"></param> public OptionsDialog(RegexDesignerScreenData data) : this() { _Options = data.ApplicationOptions; mainGrid.DataContext = _Options; ObjectDataProvider layoutProvider = (ObjectDataProvider)this.FindResource("layoutOptionsDataProvider"); layoutProvider.ObjectInstance = data.LayoutOptions; }