コード例 #1
0
 /// <summary>
 /// Writes the given message to the textview.
 /// </summary>
 /// <param name="message"></param>
 public override void Write(string message)
 {
     _textView.InvokeOnMainThread(() =>
     {
         _textView.Text = _textView.Text + message;
         _textView.ScrollRangeToVisible(
             new MonoTouch.Foundation.NSRange(_textView.Text.Length, 0));
     });
 }
コード例 #2
0
 public override void Write(char value)
 {
     previousWriter.Write(value);
     textView.BeginInvokeOnMainThread(() => {
         var newText   = textView.Text + value;
         textView.Text = newText;
         textView.ScrollRangeToVisible(new Foundation.NSRange(newText.Length, 0));
     });
 }
コード例 #3
0
		public void PrintResult (UITextView textView, string message)
		{
			DispatchQueue.MainQueue.DispatchAsync (() => {
				textView.Text = string.Format ("{0}\n{1}", textView.Text, message);
				textView.ScrollRangeToVisible (new NSRange (0, textView.Text.Length));
			});
		}
コード例 #4
0
 void PrintResult(UITextView textView, string message)
 {
     DispatchQueue.MainQueue.DispatchAsync(() => {
         textView.Text = string.Format("{0}\n{1}", textView.Text, message);
         textView.ScrollRangeToVisible(new NSRange(0, textView.Text.Length));
     });
 }
コード例 #5
0
 private void ConcatText(string text)
 {
     InvokeOnMainThread(delegate {
         textView.Text += text + "\n";
         textView.ScrollRangeToVisible(new NSRange(textView.Text.Length, 0));
     });
 }
コード例 #6
0
 public override void WriteLine(string format, params object[] args)
 {
     _context.Post(delegate
     {
         _textView.Text = _textView.Text + string.Format(format, args) + Environment.NewLine;
         _textView.ScrollRangeToVisible(new MonoTouch.Foundation.NSRange(_textView.Text.Length, 0));
     }, state: null);
 }
コード例 #7
0
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();
            float padding     = 5f;
            float buttonWidth = 50f;
            var   frame       = new RectangleF(padding, padding, this.Bounds.Width - (padding * 3) - buttonWidth, 50);

            Input.Frame = frame;
            var buttonLeft = frame.Right + padding;

            frame      = new RectangleF(buttonLeft, padding, buttonWidth, 50);
            send.Frame = frame;

            var outputTop = frame.Bottom + padding;

            frame        = new RectangleF(padding, outputTop, this.Bounds.Width - (padding * 2), this.Bounds.Height - (outputTop + padding) - KeyBoardHeight);
            Output.Frame = frame;

            Output.ScrollRangeToVisible(new NSRange(Output.Text.Length - 1, 1));
        }
 // this method makes sure that the most recently added text is exactly at the bottom of the text view
 void ScrollMessageViewToEnd()
 {
     try {
         // find the number of characters between the end of the text and the previous newline
         string text  = textView.Text.TrimEnd();
         int    index = text.Length - 1;
         while (true)
         {
             char c = text[index];
             if (c == '\r' || c == '\n')
             {
                 break;
             }
             index--;
         }
         textView.ScrollRangeToVisible(new NSRange(index + 1, 1));
     } catch (Exception ex) {
         Console.WriteLine(ex.Message);
     }
 }
コード例 #9
0
 public static void ScrollToBottom(this UITextView textView)
 {
     textView.ScrollRangeToVisible(new NSRange(textView.Text.Length - 1, 1));
 }