예제 #1
0
        private void LoadCategoriesAndCountCommand()
        {
            List <Model.RevitBase> loadedCategories = GroupByCategory.Execute(SQLDB, SelectedDatabase);

            loadedCategories.ForEach(cat => CategoriesAndCount.Add(cat));

            foreach (Model.RevitCategories cat in loadedCategories)
            {
                try
                {
                    DictCategoriesAndCount.Add(cat.CategoryName, cat.CategoryCount);
                }
                catch
                {
                    DictCategoriesAndCount[cat.CategoryName] = cat.CategoryCount;
                }
            }

            List <Model.RevitBase> existingCategories = CategoriesAndCount.ToList();

            foreach (Model.RevitCategories cat in existingCategories)
            {
                int count = 0;

                if (DictCategoriesAndCount.TryGetValue(cat.CategoryName, out count))
                {
                    cat.VariationOnPrevious = cat.CategoryCount - count;
                }
                else
                {
                    cat.VariationOnPrevious = cat.CategoryCount;
                }
            }
        }
예제 #2
0
        private void FilterCategory()
        {
            BackupCategoriesAndCount = new List <Model.RevitBase>(CategoriesAndCount);

            try
            {
                for (int i = CategoriesAndCount.Count - 1; i >= 0; i--)
                {
                    //Model.RevitElement rl = CategoriesAndCount[i] as Model.RevitElement; either do a casting or move the property to the base class

                    if (CategoriesAndCount[i].CategoryName != SelectedRevitElement.CategoryName)
                    {
                        CategoriesAndCount.RemoveAt(i);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #3
0
        private void ChangeColors()
        {
            List <Model.RevitBase> currentList = CategoriesAndCount.ToList();

            CategoriesAndCount.Clear();

            //var random = new Random();
            //var color = String.Format("#{0:X6}", random.Next(0x1000000));

            var groupByColor = currentList.GroupBy(item => item.ColorSet).Select(group => group);

            string[] color = new string[] { "#4287f5", "#0e9c44", "#adb837", "#b84837" };

            for (int i = 0; i < groupByColor.Count(); i++)
            {
                foreach (var per in groupByColor.ElementAt(i))
                {
                    per.ColorSet = color[i];
                    CategoriesAndCount.Add(per);
                }
            }
        }
예제 #4
0
 private void ClearDBList()
 {
     CategoriesAndCount.Clear();
 }
예제 #5
0
 private void LoadAllRevitElementsCommand()
 {
     LoadAllRevitElements.Execute(SQLDB, SelectedDatabase).ForEach(cat => CategoriesAndCount.Add(cat));
 }
예제 #6
0
 private void UndoFilter()
 {
     CategoriesAndCount.Clear();
     CategoriesAndCount = new ObservableCollection <Model.RevitBase>(BackupCategoriesAndCount);
 }