Exemple #1
0
        /// <summary>
        /// Добавить надпись на холст
        /// Компонет основан на TextBox - поэтому тут своя атмосфера
        /// </summary>
        /// <param name="coord">Координаты надписи (правый левый угол)</param>
        public void AddLabel(Point coord)
        {
            LabelTextBox labelBox = new LabelTextBox();

            labelBox.Foreground = (Brush)this._editor.cbStrokeColor.SelectedItem;
            labelBox.Background = (Brush)this._editor.cbFillColor.SelectedItem;
            labelBox.ToolTip    = "Двойной клик для редактирования";
            labelBox.FontFamily = (FontFamily)this._editor.cbFontFamaly.SelectedItem;
            labelBox.FontSize   = Double.Parse(((this._editor.cbFontSize.SelectedItem as ComboBoxItem).Content.ToString()));
            InkCanvas.SetLeft(labelBox, coord.X);
            InkCanvas.SetTop(labelBox, coord.Y);
            this._editor.inkBoard.Children.Add(labelBox);
            labelBox.Focus();
            labelBox.LostFocus += (s, e) =>
            {
                this._editor.rbType.IsChecked = true;
                Mouse.OverrideCursor          = null;
                if (labelBox.Text.Trim().Length == 0)
                {
                    this._editor.inkBoard.Children.Remove(labelBox);
                }
                else
                {
                    this._editor.SaveState();
                    this._editor.ResetClientsUpdate();
                }
            };
        }
Exemple #2
0
        public NodePropertiesForm(Node node)
        {
            InitializeComponent();

            Statics.AddImageToButtonWithText(SaveButton, "checkmark48.png");

            this.node = node;

            WidthTextBox.Text  = node.Width.ToString();
            HeightTextBox.Text = node.Height.ToString();
            LabelTextBox.Text  = node.Label.ToString();

            if (node.IsFontBold)
            {
                IsBoldCheckBox.IsChecked = true;
            }

            if (node.IsFontItalic)
            {
                IsItalicCheckBox.IsChecked = true;
            }

            if (node.FontDecoration == FontDecoration.Underline)
            {
                radioButton10.IsChecked = true;
            }
            else if (node.FontDecoration == FontDecoration.Stroke)
            {
                radioButton11.IsChecked = true;
            }


            colorBorder1.Background = new SolidColorBrush(node.BackgroundColor);
            colorBorder2.Background = new SolidColorBrush(node.ForeGroundColor);
            updatesyleBorders();

            FontComboBox.Items.Add("10");
            FontComboBox.Items.Add("12");
            FontComboBox.Items.Add("14");
            FontComboBox.Items.Add("16");
            FontComboBox.Items.Add("18");
            FontComboBox.Items.Add("20");
            FontComboBox.Items.Add("24");
            FontComboBox.Items.Add("36");
            FontComboBox.Items.Add("72");

            FontComboBox.Text = node.FontSize.ToString();
            SetBackgroundStyleColor(node.BackgroundColorStyle);

            if (node.Properties.Contains("RightToLeft"))
            {
                LabelTextBox.FlowDirection      = FlowDirection.RightToLeft;
                IsRightToLeftCheckbox.IsChecked = true;
            }

            LabelTextBox.Focus();
            LabelTextBox.CaretIndex = LabelTextBox.Text.Length;
        }
Exemple #3
0
        private void ValidateButton_Click(object sender, RoutedEventArgs e)
        {
            // Only adds if the label is unique and required fields are filled
            if (MyGlobals.Lista.Exists(x => x.DirectKey == LabelTextBox.Text))
            {
                Thread thread = new Thread(ShowRectangleLabelExists);
                thread.Start();

                LabelTextBox.Focus();
            }
            else
            {
                if (LoginTextBox.Text == String.Empty || LoginTextBox.Text == (String)LoginTextBox.Tag)
                {
                    Thread thread = new Thread(ShowRequiredFieldWarning);
                    thread.Start(ErrorFieldEmpty2);

                    LoginTextBox.Focus();
                }
                else
                {
                    if (LabelTextBox.Text == String.Empty || LabelTextBox.Text == (String)LabelTextBox.Tag)
                    {
                        Thread thread = new Thread(ShowRequiredFieldWarning);
                        thread.Start(ErrorFieldEmpty);

                        LabelTextBox.Focus();
                    }
                    else
                    {
                        if (PasswordTextBox.Text == String.Empty || PasswordTextBox.Text == (String)PasswordTextBox.Tag)
                        {
                            Thread thread = new Thread(ShowRequiredFieldWarning);
                            thread.Start(ErrorFieldEmpty3);

                            PasswordTextBox.Focus();
                        }
                        else
                        {
                            // Add entry to local list and database
                            AddEntry();

                            // Checks if temporary Item exists, if so clears it
                            if (MyGlobals.TemporaryItem.DirectKey != String.Empty)
                            {
                                MyGlobals.TemporaryItem = Items.Empty();
                            }

                            nav.Navigate(new System.Uri("InitialPage.xaml", UriKind.RelativeOrAbsolute));
                        }
                    }
                }
            }
        }
Exemple #4
0
 public AddLabelWindow()
 {
     InitializeComponent();
     LabelTextBox.Focus();
 }
Exemple #5
0
 /// <summary>
 /// Добавить надпись на холст. 
 /// Компонет основан на TextBox - поэтому тут своя атмосфера
 /// </summary>
 /// <param name="coord">Координаты надписи (правый левый угол)</param>
 private void AddLabel(Point coord)
 {
     LabelTextBox labelBox = new LabelTextBox();
     labelBox.Foreground = (Brush)this.cbStrokeColor.SelectedItem;
     labelBox.Background = (Brush)this.cbFillColor.SelectedItem;
     labelBox.ToolTip = "Двойной клик для редактирования";
     labelBox.FontFamily = (FontFamily)this.cbFontFamaly.SelectedItem;
     labelBox.FontSize = Double.Parse(((this.cbFontSize.SelectedItem as ComboBoxItem).Content.ToString()));
     InkCanvas.SetLeft(labelBox, coord.X);
     InkCanvas.SetTop(labelBox, coord.Y);
     this.inkBoard.Children.Add(labelBox);
     labelBox.Focus();
     labelBox.LostFocus += (s, e) => 
     {
         this.rbType.IsChecked = true;
         Mouse.OverrideCursor = null;
         if (labelBox.Text.Trim().Length == 0)
         {
             this.inkBoard.Children.Remove(labelBox);
         }
     };
 }