private void Window_Loaded(object sender, RoutedEventArgs e) { System.Windows.Data.CollectionViewSource cableTypeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("cableTypeViewSource"))); cableTypeViewSource.Source = MainWindow.activeProject.CableTypes; List <string> results = new List <string>(); results.Add("Tak"); results.Add("Nie"); ResultComboBox.ItemsSource = results; SourceTextBox.Text = mesurement.Source; DestinationTextBox.Text = mesurement.Destination; WireTextBox.Text = mesurement.NumberOfWire.ToString(); DistanceTextBox.Text = mesurement.Distance.ToString(); PigCountTextBox.Text = mesurement.CountOfPig.ToString(); WeldCountTextBox.Text = mesurement.CountOfWeld.ToString(); MesurementTextBox.Text = mesurement.RealAttenuation.ToString(); CabletypeCombo.SelectedItem = mesurement.Type; ManuallyResultCheckBox.IsChecked = mesurement.IsPropperValueManuallySet; if (mesurement.IsPropperValueManuallySet) { ResultComboBox.SelectedIndex = mesurement.PropperValue == true ? 0 : 1; } SourceTextBox.Focus(); }
public void SourceTextBox_KeyPress(object sender, KeyPressEventArgs e) { try { if (InHouseRadioButton.Checked) { if ((e.KeyChar >= 48 && e.KeyChar <= 57) || e.KeyChar == 8) { e.Handled = false; } else { MessageBox.Show("Please enter a number.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); SourceTextBox.Clear(); e.Handled = true; } } else { if (e.Handled = !(char.IsLetter(e.KeyChar) || e.KeyChar == (char)Keys.Back || e.KeyChar == (char)Keys.Space)) { e.Handled = true; base.OnKeyPress(e); MessageBox.Show("Please enter a Letter.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); SourceTextBox.Clear(); } } } catch (Exception) { MessageBox.Show("Incorrect datatype for part source.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
public SourceGherkinPage(BusinessFlow BizFlow) { InitializeComponent(); mBusinessFlow = BizFlow; SourceTextBox.BindControl(mBusinessFlow, nameof(BusinessFlow.Source), System.Windows.Data.BindingMode.OneWay); ExternalIDTextBox.BindControl(mBusinessFlow, nameof(BusinessFlow.ExternalID), System.Windows.Data.BindingMode.OneWay); }
private void SourceText_Changed(object sender, TextChangedEventArgs e) { if (SourceTextBox.Decorations.Count != 0) { SourceTextBox.Decorations.Clear(); SourceTextBox.InvalidateVisual(); } _nextRescanTime = DateTime.Now + TimeSpan.FromSeconds(1.0); _modified = true; }
private void Window_Loaded(object sender, RoutedEventArgs e) { System.Windows.Data.CollectionViewSource cableTypeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("cableTypeViewSource"))); cableTypeViewSource.Source = MainWindow.activeProject.CableTypes; List <string> results = new List <string>(); results.Add("Tak"); results.Add("Nie"); ResultComboBox.ItemsSource = results; SourceTextBox.Focus(); }
private void ViewSourceLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (ViewSourceLinkLabel.Text == "View Source") { ViewSourceLinkLabel.Text = "Normal View"; SourceTextBox.BringToFront(); } else if (ViewSourceLinkLabel.Text == "Normal View") { ViewSourceLinkLabel.Text = "View Source"; SourceTextBox.SendToBack(); } }
private void Clear_Click(object sender, RoutedEventArgs e) { string cmd = (sender as Button).CommandParameter.ToString(); switch (cmd) { case "ClearInput": { SourceTextBox.Clear(); } break; case "ClearResult": { ResultTextBox.Clear(); } break; default: break; } }
private void SelectSourceButton_Click(object sender, EventArgs e) { using (var op = new OpenFileDialog { Filter = Consts.FirmwareFilter }) { if (op.ShowDialog() != DialogResult.OK) { return; } m_sourceFileName = op.FileName; m_source = File.ReadAllBytes(m_sourceFileName); m_sourceEncrypted = m_loader.IsFirmwareEncrypted(m_source); SourceGroupBox.Text = string.Format("Source: ({0})", m_sourceEncrypted ? Consts.Encrypted : Consts.Decrypted); DestinationGroupBox.Text = string.Format("Destination: ({0})", !m_sourceEncrypted ? Consts.Encrypted : Consts.Decrypted); DestinationTextBox.Text = string.Empty; EncryptDecryptButton.Text = !m_sourceEncrypted ? "Encrypt" : "Decrypt"; SourceTextBox.Text = m_sourceFileName; SourceTextBox.ScrollToEnd(); SelectDestinationButton.Enabled = true; } }
private void EditRuleView_OnLoaded(object sender, RoutedEventArgs e) { SourceTextBox.Focus(); }
private void OutsourcedRadioButton_CheckedChanged(object sender, EventArgs e) { CompanyMachineToggle.Text = "Company Name"; IsOutsourced = true; SourceTextBox.Clear(); }
private void InHouseRadioButton_CheckedChanged(object sender, EventArgs e) { CompanyMachineToggle.Text = "Machine ID"; IsOutsourced = false; SourceTextBox.Clear(); }
private void SelectSourceButton_Click(object sender, EventArgs e) { string fileName; using (var op = new OpenFileDialog { Filter = Consts.BitmapImportFilter }) { if (op.ShowDialog() != DialogResult.OK) { return; } fileName = op.FileName; } try { if (m_originalBitmap != null) { m_originalBitmap.Dispose(); } m_originalBitmap = BitmapProcessor.LoadBitmapFromFile(fileName); if (m_originalBitmap.Width > 2048 || m_originalBitmap.Height > 2048) { if (m_monochromeBitmap != null) { m_monochromeBitmap.Dispose(); m_monochromeBitmap = null; } SourceTextBox.Clear(); ResizeContainerPanel.Enabled = false; ConversionContainerPanel.Enabled = false; m_doNotUpdateMonochrome = true; NewWidthUpDown.Value = m_width = (int)NewWidthUpDown.Minimum; NewHeightUpDown.Value = m_height = (int)NewHeightUpDown.Minimum; m_doNotUpdateMonochrome = false; ImagePreviewSurface.Invalidate(); OkButton.Enabled = false; InfoBox.Show("Selected images is too big. Choose an image that has dimension lower than 2048x2048."); } else { SourceTextBox.Text = fileName; ConversionContainerPanel.Enabled = true; if (m_importMode) { NewWidthUpDown.Value = m_width = m_desireWidth; NewHeightUpDown.Value = m_height = m_desireHeight; } else { ResizeContainerPanel.Enabled = true; m_doNotUpdateMonochrome = true; NewWidthUpDown.Value = m_width = m_originalBitmap.Width; NewHeightUpDown.Value = m_height = m_originalBitmap.Height; m_doNotUpdateMonochrome = false; } CreateMonochromeBitmap(); ImagePreviewSurface.Invalidate(); OkButton.Enabled = true; } } catch (Exception ex) { InfoBox.Show("An error occured during opening image file!\n" + ex.Message); } }
private void SourceTextBox_MouseDown(object sender, MouseEventArgs e) { SourceTextBox.DoDragDrop(SourceTextBox.Text, DragDropEffects.Move); SourceTextBox.Clear(); }
public void TextractorHookContent(string[] Item) { SourceTextBox.BeginInvoke(new Action(() => { SourceTextBox.Text = Item[3]; })); }
private void PresentColoredTokens(IEnumerable <Token> tokens, IEnumerable <Error> errors) { SourceTextBox.Decorations.Clear(); SourceTextBox.InvalidateVisual(); foreach (var token in tokens) { if (_colorMap.ContainsKey(token.Type)) { ExplicitDecoration ed = new ExplicitDecoration(); ed.Start = token.Position.Value.Offset; ed.Length = token.Value.Length; ed.Brush = _colorMap[token.Type]; ed.DecorationType = EDecorationType.TextColor; SourceTextBox.Decorations.Add(ed); } } foreach (var error in errors) { if (error.Token != null) { if (error.Kind == ErrorKind.Syntax) { ExplicitDecoration ed = new ExplicitDecoration(); ExplicitDecoration ed2 = new ExplicitDecoration(); ed.Start = ed2.Start = error.Token.Position.Value.Offset; ed.Length = ed2.Length = error.Token.Value.Length; ed.DecorationType = EDecorationType.Hilight; ed.Brush = new SolidColorBrush(Color.FromArgb(200, 255, 0, 0)); ed2.DecorationType = EDecorationType.TextColor; ed2.Brush = new SolidColorBrush(Colors.White); SourceTextBox.Decorations.Add(ed); SourceTextBox.Decorations.Add(ed2); } else if (error.Kind == ErrorKind.Lexical) { ExplicitDecoration ed = new ExplicitDecoration(); ed.Start = error.Token.Position.Value.Offset; ed.Length = error.Token.Value.Length; ed.DecorationType = EDecorationType.Underline; ed.Brush = Brushes.Red; SourceTextBox.Decorations.Add(ed); } else if (error.Kind == ErrorKind.Semantic) { ExplicitDecoration ed = new ExplicitDecoration(); ed.Start = error.Token.Position.Value.Offset; ed.Length = error.Token.Value.Length; ed.DecorationType = EDecorationType.Hilight; ed.Brush = new SolidColorBrush(Color.FromArgb(200, 0, 255, 0)); SourceTextBox.Decorations.Add(ed); } } } SourceTextBox.InvalidateVisual(); }