Beispiel #1
0
 public DataEntryUtcOffset(ControlRow control, DataEntryControls styleProvider) :
     base(control, styleProvider, ControlContentStyleEnum.UTCOffsetBox, ControlLabelStyleEnum.DefaultLabel)
 {
     // Callback to change the look of the control whenever it gets the focus
     this.ContentControl.GotKeyboardFocus  += this.ContentControl_GotKeyboardFocus;
     this.ContentControl.LostKeyboardFocus += this.ContentControl_LostKeyboardFocus;
     // configure the various elements
 }
Beispiel #2
0
 public DataEntryDateTime(ControlRow control, DataEntryControls styleProvider) :
     base(control, styleProvider, ControlContentStyleEnum.DateTimeBox, ControlLabelStyleEnum.DefaultLabel)
 {
     // configure the various elements
     DataEntryHandler.Configure(this.ContentControl, null);
     this.ContentControl.GotKeyboardFocus  += this.ContentControl_GotKeyboardFocus;
     this.ContentControl.LostKeyboardFocus += this.ContentControl_LostKeyboardFocus;
 }
Beispiel #3
0
        public DataEntryChoice(ControlRow control, DataEntryControls styleProvider)
            : base(control, styleProvider, ControlContentStyleEnum.ChoiceComboBox, ControlLabelStyleEnum.DefaultLabel)
        {
            // The behaviour of the combo box
            this.ContentControl.Focusable           = true;
            this.ContentControl.IsEditable          = false;
            this.ContentControl.IsTextSearchEnabled = true;

            // Callback used to allow Enter to select the highlit item
            this.ContentControl.PreviewKeyDown += this.ContentCtl_PreviewKeyDown;

            // Add items to the combo box. If we have an  EmptyChoiceItem, then  add an 'empty string' to the end
            // Check the arguments for null
            List <string> choiceList;
            bool          includesEmptyChoice;

            if (control == null)
            {
                // this should not happen
                TracePrint.PrintStackTrace(1);
                choiceList          = new List <string>();
                includesEmptyChoice = true;
            }
            else
            {
                choiceList = control.GetChoices(out includesEmptyChoice);
            }
            ComboBoxItem cbi;

            foreach (string choice in choiceList)
            {
                cbi = new ComboBoxItem()
                {
                    Content = choice
                };
                this.ContentControl.Items.Add(cbi);
            }
            if (includesEmptyChoice)
            {
                // put empty choice at the beginning of the control below a separator for visual clarity
                cbi = new ComboBoxItem()
                {
                    Content = String.Empty
                };
                this.ContentControl.Items.Insert(0, cbi);
            }
            // We include an invisible ellipsis menu item. This allows us to display an ellipsis in the combo box text field
            // when multiple images with different values are selected
            cbi = new ComboBoxItem()
            {
                Content = Constant.Unicode.Ellipsis
            };
            this.ContentControl.Items.Insert(0, cbi);
            ((ComboBoxItem)this.ContentControl.Items[0]).Visibility = System.Windows.Visibility.Collapsed;
            this.ContentControl.SelectedIndex = 1;
        }
Beispiel #4
0
 public DataEntryCounter(ControlRow control, DataEntryControls styleProvider) :
     base(control, styleProvider, ControlContentStyleEnum.CounterTextBox, ControlLabelStyleEnum.CounterButton)
 {
     // Configure the various elements if needed
     // Assign all counters to a single group so that selecting a new counter deselects any currently selected counter
     this.LabelControl.GroupName            = "DataEntryCounter";
     this.LabelControl.Click               += this.LabelControl_Click;
     this.ContentControl.Width             += 18; // to account for the width of the spinner
     this.ContentControl.PreviewKeyDown    += this.ContentControl_PreviewKeyDown;
     this.ContentControl.PreviewTextInput  += this.ContentControl_PreviewTextInput;
     this.ContentControl.GotKeyboardFocus  += this.ContentControl_GotKeyboardFocus;
     this.ContentControl.LostKeyboardFocus += this.ContentControl_LostKeyboardFocus;
 }
        protected DataEntryControl(ControlRow control, DataEntryControls styleProvider)
        {
            // Check the arguments for null
            ThrowIf.IsNullArgument(control, nameof(control));
            ThrowIf.IsNullArgument(styleProvider, nameof(styleProvider));

            // populate properties from database definition of control
            // this.Content and Tooltip can't be set, however, as the caller hasn't instantiated the content control yet
            this.Copyable  = control.Copyable;
            this.DataLabel = control.DataLabel;

            // Create the stack panel
            this.Container = new StackPanel();
            Style style = styleProvider.FindResource(Constant.ControlStyle.ContainerStyle) as Style;

            this.Container.Style = style;

            // use the containers's tag to point back to this so event handlers can access the DataEntryControl
            // this is needed by callbacks such as DataEntryHandler.Container_PreviewMouseRightButtonDown() and TimelapseWindow.CounterControl_MouseLeave()
            this.Container.Tag = this;
        }
Beispiel #6
0
 public DataEntryNote(ControlRow control, Dictionary <string, string> autocompletions, DataEntryControls styleProvider) :
     base(control, styleProvider, ControlContentStyleEnum.NoteTextBox, ControlLabelStyleEnum.DefaultLabel)
 {
     // Now configure the various elements
     this.ContentControl.Autocompletions = autocompletions;
     this.ContentChanged = false;
 }
 public DataEntryFlag(ControlRow control, DataEntryControls styleProvider)
     : base(control, styleProvider, ControlContentStyleEnum.FlagCheckBox, ControlLabelStyleEnum.DefaultLabel)
 {
     // Callback used to allow Enter to select the highlit item
     this.ContentControl.PreviewKeyDown += this.ContentControl_PreviewKeyDown;
 }