예제 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button        button        = (Button)sender;
            WrapPanel     panel         = (WrapPanel)button.Parent;
            ComboBox      comboBox      = (ComboBox)panel.Children[0];
            IntegerUpDown integerUpDown = (IntegerUpDown)panel.Children[2];
            ListBox       listBox       = (ListBox)panel.Parent;

            Exercise exercise;

            try
            {
                exercise = (Exercise)comboBox.SelectedItem;
                string abc = exercise.name;
            }
            catch (Exception)
            {
                System.Windows.MessageBox.Show("Nie wybrano ćwiczenia", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (integerUpDown.Value <= 0)
            {
                System.Windows.MessageBox.Show("Zła ilość powtórzeń", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            int amount = (int)integerUpDown.Value;

            listBox.Items[listBox.Items.IndexOf(panel)] = addnewExercise(exercise, amount);
        }
 private void clearAllControlFields()
 {
     for (int x = 0; x < controlTest.Count; x++)
     {
         if (controlTest[x] is TextBox)
         {
             TextBox tb = controlTest[x] as TextBox;
             tb.Clear();
         }
         else if (controlTest[x] is IntegerUpDown)
         {
             IntegerUpDown iud = controlTest[x] as IntegerUpDown;
             iud.Value = null;
         }
         else if (controlTest[x] is DecimalUpDown)
         {
             DecimalUpDown dud = controlTest[x] as DecimalUpDown;
             dud.Value = null;
         }
         else if (controlTest[x] is DatePicker)
         {
             DatePicker dp = controlTest[x] as DatePicker;
             dp.Text = null;
         }
         else if (controlTest[x] is TimePicker)
         {
             TimePicker tp = controlTest[x] as TimePicker;
             tp.Value = null;
         }
     }
 }
예제 #3
0
 public IntegerPickerWidget() : base(new IntegerUpDown())
 {
     Debug.Assert(Control.GetType() == typeof(IntegerUpDown));
     Spinbox = Control as IntegerUpDown;
     Spinbox.AllowTextInput = false;
     Spinbox.ValueChanged  += (sender, args) => OnInputChanged(new IntegerType(Spinbox.Value.Value));
 }
 /// <summary>
 /// Generates the numeric integer row.
 /// </summary>
 /// <param name="gridContainer">The grid container.</param>
 /// <param name="item">The item.</param>
 /// <param name="row">The row.</param>
 private void GenerateNumericIntegerRow(Grid gridContainer, DnwSetting item, int row)
 {
     try
     {
         GenerateDescriptions(gridContainer, item, row);
         IntegerUpDown iud = new IntegerUpDown();
         if (item.Mask.XDwIsNullOrTrimEmpty())
         {
             iud.FormatString = "N0";
         }
         else
         {
             iud.FormatString = item.Mask;
         }
         iud.Padding = new Thickness(2);
         iud.Margin  = new Thickness(5);
         Binding vBinding = new Binding(DnwSetting.FLD_Value);
         vBinding.Source = item;
         iud.SetBinding(IntegerUpDown.ValueProperty, vBinding);
         gridContainer.Children.Add(iud);
         Grid.SetRow(iud, row);
         Grid.SetColumn(iud, 2);
     }
     catch (Exception ex)
     {
         EventLogger.SendMsg(ex);
         throw;
     }
 }
        private static FrameworkElement ExtractInt(DisplayOption option)
        {
            var ctrl = new IntegerUpDown
            {
                Margin = new Thickness(3),
                HorizontalAlignment = HorizontalAlignment.Left,
                MinWidth            = 50
            };

            ctrl.SetBinding(IntegerUpDown.ValueProperty, new Binding(option.PropertyName));

            int newVal;

            if (option.Minimum != null)
            {
                newVal       = Convert.ToInt32(option.Minimum);
                ctrl.Minimum = newVal;
            }
            if (option.Maximum != null)
            {
                newVal       = Convert.ToInt32(option.Maximum);
                ctrl.Maximum = newVal;
            }
            return(ctrl);
        }
예제 #6
0
        private void Setup()
        {
            selectPhotoButton = SelectPhotoButton;
            savePhotoButton   = SaveButton;
            watermarkTextBox  = WatermarkTextBox;
            colorComboBox     = ColorComboBox;
            fontComboBox      = FontComboBox;
            fontSizePicker    = FontSizePicker;

            textPositionSelectors.Add(TopLeftRadio);
            textPositionSelectors.Add(TopMiddleRadio);
            textPositionSelectors.Add(TopRightRadio);
            textPositionSelectors.Add(MiddleLeftRadio);
            textPositionSelectors.Add(MiddleRadio);
            textPositionSelectors.Add(MiddleRightRadio);
            textPositionSelectors.Add(BottomLeftRadio);
            textPositionSelectors.Add(BottomMiddleRadio);
            textPositionSelectors.Add(BottomRightRadio);

            fontComboBox.SelectionChanged  += new SelectionChangedEventHandler((sender, args) => FontChanged(sender, args));
            colorComboBox.SelectionChanged += new SelectionChangedEventHandler((sender, args) => ColorChanged(sender, args));

            selectPhotoButton.Click += new RoutedEventHandler((sender, args) => OpenPhoto(sender, args));
            savePhotoButton.Click   += new RoutedEventHandler((sender, args) => SavePhoto(sender, args));

            watermarkTextBox.TextChanged += new TextChangedEventHandler((sender, args) => UpdateText(sender, args));

            fontSizePicker.ValueChanged += new RoutedPropertyChangedEventHandler <object>((sender, args) => UpdateFontSize(sender, args));

            foreach (var radio in textPositionSelectors)
            {
                radio.Click += new RoutedEventHandler((sender, args) => PositionChanged(sender, args));
            }
        }
예제 #7
0
        private void SubLeftCatdValue(int value)
        {
            String        temp = "lf_" + value;
            IntegerUpDown nmb  = _instance.FindName(temp) as IntegerUpDown;

            nmb.Value -= 1;
        }
예제 #8
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (gameWorld == null)
            {
                return;
            }

            if (BombUpDown.Value == null)
            {
                return;
            }

            List <int> cards     = new List <int>();
            int        numPlayer = gameWorld.Players.Count;

            for (int i = 0; i < numPlayer; ++i)
            {
                IntegerUpDown cardUpDown = CardGrid.FindName(string.Format("Player{0}UpDown", i)) as IntegerUpDown;
                if (cardUpDown == null || cardUpDown.Value == null)
                {
                    return;
                }
                cards.Add((int)cardUpDown.Value);
                cardUpDown.Value = 0;
            }
            gameWorld.AddGame((int)BombUpDown.Value, cards);
            BombUpDown.Value = 0;

            UpdatePlayerScoreLabels();
            ScoreListViewer.Items.Refresh();
        }
예제 #9
0
        private void InitializeMatrixGrid()
        {
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    int           index         = 3 * i + j;
                    IntegerUpDown integerUpDown = new IntegerUpDown()
                    {
                        Margin        = new Thickness(5),
                        Height        = 20,
                        TextAlignment = TextAlignment.Center
                    };

                    Binding binding = new Binding
                    {
                        Mode = BindingMode.TwoWay,
                        Path = new PropertyPath("Filter.MatrixFilter[" + index + "].Value")
                    };
                    integerUpDown.SetBinding(IntegerUpDown.ValueProperty, binding);
                    Grid.SetColumn(integerUpDown, i);
                    Grid.SetRow(integerUpDown, j);
                    MatrixGrid.Children.Add(integerUpDown);
                }
            }
        }
예제 #10
0
        public static FrameworkElement Render(AdaptiveNumberInput input, AdaptiveRenderContext context)
        {
            if (context.Config.SupportsInteractivity)
            {
                IntegerUpDown numberPicker = new IntegerUpDown();
                // numberPicker.ShowButtonSpinner = true;

                if (!Double.IsNaN(input.Value))
                {
                    numberPicker.Value = Convert.ToInt32(input.Value);
                }

                if (!Double.IsNaN(input.Min))
                {
                    numberPicker.Minimum = Convert.ToInt32(input.Min);
                }

                if (!Double.IsNaN(input.Max))
                {
                    numberPicker.Minimum = Convert.ToInt32(input.Max);
                }

                numberPicker.Watermark   = input.Placeholder;
                numberPicker.Style       = context.GetStyle("Adaptive.Input.Number");
                numberPicker.DataContext = input;
                context.InputBindings.Add(input.Id, () => numberPicker.Value?.ToString());
                return(numberPicker);
            }
            else
            {
                var textBlock = AdaptiveTypedElementConverter.CreateElement <AdaptiveTextBlock>();
                textBlock.Text = XamlUtilities.GetFallbackText(input) ?? input.Placeholder;
                return(context.Render(textBlock));
            }
        }
예제 #11
0
        /// <summary>
        /// Creates a new StackPanel with the given parameters (if they're set)
        /// </summary>
        /// <param name="name"></param>
        /// <param name="seats"></param>
        /// <returns></returns>
        private static StackPanel CreatePanel(string name = null, int?seats = null)
        {
            StackPanel panel = new StackPanel();

            TextBlock tbkName = new TextBlock()
            {
                Text       = "Name",
                FontWeight = FontWeights.Bold
            };
            TextBox tbxName = new TextBox()
            {
                Text = name
            };

            TextBlock tbkSeats = new TextBlock()
            {
                Text       = "Sitzplätze",
                FontWeight = FontWeights.Bold,
                Margin     = new Thickness(0, 10, 0, 0)
            };
            IntegerUpDown numSeats = new IntegerUpDown()
            {
                ParsingNumberStyle = NumberStyles.Integer,
                Value = seats
            };

            panel.Children.Add(tbkName);
            panel.Children.Add(tbxName);
            panel.Children.Add(tbkSeats);
            panel.Children.Add(numSeats);

            return(panel);
        }
예제 #12
0
        static DockPanel GenForm(this int value, string name, string desc)
        {
            var des = new TextBlock();

            des.Text = name;
            des.HorizontalAlignment = HorizontalAlignment.Left;


            var input = new IntegerUpDown();

            input.DisplayDefaultValueOnEmptyText = true;
            input.Value = value;
            input.HorizontalAlignment = HorizontalAlignment.Right;
            input.MinWidth            = 120;

            var dockPanel = new DockPanel();

            DockPanel.SetDock(des, Dock.Left);
            DockPanel.SetDock(input, Dock.Right);
            dockPanel.Children.Add(des);
            dockPanel.Children.Add(input);
            if (!string.IsNullOrEmpty(desc))
            {
                dockPanel.ToolTip = desc;
            }

            return(dockPanel);
        }
예제 #13
0
 private static void InitializeObject(KeyValuePair <string, object> prop, Panel content, object parent)
 {
     content.Children.Add(new TextBlock {
         Text = prop.Key, Padding = new Thickness(0, 10, 0, 0)
     });
     if (prop.Value is int)
     {
         var input = new IntegerUpDown();
         BindingOperations.SetBinding(input, IntegerUpDown.ValueProperty, GetBinding(prop, parent));
         content.Children.Add(input);
     }
     else if (prop.Value is double)
     {
         var input = new DoubleUpDown();
         BindingOperations.SetBinding(input, DoubleUpDown.ValueProperty, GetBinding(prop, parent));
         content.Children.Add(input);
     }
     else if (prop.Value is IList)
     {
         ProcessList(prop, content);
     }
     else
     {
         var input = new TextBox {
             HorizontalContentAlignment = HorizontalAlignment.Right
         };
         BindingOperations.SetBinding(input, TextBox.TextProperty, GetBinding(prop, parent));
         content.Children.Add(input);
     }
 }
예제 #14
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                ((ColumnGuideWindow)target).Loaded += new RoutedEventHandler(this.ColumnGuideWindow_OnLoaded);
                return;

            case 2:
                this.CheckBox_EnableColumnGuide = (CheckBox)target;
                return;

            case 3:
                this.IntUpDown_ColumnGuidePosition = (IntegerUpDown)target;
                return;

            case 4:
                this.Button_OK        = (Button)target;
                this.Button_OK.Click += new RoutedEventHandler(this.Button_OK_OnClick);
                return;

            case 5:
                this.Button_Cancel        = (Button)target;
                this.Button_Cancel.Click += new RoutedEventHandler(this.Button_Cancel_OnClick);
                return;

            default:
                this._contentLoaded = true;
                return;
            }
        }
예제 #15
0
        private void Spinner_ValueChanged(object senderObj, RoutedPropertyChangedEventArgs <object> e)
        {
            if (!process)
            {
                process = true;
                return;
            }
            IntegerUpDown sender = (IntegerUpDown)senderObj;

            int oldValue = (e.OldValue == null) ? (int)e.NewValue:(int)e.OldValue;
            int newValue = (int)e.NewValue;

            if (oldValue == newValue)
            {
                return;
            }


            //going down
            if (newValue < oldValue)
            {
                if (oldValue <= 16)
                {
                    if (!TryChangePointsValue(1, true))
                    {
                        process      = false;
                        sender.Value = oldValue;
                    }
                }
                else
                {
                    if (!TryChangePointsValue(2, true))
                    {
                        process      = false;
                        sender.Value = oldValue;
                    }
                }
            }
            else //going up
            {
                if (newValue <= 16)
                {
                    if (!TryChangePointsValue(1, false))
                    {
                        process      = false;
                        sender.Value = oldValue;
                    }
                }
                else
                {
                    if (!TryChangePointsValue(2, false))
                    {
                        process      = false;
                        sender.Value = oldValue;
                    }
                }
            }

            Calculate();
        }
예제 #16
0
        private void loadDataFromGUItoSelectedPart()
        {
            List <float> angles  = new List <float>();
            List <int>   joints  = new List <int>();
            List <float> lengths = new List <float>();

            Debug.WriteLine(corners_stackPanel.Children.Count);

            foreach (UIElement element in corners_stackPanel.Children)
            {
                Grid          grid   = (Grid)element;
                DoubleUpDown  angle  = (DoubleUpDown)grid.Children[0];
                DoubleUpDown  length = (DoubleUpDown)grid.Children[1];
                IntegerUpDown joint  = (IntegerUpDown)grid.Children[2];
                angles.Add((float)angle.Value);
                joints.Add((int)joint.Value);
                lengths.Add((float)length.Value);

                Debug.WriteLine(angle.Value + " " + joint.Value + " " + length.Value);
            }

            parts[partIndex].Relative = new Vector2((float)rellativeX_DoubleUpDown.Value, (float)rellativeY_DoubleUpDown.Value);

            parts[partIndex].Collide = collide_checkBox.IsChecked.Value;

            parts[partIndex].setAnglesJointsLengths(angles.Count, angles, lengths, joints);
        }
예제 #17
0
 private void SettingsChanged_NumericUpDown(object sender, RoutedPropertyChangedEventArgs <object> o)
 {
     if (((sender != null) && (o.NewValue != null)) && (this.SettingsObject != null))
     {
         IntegerUpDown down     = (IntegerUpDown)sender;
         int           newValue = (int)o.NewValue;
         if (down.Tag.ToString() == "Buttn_ShowTicksFrom")
         {
             this.m_iShowTicksFrom = newValue;
             this.SettingsObject.TickPanel_Settings.ShowTicksFrom = newValue;
         }
         else if (down.Tag.ToString() == "Buttn_TicksWeight")
         {
             this.m_iTicksWeight = newValue;
             this.SettingsObject.TickPanel_Settings.TicksWeight = newValue;
             this.m_LinesPen     = new Pen(Brushes.Black, (double)this.m_iTicksWeight);
             this.m_bTicksFilled = true;
         }
         else if (down.Tag.ToString() == "Buttn_RenewSpeed_Ticks")
         {
             this.SettingsObject.TickPanel_Settings.RenewSpeed = newValue;
             this.m_Timer_Ticks.Interval = 0x3e8 / newValue;
             this.m_Timer_Ticks.Start();
         }
     }
 }
예제 #18
0
            public override UIElement GenerateUI()
            {
                Thickness sep = new Thickness(5, 0, 0, 0);

                modifier = new ComparisonLogicModifier()
                {
                    Margin = sep,
                    VerticalContentAlignment = VerticalAlignment.Center
                };
                modifier.SelectionChanged += GenerateSelectionChangedHandler("modifier");
                target = new IntegerUpDown()
                {
                    Value   = 0,
                    Minimum = 0
                };
                StackPanel spMain = new StackPanel()
                {
                    Orientation = Orientation.Horizontal,
                    Margin      = new Thickness(0, 0, 30, 0),
                };

                spMain.Children.Add(new TextBlock()
                {
                    Text = Verb, VerticalAlignment = VerticalAlignment.Center
                });
                spMain.Children.Add(modifier);
                spMain.Children.Add(target);
                return(spMain);
            }
예제 #19
0
        private void FreqSearch_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            _freqSear4 = true;

            IntegerUpDown freq = (IntegerUpDown)sender;

            freq.Increment = freq.Value >= 3200 ? 5 : 10;
        }
예제 #20
0
 public static void HandleClick(this IntegerUpDown pickr)
 {
     //pickr.MouseRightButtonDown += (s, e) =>
     //{
     //    if (Keyboard.IsKeyDown(Key.LeftShift))
     //        Clipboard.SetText(pickr.Text);
     //};
 }
예제 #21
0
 private void Data_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
 {
     if (_rewriteTempEnable == false)
     {
         IntegerUpDown freq = (IntegerUpDown)sender;
         freq.Increment = freq.Value >= 3200 ? 5 : 10;
     }
 }
        public static IntegerUpDown GetIntegerEditor(Binding valuePropertyBinding, int minValue = Int32.MinValue, int maxValue = Int32.MaxValue, bool isReadOnly = false)
        {
            var control = new IntegerUpDown();

            SetNumericProperties(control, minValue, maxValue, isReadOnly);
            control.SetBinding(IntegerUpDown.ValueProperty, valuePropertyBinding);
            return(control);
        }
예제 #23
0
        internal static string GetCellValueControl(ref DataGrid Grid1, string strControl, int iColumn, int iRow)
        {
            string           strReturnValue = "";
            DataGridRow      row            = Grid1.ItemContainerGenerator.ContainerFromIndex(iRow) as DataGridRow;
            ContentPresenter CP             = Grid1.Columns[iColumn].GetCellContent(row) as ContentPresenter;

            if (strControl == "Date")
            {
                DatePicker DP = FindVisualChild <DatePicker>(CP);
                if (DP != null)
                {
                    strReturnValue = DP.SelectedDate.Value.ToString("dd/MM/yyyy");
                }
                else
                {
                    strReturnValue = "";
                }
            }
            if (strControl == "TextBox")
            {
                TextBox DP = FindVisualChild <TextBox>(CP);
                if (DP != null)
                {
                    strReturnValue = DP.Text.Trim();
                }
                else
                {
                    strReturnValue = "";
                }
            }
            if (strControl == "Double")
            {
                DoubleUpDown DP = FindVisualChild <DoubleUpDown>(CP);
                if (DP != null)
                {
                    strReturnValue = DP.Value.ToString().Trim();
                }
                else
                {
                    strReturnValue = "";
                }
            }
            if (strControl == "Int")
            {
                IntegerUpDown DP = FindVisualChild <IntegerUpDown>(CP);
                if (DP != null)
                {
                    strReturnValue = DP.Value.ToString().Trim();
                }
                else
                {
                    strReturnValue = "";
                }
            }


            return(strReturnValue);
        }
예제 #24
0
        private void Data_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            IntegerUpDown data = (IntegerUpDown)sender;

            if (data.Value == null)
            {
                data.Value = 0;
            }
        }
예제 #25
0
        public static UIElement CreateSpinner(object source, string path, AnnotationVariable var, object storedValue)
        {
            if (var.DataType.IsIntegral())
            {
                IntegerUpDown spinner = new IntegerUpDown();
                spinner.Increment = var.GetStepInteger();
                spinner.Minimum   = var.GetMinimumInteger();
                spinner.Maximum   = var.GetMaximumInteger();

                Binding binding = new Binding();
                binding.Source = source;
                binding.Mode   = BindingMode.TwoWay;
                binding.Path   = new PropertyPath(path);

                BindingOperations.SetBinding(spinner, IntegerUpDown.ValueProperty, binding);
                if (storedValue == null)
                {
                    spinner.Value = Math.Max(Math.Min(0, spinner.Maximum.Value), spinner.Minimum.Value);
                }
                else
                {
                    spinner.Value = (int)storedValue;
                }
                spinner.HorizontalContentAlignment = HorizontalAlignment.Stretch;
                spinner.HorizontalAlignment        = HorizontalAlignment.Stretch;

                return(spinner);
            }
            else
            {
                DoubleUpDown spinner = new DoubleUpDown();
                spinner.Increment = var.GetStepDouble();
                spinner.Minimum   = var.GetMinimumDouble();
                spinner.Maximum   = var.GetMaximumDouble();


                Binding binding = new Binding();
                binding.Source = source;
                binding.Mode   = BindingMode.TwoWay;
                binding.Path   = new PropertyPath(path);

                BindingOperations.SetBinding(spinner, DoubleUpDown.ValueProperty, binding);
                if (storedValue == null)
                {
                    spinner.Value = Math.Max(Math.Min(0, spinner.Maximum.Value), spinner.Minimum.Value);
                }
                else
                {
                    spinner.Value = (double)storedValue;
                }
                spinner.HorizontalContentAlignment = HorizontalAlignment.Stretch;
                spinner.HorizontalAlignment        = HorizontalAlignment.Stretch;

                return(spinner);
            }
        }
예제 #26
0
        protected override FrameworkElement CreateEditingElement()
        {
            var updown = new IntegerUpDown();

            this.ResetBinding(updown);

            this.SetAutomationElement(updown);

            return(updown);
        }
예제 #27
0
        protected override FrameworkElement CreateEditingElement()
        {
            var updown = new IntegerUpDown();

            this.ResetBinding(updown);

            this.SetAutomationElement(updown);

            return updown;
        }
예제 #28
0
 public void UpdateLeftCards(MainWindow instance)
 {
     for (int i = 0; i < 13; i++)
     {
         String temp = "lf_" + (i + 1);
         //Debug.WriteLine(temp);
         IntegerUpDown nmb = this.FindName(temp) as IntegerUpDown;
         lf[i] = Convert.ToInt32(nmb.Value);
     }
     //Debug.WriteLine(string.Join(" ", lf));
 }
예제 #29
0
 private void InitLeftCatdValue()
 {
     for (int value = 1; value <= 13; value++)
     {
         String        temp  = "lf_" + value;
         IntegerUpDown lfnmb = _instance.FindName(temp) as IntegerUpDown;
         String        temp2 = "df_" + value;
         IntegerUpDown dfnmb = _instance.FindName(temp2) as IntegerUpDown;
         lfnmb.Value = dfnmb.Value;
     }
 }
예제 #30
0
        public AttractorEditing(MapControl mapControl, WritableLayer targetLayer, UIElement editingUIRoot, ComboBox typeComboBox, ComboBox performanceComboBox, IntegerUpDown workingRadiusUpDown)
        {
            this.mapControl          = mapControl;
            this.targetLayer         = targetLayer;
            this.editingUIRoot       = editingUIRoot;
            this.typeComboBox        = typeComboBox;
            this.performanceComboBox = performanceComboBox;
            this.workingRadiusUpDown = workingRadiusUpDown;

            InitLayers();
        }
예제 #31
0
        private static void IntUpDown_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            IntegerUpDown dp = ( IntegerUpDown )sender;

            char input = e.Text[0];

            if (!Char.IsDigit(input))
            {
                e.Handled = true;
            }
        }
        protected override FrameworkElement BuildElement(ValueContainer value)
        {
            IntegerUpDown iud = new IntegerUpDown() { Width = 200 };
            iud.ValueChanged += (s, e) =>
            {
                value.Value = iud.Value;
            };

            Action onValueChanged = () =>
            {
                iud.Value = Convert.ToInt32(value.Value);
            };
            value.ValueChanged += onValueChanged;
            onValueChanged();

            return iud;
        }
        //Sets up the controls for the custom control
        private void InitializeControl()
        {
            int i = 0;

            foreach (CCustomLine cl in this.CustomFields.CustomLines)
            {
                //Add new row to the grid
                RowDefinition rd = new RowDefinition();
                rd.MinHeight = 30;
                rd.MaxHeight = 30;
                ControlGrid.RowDefinitions.Add(rd);

                System.Windows.Controls.TextBlock tb = new TextBlock();
                tb.SetValue(Grid.RowProperty, i);
                tb.SetValue(Grid.ColumnProperty, 0);
                tb.TextAlignment = TextAlignment.Right;
                tb.Margin = new Thickness(3);
                tb.Text = cl.Caption;
                ControlGrid.Children.Add(tb);

                 switch (cl.DataType)
                {
                    case CCustomLine.CustDataType.cdText:

                        if (cl.IsList)
                        {
                            System.Windows.Controls.ComboBox cbx = new ComboBox();
                            cbx.SetValue(Grid.RowProperty, i);
                            cbx.SetValue(Grid.ColumnProperty, 1);
                            cbx.Margin = new Thickness(3);
                            cbx.Tag = cl.Caption;
                            cbx.SelectionChanged += CustomDataChanged;

                            foreach (string sl in cl.PickList)
                            {
                                cbx.Items.Add(sl);
                            }
                            ControlGrid.Children.Add(cbx);
                        }
                        else
                        {
                            System.Windows.Controls.TextBox tbx = new TextBox();
                            tbx.SetValue(Grid.RowProperty, i);
                            tbx.SetValue(Grid.ColumnProperty, 1);
                            tbx.Margin = new Thickness(3);
                            tbx.Tag = cl.Caption;
                            tbx.Text = cl.Caption;
                            tbx.TextChanged += CustomDataChanged;
                            ControlGrid.Children.Add(tbx);
                        }
                        break;

                    case CCustomLine.CustDataType.cdDate:

                        System.Windows.Controls.DatePicker dtp = new DatePicker();
                        dtp.SetValue(Grid.RowProperty, i);
                        dtp.SetValue(Grid.ColumnProperty, 1);
                        dtp.Margin = new Thickness(3);
                        dtp.Tag = cl.Caption;
                        dtp.SelectedDateChanged += CustomDataChanged;
                        ControlGrid.Children.Add(dtp);
                        break;

                    case CCustomLine.CustDataType.cdInteger:

                        Xceed.Wpf.Toolkit.IntegerUpDown iud = new IntegerUpDown();
                        iud.SetValue(Grid.RowProperty, i);
                        iud.SetValue(Grid.ColumnProperty, 1);
                        iud.Margin = new Thickness(3);
                        iud.Tag = cl.Caption;
                        iud.ValueChanged += CustomDataChanged;
                        ControlGrid.Children.Add(iud);
                        break;

                    case CCustomLine.CustDataType.cdNumber:

                        Xceed.Wpf.Toolkit.CalculatorUpDown dud = new CalculatorUpDown();
                        dud.SetValue(Grid.RowProperty, i);
                        dud.SetValue(Grid.ColumnProperty, 1);
                        dud.Margin = new Thickness(3);
                        dud.Tag = cl.Caption;
                        dud.ValueChanged += CustomDataChanged;
                        ControlGrid.Children.Add(dud);
                        break;

                    case CCustomLine.CustDataType.cdCurrency:

                        Xceed.Wpf.Toolkit.CalculatorUpDown cud = new CalculatorUpDown();
                        cud.SetValue(Grid.RowProperty, i);
                        cud.SetValue(Grid.ColumnProperty, 1);
                        cud.Margin = new Thickness(3);
                        cud.Tag = cl.Caption;
                        cud.FormatString = "C2";
                        cud.ValueChanged += CustomDataChanged;
                        ControlGrid.Children.Add(cud);
                        break;

                    case CCustomLine.CustDataType.cdBoolean:

                        System.Windows.Controls.CheckBox chkb = new CheckBox();
                        chkb.SetValue(Grid.RowProperty, i);
                        chkb.SetValue(Grid.ColumnProperty, 1);
                        chkb.Margin = new Thickness(3); //Do we need this?
                        chkb.Tag = cl.Caption;
                        chkb.Checked += CustomDataChanged;
                        ControlGrid.Children.Add(chkb);
                        break;

                    case CCustomLine.CustDataType.cdBusinessLink:
                    case CCustomLine.CustDataType.cdInspectorLink:

                        System.Windows.Controls.TextBlock LinkTB = new TextBlock();
                        LinkTB.SetValue(Grid.RowProperty, i);
                        LinkTB.SetValue(Grid.ColumnProperty, 1);
                        LinkTB.Margin = new Thickness(3); //Do we need this?
                        LinkTB.Tag = cl.Caption;
                        ControlGrid.Children.Add(LinkTB);
                        break;

                }

                i++;
            }
        }
		FrameworkElement GetTypeEditor(XmlSchemaType xtype, ItemList.SimpleItem sitem) {
			FrameworkElement felement = null;
			if (XmlSchemaType.IsDerivedFrom(xtype, XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Boolean), XmlSchemaDerivationMethod.All)) {
				try {
					var val = XmlConvert.ToBoolean(sitem.value);
					felement = new CheckBox() {
						IsChecked = val,
						Margin = new Thickness(3)
					};
					felement.SetUpdateTrigger(
						CheckBox.IsCheckedProperty,
						(bool v) => {
							sitem.value = XmlConvert.ToString(v);
						}
					);
				} catch {
					felement = CreateTextEditor(sitem);
				}
			} else if (XmlSchemaType.IsDerivedFrom(xtype, XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Integer), XmlSchemaDerivationMethod.All)) {
				try {
					var val = XmlConvert.ToInt32(sitem.value);
					felement = new IntegerUpDown() {
						Value = val,
						Margin = new Thickness(3),
						Increment = 1,
						VerticalAlignment = VerticalAlignment.Center,
						MinWidth = 50
					};
					felement.SetUpdateTrigger(
						IntegerUpDown.ValueProperty,
						(int v) => {
							sitem.value = v.ToString();
						}
					);
				} catch {
					felement = CreateTextEditor(sitem);
				}
			} else if (XmlSchemaType.IsDerivedFrom(xtype, XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Float), XmlSchemaDerivationMethod.All)) {
				try {
					var val = XmlConvert.ToDouble(sitem.value);
					felement = new DoubleUpDown() {
						Value = val,
						CultureInfo = System.Globalization.CultureInfo.InvariantCulture,
						Margin = new Thickness(3),
						Increment = 0.1,
						FormatString = "F1",
						VerticalAlignment = VerticalAlignment.Center,
						MinWidth = 50
					};
					felement.SetUpdateTrigger(
						DoubleUpDown.ValueProperty,
						(double v) => {
							sitem.value = v.ToString();
						}
					);
				} catch {
					felement = CreateTextEditor(sitem);
				}
			} else if (XmlSchemaType.IsDerivedFrom(xtype, XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Double), XmlSchemaDerivationMethod.All)) {
				try {
					var val = XmlConvert.ToDouble(sitem.value);
					felement = new DoubleUpDown() {
						Value = val,
						CultureInfo = System.Globalization.CultureInfo.InvariantCulture,
						Margin = new Thickness(3),
						Increment = 0.1,
						FormatString = "F2",
						VerticalAlignment = VerticalAlignment.Center,
						MinWidth = 50
					};
					felement.SetUpdateTrigger(
						DoubleUpDown.ValueProperty,
						(double v) => {
							sitem.value = v.ToString();
						}
					);
				} catch {
					felement = CreateTextEditor(sitem);
				}
			} else {
				felement = CreateTextEditor(sitem);
			}

			return felement;
		}
        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);

            ////////
            // EntityInstanceDefinition
            CollectionViewSource collectionViewSource_entityInstanceDefinition =
                new CollectionViewSource()
                {
                    Source = DataManager.EntityInstanceDefinitions
                };
            m_comboBox_entityInstanceDefinition =
                new ComboBox()
                {
                    DisplayMemberPath = "Name",
                    IsTextSearchEnabled = true
                };
            m_comboBox_entityInstanceDefinition.SetBinding(ItemsControl.ItemsSourceProperty, new Binding() { Source = collectionViewSource_entityInstanceDefinition });
            ValidatorPanel validator_entityInstanceDefinition = new ValidatorPanel(m_comboBox_entityInstanceDefinition, ComboBox.SelectedItemProperty, new Validate_NotNull());

            Label label_entityInstanceDefinition = new Label() { Content = "Entity Instance: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_entityInstanceDefinition = new Grid();
            grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_entityInstanceDefinition.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_entityInstanceDefinition.SetRowColumn(validator_entityInstanceDefinition, 1, 0);
            grid_entityInstanceDefinition.SetRowColumn(label_entityInstanceDefinition, 0, 0);
            grid_main.SetRowColumn(grid_entityInstanceDefinition, 2, 0);

            ////////
            // ZOrder
            m_integerUpDown_zOrder = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_zOrder = new ValidatorPanel(m_integerUpDown_zOrder, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_zOrder = new Label() { Content = "Z-Order: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_zOrder = new Grid();
            grid_zOrder.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_zOrder.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_zOrder.SetRowColumn(validator_zOrder, 1, 0);
            grid_zOrder.SetRowColumn(label_zOrder, 0, 0);
            grid_main.SetRowColumn(grid_zOrder, 3, 0);

            ////////
            // RenderPass
            m_integerUpDown_renderPass = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_renderPass = new ValidatorPanel(m_integerUpDown_renderPass, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_renderPass = new Label() { Content = "Render Pass: "******"Animation", HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Center };
            Label label_radioButton_font = new Label() { Content = "Font", HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Center };

            Grid grid_radioButtons = new Grid();
            grid_radioButtons.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_radioButtons.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_radioButtons.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_radioButtons.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_radioButtons.SetRowColumn(m_radioButton_animation, 0, 0);
            grid_radioButtons.SetRowColumn(label_radioButton_animation, 0, 1);
            grid_radioButtons.SetRowColumn(m_radioButton_font, 1, 0);
            grid_radioButtons.SetRowColumn(label_radioButton_font, 1, 1);
            MultiValidatorPanel validator_radioButtons = new MultiValidatorPanel(grid_radioButtons, new[] {
                    m_radioButton_animation,
                    m_radioButton_font
                },
                RadioButton.IsCheckedProperty,
                new Validate_True(),
                MultiValidatorPanel.ValidationAggregationType.Or);

            m_groupBox_type = new GroupBox() { Header = "Type", Content = validator_radioButtons };

            grid_main.SetRowColumn(m_groupBox_type, 5, 0);

            if (GraphicsInstanceDefinitionType != GraphicsInstanceDefinition_WithAnimationStateDefinitions.GraphicsInstanceDefinitionType.Undetermined)
            {
                switch (GraphicsInstanceDefinitionType)
                {
                    case GraphicsInstanceDefinition_WithAnimationStateDefinitions.GraphicsInstanceDefinitionType.Animation:
                        m_radioButton_animation.IsChecked = true;
                        break;
                    case GraphicsInstanceDefinition_WithAnimationStateDefinitions.GraphicsInstanceDefinitionType.Font:
                        m_radioButton_font.IsChecked = true;
                        break;
                }
                m_groupBox_type.IsEnabled = false;
            }

            ////////
            // FIN
            ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] {
                validator_name,
                validator_entityInstanceDefinition,
                validator_zOrder,
                validator_renderPass,
                validator_radioButtons
            }};
        }
    private void BuildUI()
    {
      AddCategory("Scanner Settings");
      UpDownDoubleCustomPageWidth = AddDouble("Custom Page Size:", "Width:", 0.1, 100, 0.1, "##.##", "inches");
      UpDownDoubleCustomPageHeight = AddDouble("", "Height:", 0.1, 100, 0.1, "##.##", "inches");
      List<string> colorMode = new List<string>() { "Black/White", "Grayscale", "Color" };
      ComboBoxScannerColorMode = AddList("Color Mode:", "", colorMode, "");
      UpDownIntegerScannerResolution = AddInteger("Resolution:", "", 1, 2400, "DPI");
      UpDownDoubleScannerThreshold = AddDouble("Threshold:", "", 0, 1, 0.01, "0.##", "");
      UpDownDoubleScannerBrightness = AddDouble("Brightness:", "", 0, 1, 0.01, "0.##", "");
      UpDownDoubleScannerContrast = AddDouble("Contrast:", "", 0, 1, 0.01, "0.##", "");
      AddCategory("Program Settings");
      UpDownDoubleDefaultPageWidth = AddDouble("Default Page Size (for image import):", "Width:", 0.1, 100, 0.1, "##.##", "inches");
      UpDownDoubleDefaultPageHeight = AddDouble("", "Height:", 0.1, 100, 0.1, "##.##", "inches");
//      List<string> pageScaling = new List<string>() { "Use DPI", "Fit (Only Shrink)", "Fit(Stretch / Shrink)" };
//      ComboBoxPageScaling = AddList("Page Scaling:", "", pageScaling, "");
      UpDownIntegerDpiPdfRendering = AddInteger("PDF Viewing Resolution:", "", 1, 2400, "DPI");
      UpDownIntegerDpiPdfExport = AddInteger("PDF Export (Max) Resolution:", "", 1, 2400, "DPI");
      CheckBoxPdfImageImport = AddCheck("Attempt PDF Image Import:", "");
      CheckBoxExportCompressImages = AddCheck("Compress Images For PDF Export:", "");
      UpDownIntegerExportCompressionFactor = AddInteger("PDF Export Compression Factor:", "", 1, 100, "");
      List<string> pdfImportAction = new List<string>() { "Native", "Render" };
      ComboBoxPdfImportAction = AddList("PDF Page Import Action:", "", pdfImportAction, "");
      CheckBoxRemovePagesPdfExport = AddCheck("Remove Pages on PDF Save:", "");
      CheckBoxShowPrintButton = AddCheck("Show Print Button:", "");
    }
    private IntegerUpDown AddInteger(string title, string subTitle, int min, int max, string unit)
    {
      IntegerUpDown element = new IntegerUpDown();
      element.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
      element.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
      element.Margin = new Thickness(10, 3, 0, 3);
      element.Minimum = min;
      element.Maximum = max;

      AddRow(title, subTitle, element, unit);
      return element;
    }
예제 #38
0
        /// <summary>
        /// Populates the settings panel with the settings of a given plugin.
        /// </summary>
        /// <param name="plugin">The plugin whose settings to display</param>
        private void PopulateSettings(Plugin plugin)
        {
            SettingsGrid.RowDefinitions.Clear();
            SettingsGrid.Children.Clear();

            for (int i = 0; i < plugin.Settings.Count; i++)
            {
                Setting s = plugin.Settings[i];

                // add row
                SettingsGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

                // create label
                TextBlock tb = new TextBlock()
                {
                    Text = plugin.T(s.ID),
                    Margin = new Thickness(5, 5, 10, 5),
                    VerticalAlignment = VerticalAlignment.Center
                };

                tb.SetBinding(TextBlock.VisibilityProperty, new Binding("IsVisible")
                {
                    Source = s,
                    Mode = BindingMode.OneWay,
                    Converter = new BooleanToVisibilityConverter()
                });

                Grid.SetRow(tb, i);
                Grid.SetColumn(tb, 0);
                SettingsGrid.Children.Add(tb);

                FrameworkElement control = null;

                // create control
                if (s.Type == typeof(Boolean))
                {
                    // checkbox
                    control = new CheckBox() { Height = 15 };
                    control.SetBinding(CheckBox.IsCheckedProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode = BindingMode.TwoWay
                    });
                }
                else if (s.Type == typeof(Color))
                {
                    // color selector
                    control = new ColorPicker()
                    {
                        ShowAvailableColors = false,
                        ShowStandardColors = true,
                        Width = 50,
                    };
                    if (s.PossibleValues != null)
                    {
                        ColorConverter converter = new ColorConverter();
                        ((ColorPicker)control).AvailableColors.Clear();
                        foreach (Color c in s.PossibleValues)
                        {
                            System.Windows.Media.Color color = (System.Windows.Media.Color)converter.Convert(c, null, null, null);
                            ((ColorPicker)control).AvailableColors.Add(new ColorItem(color, c.Name));
                        }
                    }
                    control.SetBinding(ColorPicker.SelectedColorProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode = BindingMode.TwoWay,
                        Converter = new ColorConverter()
                    });
                }
                else if (s.PossibleValues != null)
                {
                    // dropdown
                    control = new ComboBox();
                    foreach (Object val in s.PossibleValues)
                    {
                        try
                        {
                            String content = val.ToString();
                            if (s.Type == typeof(String))
                                content = plugin.T(val.ToString());
                            ((ComboBox)control).Items.Add(new ComboBoxItem
                            {
                                Content = content,
                                Name = val.ToString()
                            });
                        }
                        catch (Exception exc)
                        {
                            U.L(LogLevel.Warning, "PLUGIN", "Could not add combobox item in plugin settings: " + exc.Message);
                        }
                    }
                    ((ComboBox)control).SelectedValuePath = "Name";
                    control.SetBinding(ComboBox.SelectedValueProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode = BindingMode.TwoWay
                    });
                }
                else if (s.Type == typeof(String))
                {
                    // text input
                    control = new TextBox()
                    {
                        MaxWidth = 400,
                        MinWidth = 250
                    };
                    control.SetBinding(TextBox.TextProperty, new Binding("Value")
                    {
                        Source = s,
                        Mode = BindingMode.TwoWay
                    });
                }
                else if (s.Type == typeof(Int32))
                {
                    if (s.Maximum != null)
                    {
                        // slider
                        control = new Slider()
                        {
                            Maximum = (Int32)s.Maximum,
                            AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                            Width = 200,
                        };
                        if (s.Minimum != null)
                            ((Slider)control).Minimum = (Int32)s.Minimum;
                        control.SetBinding(Slider.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode = BindingMode.TwoWay
                        });
                    }
                    else
                    {
                        // spinner
                        control = new IntegerUpDown();
                        control.SetBinding(IntegerUpDown.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode = BindingMode.TwoWay
                        });
                    }
                }
                else if (s.Type == typeof(Double))
                {
                    if (s.Maximum != null)
                    {
                        // slider
                        control = new Slider()
                        {
                            Maximum = (Double)s.Maximum,
                            AutoToolTipPlacement = AutoToolTipPlacement.TopLeft,
                            Width = 200,
                        };
                        if (s.Minimum != null)
                            ((Slider)control).Minimum = (Double)s.Minimum;
                        control.SetBinding(Slider.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode = BindingMode.TwoWay
                        });
                    }
                    else
                    {
                        // spinner
                        control = new DoubleUpDown();
                        control.SetBinding(DoubleUpDown.ValueProperty, new Binding("Value")
                        {
                            Source = s,
                            Mode = BindingMode.TwoWay
                        });
                    }
                }

                if (control != null)
                {
                    control.Margin = new Thickness(0, 5, 0, 5);
                    control.VerticalAlignment = VerticalAlignment.Center;
                    control.HorizontalAlignment = HorizontalAlignment.Left;

                    control.SetBinding(FrameworkElement.VisibilityProperty, new Binding("IsVisible")
                    {
                        Source = s,
                        Mode = BindingMode.OneWay,
                        Converter = new BooleanToVisibilityConverter()
                    });

                    Grid.SetRow(control, i);
                    Grid.SetColumn(control, 1);
                    SettingsGrid.Children.Add(control);
                }
            }
        }
예제 #39
0
        private void x628e6c716ec340be(int xf3efd21c486a5cce, object x11d58b056c032b03)
        {
            int num = xf3efd21c486a5cce;
            switch (num)
            {
                case 1:
                    this.cbNsim2 = (RadioButton) x11d58b056c032b03;
                    return;

                case 2:
                    this.cbNsim4 = (RadioButton) x11d58b056c032b03;
                    return;

                case 3:
                    ((Button) x11d58b056c032b03).Click += new RoutedEventHandler(this.x06e0310f82c2e3d9);
                    if (((uint) num) <= uint.MaxValue)
                    {
                        if ((((uint) xf3efd21c486a5cce) - ((uint) xf3efd21c486a5cce)) <= uint.MaxValue)
                        {
                        }
                        return;
                    }
                    break;

                case 4:
                    this.seFindCount = (IntegerUpDown) x11d58b056c032b03;
                    return;

                case 5:
                    this.cbSelect = (RadioButton) x11d58b056c032b03;
                    return;

                case 6:
                    this.cbDelete = (RadioButton) x11d58b056c032b03;
                    return;

                case 7:
                    this.cbSendToExcel = (RadioButton) x11d58b056c032b03;
                    return;

                case 8:
                    ((Button) x11d58b056c032b03).Click += new RoutedEventHandler(this.xd3b044bc7a476aeb);
                    return;

                case 9:
                    ((Button) x11d58b056c032b03).Click += new RoutedEventHandler(this.xd68518a4013c2043);
                    return;
            }
            this._x7dc3d9d322900926 = true;
            if ((((uint) xf3efd21c486a5cce) + ((uint) xf3efd21c486a5cce)) < 0)
            {
            }
        }
		FrameworkElement GetValueEditor(elementDescr element) {
			FrameworkElement felem = null;

			switch (element.QName.Name) { 
				case "int":
					IntegerUpDown numUp = new IntegerUpDown();
					numUp.Margin = new Thickness(3);
					numUp.Increment = 1;
					numUp.VerticalAlignment = VerticalAlignment.Center;
					numUp.MinWidth = 50;
					numUp.CreateBinding(IntegerUpDown.ValueProperty, element, x => {
						int val = 0;
						int.TryParse(element.Value, out val);
						return val;
					}, (o, v) => {
						o.Value = v.ToString();
					});
					felem = numUp;
					break;
				case "float":
					DoubleUpDown doubleUp = new DoubleUpDown();
					doubleUp.CultureInfo = System.Globalization.CultureInfo.InvariantCulture;
					doubleUp.Margin = new Thickness(3);
					doubleUp.Increment = 0.01f;
					doubleUp.FormatString = "F3";
					doubleUp.VerticalAlignment = VerticalAlignment.Center;
					doubleUp.MinWidth = 50;
					doubleUp.CreateBinding(DoubleUpDown.ValueProperty, element, x => {
						float val = 0;
						//float.TryParse(element.Value, out val);
						try {
							val = XmlConvert.ToSingle(element.Value);
						}catch(Exception err){
							dbg.Error(err);
						}
						return val;
					}, (o, v) => {
						o.Value = XmlConvert.ToString(v);
					});
					felem = doubleUp;
					break;
				case "boolean":
					CheckBox chBox = new CheckBox();
					chBox.Margin = new Thickness(3);
					chBox.CreateBinding(CheckBox.IsCheckedProperty, element, x => {
						bool val = false;
						bool.TryParse(element.Value, out val);
						return val;
					}, (o, v) => {
						o.Value = v.ToString();
					});
					felem = chBox;
					break;
				default:
					TextBox tbox = new TextBox();
					tbox.Margin = new Thickness(3);
					tbox.CreateBinding(TextBox.TextProperty, element, x => x.Value, (o, v) => {
						o.Value = v;
					});
					tbox.MinWidth = 50;
					tbox.VerticalAlignment = System.Windows.VerticalAlignment.Center;
					felem = tbox;
					break;
			}
			return felem;
		}
        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);

            ////////
            // State
            m_integerUpDown_state = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_state = new ValidatorPanel(m_integerUpDown_state, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_state = new Label() { Content = "State: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_state = new Grid();
            grid_state.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_state.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_state.SetRowColumn(validator_state, 1, 0);
            grid_state.SetRowColumn(label_state, 0, 0);
            grid_main.SetRowColumn(grid_state, 2, 0);

            ////////
            // FIN
            ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] {
                validator_name,
                validator_state
            }};
        }
        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            /*m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);*/

            ////////
            // Priority
            m_integerUpDown_priority = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_priority = new ValidatorPanel(m_integerUpDown_priority, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_priority = new Label() { Content = "Priority: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_priority = new Grid();
            grid_priority.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_priority.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_priority.SetRowColumn(validator_priority, 1, 0);
            grid_priority.SetRowColumn(label_priority, 0, 0);
            grid_main.SetRowColumn(grid_priority, 2, 0);

            ////////
            // X
            /*m_doubleUpDown_x = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_x = new ValidatorPanel(m_doubleUpDown_x, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_x = new Label() { Content = "X: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_x = new Grid();
            grid_x.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_x.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_x.SetRowColumn(validator_x, 1, 0);
            grid_x.SetRowColumn(label_x, 0, 0);
            grid_main.SetRowColumn(grid_x, 3, 0);*/

            ////////
            // Y
            /*m_doubleUpDown_y = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_y = new ValidatorPanel(m_doubleUpDown_y, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_y = new Label() { Content = "Y: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_y = new Grid();
            grid_y.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_y.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_y.SetRowColumn(validator_y, 1, 0);
            grid_y.SetRowColumn(label_y, 0, 0);
            grid_main.SetRowColumn(grid_y, 4, 0);*/

            ////////
            // Data
            m_grid_data = new Grid();
            m_grid_data.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            Grid grid_newData = new Grid();
            Label label_data = new Label() { Content = "Data: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            var enumNames = Enum.GetNames(typeof(UserControl_LevelLayoutData.DataType));
            var enumValues = Enum.GetValues(typeof(UserControl_LevelLayoutData.DataType)).OfType<UserControl_LevelLayoutData.DataType>().ToArray();
            for(int i = 0, j = enumNames.Length, percent = 100 / j; i < j; ++i)
            {
                var enumName = enumNames[i];
                var enumValue = enumValues[i];

                grid_newData.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(percent, GridUnitType.Star) });
                Button button_addNewData = new Button() { Content = "+ " + enumName };
                button_addNewData.Click += (x,y) =>
                    {
                        var ev = enumValue;
                        AddLevelLayoutDataControl(ev);
                    };
                grid_newData.SetRowColumn(button_addNewData, 0, i);
            }
            Grid grid_data = new Grid();
            grid_data.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_data.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_data.SetRowColumn(m_grid_data, 2, 0);
            grid_data.SetRowColumn(grid_newData, 1, 0);
            grid_data.SetRowColumn(label_data, 0, 0);
            grid_main.SetRowColumn(grid_data, 5, 0);

            ////////
            // FIN
            ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_integerUpDown_priority, Validators = new ValidatorBase[] {
                //validator_name,
                validator_priority,
                //validator_x,
                //validator_y
            }};
        }
예제 #43
0
 public FrameworkElement ResolveEditor(PropertyItem propertyItem)
 {
     var editor = new IntegerUpDown();
     editor.TextAlignment = System.Windows.TextAlignment.Left;
     var attr = propertyItem.PropertyDescriptor.Attributes.OfType<RangeAttribute>().FirstOrDefault();
     editor.Value = (int)propertyItem.Value;
     editor.Minimum = (int)attr.Minimum;
     editor.Maximum = (int)attr.Maximum;
     return editor;
 }
            public UserControl_IntData(string dataName, int dataValue)
                : base(dataName)
            {
                var grid_main = Content as Grid;
                if (grid_main != null)
                {

                    var control_dataValue = new IntegerUpDown();
                    Binding binding_control_dataValue =
                        new Binding("DataValue")
                        {
                            Source = this,
                            Mode = BindingMode.TwoWay
                        };
                    control_dataValue.SetBinding(IntegerUpDown.ValueProperty, binding_control_dataValue);

                    grid_main.SetRowColumn(control_dataValue, 0, 1);
                }

                DataValue = dataValue;
            }
        protected override void SetThisContent()
        {
            Grid grid_main = new Grid();
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            ////////
            // Id
            m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
            Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_id = new Grid();
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid_id.SetRowColumn(m_textBlock_id, 0, 1);
            grid_id.SetRowColumn(label_id, 0, 0);
            grid_main.SetRowColumn(grid_id, 0, 0);

            ////////
            // Name
            m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
            Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_name = new Grid();
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_name.SetRowColumn(validator_name, 1, 0);
            grid_name.SetRowColumn(label_name, 0, 0);
            grid_main.SetRowColumn(grid_name, 1, 0);

            ////////
            // Order
            m_integerUpDown_order = new IntegerUpDown() { VerticalAlignment = VerticalAlignment.Center };
            Label label_order = new Label() { Content = "Order: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_order = new Grid();
            grid_order.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_order.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_order.SetRowColumn(m_integerUpDown_order, 1, 0);
            grid_order.SetRowColumn(label_order, 0, 0);
            grid_main.SetRowColumn(grid_order, 2, 0);

            ////////
            // Width
            m_doubleUpDown_width = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_width = new ValidatorPanel(m_doubleUpDown_width, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_width = new Label() { Content = "Width: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_width = new Grid();
            grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_width.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_width.SetRowColumn(validator_width, 1, 0);
            grid_width.SetRowColumn(label_width, 0, 0);
            grid_main.SetRowColumn(grid_width, 3, 0);

            ////////
            // Height
            m_doubleUpDown_height = new DoubleUpDown() { VerticalAlignment = VerticalAlignment.Center };
            ValidatorPanel validator_height = new ValidatorPanel(m_doubleUpDown_height, IntegerUpDown.ValueProperty, new Validate_NotNull());
            Label label_height = new Label() { Content = "Height: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
            Grid grid_height = new Grid();
            grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_height.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid_height.SetRowColumn(validator_height, 1, 0);
            grid_height.SetRowColumn(label_height, 0, 0);
            grid_main.SetRowColumn(grid_height, 4, 0);

            ////////
            // FIN
            ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] {
                validator_name,
                validator_width,
                validator_height
            }};
        }
	    private Control GetControlByType(RdlType.ReportParameterType parameter, Binding paramValueBind)
	    {
            Control paramControl = new TextBox();
	        BindingExpressionBase expr = null;

	        if (parameter.HasValidValues)
	        {
	            paramControl = new ComboBox()
	            {
	                ItemsSource = viewModel.ReportType.GetReportParameterValidValues(parameter.Name),
	                SelectedValuePath = "Value",
	                DisplayMemberPath = "Key"
	            };

	            expr = paramControl.SetBinding(ComboBox.SelectedValueProperty, paramValueBind);
	        }
	        else
	        {

	            switch (parameter.DataType)
	            {
	                case RdlType.ReportParameterType.DataTypeEnum.DateTime:
	                    paramControl = new DatePicker();
	                    expr = paramControl.SetBinding(DatePicker.SelectedDateProperty, paramValueBind);
	                    break;

	                case RdlType.ReportParameterType.DataTypeEnum.Boolean:
	                    paramControl = new CheckBox();
	                    expr = paramControl.SetBinding(CheckBox.IsCheckedProperty, paramValueBind);
	                    break;

	                case RdlType.ReportParameterType.DataTypeEnum.Integer:
	                    paramControl = new IntegerUpDown();
	                    expr = paramControl.SetBinding(IntegerUpDown.ValueProperty, paramValueBind);
	                    break;

	                case RdlType.ReportParameterType.DataTypeEnum.Float:
	                    paramControl = new DecimalUpDown();
	                    expr = paramControl.SetBinding(DecimalUpDown.ValueProperty, paramValueBind);
	                    break;

	                default:
	                    expr = paramControl.SetBinding(TextBox.TextProperty, paramValueBind);
	                    break;
	            }
	        }
           
	        viewModel.ClearParameters += (sender, args) => expr.UpdateTarget();
	        return paramControl;
	    }