Example #1
0
        public WindowAttributeMultiSelect(
            IWriteToOutput outputWindow
            , IOrganizationServiceExtented service
            , EntityMetadata entityMetadata
            , string selectedAttributes
            )
        {
            this.IncreaseInit();

            InitializeComponent();

            lstVwAttributes.ItemsSource = _sourceDataGrid;

            InputLanguageManager.SetInputLanguage(this, CultureInfo.CreateSpecificCulture("en-US"));

            this._iWriteToOutput = outputWindow;
            this._service        = service;
            this._entityMetadata = entityMetadata;

            this.tSSLblConnectionName.Content = this._service.ConnectionData.Name;

            HashSet <string> selectedAttributesColl = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);

            if (!string.IsNullOrEmpty(selectedAttributes))
            {
                var split = selectedAttributes.Split(',');

                foreach (var item in split)
                {
                    selectedAttributesColl.Add(item);
                }
            }

            foreach (var attr in _entityMetadata.Attributes.Where(a => string.IsNullOrEmpty(a.AttributeOf)).OrderBy(a => a.LogicalName))
            {
                var item = new AttributeSelectItem(attr)
                {
                    IsChecked = selectedAttributesColl.Contains(attr.LogicalName),
                };

                item.PropertyChanged += Item_PropertyChanged;

                _source.Add(item);
            }

            foreach (var item in _source.OrderBy(a => a.LogicalName))
            {
                _sourceDataGrid.Add(item);
            }

            this.DecreaseInit();

            UpdateSelectedAttributesText();

            txtBFilter.SelectionStart  = txtBFilter.Text.Length;
            txtBFilter.SelectionLength = 0;
            txtBFilter.Focus();
        }
Example #2
0
        public WindowAttributeMultiSelect(
            IWriteToOutput iWriteToOutput
            , IOrganizationServiceExtented service
            , Guid entityMetadataId
            , IEnumerable <AttributeMetadata> attributeList
            , string selectedAttributes
            ) : base(iWriteToOutput, service)
        {
            this.IncreaseInit();

            InitializeComponent();

            SetInputLanguageEnglish();

            lstVwAttributes.ItemsSource = _sourceDataGrid;

            this._entityMetadataId = entityMetadataId;

            this.tSSLblConnectionName.Content = this._service.ConnectionData.Name;

            HashSet <string> selectedAttributesColl = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase);

            if (!string.IsNullOrEmpty(selectedAttributes))
            {
                var split = selectedAttributes.Split(',');

                foreach (var item in split)
                {
                    selectedAttributesColl.Add(item);
                }
            }

            foreach (var attr in attributeList.Where(a => string.IsNullOrEmpty(a.AttributeOf)).OrderBy(a => a.LogicalName))
            {
                var item = new AttributeSelectItem(attr)
                {
                    IsChecked = selectedAttributesColl.Contains(attr.LogicalName),
                };

                item.PropertyChanged += Item_PropertyChanged;

                _source.Add(item);
            }

            foreach (var item in _source.OrderBy(a => a.LogicalName))
            {
                _sourceDataGrid.Add(item);
            }

            this.DecreaseInit();

            UpdateSelectedAttributesText();

            txtBFilter.SelectionStart  = txtBFilter.Text.Length;
            txtBFilter.SelectionLength = 0;
            txtBFilter.Focus();
        }
        private void lstVwAttributes_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                AttributeSelectItem item = GetItemFromRoutedDataContext <AttributeSelectItem>(e);

                if (item != null)
                {
                    SelectAttributeMetadataAction(item.AttributeMetadata);
                }
            }
        }