Beispiel #1
0
 private bool alreadyHaveThisTextBox(MeTLTextBox box)
 {
     bool result = false;
     Dispatcher.adopt(() =>
     {
         var boxId = box.tag().id;
         var privacy = box.tag().privacy;
         foreach (var text in Children)
             if (text is MeTLTextBox)
                 if (((MeTLTextBox)text).tag().id == boxId && ((MeTLTextBox)text).tag().privacy == privacy) result = true;
     });
     return result;
 }
Beispiel #2
0
 public MeTLTextBox Clone(MeTLTextBox OldBox)
 {
     var box = new MeTLTextBox();
     box.AcceptsReturn = true;
     box.TextWrapping = TextWrapping.WrapWithOverflow;
     box.GotFocus += textboxGotFocus;
     box.LostFocus += textboxLostFocus;
     box.BorderThickness = new Thickness(0);
     box.BorderBrush = new SolidColorBrush(Colors.Transparent);
     box.Background = new SolidColorBrush(Colors.Transparent);
     box.Focusable = canEdit && canFocus;
     box.tag(OldBox.tag());
     box.Height = OldBox.Height;
     box.Width = OldBox.Width;
     box.FontFamily = OldBox.FontFamily;
     box.FontWeight = OldBox.FontWeight;
     box.FontStyle = OldBox.FontStyle;
     box.TextDecorations = OldBox.TextDecorations;
     box.FontSize = OldBox.FontSize;
     box.Foreground = OldBox.Foreground;
     box.Text = OldBox.Text;
     SetLeft(box, GetLeft(OldBox));
     SetTop(box, GetTop(OldBox));
     return box;
 }
Beispiel #3
0
        public MeTLTextBox createNewTextbox()
        {
            var box = new MeTLTextBox();
            box.tag(new TextTag
                        {
                            author = Globals.me,
                            privacy = privacy,
                            id = string.Format("{0}:{1}", Globals.me, SandRibbonObjects.DateTimeFactory.Now())
                        });
            box.FontFamily = currentFamily;
            box.FontSize = currentSize;
            box.Foreground = new SolidColorBrush(currentColor);
            box.UndoLimit = 0;
            box.LostFocus += (_sender, _args) =>
            {
                myTextBox = null;

            };
            return applyDefaultAttributes(box);
        }
Beispiel #4
0
 public void sendTextWithoutHistory(MeTLTextBox box, string thisPrivacy, int slide)
 {
     RemovePrivacyStylingFromElement(box);
     if (box.tag().privacy != Globals.privacy)
         dirtyTextBoxWithoutHistory(box);
     var oldTextTag = box.tag();
     var newTextTag = new MeTLLib.DataTypes.TextTag(oldTextTag.author, thisPrivacy, oldTextTag.id);
     box.tag(newTextTag);
     var privateRoom = string.Format("{0}{1}", currentSlide, box.tag().author);
     if(thisPrivacy.ToLower() == "private" && Globals.isAuthor && Globals.me != box.tag().author)
         Commands.SneakInto.Execute(privateRoom);
     Commands.SendTextBox.ExecuteAsync(new TargettedTextBox(slide, box.tag().author, target, thisPrivacy, box));
     if(thisPrivacy.ToLower() == "private" && Globals.isAuthor && Globals.me != box.tag().author)
         Commands.SneakOutOf.Execute(privateRoom);
 }
Beispiel #5
0
 private void resetText(MeTLTextBox box)
 {
     RemovePrivacyStylingFromElement(box);
     currentColor = Colors.Black;
     box.FontWeight = FontWeights.Normal;
     box.FontStyle = FontStyles.Normal;
     box.TextDecorations = new TextDecorationCollection();
     box.FontFamily = new FontFamily("Arial");
     box.FontSize = 24;
     box.Foreground = Brushes.Black;
     var info = new TextInformation
                    {
                        Family = box.FontFamily,
                        Size = box.FontSize,
                    };
     Commands.TextboxFocused.ExecuteAsync(info);
     sendTextWithoutHistory(box, box.tag().privacy);
 }
Beispiel #6
0
 private void sendBox(MeTLTextBox box)
 {
     myTextBox = box;
     if(Children.ToList().Where(c => ((MeTLTextBox)c).tag().id == box.tag().id).ToList().Count == 0)
         Children.Add(box);
     box.TextChanged += SendNewText;
     box.PreviewTextInput += box_PreviewTextInput;
     sendTextWithoutHistory(box, box.tag().privacy);
 }
Beispiel #7
0
 private void dirtyTextBoxWithoutHistory(MeTLTextBox box)
 {
     RemovePrivacyStylingFromElement(box);
     if (Children.ToList().Where(c => ((MeTLTextBox)c).tag().id == box.tag().id).ToList().Count != 0)
         Children.Remove(Children.ToList().Where(b => ((MeTLTextBox)b).tag().id == box.tag().id).First());
     Commands.SendDirtyText.ExecuteAsync(new TargettedDirtyElement(currentSlide, box.tag().author, target, box.tag().privacy, box.tag().id));
 }
Beispiel #8
0
 public static MeTLTextBox toMeTLTextBox(this TextBox OldBox)
 {
     var box = new MeTLTextBox(); 
     box.AcceptsReturn = true;
     box.TextWrapping = TextWrapping.WrapWithOverflow;
     box.BorderThickness = new Thickness(0);
     box.BorderBrush = new SolidColorBrush(Colors.Transparent);
     box.Background = new SolidColorBrush(Colors.Transparent);
     box.tag(OldBox.tag());
     box.FontFamily = OldBox.FontFamily;
     box.FontStyle = OldBox.FontStyle;
     box.FontWeight = OldBox.FontWeight;
     box.TextDecorations = OldBox.TextDecorations;
     box.FontSize = OldBox.FontSize;
     box.Foreground = OldBox.Foreground;
     box.Text = OldBox.Text;
     box.Width = OldBox.Width;
     //box.Height = OldBox.Height;
     InkCanvas.SetLeft(box, InkCanvas.GetLeft(OldBox));
     InkCanvas.SetTop(box, InkCanvas.GetTop(OldBox));
     return box;
 }
Beispiel #9
0
        public static MeTLTextBox clone(this MeTLTextBox box)
        {
            var newBox = new MeTLTextBox();
            newBox.Text = box.Text;
            newBox.TextAlignment = box.TextAlignment;
            newBox.TextDecorations = box.TextDecorations;
            newBox.FontFamily = box.FontFamily;
            newBox.FontSize = box.FontSize;
            newBox.Foreground = box.Foreground;
            newBox.Background = box.Background;
            newBox.tag(box.tag());
            InkCanvas.SetLeft(newBox, InkCanvas.GetLeft(box));
            InkCanvas.SetTop(newBox, InkCanvas.GetTop(box));

            return newBox;
        }