コード例 #1
0
ファイル: EntityTree.xaml.cs プロジェクト: masixian/revit-ifc
        private void ComboBox_IFCSchema_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string currSelEntity = null;
            string currSelPdef   = null;

            if (m_SingleNodeSelection)
            {
                currSelEntity = PrevSelEntityItem?.Name;
                currSelPdef   = PrevSelPDefItem?.Name;
            }

            string selIFCSchema = ComboBox_IFCSchema.SelectedItem.ToString();

            if (!m_IfcVersion.Equals(selIFCSchema))
            {
                m_IfcVersion = selIFCSchema;
                m_EntityTrie = new IFCEntityTrie();
                LoadTreeviewFilterElement();

                if (m_SingleNodeSelection)
                {
                    PreSelectItem(currSelEntity, currSelPdef);
                }
                else
                {
                    PredefinedTypeTreeView.ItemsSource = null;
                    PrevSelPDefItem = null;
                }
                IfcSchemaEntityTree.GenerateEntityTrie(ref m_EntityTrie);
            }
        }
コード例 #2
0
ファイル: EntityTree.xaml.cs プロジェクト: masixian/revit-ifc
        void InitializeEntityTree(string preSelectEntity, string preSelectPDef)
        {
            IfcSchemaEntityTree.GetAllEntityDict();
            InitializeComponent();

            textBox_Search.Focus();

            if (m_SingleNodeSelection)
            {
                label_Show.Visibility         = System.Windows.Visibility.Hidden;
                comboBox_ShowItems.Visibility = System.Windows.Visibility.Hidden;
            }
            else
            {
                HelpRun.Text = Properties.Resources.HelpSelectEntityForExport;
                comboBox_ShowItems.ItemsSource = new List <string>()
                {
                    Properties.Resources.ShowAll, Properties.Resources.ShowChecked, Properties.Resources.ShowUnchecked
                };
                comboBox_ShowItems.SelectedIndex = 0; // Default selection to show All
            }

            // If the IFC schema version is selected for export, the combobox will be disabled for selection
            ComboBox_IFCSchema.IsEnabled = false;
            // Assign default
            if (string.IsNullOrEmpty(m_IfcVersion))
            {
                m_IfcVersion = IFCVersion.IFC4.ToString();
                ComboBox_IFCSchema.IsEnabled = true;
            }

            ComboBox_IFCSchema.ItemsSource  = IfcSchemaEntityTree.GetAllCachedSchemaNames();
            ComboBox_IFCSchema.SelectedItem = m_IfcVersion;
            if (m_SingleNodeSelection)
            {
                Grid_Main.ColumnDefinitions[2].MinWidth = 200;
            }
            else
            {
                // In multi-selection mode, hide the TreView panel for the PredefinedType
                Grid_Main.ColumnDefinitions[2].MinWidth = 0;
                GridLengthConverter grLenConv = new GridLengthConverter();
                GridLength          grLen     = (GridLength)grLenConv.ConvertFrom(0);
                Grid_Main.ColumnDefinitions[2].Width = grLen;
            }

            LoadTreeviewFilterElement();
            PreSelectItem(preSelectEntity, preSelectPDef);
            IfcSchemaEntityTree.GenerateEntityTrie(ref m_EntityTrie);
        }