Example #1
0
        public void GenerateHistoryGrid()
        {
            string[] ImageList = Directory.GetFiles(System.IO.Path.GetTempPath() + "FamilyBrowser\\");

            if (collectedData != Properties.Settings.Default.CollectedData || ImageList.Length != ImageListLength)
            {
                ImageListLength = ImageList.Length;
                collectedData   = Properties.Settings.Default.CollectedData;
                ObservableCollection <FamilyData> collectionData = new ObservableCollection <FamilyData>();
                List <string> listData = new List <string>(collectedData.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries));
                DirectoryInfo di       = new DirectoryInfo(System.IO.Path.GetTempPath() + "FamilyBrowser\\RevitLogo.bmp");
                foreach (var item in listData)
                {
                    int      index   = item.IndexOf('#');
                    string[] symbols = item.Substring(index + 1).Split('#');
                    foreach (var symbol in symbols)
                    {
                        FamilyData projectInstance = new FamilyData();
                        projectInstance.Name = symbol;
                        projectInstance.img  = new Uri(di.ToString());

                        try
                        {
                            projectInstance.FamilyName = item.Substring(0, index);
                        }
                        catch (Exception)
                        {
                            projectInstance.FamilyName = "NO FAMILY NAME";
                        }

                        foreach (var imageName in ImageList)
                        {
                            if (imageName.Contains(projectInstance.Name))
                            {
                                projectInstance.img = new Uri(imageName);
                            }
                        }
                        collectionData.Add(projectInstance);
                    }
                }

                collectionData = new ObservableCollection <FamilyData>(collectionData.Reverse());

                foreach (var symbol in collectionData)
                {
                    if (symbol.img == new Uri(di.ToString()))
                    {
                        foreach (var item in collectionData)
                        {
                            if (item.FamilyName == symbol.FamilyName && item.img != new Uri(di.ToString()))
                            {
                                symbol.img = item.img;
                            }
                        }
                    }
                }
                ListCollectionView collectionProject = new ListCollectionView(collectionData);
                collectionProject.GroupDescriptions.Add(new PropertyGroupDescription("FamilyName"));
                dataGridHistory.ItemsSource = collectionProject;
            }
        }
Example #2
0
 private void SetProperty(FamilyData instance)
 {
     Properties.Settings.Default.FamilyPath   = instance.FullName;
     Properties.Settings.Default.FamilySymbol = instance.Name;
     Properties.Settings.Default.FamilyName   = instance.FamilyName;
 }
Example #3
0
 private void SetHistoryProperty(FamilyData instance)
 {
     Properties.Settings.Default.FamilyPath   = string.Empty;
     Properties.Settings.Default.FamilySymbol = instance.Name;
     Properties.Settings.Default.FamilyName   = instance.FamilyName;
 }
Example #4
0
 private void SetHistoryTemp(FamilyData instance)
 {
     tempFamilyPath   = string.Empty;
     tempFamilySymbol = instance.Name;
     tempFamilyName   = instance.FamilyName;
 }