Example #1
0
        private void ToolBarButtonClick(object sender, RoutedEventArgs e)
        {
            // Call the text editor event which added this button, giving him all the data in args
            // since it can be implemented also as Plugin we need to avoid passing Avalon objects

            ToolClickRoutedEventHandler   clickHandler = (ToolClickRoutedEventHandler)((Button)sender).Tag;
            TextEditorToolRoutedEventArgs args         = new TextEditorToolRoutedEventArgs();

            args.CaretLocation = textEditor.CaretOffset;
            args.txt           = textEditor.Text;
            clickHandler.Invoke(args);

            BackgroundRenderer.Segments.Clear();
            if (!string.IsNullOrEmpty(args.ErrorMessage))
            {
                Reporter.ToUser(eUserMsgKey.StaticErrorMessage, args.ErrorMessage);

                if (args.ErrorLines != null)
                {
                    AddSegments(args.ErrorLines);
                }
            }
            else if (!string.IsNullOrEmpty(args.SuccessMessage))//succ
            {
                Reporter.ToUser(eUserMsgKey.StaticInfoMessage, args.SuccessMessage);
            }
            else if (!string.IsNullOrEmpty(args.WarnMessage))//warn
            {
                Reporter.ToUser(eUserMsgKey.StaticWarnMessage, args.WarnMessage);
            }
        }