Esempio n. 1
0
        private void _addSelectAll(Grid grid, CheckBox selectAll)
        {
            List <CheckBox> boxes = DisplayablePropertyHelper.FindAll <CheckBox>(grid);

            boxes.ForEach(WpfUtils.AddMouseInOutEffectsBox);
            bool eventsActive = true;

            WpfUtils.AddMouseInOutEffectsBox(selectAll);

            foreach (var box in boxes)
            {
                box.Checked += delegate {
                    if (eventsActive)
                    {
                        _checkAllSelected(boxes, selectAll, true);
                    }
                };

                box.Unchecked += delegate {
                    if (eventsActive)
                    {
                        _checkAllSelected(boxes, selectAll, false);
                    }
                };
            }

            selectAll.Checked += delegate {
                eventsActive = false;

                foreach (var box in boxes)
                {
                    if (box.IsChecked == false)
                    {
                        box.IsChecked = true;
                    }
                }

                eventsActive = true;
            };

            selectAll.Unchecked += delegate {
                eventsActive = false;

                foreach (var box in boxes)
                {
                    if (box.IsChecked == true)
                    {
                        box.IsChecked = false;
                    }
                }

                eventsActive = true;
            };
        }
Esempio n. 2
0
        private void _loadAutocomplete()
        {
            Binder.Bind(_cbAcIdDn, () => ProjectConfiguration.AutocompleteIdDisplayName);
            Binder.Bind(_cbAcUnDn, () => ProjectConfiguration.AutocompleteUnDisplayName);
            Binder.Bind(_cbAcIdRn, () => ProjectConfiguration.AutocompleteIdResourceName);
            Binder.Bind(_cbAcUnRn, () => ProjectConfiguration.AutocompleteUnResourceName);
            Binder.Bind(_cbAcIdDesc, () => ProjectConfiguration.AutocompleteIdDescription);
            Binder.Bind(_cbAcUnDesc, () => ProjectConfiguration.AutocompleteUnDescription);
            Binder.Bind(_tbPropFormat, () => ProjectConfiguration.AutocompleteDescriptionFormat);
            Binder.Bind(_cbAcNumberOfSlot, () => ProjectConfiguration.AutocompleteNumberOfSlot);
            Binder.Bind(_cbAcEmptyFields, () => ProjectConfiguration.AutocompleteFillOnlyEmptyFields);
            Binder.Bind(_tbUnDesc, () => ProjectConfiguration.AutocompleteUnDescriptionFormat);
            Binder.Bind(_tbDescNotSet, () => ProjectConfiguration.AutocompleteDescNotSet);
            Binder.Bind(_cbWriteNeutralProperty, () => ProjectConfiguration.AutocompleteNeutralProperty);
            Binder.Bind(_cbAcViewId, () => ProjectConfiguration.AutocompleteViewId);

            int index = 0;

            List <TextBox> boxes = new List <TextBox>();

            foreach (ParameterHolderKeys property in ParameterHolderKeys.Keys)
            {
                ParameterHolderKeys key = property;
                Label label             = new Label {
                    Padding = new Thickness(0), Margin = new Thickness(3), Content = property.Key
                };
                TextBox box = new TextBox {
                    Text = SdeAppConfiguration.ConfigAsker["Autocompletion - " + key.Key, key.Key], Margin = new Thickness(3)
                };

                WpfUtilities.SetGridPosition(label, index, 1, 0, 1);
                WpfUtilities.SetGridPosition(box, index, 1, 2, 1);

                _gridDescProp.Children.Add(label);
                _gridDescProp.Children.Add(box);
                _gridDescProp.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(-1, GridUnitType.Auto)
                });

                SdeAppConfiguration.Bind(box, v => SdeAppConfiguration.ConfigAsker["Autocompletion - " + key.Key] = box.Text, p => p);

                index++;
            }

            index = 0;

            foreach (string property in ParameterHolder.Properties)
            {
                TextBox box = new TextBox {
                    Text = ProjectConfiguration.AutocompleteProperties[index], Margin = new Thickness(3)
                };
                TextBlock block = new TextBlock {
                    Text = property, Margin = new Thickness(3), VerticalAlignment = VerticalAlignment.Center
                };

                WpfUtilities.SetGridPosition(block, index / 2 + 4, 2 * (index % 2));
                WpfUtilities.SetGridPosition(box, index / 2 + 4, 2 * (index % 2) + 1);

                boxes.Add(box);
                _gridDescription.Children.Add(box);
                _gridDescription.Children.Add(block);

                SdeAppConfiguration.Bind(box, v => ProjectConfiguration.AutocompleteProperties = v, q => boxes.Select(p => p.Text).ToList());

                index++;
            }

            DisplayablePropertyHelper.FindAll <CheckBox>(_gridAutocomplete).ForEach(WpfUtils.AddMouseInOutEffectsBox);
        }