private void OnWriterEventRaised(object sender, WriterEventArgs e)
 {
     if (e != null && e.Type == Writer.EventType.Sleep)
     {
         Interlocked.Increment(ref _writerFinishedCount);
     }
 }
        private void myEditControl_SelectionChanged(object eventSender, WriterEventArgs args)
        {
            //XTextFieldElement field = (XTextFieldElement)myEditControl.Document.CurrentField;
            //field.EditorTextExt = "bbb";

            provider.Document = myEditControl.Document;
            provider.Prefix = '{';
            provider.Endfix = '}';
            XTextRange range = provider.GetRange(myEditControl.CurrentElement);
            if (range != null)
            {
                myEditControl.HighlightRange = new HighlightInfo(range);
            }
            else
            {
                myEditControl.HighlightRange = null;
            }


            //XTextLine line = myEditControl.Document.CurrentContentElement.CurrentLine;
            //if (line != null && line.OwnerPage != null)
            //{
            //    string txt =
            //        string.Format(ResourceStrings._LINE,
            //        Convert.ToString(myEditControl.CurrentLineOwnerPageIndex),
            //        Convert.ToString(myEditControl.CurrentLineIndexInPage),
            //        Convert.ToString(myEditControl.CurrentColumnIndex));
            //    if (myEditControl.Selection.Length != 0)
            //    {
            //        txt = txt + string.Format(
            //            ResourceStrings._SELECTELEMENTS,
            //            Math.Abs(myEditControl.Selection.Length));
            //    }
            //    Point p = myEditControl.SelectionStartPosition;
            //    this.lblPosition.Text = txt + " X:" + p.X + " Y:" + p.Y;
            //}

            UpdateFormText();

            SetContextMenu();

            if (this.dstvControler != null)
            {
                this.dstvControler.UpdateCurrentDataSourceNode(myEditControl);
            }
            //this.Text = myEditControl.CaretPosition.ToString();
        }
        private void myEditControl_HoverElementChanged(object eventSender, WriterEventArgs args)
        {
            provider.Document = myEditControl.Document;
            provider.Prefix = '{';
            provider.Endfix = '}';
            if (myEditControl.HoverElement != null && myEditControl.HoverElement.Parent is XTextInputFieldElement)
            {
                XTextInputFieldElement field = (XTextInputFieldElement)myEditControl.HoverElement.Parent;
                if (field.IsBackgroundTextElement(myEditControl.HoverElement))
                {
                }
            }
            XTextRange range = provider.GetRange(myEditControl.HoverElement);
            if (range != null)
            {
                this.myEditControl.HighlightRange = new HighlightInfo(range);

            }
            else
            {
                this.myEditControl.HighlightRange = null;
            }
        }
        private void myEditControl_SelectionChanged(object eventSender, WriterEventArgs args)
        {

            provider.Document = myEditControl.Document;
            provider.Prefix = '{';
            provider.Endfix = '}';
            XTextRange range = provider.GetRange(myEditControl.CurrentElement);
            if (range != null)
            {
                myEditControl.HighlightRange = new HighlightInfo(range);
            }
            else
            {
                myEditControl.HighlightRange = null;
            }


            SetContextMenu();

            if (this.dstvControler != null)
            {
                this.dstvControler.UpdateCurrentDataSourceNode(myEditControl);
            }
            //this.Text = myEditControl.CaretPosition.ToString();
        }