コード例 #1
0
ファイル: Text.cs プロジェクト: StackableRegiments/metl2011
 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;
 }
コード例 #2
0
ファイル: Text.cs プロジェクト: StackableRegiments/metl2011
 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;
 }
コード例 #3
0
ファイル: Text.cs プロジェクト: StackableRegiments/metl2011
        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);
        }
コード例 #4
0
ファイル: Text.cs プロジェクト: StackableRegiments/metl2011
 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);
 }
コード例 #5
0
ファイル: Text.cs プロジェクト: StackableRegiments/metl2011
 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);
 }
コード例 #6
0
ファイル: Text.cs プロジェクト: StackableRegiments/metl2011
 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);
 }
コード例 #7
0
ファイル: Text.cs プロジェクト: StackableRegiments/metl2011
 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));
 }
コード例 #8
0
ファイル: Text.cs プロジェクト: StackableRegiments/metl2011
 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;
 }
コード例 #9
0
ファイル: Text.cs プロジェクト: StackableRegiments/metl2011
        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;
        }