Пример #1
0
        void propertyItems_ItemDeleted(object sender, GridItemEventArgs e)
        {
            selectedProperty = null;

            txtDefaultValue.Text        = txtPropertyName.Text = string.Empty;
            cmbSearchType.SelectedIndex = -1;
            dgrPropertySearch.Rows.Clear();
        }
Пример #2
0
        private void AddNewProperty_Click(object sender, EventArgs e)
        {
            UpdateSelectedProperty(true);

            WindowsProperty property = new WindowsProperty();

            txtPropertyName.Text = property.Name;
            txtDescription.Text  = property.Description;
            txtDefaultValue.Text = property.DefaultValue;

            propertyItems.AddNewItem(property);
        }
Пример #3
0
        void INvnControl.Open(Dictionary <string, object> objects)
        {
            Dictionary <string, WindowsProperty> properties = (Dictionary <string, WindowsProperty>)objects["Properties"];

            // create items in datagrid
            propertyItems.ClearItems();
            foreach (string id in properties.Keys)
            {
                WindowsProperty property = properties[id];
                propertyItems.AddNewItem(property);
            }
        }
Пример #4
0
        void propertyItems_ItemSelectionChanged(object sender, GridItemEventArgs e)
        {
            UpdateSelectedProperty(true);

            if (e.SelectedItem != null)
            {
                WindowsProperty property = (WindowsProperty)e.SelectedItem;
                txtPropertyName.Text       = property.Name;
                txtDescription.Text        = property.Description;
                txtDefaultValue.Text       = property.DefaultValue;
                selectedProperty           = property;
                cmbSearchType.SelectedItem = property.SearchType.ToString();
            }
        }
Пример #5
0
        private void UpdateSelectedProperty(bool setSelectedItemNull)
        {
            if (selectedProperty != null)
            {
                selectedProperty.DefaultValue = txtDefaultValue.Text;
                selectedProperty.Description  = txtDescription.Text;
                selectedProperty.Name         = txtPropertyName.Text;

                switch (selectedProperty.SearchType)
                {
                case PropertySearchType.DirectorySearch:
                    DirectorySearch dirSearch = (DirectorySearch)selectedProperty.propSearch[PropertySearchType.DirectorySearch];
                    dirSearch.DirectoryPath = (string)dgrPropertySearch[1, 0].Value;
                    dirSearch.Depth         = (string)dgrPropertySearch[1, 1].Value;
                    break;

                case PropertySearchType.FileSearch:
                    FileSearch fileSearch = (FileSearch)selectedProperty.propSearch[PropertySearchType.FileSearch];
                    fileSearch.DirectoryPath = (string)dgrPropertySearch[1, 0].Value;
                    fileSearch.Depth         = (string)dgrPropertySearch[1, 1].Value;
                    fileSearch.FileName      = (string)dgrPropertySearch[1, 2].Value;
                    break;

                case PropertySearchType.INISearch:
                    INISearch iniSearch = (INISearch)selectedProperty.propSearch[PropertySearchType.INISearch];
                    iniSearch.Name    = (string)dgrPropertySearch[1, 0].Value;
                    iniSearch.Section = (string)dgrPropertySearch[1, 1].Value;
                    iniSearch.Key     = (string)dgrPropertySearch[1, 2].Value;
                    break;

                case PropertySearchType.RegistrySearch:
                    RegistrySearch regSearch = (RegistrySearch)selectedProperty.propSearch[PropertySearchType.RegistrySearch];
                    regSearch.Root = (string)dgrPropertySearch[1, 0].Value;
                    regSearch.Key  = (string)dgrPropertySearch[1, 1].Value;
                    regSearch.Name = (string)dgrPropertySearch[1, 2].Value;
                    break;
                }

                if (UserDefinedPropertyChanged != null)
                {
                    UserDefinedPropertyChanged(null, null);
                }
            }

            if (setSelectedItemNull)
            {
                selectedProperty = null;
            }
        }