コード例 #1
36
ファイル: NumberBox.cs プロジェクト: TheAngryByrd/MetroPass
 /*
  * The default constructor
  */
 public NumberBox()
 {
     this.InputScope = new InputScope();
     this.InputScope.Names.Add(new InputScopeName(InputScopeNameValue.Number));
     TextChanged += new TextChangedEventHandler(OnTextChanged);
     KeyDown += new KeyEventHandler(OnKeyDown);
 }
コード例 #2
0
        private static void OnWatermarkTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var tb = d as TextBox;

            if (tb != null)
            {
                var textChangedHandler  = new TextChangedEventHandler((s, ea) => ShowOrHideWatermark(s as TextBox));
                var focusChangedHandler = new DependencyPropertyChangedEventHandler((s, ea) => ShowOrHideWatermark(s as TextBox));
                var sizeChangedHandler  = new SizeChangedEventHandler((s, ea) => ShowOrHideWatermark(s as TextBox));

                if (string.IsNullOrEmpty(e.OldValue as string))
                {
                    tb.TextChanged += textChangedHandler;
                    tb.IsKeyboardFocusedChanged += focusChangedHandler;
                    // We need SizeChanged events because the Background brush is sized according to the control size
                    tb.SizeChanged += sizeChangedHandler;
                }

                if (string.IsNullOrEmpty(e.NewValue as string))
                {
                    tb.TextChanged -= textChangedHandler;
                    tb.IsKeyboardFocusedChanged -= focusChangedHandler;
                    tb.SizeChanged -= sizeChangedHandler;
                }

                ShowOrHideWatermark(tb);
            }
        }
コード例 #3
0
        /// <summary>
        /// Property changing logic.
        /// </summary>
        /// <param name="dependencyObject"><see cref="DependencyObject"/> which has attached property.</param>
        /// <param name="e">Property changed event arguments.</param>
        private static void OnAlwaysScrollToEndChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            // Get TextBox instance
            var textBox = dependencyObject as TextBox;

            // Get new property value
            var newValue = (bool) e.NewValue;

            // Check above values for sanity
            if (textBox == null || (bool) e.OldValue == newValue)
            {
                return;
            }

            // Create event handler which scrolls to end event sender
            TextChangedEventHandler handler = (sender, args) =>
                ((TextBox) sender).ScrollToEnd();

            // If AlwaysScrollToEnd is true - attach handler, otherwise detach handler
            if (newValue)
            {
                textBox.TextChanged += handler;
            }
            else
            {
                textBox.TextChanged -= handler;
            }
        }
コード例 #4
0
 public static void CreateControlAndAddToGrid(
     Grid grid,
     ControlType eControlType,
     object tagValue,
     string caption,
     int row,
     int column,
     int width,
     int height,
     string tooltip,
     Thickness margin,
     RoutedEventHandler clickEventHandler,
     TextChangedEventHandler textChangedEventHandler
     )
 {
     CreateControlAndAddToGrid(
         grid,
         eControlType,
         tagValue,
         caption,
         new List <string>(),
         row,
         column,
         width,
         height,
         tooltip,
         margin,
         clickEventHandler,
         textChangedEventHandler
         );
 }
コード例 #5
0
        private static void OnWatermarkTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var tb = d as TextBox;

            if (tb != null)
            {
                var textChangedHandler  = new TextChangedEventHandler((s, ea) => ShowOrHideWatermark(s as TextBox));
                var focusChangedHandler = new DependencyPropertyChangedEventHandler((s, ea) => ShowOrHideWatermark(s as TextBox));
                var sizeChangedHandler  = new SizeChangedEventHandler((s, ea) => ShowOrHideWatermark(s as TextBox));

                if (string.IsNullOrEmpty(e.OldValue as string))
                {
                    tb.TextChanged += textChangedHandler;
                    tb.IsKeyboardFocusedChanged += focusChangedHandler;
                    // subscribe to SizeChanged events in substitution for FontSize change events
                    tb.SizeChanged += sizeChangedHandler;
                }

                if (string.IsNullOrEmpty(e.NewValue as string))
                {
                    tb.TextChanged -= textChangedHandler;
                    tb.IsKeyboardFocusedChanged -= focusChangedHandler;
                    tb.SizeChanged -= sizeChangedHandler;
                }

                ShowOrHideWatermark(tb);
            }
        }
コード例 #6
0
        public static RichTextBox CreateRichTextBox(RoutedEventHandler contextMenuEventHandler_Click,
                                                    DragEventHandler richTextBoxEventHandler_DragOver,
                                                    DragEventHandler richTextBoxEventHandler_DragDrop,
                                                    TextChangedEventHandler richTextBoxEventHandler_OnTextChange
                                                    )
        {
            //---------------- Создание контекстного меню
            ContextMenu contextMenu = new ContextMenu();
            MenuItem    item        = new MenuItem {
                Header = "Close"
            };

            item.Click += contextMenuEventHandler_Click;
            contextMenu.Items.Add(item);
            //----------------
            //---------------- Создание пустого rich text box
            RichTextBox richTextBox = new RichTextBox()
            {
                Name = "tmpRichText",
            };

            //----------------
            //---------------- Задание drag and drop
            richTextBox.AllowDrop = true;
            richTextBox.AddHandler(RichTextBox.DragOverEvent, richTextBoxEventHandler_DragOver, true);
            richTextBox.AddHandler(RichTextBox.DropEvent, richTextBoxEventHandler_DragDrop, true);
            //----------------
            //---------------- Назначение контекстного меню/ прокрутки
            richTextBox.ContextMenu = contextMenu;
            richTextBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            richTextBox.TextChanged += richTextBoxEventHandler_OnTextChange;

            return(richTextBox);
        }
コード例 #7
0
        /// <summary>
        /// Translates WPF control events into an observable source.
        /// </summary>
        /// <returns></returns>
        IObservable <ThresholdConfiguration> CreateConfigurationObservable()
        {
            return(Utility.CreateObservable <ThresholdConfiguration>(observer =>
            {
                // immediately output last read configuration to seed the configuration
                // stream
                Dispatcher.Invoke((Func <ThresholdConfiguration>)GetConfiguration);
                observer.OnNext(_configuration);

                // whenever the user modifies the threshold or duration, output
                // a new event
                RoutedPropertyChangedEventHandler <double> thresholdAction = (sender, args) =>
                                                                             observer.OnNext(GetConfiguration());
                TextChangedEventHandler durationAction = (sender, args) =>
                                                         observer.OnNext(GetConfiguration());
                _thresholdSlider.ValueChanged += thresholdAction;
                _durationTextBox.TextChanged += durationAction;

                // when the subscription is disposed, remove event delegates as well
                return Utility.CreateDisposable(() =>
                {
                    _thresholdSlider.ValueChanged -= thresholdAction;
                    _durationTextBox.TextChanged -= durationAction;
                });
            }));
        }
コード例 #8
0
ファイル: TextBoxUtil.cs プロジェクト: leontius/Ragnarok
        private static void OnAutoHorizontalScrollToEndChanged(DependencyObject s, DependencyPropertyChangedEventArgs e)
        {
            var textBox = s as TextBox;

            var handler = new TextChangedEventHandler(
                (s1, e1) =>
            {
                // キャレット位置を最後にします。
                textBox.CaretIndex = int.MaxValue;

                // GetRectFromCharacterIndexは表示中の文字位置を
                // 取得しますが、ScrollToHorizontalOffsetは
                // 文字位置0基準とした座標系で値を設定します。
                // このため、基準位置をずらして値を設定しています。
                var rect     = textBox.GetRectFromCharacterIndex(textBox.CaretIndex);
                var position = textBox.HorizontalOffset + rect.Right;
                textBox.ScrollToHorizontalOffset(Math.Max(0.0, position));
            });

            if ((bool)e.NewValue)
            {
                textBox.TextChanged += handler;
            }
            else
            {
                textBox.TextChanged -= handler;
            }
        }
コード例 #9
0
        private static void OnWatermarkTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var tb = d as TextBox;

            if (tb != null)
            {
                var textChangedHandler  = new TextChangedEventHandler((s, ea) => ShowOrHideWatermark(s as TextBox));
                var focusChangedHandler = new DependencyPropertyChangedEventHandler((s, ea) => ShowOrHideWatermark(s as TextBox));
                var sizeChangedHandler  = new SizeChangedEventHandler((s, ea) => ShowOrHideWatermark(s as TextBox));

                if (e.OldValue == null)
                {
                    tb.TextChanged += textChangedHandler;
                    tb.IsKeyboardFocusedChanged += focusChangedHandler;
                    tb.SizeChanged += sizeChangedHandler;
                }

                if (e.NewValue == null)
                {
                    tb.TextChanged -= textChangedHandler;
                    tb.IsKeyboardFocusedChanged -= focusChangedHandler;
                    tb.SizeChanged -= sizeChangedHandler;
                }

                ShowOrHideWatermark(tb);
            }
        }
コード例 #10
0
        private void Show(string title, Func <string, string, object> computation)
        {
            // create controls to show result
            var rowColor = Rows.Children.Count % 2 == 0 ? Color.FromArgb(0, 0, 0, 0) : Color.FromArgb(25, 0, 0, 0);
            var rowStack = new StackPanel {
                Orientation = Orientation.Horizontal, Background = new SolidColorBrush(rowColor)
            };
            var titleBlock = new TextBlock {
                Width = 300, Text = title
            };
            var valueBlock = new TextBlock();

            rowStack.Children.Add(titleBlock);
            rowStack.Children.Add(valueBlock);
            Rows.Children.Add(rowStack);

            // show initial value
            Action update = () => valueBlock.Text = "" + computation(txtA.Text, txtB.Text);

            update();

            // recompute when text changes
            TextChangedEventHandler h = (sender, arg) => update();

            txtA.TextChanged += h;
            txtB.TextChanged += h;
        }
コード例 #11
0
            public TextBox CreateNameBox(TextChangedEventHandler onTextChanged)
            {
                var nameBox = _template.CreateNameBox(_query.Name, _query.NameBoxName);

                nameBox.TextChanged += onTextChanged;
                return(nameBox);
            }
コード例 #12
0
        public DoubleTextBox()
        {
            CommandBinding CutCommandBinding = new CommandBinding(ApplicationCommands.Cut);

            CutCommandBinding.CanExecute += new CanExecuteRoutedEventHandler(CutCommandBinding_CanExecute);
            CutCommandBinding.Executed   += new ExecutedRoutedEventHandler(CutCommandBinding_Executed);

            CommandBinding CopyCommandBinding = new CommandBinding(ApplicationCommands.Copy);

            CopyCommandBinding.Executed   += new ExecutedRoutedEventHandler(CopyCommandBinding_Executed);
            CopyCommandBinding.CanExecute += new CanExecuteRoutedEventHandler(CopyCommandBinding_CanExecute);

            CommandBinding PasteCommandBinding = new CommandBinding(ApplicationCommands.Paste);

            PasteCommandBinding.Executed   += new ExecutedRoutedEventHandler(PasteCommandBinding_Executed);
            PasteCommandBinding.CanExecute += new CanExecuteRoutedEventHandler(PasteCommandBinding_CanExecute);

            CommandBindings.Add(CutCommandBinding);
            CommandBindings.Add(CopyCommandBinding);
            CommandBindings.Add(PasteCommandBinding);

            TextChanged      += new TextChangedEventHandler(DoubleTextBox_TextChanged);
            PreviewKeyDown   += new KeyEventHandler(DoubleTextBox_PreviewKeyDown);
            PreviewTextInput += new TextCompositionEventHandler(DoubleTextBox_PreviewTextInput);
            MouseDoubleClick += new MouseButtonEventHandler(DoubleTextBox_MouseDoubleClick);

            LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DoubleTextBox_LostKeyboardFocus);
            OnNewDependencyPropertyChanged();
        }
コード例 #13
0
 public TextBoxEx()
 {
     GotFocus         += TextBoxEx_GotFocus;
     LostFocus        += TextBoxEx_LostFocus;
     PreviewTextInput += TextBoxEx_PreviewTextInput;
     TextChanged      += new TextChangedEventHandler(TextBoxEx_OnTextChanged);
 }
コード例 #14
0
        /// <summary>
        /// Erzeugt einen DelayedEventHandler mit der angegebenen Zeitspanne in Millisekunden.
        /// </summary>
        /// <param name="delayInMilliseconds">Das Delay in Millisekunden, mit dem...</param>
        /// <param name="handler">...der gewünscht Handler aufgerufen wird.</param>
        public DelayedEventHandler(int delayInMilliseconds, TextChangedEventHandler handler)
        {
            timer = new Timer
            {
                Enabled  = false,
                Interval = delayInMilliseconds
            };
            timer.Elapsed += new ElapsedEventHandler((s, e) =>
            {
                timer.Stop();

                if (handler != null)
                {
                    handler(this.forwardSender, this.forwardArgs);
                }
            });

            this.handler = handler;

            Delayed = new TextChangedEventHandler((sender, e) =>
            {
                this.forwardSender = sender;
                this.forwardArgs   = e;

                timer.Stop();
                timer.Start();
            });
        }
コード例 #15
0
        public UiEncodingLabeledWatermark(string label, string watermark, int width, TextChangedEventHandler onValueChanged)
        {
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            ColumnDefinitions.Add(new ColumnDefinition());

            Margin = new Thickness(5);

            UiTextBlock labelControl = UiTextBlockFactory.Create(label);

            {
                labelControl.Margin            = new Thickness(5, 5, 2, 5);
                labelControl.VerticalAlignment = VerticalAlignment.Center;
                AddUiElement(labelControl, 0, 0);
            }

            _textControl = UiWatermarkTextBoxFactory.Create(watermark);
            {
                _textControl.Width        = width;
                _textControl.Margin       = new Thickness(2, 5, 5, 5);
                _textControl.TextChanged += onValueChanged;
                AddUiElement(_textControl, 0, 1);
            }
        }
コード例 #16
0
ファイル: TextBoxNum.cs プロジェクト: hugoestr/calculr_waves
        /*
         * The default constructor
         */
        public TextBoxNum()
        {
            VerticalContentAlignment = System.Windows.VerticalAlignment.Center;

            TextChanged += new TextChangedEventHandler(OnTextChanged);
            KeyDown += new KeyEventHandler(OnKeyDown);
        }
コード例 #17
0
 private void reload()
 {
     this.wrapPanel.Children.Clear();
     if (!Directory.Exists(MainWindow.folder))
     {
         MainWindow.folder = Directory.GetCurrentDirectory() + "\\db";
         Directory.CreateDirectory(MainWindow.folder);
     }
     foreach (FileInfo fileInfo in ((IEnumerable <FileInfo>) new DirectoryInfo(MainWindow.folder).GetFiles("*.*", SearchOption.AllDirectories)).OrderBy <FileInfo, DateTime>((Func <FileInfo, DateTime>)(t => t.CreationTime)).ToList <FileInfo>())
     {
         FileInfo item = fileInfo;
         string   str  = File.ReadAllText(item.FullName);
         var      data = readFromDb(item.FullName);
         if (data == null || data.Text.Length == 0)
         {
             File.Delete(item.FullName);
         }
         else
         {
             TextBox b = this.createbox();
             b.Background = StringToColor(data.ColorName);
             TextChangedEventHandler changedEventHandler = (TextChangedEventHandler)((s, a) => OnTextEdited(item.FullName, b));
             b.MouseWheel  += (MouseWheelEventHandler)((s, e) => this.TextBoxOnMouseWheel(item.FullName, b, s, e));
             b.Text         = data.Text;
             b.ToolTip      = data.Text;
             b.TextChanged += changedEventHandler;
             this.wrapPanel.Children.Add((UIElement)b);
         }
     }
 }
コード例 #18
0
ファイル: TextBoxUtil.cs プロジェクト: JuroGandalf/Ragnarok
        private static void OnAutoHorizontalScrollToEndChanged(DependencyObject s, DependencyPropertyChangedEventArgs e)
        {
            var textBox = s as TextBox;

            var handler = new TextChangedEventHandler(
                (s1, e1) =>
                {
                    // キャレット位置を最後にします。
                    textBox.CaretIndex = int.MaxValue;

                    // GetRectFromCharacterIndexは表示中の文字位置を
                    // 取得しますが、ScrollToHorizontalOffsetは
                    // 文字位置0基準とした座標系で値を設定します。
                    // このため、基準位置をずらして値を設定しています。
                    var rect = textBox.GetRectFromCharacterIndex(textBox.CaretIndex);
                    var position = textBox.HorizontalOffset + rect.Right;
                    textBox.ScrollToHorizontalOffset(Math.Max(0.0, position));
                });

            if ((bool)e.NewValue)
            {
                textBox.TextChanged += handler;
            }
            else
            {
                textBox.TextChanged -= handler;
            }
        }
コード例 #19
0
 public MyTextBox()
 {
     TextChanged      += new TextChangedEventHandler(MyTextBox_TextChanged);
     PreviewKeyDown   += new KeyEventHandler(MyTextBox_PreviewKeyDown);
     PreviewTextInput += new TextCompositionEventHandler(MyTextBox_PreviewTextInput);
     DataObject.AddPastingHandler(this, new DataObjectPastingEventHandler(OnPaste));
 }
コード例 #20
0
            public TextBox CreateQueryTextBox(TextChangedEventHandler onTextChanged)
            {
                var textBox = _template.CreateQueryTextBox(_query.Value, _query.TextBoxName);

                textBox.TextChanged += onTextChanged;
                return(textBox);
            }
コード例 #21
0
        public CueTextBox()
        {
            //  Override the default style.
            DefaultStyleKey = typeof(CueTextBox);

            //  Handle the text changed event.
            TextChanged += new TextChangedEventHandler(CueTextBox_TextChanged);
        }
コード例 #22
0
 public void AddNewTextChanged(TextChangedEventHandler handler)
 {
     if (_datePickerTextBox is null)
     {
         ApplyTemplate();
     }
     _datePickerTextBox.TextChanged += handler;
 }
コード例 #23
0
ファイル: Subject.xaml.cs プロジェクト: tedechan/Workload
        public SubjectEditForm()
        {
            InitializeComponent();
            this.DataContext = new Valid();
            TextChangedEventHandler textChanged = new TextChangedEventHandler((object obj, TextChangedEventArgs args) => this.FieldsHasBeenChanged?.Invoke());

            this.NameText.TextChanged  += textChanged;
            this.NotesText.TextChanged += textChanged;
        }
コード例 #24
0
ファイル: Work.xaml.cs プロジェクト: tedechan/Workload
        public WorkTypesEditForm()
        {
            InitializeComponent();
            this.DataContext = new Valid();
            TextChangedEventHandler textChanged = new TextChangedEventHandler((object sender, TextChangedEventArgs args) => this.FieldsHasBeenChanged?.Invoke());

            this.NameText.TextChanged            += textChanged;
            this.HoursPerStudentText.TextChanged += textChanged;
        }
コード例 #25
0
ファイル: ControlLine.cs プロジェクト: obejnen/ImageManager
 public void AddEventHandlers(RoutedEventHandler DeleteControlLineButton_Click,
                              TextChangedEventHandler SubfolderName_Changed, TextChangedEventHandler BindKey_Changed,
                              System.Windows.Input.KeyEventHandler BindKey_KeyDown)
 {
     DeleteKeyButton.Click        += DeleteControlLineButton_Click;
     SubfolderTextBox.TextChanged += SubfolderName_Changed;
     KeyTextBox.TextChanged       += BindKey_Changed;
     KeyTextBox.PreviewKeyDown    += BindKey_KeyDown;
 }
コード例 #26
0
ファイル: Placeholder.cs プロジェクト: hectorcayul/Magnolia-
        protected Placeholder(Control adornedElement) : base(adornedElement)
        {
            this.IsHitTestVisible = false;
            _textChangedHandler = new TextChangedEventHandler(AdornedElement_ContentChanged);
            _passwordChangedHandler = new RoutedEventHandler(AdornedElement_ContentChanged);

            adornedElement.GotFocus += new RoutedEventHandler(AdornedElement_GotFocus);
            adornedElement.LostFocus += new RoutedEventHandler(AdornedElement_LostFocus);
        }
コード例 #27
0
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// textchangedeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this TextChangedEventHandler textchangedeventhandler, Object sender, TextChangedEventArgs e, AsyncCallback callback)
        {
            if (textchangedeventhandler == null)
            {
                throw new ArgumentNullException("textchangedeventhandler");
            }

            return(textchangedeventhandler.BeginInvoke(sender, e, callback, null));
        }
コード例 #28
0
ファイル: DoctorData.cs プロジェクト: galatiayxh/WinformTest1
        private void RaiseTextChangeEvent()
        {
            TextChangedEventHandler eventHandler = OnTextChanged;

            if (eventHandler != null)
            {
                OnTextChanged(this.txtSearchContent, new TextChangeEventArgs(txtSearchContent.Text));
            }
        }
コード例 #29
0
        protected virtual void OnTextChanged(TextChangedEventArgs e)
        {
            TextChangedEventHandler handler = TextChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #30
0
        protected Placeholder(Control adornedElement) : base(adornedElement)
        {
            this.IsHitTestVisible   = false;
            _textChangedHandler     = new TextChangedEventHandler(AdornedElement_ContentChanged);
            _passwordChangedHandler = new RoutedEventHandler(AdornedElement_ContentChanged);

            adornedElement.GotFocus  += new RoutedEventHandler(AdornedElement_GotFocus);
            adornedElement.LostFocus += new RoutedEventHandler(AdornedElement_LostFocus);
        }
コード例 #31
0
        public ControlLine CreateControlLine(RoutedEventHandler DeleteControlLineButton_Click,
                                             TextChangedEventHandler SubfolderName_Changed, TextChangedEventHandler BindKey_Changed,
                                             System.Windows.Input.KeyEventHandler BindKey_KeyDown)
        {
            var cl = new ControlLine(BindingLines.Count);

            cl.AddEventHandlers(DeleteControlLineButton_Click, SubfolderName_Changed, BindKey_Changed, BindKey_KeyDown);
            BindingLines.Add(cl);
            return(cl);
        }
コード例 #32
0
 static void AttachChangeTextEvent(RichTextBox textbox)
 {
     TextChangedEventHandler handler = null;
     handler = (s, e) =>
     {
         MessageBox.Show("");
         textbox.TextChanged -= handler;
     };
     textbox.TextChanged += handler;
 }
コード例 #33
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            mTextBoxGainInDbChangedEH        = new TextChangedEventHandler(textBoxGainInDB_TextChanged);
            mTextBoxGainInAmplitudeChangedEH = new TextChangedEventHandler(textBoxGainInAmplitude_TextChanged);

            if (mFilter != null)
            {
                // filterの設定をUIに反映する
                InitializeUIbyFilter(mFilter);
            }
        }
コード例 #34
0
        public ControlLine CreateControlLine(RoutedEventHandler DeleteControlLineButton_Click,
                                             TextChangedEventHandler SubfolderName_Changed, TextChangedEventHandler BindKey_Changed,
                                             System.Windows.Input.KeyEventHandler BindKey_KeyDown, string bindedKey, string subfolderName, bool?isMoveFileMode)
        {
            var cl = new ControlLine(BindingLines.Count);

            cl.FillData(bindedKey, subfolderName, isMoveFileMode);
            cl.AddEventHandlers(DeleteControlLineButton_Click, SubfolderName_Changed, BindKey_Changed, BindKey_KeyDown);
            BindingLines.Add(cl);
            return(cl);
        }
            public ComboBoxHintProxy(ComboBox comboBox)
            {
                if (comboBox == null) throw new ArgumentNullException(nameof(comboBox));

                _comboBox = comboBox;
                _comboBoxTextChangedEventHandler = new TextChangedEventHandler(ComboBoxTextChanged);
                _comboBox.AddHandler(TextBoxBase.TextChangedEvent, _comboBoxTextChangedEventHandler);
                _comboBox.SelectionChanged += ComboBoxSelectionChanged;
                _comboBox.Loaded += ComboBoxLoaded;
                _comboBox.IsVisibleChanged += ComboBoxIsVisibleChanged;
            }
コード例 #36
0
        // Constructors
        public NumberBox()
        {
            KeyDown += new KeyEventHandler(OnKeyDown);
            TextChanged += new TextChangedEventHandler(OnTextChanged);

            InputScopeName name = new InputScopeName();
            name.NameValue = InputScopeNameValue.Number;
            InputScope scope = new InputScope();
            scope.Names.Add(name);

            InputScope = scope;

            Refresh();
        }
コード例 #37
0
ファイル: SudokuCell.xaml.cs プロジェクト: delner/sudoku
        public SudokuCell()
        {
            InitializeComponent();

            this._zone = null;

            this._zoneRow = 0;
            this._zoneCol = 0;
            this._value = null;
            this._cellState = SudokuCell.CellState.Editable;
            this._textChangedHandler = new TextChangedEventHandler(CellTextBox_TextChanged);
            this.DataContext = this;

            this.CellTextBox.MaxLength = (3 * 3).ToString().Length;

            this.BindTextBoxHandler();
        }
コード例 #38
0
ファイル: SudokuCell.xaml.cs プロジェクト: delner/sudoku
        public SudokuCell(SudokuZone zone, int zoneRow, int zoneCol)
        {
            InitializeComponent();

            this._zone = zone;

            this._zoneRow = zoneRow;
            this._zoneCol = zoneCol;
            this._value = null;
            this._cellState = SudokuCell.CellState.Editable;
            this._textChangedHandler = new TextChangedEventHandler(CellTextBox_TextChanged);
            this.DataContext = this;

            this.CellTextBox.MaxLength = (zone.Grid.Puzzle.Rank * zone.Grid.Puzzle.Rank).ToString().Length;

            this.BindTextBoxHandler();
        }
コード例 #39
0
        public UiEncodingLabeledWatermark(string label, string watermark, int width, TextChangedEventHandler onValueChanged)
        {
            ColumnDefinitions.Add(new ColumnDefinition() {Width = GridLength.Auto});
            ColumnDefinitions.Add(new ColumnDefinition());

            Margin = new Thickness(5);

            UiTextBlock labelControl = UiTextBlockFactory.Create(label);
            {
                labelControl.Margin = new Thickness(5, 5, 2, 5);
                labelControl.VerticalAlignment = VerticalAlignment.Center;
                AddUiElement(labelControl, 0, 0);
            }

            _textControl = UiWatermarkTextBoxFactory.Create(watermark);
            {
                _textControl.Width = width;
                _textControl.Margin = new Thickness(2, 5, 5, 5);
                _textControl.TextChanged += onValueChanged;
                AddUiElement(_textControl, 0, 1);
            }
        }
コード例 #40
0
        public MainWindowSearch()
        {
            // Required to initialize variables
            InitializeComponent();
            proxy = new WebServiceClient();
            tmpSelectedList = new List<SearchableData>();

            dataSet = new RequirementsAndPatternsAndCategoriesAndPrivRequirements();
            searchResult = new List<Data.SearchableData>();

            proxy.getAllDataCompleted += new EventHandler<getAllDataCompletedEventArgs>(proxy_getAllDataCompleted);
            proxy.toggleActiveRequirementCompleted += new EventHandler<toggleActiveRequirementCompletedEventArgs>(proxy_toggleActiveRequirementCompleted);
            proxy.toggleActivePrivateRequirementCompleted += new EventHandler<toggleActivePrivateRequirementCompletedEventArgs>(proxy_toggleActivePrivateRequirementCompleted);

            textChangedEventHandler = new TextChangedEventHandler(searchString_TextChanged);
            searchString.TextChanged += textChangedEventHandler;

            getAllSearchData();

            //Hide info panels
            hideInfoPanels();
        }
コード例 #41
0
ファイル: Events.cs プロジェクト: kangaroo/moon
		public static UnmanagedEventHandler CreateTextChangedEventHandlerDispatcher (TextChangedEventHandler handler)
		{
			return SafeDispatcher ( (sender, calldata, closure)
						=> handler (NativeDependencyObjectHelper.FromIntPtr (closure),
							    NativeDependencyObjectHelper.FromIntPtr (calldata) as TextChangedEventArgs ?? new TextChangedEventArgs (calldata)) );
		}
コード例 #42
0
        private void Internal_add_TextChanged(TextChangedEventHandler value)
        {
            //Console.WriteLine("Internal_add_TextChanged: ");

            var NotifyText = default(string);

            Action Notify =
                delegate
                {
                    //Console.WriteLine("notify: " + this.Text);
                    InternalAutoSizeUpdate();
                    value(this, null);
                };

            var t = new ScriptCoreLib.JavaScript.Runtime.Timer();

            Action Check =
                delegate
                {
                    var Text = this.Text;

                    if (Text == NotifyText)
                        return;

                    NotifyText = Text;
                    Notify();
                };

            t.Tick +=
                delegate
                {
                    Check();
                };

            this.InternalGetTextField().onfocus +=
                delegate
                {
                    //Console.WriteLine("onfocus: ");
                    NotifyText = this.Text;
                    // based on cpu and text length we may choose a larger interval
                    t.StartInterval(1000 / 10);
                };


            this.InternalGetTextField().onblur +=
                delegate
                {
                    //Console.WriteLine("onblur: ");
                    t.Stop();
                    NotifyText = null;
                };

            this.InternalGetTextField().onchange +=
                delegate
                {
                    Check();
                };


            this.InternalGetTextField().onkeyup +=
             delegate
             {
                 Check();
             };

            this.InternalGetTextField().onkeydown +=
             delegate
             {
                 Check();
             };
        }
コード例 #43
0
ファイル: WaterMarkTextBox.cs プロジェクト: JuRogn/OA
 public WaterMarkTextBox()
 {
     this.DefaultStyleKey = typeof(WaterMarkTextBox);
     TextChanged += new TextChangedEventHandler(WaterMarkTextBox_TextChanged);
 }
コード例 #44
0
 public TextBox CreateQueryTextBox(TextChangedEventHandler onTextChanged)
 {
     var textBox = _template.CreateQueryTextBox(_query.Value, _query.TextBoxName);
     textBox.TextChanged += onTextChanged;
     return textBox;
 }
コード例 #45
0
ファイル: CTextBox.xaml.cs プロジェクト: Olegna/PawnGuard
 public CTextBox()
 {
     InitializeComponent();
     TextChange -= new TextChangedEventHandler(CTextBox_TextChanged);
     TextChange += new TextChangedEventHandler(CTextBox_TextChanged);
 }
コード例 #46
0
 public void AddTbSearchTextChangedHandler(TextChangedEventHandler handler)
 {
     tbSearch.TextChanged += handler;
 }
コード例 #47
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            mTextBoxGainInDbChangedEH = new TextChangedEventHandler(textBoxGainInDB_TextChanged);
            mTextBoxGainInAmplitudeChangedEH = new TextChangedEventHandler(textBoxGainInAmplitude_TextChanged);

            if (mFilter != null) {
                // filterの設定をUIに反映する
                InitializeUIbyFilter(mFilter);
            }

            mInitialized = true;
        }
コード例 #48
0
ファイル: MainWindow.xaml.cs プロジェクト: TiCK3R/SharpLeech
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Extend Aero glass into client area
            this.TryExtendAeroGlass();

            #region Hide
            // Irc setup
            this.irc = new IrcClient();
            this.irc.AutoNickHandling = true;
            this.irc.OnChannelAction += new ActionEventHandler(irc_OnChannelAction);
            this.irc.OnChannelMessage += new IrcEventHandler(irc_OnChannelMessage);
            this.irc.OnConnected += new EventHandler(irc_OnConnected);
            this.irc.OnConnecting += new EventHandler(irc_OnConnecting);
            this.irc.OnJoin += new JoinEventHandler(irc_OnJoin);
            this.irc.OnMotd += new MotdEventHandler(irc_OnMotd);
            this.irc.OnNames += new NamesEventHandler(irc_OnNames);
            this.irc.OnNickChange += new NickChangeEventHandler(irc_OnNickChange);
            this.irc.OnPart += new PartEventHandler(irc_OnPart);
            this.irc.OnQuit += new QuitEventHandler(irc_OnQuit);
            this.irc.OnReadLine += new ReadLineEventHandler(irc_OnReadLine);
            this.irc.OnTopic += new TopicEventHandler(irc_OnTopic);
            this.irc.OnWriteLine += new WriteLineEventHandler(irc_OnWriteLine);

            ThreadPool.QueueUserWorkItem(state =>
            {
                try { this.irc.Connect(Cfg.Default.IrcServer, Int32.Parse(Res.IrcPort)); }
                catch { this.AddChatMsg("# Connection failed :("); }
            });

            // Setup some controls
            MainWindow.TextChangedInt32Filter = new TextChangedEventHandler((_s, _e) =>
            {
                #region Allow only numbers
                TextBox textBox = _s as TextBox;
                Int32 selectionStart = textBox.SelectionStart;
                Int32 selectionLength = textBox.SelectionLength;
                String newText = String.Empty;
                Boolean check = false;

                foreach (Char c in textBox.Text.ToCharArray())
                {
                    if (Char.IsDigit(c) || Char.IsControl(c)) newText += c;
                    else check = true;
                }

                textBox.Text = newText;
                textBox.SelectionStart = selectionStart <= textBox.Text.Length ?
                    selectionStart : textBox.Text.Length;

                if (check) System.Media.SystemSounds.Beep.Play();
                #endregion
            });

            this.gridForumTypesHolder.Height = double.NaN;
            this.txtTopicSectionId.TextChanged += MainWindow.TextChangedInt32Filter;
            this.txtTopicIconId.TextChanged += MainWindow.TextChangedInt32Filter;
            this.txtPauseCfg.TextChanged += MainWindow.TextChangedInt32Filter;
            this.txtTimeoutCfg.TextChanged += MainWindow.TextChangedInt32Filter;
            this.txtStartPageCfg.TextChanged += MainWindow.TextChangedInt32Filter;

            // Setup special events
            this.SetupDateScenarios();

            // Close splash and show window
            if (Cfg.Default.EnableSplash)
            {
                splash.Close(new TimeSpan(0, 0, 1));
                this.Show();
            }

            Cfg.Default.IsFirstRun = false;
            Cfg.Default.Save();

            // Misc stuff
            this.lstForumType.ScrollIntoView(this.lstForumType.SelectedItem);
            #endregion

            // Leech client setup
            this.leechClient.Error += new Engine.ErrorEventHandler(leechClient_Error);
            this.leechClient.TopicRead += new TopicReadEventHandler(leechClient_TopicRead);
            this.leechClient.Started += new EventHandler(leechClient_Started);
            this.leechClient.Stopped += new EventHandler(leechClient_Stopped);

            // Clean up before we start
            GC.Collect();
        }
コード例 #49
0
ファイル: CmsTextBox.cs プロジェクト: barrett2474/CMS2
        private void CmsTextBox_Loaded(object sender, RoutedEventArgs e)
        {
            if (!mLoaded)
            {
                mTextChangedEventHandler += (s1, e1) =>
                                                {
                                                    if (OriginalValue.ToString() == mNotInitiatedValue)
                                                    {
                                                        //OriginalValue = Text;
                                                    }

                                                    Validate();
                                                    CheckForChange();
                                                };
                OriginalValue = Text;

                AddTextChangedHandler();
                Loaded -= CmsTextBox_Loaded;
                mLoaded = true;
            }
        }
コード例 #50
0
 /// <summary> 
 /// The default constructor
 /// </summary>
 public DigitBox()
 {
     TextChanged += new TextChangedEventHandler( OnTextChanged );
     KeyDown += new KeyEventHandler( OnKeyDown );
     PreviewTextInput += new TextCompositionEventHandler( OnPreviewTextInput );
 }
コード例 #51
0
 public TextBox CreateNameBox(TextChangedEventHandler onTextChanged)
 {
     var nameBox = _template.CreateNameBox(_query.Name, _query.NameBoxName);
     nameBox.TextChanged += onTextChanged;
     return nameBox;
 }
コード例 #52
0
        private void availableTradeListView__SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            clsTRADABLE_KRX_INDEXFUTURES_TB clstb
                = this.availableTradeListView_.SelectedItem as clsTRADABLE_KRX_INDEXFUTURES_TB;

            if ( clstb != null )
            {
                this.tradeGrid_.Visibility = System.Windows.Visibility.Visible;

                int quantity = Convert.ToInt32(this.QuantityTB_.Text);

                // 전일자 또는 머... 어디서 가져옴...?
                double tradeIndex = Convert.ToDouble(this.PriceTB_.Text);

                string availableTradeCD = clstb.INST_KRX_CD;
                DateTime effective = this.ViewModel_.HedgeTradingViewModel_.TradeMaker_.TradingDate_;

                Kospi200Index_futures inst
                    = Kospi200Index_futures.CreateKOSPI200F(effective,
                                                            availableTradeCD,
                                                            quantity,
                                                            tradeIndex);


                NotionalReCalculation_ = null;
                 
                this.InstView_ = (Kospi200Index_futuresView)inst.view();

                NotionalReCalculation_ += 
                    new TextChangedEventHandler(this.InstView_.notionalRecalculation);

                this.tradeDetailGrid_.Children.Clear();
                this.tradeDetailGrid_.Children.Add(InstView_);
            }
            
        }