コード例 #1
0
ファイル: DrawingHelper.cs プロジェクト: p-mercer/Whiteboard
        /// <summary>
        /// Изменить размер шрифта выделенным надписям
        /// </summary>
        public void ChangeFontFamily()
        {
            if (this._editor.inkBoard == null)
            {
                return;
            }

            //Выделенные надписи

            if (this._editor.inkBoard.GetSelectedElements().Count != 0)
            {
                foreach (UIElement item in this._editor.inkBoard.GetSelectedElements())
                {
                    LabelTextBox label = item as LabelTextBox;
                    if (label != null)
                    {
                        label.FontFamily = (FontFamily)this._editor.cbFontFamaly.SelectedItem;
                        this._editor.SaveState();
                    }
                }
            }

            //Редактируемая надпись

            LabelTextBox focusedLabel = FocusManager.GetFocusedElement(this._editor) as LabelTextBox;

            if (focusedLabel != null)
            {
                focusedLabel.FontFamily = (FontFamily)this._editor.cbFontFamaly.SelectedItem;
                this._editor.SaveState();
            }
        }
コード例 #2
0
        private void labelText_PreviewKeyUp(object sender, KeyEventArgs e)
        {
            LabelTextBox objTextBox = sender as LabelTextBox;


            if (e.Key == Key.Enter)
            {
                if (objConnection == null)
                {
                    objConnection = new Connection();
                }
                string sourceName  = null;
                string machineCode = null;
                bool   isMin       = false;
                int    window      = 0;
                string textValue;
                sourceName  = objTextBox.sourceName;
                machineCode = sourceName.Split(':')[0];
                isMin       = sourceName.Split(':')[1] == "MIN";
                textValue   = objTextBox.text1.Text;
                int.TryParse(textValue, out window);
                if (isMin)
                {
                    objConnection.UpdateCMMinConfigWindow(machineCode, window);
                }
                else
                {
                    objConnection.UpdateCMMaxConfigWindow(machineCode, window);
                }
            }
        }
コード例 #3
0
ファイル: Editor.xaml.cs プロジェクト: p-mercer/Whiteboard
        private void cbFont_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.inkBoard == null || this.cbFontFamaly.SelectedItem == null)
            {
                return;
            }

            try
            {
                if (this.inkBoard.GetSelectedElements().Count > 0 || this.inkBoard.GetSelectedStrokes().Count > 0 || this._focusedLabel != null)
                {
                    this._drawingHelper.ChangeSelectedShape(sender);
                    this.ResetClientsUpdate();
                }
                if (this._focusedLabel != null)
                {
                    this._focusedLabel.Focus();
                    this._focusedLabel = null;
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
#endif
                MessageBox.Show(ex.Message, "Изменение шрифта", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
コード例 #4
0
ファイル: DrawingHelper.cs プロジェクト: p-mercer/Whiteboard
        /// <summary>
        /// Изменить цвет заливки выделенных объектов
        /// </summary>
        public void ChangeFillColor()
        {
            if (this._editor.inkBoard == null)
            {
                return;
            }

            //Фигуры
            if (this._editor.inkBoard.GetSelectedElements().Count != 0)
            {
                foreach (UIElement item in this._editor.inkBoard.GetSelectedElements())
                {
                    if (item is Rectangle || item is Ellipse)
                    {
                        ((Shape)item).Fill = (SolidColorBrush)this._editor.cbFillColor.SelectedItem;
                    }
                    else if (item is LabelTextBox)
                    {
                        ((LabelTextBox)item).Background = (SolidColorBrush)this._editor.cbFillColor.SelectedItem;
                    }
                }
                this._editor.SaveState();
            }

            //Надпись

            LabelTextBox focusedLabel = FocusManager.GetFocusedElement(this._editor) as LabelTextBox;

            if (focusedLabel != null)
            {
                focusedLabel.Background = (SolidColorBrush)this._editor.cbFillColor.SelectedItem;
                this._editor.SaveState();
            }
        }
コード例 #5
0
ファイル: DrawingHelper.cs プロジェクト: p-mercer/Whiteboard
        /// <summary>
        /// Изменить шрифт выделенным надписям
        /// </summary>
        public void ChangeFontSize()
        {
            if (this._editor.inkBoard == null)
            {
                return;
            }

            //Выделенные надписи

            if (this._editor.inkBoard.GetSelectedElements().Count != 0)
            {
                foreach (UIElement item in this._editor.inkBoard.GetSelectedElements())
                {
                    LabelTextBox label = item as LabelTextBox;
                    if (label != null)
                    {
                        label.FontSize = Double.Parse((this._editor.cbFontSize.SelectedItem as ComboBoxItem).Content.ToString());
                        this._editor.SaveState();
                    }
                }
            }

            //Редактируемая надпись

            LabelTextBox focusedLabel = FocusManager.GetFocusedElement(this._editor) as LabelTextBox;

            if (focusedLabel != null)
            {
                focusedLabel.FontSize = Double.Parse(((this._editor.cbFontSize as ComboBox).SelectedItem as ComboBoxItem).Content.ToString());
                this._editor.SaveState();
            }
        }
コード例 #6
0
ファイル: QRCode.cs プロジェクト: 6555355/Scan_yan1
        public void SetQrCode(byte[] data)
        {
            List <QRCodeStruct> qrCodeStructList = new List <QRCodeStruct>();
            byte headNum = data[1];

            for (int i = 0; i < headNum; i++)
            {
                byte   headIndex = data[2 + (TextLength + 1) * i];
                byte[] qRbytes   = new byte[TextLength];
                Array.Copy(data, 2 + (TextLength + 1) * i + 1, qRbytes, 0, TextLength);
                QRCodeStruct qrCodeStruct = new QRCodeStruct
                {
                    HeadIndex = headIndex,
                    QRbytes   = new List <byte>(qRbytes)
                };
                qrCodeStructList.Add(qrCodeStruct);
            }
            foreach (QRCodeStruct qrCodeStruct in qrCodeStructList)
            {
                LabelTextBox textBox = flowLayoutPanel1.Controls[qrCodeStruct.HeadIndex] as LabelTextBox;
                if (textBox != null)
                {
                    textBox.Text             = Encoding.ASCII.GetString(qrCodeStruct.QRbytes.ToArray());
                    textBox.TextBoxBackColor = SystemColors.Window;
                    textBox.MsgString        = 2;
                }
            }
            panel2.Enabled = true;
            GetQRCodeFlag  = true;
        }
コード例 #7
0
        /// <summary>
        /// Изменить цвет контура выделенных объектов
        /// </summary>
        private void ChangeStokeColor()
        {
            foreach (Stroke item in this.inkBoard.GetSelectedStrokes())
            {
                item.DrawingAttributes.Color = ((SolidColorBrush)this.cbStrokeColor.SelectedItem).Color;
            }

            foreach (UIElement item in this.inkBoard.GetSelectedElements())
            {
                if (item is Shape)
                {
                    ((Shape)item).Stroke = (SolidColorBrush)this.cbStrokeColor.SelectedItem;
                }
                else if (item is LabelTextBox)
                {
                    ((LabelTextBox)item).Foreground = (SolidColorBrush)this.cbStrokeColor.SelectedItem;
                }
            }

            LabelTextBox focusedLabel = FocusManager.GetFocusedElement(this) as LabelTextBox;

            if (focusedLabel != null)
            {
                focusedLabel.Foreground = (SolidColorBrush)this.cbStrokeColor.SelectedItem;
            }
        }
コード例 #8
0
 public void Disable()
 {
     LabelTextBox.Clear();
     LabelTextBox.IsEnabled = false;
     FontSizeTextBox.Clear();
     FontSizeTextBox.IsEnabled = false;
 }
コード例 #9
0
ファイル: DrawingHelper.cs プロジェクト: p-mercer/Whiteboard
        /// <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();
                }
            };
        }
コード例 #10
0
        private void cbStrokeColor_ColorChanged(object sender, RoutedEventArgs e)
        {
            if (this.cbStrokeColor.SelectedItem == null)
            {
                return;
            }

            try
            {
                //Цвет заметок

                if (this.inkBoard.EditingMode == InkCanvasEditingMode.Ink)
                {
                    this.inkBoard.DefaultDrawingAttributes.Color = ((SolidColorBrush)this.cbStrokeColor.SelectedItem).Color;
                }

                //Изменить выделенные фигуры

                this.ChangeSelectedShape(sender);

                //Вернуть фокус полю ввода надписи

                if (this._focusedLabel != null)
                {
                    this._focusedLabel.Focus();
                    this._focusedLabel = null;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show(ex.Message, "Изменение цвета контура", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
コード例 #11
0
        private void backgroundWorkerSearch_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.BtnSearch.Enabled        = true;
            this.Cursor                   = Cursors.Default;
            CEnum.Message_Body[,] mResult = (CEnum.Message_Body[, ])e.Result;
            if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg)
            {
                MessageBox.Show(mResult[0, 0].oContent.ToString());
                return;
            }

            //CmbServer.Enabled = false;
            TxtAccount.Enabled        = false;
            this.buttonSaveAS.Enabled = true;

            //if (mResult[0, 8].eName == C_Global.CEnum.TagName.SDO_ActiveStatus && mResult[0, 8].oContent.ToString() == "1")
            //{
            //    LblDetail.Text = config.ReadConfigValue("MSDO", "AF_Code_UserEnabledDes").Replace("{Account}", TxtAccount.Text).Replace("{Server}", CmbServer.Text);
            //}

            //if (mResult[0, 8].eName == C_Global.CEnum.TagName.Status && mResult[0, 0].oContent.ToString() == "ERROR")
            //{
            //    LblDetail.Text = config.ReadConfigValue("MSDO", "AF_Code_UserNotEnabledDes").Replace("{Account}", TxtAccount.Text).Replace("{Server}", CmbServer.Text);
            //}

            PnlDetail.Visible = false;
            Operation_Card.SaveTxt(config, mResult, this.Name, "MAU");
            for (int i = 0; i < mResult.GetLength(1); i++)
            {
                LabelTextBox mDisplay = new LabelTextBox();
                mDisplay.Parent   = PnlDetail;
                mDisplay.Position = C_Controls.LabelTextBox.LabelTextBox.ELABELPOSITION.LEFT;
                mDisplay.Width    = 222;

                if (i % 2 == 0)
                {
                    mDisplay.Top  = 20 * i + 30;
                    mDisplay.Left = 44;
                }
                else
                {
                    mDisplay.Top  = 20 * (i - 1) + 30;
                    mDisplay.Left = mDisplay.Width + 111;
                }
                mDisplay.Font        = new Font("幼圆", 12);
                mDisplay.LabelText   = config.ReadConfigValue("MAU", mResult[0, i].eName.ToString()) + ":";
                mDisplay.TextBoxText = mResult[0, i].oContent.ToString();
            }
            PnlDetail.Visible = true;

            for (int i = 0; i < PnlDetail.Controls.Count; i++)
            {
                if (PnlDetail.Controls[i].GetType() == typeof(LabelTextBox))
                {
                    LabelTextBox mControls = (LabelTextBox)PnlDetail.Controls[i];
                    mControls.ReadOnly = true;
                }
            }
        }
コード例 #12
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;
        }
コード例 #13
0
        protected override void Execute(CodeActivityContext context)
        {
            try
            {
                string   _title       = TitleTextBox.Get(context);
                string   _textValue   = LabelTextBox.Get(context);
                string[] _listItem    = OptionsTextBox.Get(context);
                string   _resultValue = null;
                latch = new CountdownEvent(1);
                Thread td = new Thread(() =>
                {
                    DialogActivity.Windows.InputDialogWindow dlg = new DialogActivity.Windows.InputDialogWindow();

                    if (_title != null)
                    {
                        dlg.Title = _title;
                    }

                    if (_textValue != null)
                    {
                        dlg.setTextContent(_textValue);
                    }

                    if (_listItem != null)
                    {
                        if (_listItem.Length <= 1)
                        {
                            dlg.CreateEditBox(IsPassword);
                        }
                        else if (_listItem.Length > 1 && _listItem.Length < 4)
                        {
                            dlg.CreateCheckBox(_listItem);
                        }
                        else
                        {
                            dlg.CreateCombobox(_listItem);
                        }
                    }
                    else
                    {
                        dlg.CreateEditBox(IsPassword);
                    }
                    dlg.ShowDialog();
                    _resultValue = dlg.getValue();
                    dlg.Close();
                    refreshData(latch);
                });
                td.TrySetApartmentState(ApartmentState.STA);
                td.IsBackground = true;
                td.Start();
                latch.Wait();
                Result.Set(context, _resultValue);
            }
            catch (Exception e)
            {
                SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message);
            }
        }
コード例 #14
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));
                        }
                    }
                }
            }
        }
コード例 #15
0
ファイル: QRCode.cs プロジェクト: 6555355/Scan_yan1
        private void SetQrCodeThread(Object obj)
        {
            List <string> qrCodeList = obj as List <string>;

            if (qrCodeList != null)
            {
                for (int i = 0; i < qrCodeList.Count; i++)
                {
                    if (qrCodeList[i] != string.Empty)
                    {
                        feedBack     = false;
                        feedBackData = false;
                        List <byte> buffer    = new List <byte>();
                        byte        headIndex = (byte)i;
                        buffer.Add(0xC5);
                        buffer.Add(0xD3);
                        buffer.Add(headIndex);
                        buffer.AddRange(Encoding.ASCII.GetBytes(qrCodeList[i]));
                        if (buffer.Count < (TextLength + 3))
                        {
                            buffer.AddRange(new byte[(TextLength + 3) - buffer.Count]);
                        }
                        ushort value   = (ushort)HeadBoardIndex;
                        uint   bufsize = (uint)buffer.Count;
                        if (CoreInterface.SetEpsonEP0Cmd(0x80, buffer.ToArray(), ref bufsize, value, 0) == 0)
                        {
                            MessageBox.Show(ResString.GetResString("SendCmdError"));
                        }
                        for (int j = 0; j < 50; j++)
                        {
                            if (feedBack)
                            {
                                break;
                            }
                            Thread.Sleep(100);
                        }
                        //while (true)
                        //{
                        //    if (feedBack)
                        //        break;
                        //}
                        this.Invoke(new Action <bool, int>((x, y) =>
                        {
                            LabelTextBox textBox = flowLayoutPanel1.Controls[y] as LabelTextBox;
                            if (textBox != null)
                            {
                                textBox.MsgString = x ? 1 : 0;
                            }
                        }), feedBackData, i);
                    }
                }
            }
            this.Invoke(new Action <bool>(o => panel2.Enabled = o), true);
        }
コード例 #16
0
ファイル: Editor.xaml.cs プロジェクト: p-mercer/Whiteboard
        private void cbSetting_GotFocus(object sender, RoutedEventArgs e)
        {
            try
            {
                var fe = FocusManager.GetFocusedElement(this);
                this._focusedLabel = FocusManager.GetFocusedElement(this) as LabelTextBox;
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
#endif
            }
        }
コード例 #17
0
 public static Size MeasureTextSize(string text, LabelTextBox ob)
 {
     FontFamily fontFamily = ob.txb.FontFamily;
     FontStyle fontStyle = ob.txb.FontStyle;
     FontWeight fontWeight = ob.txb.FontWeight;
     FontStretch fontStretch = ob.txb.FontStretch;
     double fontSize = ob.txb.FontSize;
     FormattedText ft = new FormattedText(text,
                                          CultureInfo.CurrentCulture,
                                          FlowDirection.LeftToRight,
                                          new Typeface(fontFamily, fontStyle, fontWeight, fontStretch),
                                          fontSize,
                                          Brushes.Black);
     return new Size(ft.Width, ft.Height);
 }
コード例 #18
0
ファイル: QRCode.cs プロジェクト: 6555355/Scan_yan1
        private void buttonGetHeadQR_Click(object sender, EventArgs e)
        {
            if (comboBox_HeadBoardIndex.SelectedIndex < 0)
            {
                MessageBox.Show(ResString.GetResString("inputerror"));
                return;
            }
            GetQRCodeFlag = false;
            for (int i = 0; i < HeadNumPerBoard; i++)
            {
                LabelTextBox textBox1 = flowLayoutPanel1.Controls[i] as LabelTextBox;
                LabelTextBox textBox2 = flowLayoutPanel2.Controls[i] as LabelTextBox;
                if (textBox1 != null && textBox2 != null)
                {
                    textBox1.Text             = string.Empty;
                    textBox2.Text             = string.Empty;
                    textBox1.MsgString        = 2;
                    textBox2.MsgString        = 2;
                    textBox1.TextBoxBackColor = SystemColors.Window;
                    textBox2.TextBoxBackColor = SystemColors.Window;
                }
                else
                {
                    //MessageBox.Show(@"Control Is NULL!");
                    return;
                }
            }
            byte[] val = new byte[2];
            val[0] = 0xC5;
            val[1] = 0xE6;
            uint   bufsize = (uint)val.Length;
            ushort value   = (ushort)comboBox_HeadBoardIndex.SelectedIndex;

            if (CoreInterface.SetEpsonEP0Cmd(0x80, val, ref bufsize, value, 0) == 0)
            {
                MessageBox.Show(ResString.GetResString("SendCmdError"));
            }
            else
            {
                panel2.Enabled = false;
            }
            Thread thread = new Thread(GetQRCode_TimeOut)
            {
                IsBackground = true
            };

            thread.Start();
        }
コード例 #19
0
ファイル: DrawingHelper.cs プロジェクト: p-mercer/Whiteboard
        /// <summary>
        /// Изменить цвет контура выделенных объектов
        /// </summary>
        public void ChangeStokeColor()
        {
            if (this._editor.inkBoard == null)
            {
                return;
            }

            //Штрихи

            if (this._editor.inkBoard.GetSelectedStrokes().Count != 0)
            {
                foreach (Stroke item in this._editor.inkBoard.GetSelectedStrokes())
                {
                    item.DrawingAttributes.Color = ((SolidColorBrush)this._editor.cbStrokeColor.SelectedItem).Color;
                }
                this._editor.SaveState();
            }

            //Фигуры

            if (this._editor.inkBoard.GetSelectedElements().Count != 0)
            {
                foreach (UIElement item in this._editor.inkBoard.GetSelectedElements())
                {
                    if (item is Shape)
                    {
                        ((Shape)item).Stroke = (SolidColorBrush)this._editor.cbStrokeColor.SelectedItem;
                    }
                    else if (item is LabelTextBox)
                    {
                        ((LabelTextBox)item).Foreground = (SolidColorBrush)this._editor.cbStrokeColor.SelectedItem;
                    }
                }
                this._editor.SaveState();
            }

            //Надпись (Foreground)

            LabelTextBox focusedLabel = FocusManager.GetFocusedElement(this._editor) as LabelTextBox;

            if (focusedLabel != null)
            {
                focusedLabel.Foreground = (SolidColorBrush)this._editor.cbStrokeColor.SelectedItem;
                this._editor.SaveState();
            }
        }
コード例 #20
0
        /// <summary>
        /// Изменить шрифт выделенным надписям
        /// </summary>
        private void ChangeFontSize()
        {
            foreach (UIElement item in this.inkBoard.GetSelectedElements())
            {
                LabelTextBox element = item as LabelTextBox;
                if (item is LabelTextBox)
                {
                    ((LabelTextBox)item).FontSize = Double.Parse((this.cbFontSize.SelectedItem as ComboBoxItem).Content.ToString());
                }
            }

            foreach (UIElement item in this.inkBoard.Children)
            {
                LabelTextBox element = item as LabelTextBox;
                if (element != null && element.IsFocused)
                {
                    element.FontSize = Double.Parse(((this.cbFontSize as ComboBox).SelectedItem as ComboBoxItem).Content.ToString());
                }
            }
        }
コード例 #21
0
        public UserstatFrm(CEnum.Message_Body[,] val, CSocketEvent m_ClientEvent)
        {
            InitializeComponent();

            PnlDetail.Controls.Clear();

            for (int i = 0; i < val.GetLength(1); i++)
            {
                LabelTextBox mDisplay = new LabelTextBox();
                mDisplay.Parent   = PnlDetail;
                mDisplay.Position = C_Controls.LabelTextBox.LabelTextBox.ELABELPOSITION.LEFT;
                mDisplay.Width    = 222;

                mDisplay.Top  = 20 * i + 30;
                mDisplay.Left = 44;

                mDisplay.LabelText   = m_ClientEvent.DecodeFieldName(val[0, i].eName) + "£º";
                mDisplay.TextBoxText = val[0, i].oContent.ToString();
            }
        }
コード例 #22
0
        /// <summary>
        /// Изменить цвет заливки выделенных объектов
        /// </summary>
        private void ChangeFillColor()
        {
            foreach (UIElement item in this.inkBoard.GetSelectedElements())
            {
                if (item is Rectangle || item is Ellipse)
                {
                    ((Shape)item).Fill = (SolidColorBrush)this.cbFillColor.SelectedItem;
                }
                else if (item is LabelTextBox)
                {
                    ((LabelTextBox)item).Background = (SolidColorBrush)this.cbFillColor.SelectedItem;
                }
            }

            LabelTextBox focusedLabel = FocusManager.GetFocusedElement(this) as LabelTextBox;

            if (focusedLabel != null)
            {
                focusedLabel.Background = (SolidColorBrush)this.cbFillColor.SelectedItem;
            }
        }
コード例 #23
0
        private void cbFont_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.cbFontFamaly.SelectedItem == null)
            {
                return;
            }

            try
            {
                this.ChangeSelectedShape(sender);
                if (this._focusedLabel != null)
                {
                    this._focusedLabel.Focus();
                    this._focusedLabel = null;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show(ex.Message, "Изменение шрифта", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
コード例 #24
0
        private void cbFillColor_ColorChanged(object sender, RoutedEventArgs e)
        {
            if (this.cbFillColor.SelectedItem == null)
            {
                return;
            }

            try
            {
                this.ChangeSelectedShape(sender);

                if (this._focusedLabel != null)
                {
                    this._focusedLabel.Focus();
                    this._focusedLabel = null;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show(ex.Message, "Изменение цвета заливки", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
コード例 #25
0
        /// <summary>
        /// Изменить размер шрифта выделенным надписям
        /// </summary>
        private void ChangeFontFamily()
        {
            if (this.inkBoard == null)
            {
                return;
            }
            foreach (UIElement item in this.inkBoard.GetSelectedElements())
            {
                if (item is LabelTextBox)
                {
                    ((LabelTextBox)item).FontFamily = (FontFamily)this.cbFontFamaly.SelectedItem;
                }
            }

            foreach (UIElement item in this.inkBoard.Children)
            {
                LabelTextBox element = item as LabelTextBox;
                if (element != null && element.IsFocused)
                {
                    element.FontFamily = (FontFamily)this.cbFontFamaly.SelectedItem;
                }
            }
        }
コード例 #26
0
        public UserstatFrm(CEnum.Message_Body[,] val, CSocketEvent m_ClientEvent)
        {
            InitializeComponent();
            ConfigValue config = (ConfigValue)m_ClientEvent.GetInfo("INI");

            this.Text = config.ReadConfigValue("MAUDITION", "UF_UI_UserstatFrm");
            PnlDetail.Controls.Clear();

            for (int i = 0; i < val.GetLength(1); i++)
            {
                LabelTextBox mDisplay = new LabelTextBox();
                mDisplay.Parent   = PnlDetail;
                mDisplay.Position = C_Controls.LabelTextBox.LabelTextBox.ELABELPOSITION.LEFT;
                mDisplay.Width    = 222;

                mDisplay.Top  = 20 * i + 30;
                mDisplay.Left = 44;

                mDisplay.LabelText = config.ReadConfigValue("GLOBAL", val[0, i].eName.ToString()) + "£º";
                //mDisplay.LabelText = m_ClientEvent.DecodeFieldName(val[0, i].eName) + "£º";
                mDisplay.TextBoxText = val[0, i].oContent.ToString();
            }
        }
コード例 #27
0
        private void EES_nonbase_ref_aisle_PreviewKeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (objSlotDba == null)
                {
                    objSlotDba = new SlotDba();
                }
                string       sourceName = null;
                string       EESName    = null;
                string       textValue;
                int          number     = 0;
                LabelTextBox objTextBox = sender as LabelTextBox;

                sourceName = objTextBox.Name;
                EESName    = sourceName.Split('_')[0];
                if (int.TryParse(objTextBox.text1.Text, out number))
                {
                    objSlotDba.SetCustomizedNonBaseRefAisle(EESName, number);
                }
                objTextBox.text1.Text = objSlotDba.GetCustomizedNonBaseRefAisle(EESName).ToString();
            }
        }
コード例 #28
0
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.TimerTextBox = (TextBox)target;
                break;

            case 2:
                this.ProjectNameBox = (TextBox)target;
                break;

            case 3:
                this.StartTimerBtn = (Button)target;
                break;

            case 4:
                this.SpreadSheetID = (LabelTextBox)target;
                break;

            case 5:
                this.EditArea = (LabelTextBox)target;
                break;

            case 6:
                this.SaveGoogleBtn = (Button)target;
                break;

            case 7:
                this.LoadGoogleBtn = (Button)target;
                break;

            default:
                this._contentLoaded = true;
                break;
            }
        }
コード例 #29
0
        private void labelText_PreviewKeyUp(object sender, KeyEventArgs e)
        {
            LabelTextBox objTextBox = sender as LabelTextBox;


            if (e.Key == Key.Enter)
            {
                if (objPVLDba == null)
                {
                    objPVLDba = new PVLDba();
                }
                string sourceName  = null;
                string machineCode = null;
                bool   isMin       = false;
                int    window      = 0;
                string textValue;
                sourceName  = objTextBox.sourceName;
                machineCode = sourceName.Split(':')[0];
                isMin       = sourceName.Split(':')[1] == "MIN";
                textValue   = objTextBox.text1.Text;
                if (int.TryParse(textValue, out window))
                {
                    if (isMin)
                    {
                        objPVLDba.SetPVLMinSlotRange(machineCode, window);
                        window = objPVLDba.GetPVLMinSlotRange(machineCode);
                    }
                    else
                    {
                        objPVLDba.SetPVLMaxSlotRange(machineCode, window);
                        window = objPVLDba.GetPVLMaxSlotRange(machineCode);
                    }
                    objTextBox.text1.Text = window.ToString();
                }
            }
        }
コード例 #30
0
        private void enterButton_Click(object sender, EventArgs e)
        {
            string message = "Shipping Label Created";
            string title   = "Shipping Label Message";

            MessageBox.Show(message, title);

            // info about sender
            String NameS      = NameTextBox1.Text;
            String StreetS    = StreetTextBox1.Text;
            String CityNameS  = CityTextBox1.Text;
            String StateNameS = StateComboBox1.Text;
            String ZIPCodeS   = ZIPTextBox1.Text;

            NameS     = NameS.Trim();
            StreetS   = StreetS.Trim();
            CityNameS = CityNameS.Trim();

            LabelTextBox.Clear();
            LabelTextBox.AppendText(NameS + Environment.NewLine + StreetS + Environment.NewLine + CityNameS + ", " + StateNameS + " " + ZIPCodeS);

            // info about receiver
            String NameR      = NameTextBox2.Text;
            String StreetR    = StreetTextBox2.Text;
            String CityNameR  = CityTextBox2.Text;
            String StateNameR = StateComboBox2.Text;
            String ZIPCodeR   = ZIPTextBox2.Text;

            NameR     = NameR.Trim();
            StreetR   = StreetR.Trim();
            CityNameR = CityNameR.Trim();

            LabelTextBox.AppendText(Environment.NewLine + Environment.NewLine + "                                                           " +
                                    NameR + Environment.NewLine + "                                                           " + StreetR + Environment.NewLine +
                                    "                                                           " + CityNameR + ", " + StateNameR + " " + ZIPCodeR);
        }
コード例 #31
0
        private void ReadInfo()
        {
            mResult = null;

            CEnum.Message_Body[] mContent = new CEnum.Message_Body[3];

            mContent[0].eName    = CEnum.TagName.CARD_username;
            mContent[0].eTag     = CEnum.TagFormat.TLV_STRING;
            mContent[0].oContent = TxtID.Text;

            mContent[1].eName    = CEnum.TagName.CARD_nickname;
            mContent[1].eTag     = CEnum.TagFormat.TLV_STRING;
            mContent[1].oContent = TxtUser.Text;

            mContent[2].eName    = CEnum.TagName.CARD_ActionType;
            mContent[2].eTag     = CEnum.TagFormat.TLV_INTEGER;
            mContent[2].oContent = 1;

            lock (typeof(C_Event.CSocketEvent))
            {
                mResult = Operation_Card.GetResult(this.m_ClientEvent, CEnum.ServiceKey.CARD_USERINFO_QUERY, mContent);
            }

            if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg)
            {
                MessageBox.Show(mResult[0, 0].oContent.ToString());
                return;
            }

            TxtID.Enabled   = false;
            TxtUser.Enabled = false;

            btnRestIDCode.Enabled = true;
            btnResetV.Enabled     = true;

            this.buttonSaveAS.Enabled = true;
            //LabelTextBox[] lblTextBoxArray = new LabelTextBox[mResult.GetLength(1)];
            Operation_Card.SaveTxt(config, mResult, this.Name, "GLOBAL");
            for (int i = 0; i < mResult.GetLength(1); i++)
            {
                LabelTextBox mDisplay = new LabelTextBox(false);
                //lblTextBoxArray[0] = mDisplay;

                mDisplay.Parent   = PnlResult;
                mDisplay.Position = C_Controls.LabelTextBox.LabelTextBox.ELABELPOSITION.LEFT;
                mDisplay.Width    = 222;

                //mDisplay.Visible = false;

                if (i % 2 == 0)
                {
                    mDisplay.Top  = 20 * i + 30;
                    mDisplay.Left = 44;
                }
                else
                {
                    mDisplay.Top  = 20 * (i - 1) + 30;
                    mDisplay.Left = mDisplay.Width + 111;
                }

                mDisplay.LabelText = config.ReadConfigValue("GLOBAL", mResult[0, i].eName.ToString()) + ":";
                // mDisplay.LabelText = this.m_ClientEvent.DecodeFieldName(mResult[0, i].eName) + ":";
                mDisplay.TextBoxText = mResult[0, i].oContent.ToString();

                EnableBtnControl();
            }

            /*
             * for (int i = 0; i < lblTextBoxArray.Length; i++)
             * {
             *  lblTextBoxArray[i].IsVisable = true;
             * }
             */
            //foreach (Control m in PnlResult.Controls.Find("LabelTextBox", true))
            //{
            //m.Visible = true;
            //}


            PnlResult.Visible = true;

            for (int i = 0; i < PnlResult.Controls.Count; i++)
            {
                if (PnlResult.Controls[i].GetType() == typeof(LabelTextBox))
                {
                    LabelTextBox mControls = (LabelTextBox)PnlResult.Controls[i];
                    mControls.ReadOnly  = true;
                    mControls.IsVisable = true;
                }
            }
        }
コード例 #32
0
        private void createBlock(int row, int col, int blockWidth, int blockHeight)
        {
            int numberOfBlocksLabel;
            int numberOfBlocksBox;
            LabelTextBox ltb = new LabelTextBox();

            ltb.txb.Text = "Label";

            ltb.Block_Row = row;
            ltb.Block_Col = col;
            ltb.Id = System.DateTime.Now.Millisecond.ToString();

            Size s = MeasureTextSize(ltb.txb.Text, ltb);
            numberOfBlocksLabel = (int)Math.Ceiling((double)(Math.Ceiling(s.Width) / WIDTH));
            numberOfBlocksBox = blockWidth - numberOfBlocksLabel;

            ltb.Width = blockWidth * WIDTH;
            ltb.Height = blockHeight * HEIGHT;

            ltb.txb.Width = WIDTH * numberOfBlocksLabel;
            ltb.txb.Height = HEIGHT * blockHeight;

            ltb.txt.Width = WIDTH * numberOfBlocksBox;
            ltb.txt.Height = HEIGHT * blockHeight;

            ltb.txt.BorderBrush = Brushes.Red;
            ltb.txt.BorderThickness = new Thickness(2, 2, 2, 2);

            ltb.txt.TextChanged += block_Text_Change;
            ltb.PreviewKeyDown += select_Input_Block;

            Grid.SetRow(ltb, row);
            Grid.SetColumn(ltb, col - numberOfBlocksLabel);
            Grid.SetColumnSpan(ltb, ((int)(ltb.Width) / WIDTH));
            Grid.SetRowSpan(ltb, ((int)(ltb.Height) / HEIGHT));
            myGrid.Children.Add(ltb);

            daElement = new DrawAreaUiElement(ltb.Id, "INPUT_BLOCK", ltb.Block_Row.ToString(), ltb.Block_Col.ToString(), "BLOCK", "TOKEN", "", "#TARGET", "#SOURCE", "", ltb.txt.Width.ToString(), "12", ltb.txt.Height.ToString());
            daList.addUIElementToUIElementList(daElement);
            DrawToJSON.DrawAreaToJSON(daList.UIL);
        }
コード例 #33
0
 private void block_Text_Change(object sender, RoutedEventArgs e)
 {
     LabelTextBox ltb = new LabelTextBox();
     ltb.txt = (TextBox)sender;
     ltb.txb.Text = ltb.txt.Text;
 }
コード例 #34
0
ファイル: MainWindow.xaml.cs プロジェクト: Dr1N/Whiteboard
        private void cbStrokeColor_ColorChanged(object sender, RoutedEventArgs e)
        {
            if (this.cbStrokeColor.SelectedItem == null) { return; }

            try
            {
                //Цвет заметок

                if (this.inkBoard.EditingMode == InkCanvasEditingMode.Ink)
                {
                    this.inkBoard.DefaultDrawingAttributes.Color = ((SolidColorBrush)this.cbStrokeColor.SelectedItem).Color;
                }

                //Изменить выделенные фигуры

                this.ChangeSelectedShape(sender);

                //Вернуть фокус полю ввода надписи

                if (this._focusedLabel != null)
                {
                    this._focusedLabel.Focus();
                    this._focusedLabel = null;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show(ex.Message, "Изменение цвета контура", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
コード例 #35
0
ファイル: MainWindow.xaml.cs プロジェクト: Dr1N/Whiteboard
        private void cbFillColor_ColorChanged(object sender, RoutedEventArgs e)
        {
            if (this.cbFillColor.SelectedItem == null) { return; }

            try
            {
                this.ChangeSelectedShape(sender);

                if (this._focusedLabel != null)
                {
                    this._focusedLabel.Focus();
                    this._focusedLabel = null;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show(ex.Message, "Изменение цвета заливки", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
コード例 #36
0
ファイル: MainWindow.xaml.cs プロジェクト: Dr1N/Whiteboard
        private void cbFont_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.cbFontFamaly.SelectedItem == null) { return; }

            try
            {
                this.ChangeSelectedShape(sender);
                if (this._focusedLabel != null)
                {
                    this._focusedLabel.Focus();
                    this._focusedLabel = null;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show(ex.Message, "Изменение шрифта", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
コード例 #37
0
ファイル: MainWindow.xaml.cs プロジェクト: Dr1N/Whiteboard
 private void cbSetting_GotFocus(object sender, RoutedEventArgs e)
 {
     var fe = FocusManager.GetFocusedElement(this);
     this._focusedLabel = FocusManager.GetFocusedElement(this) as LabelTextBox;
 }
コード例 #38
0
ファイル: MainWindow.xaml.cs プロジェクト: Dr1N/Whiteboard
 /// <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);
         }
     };
 }