private UserControl GetDataRepositoryContentUserControl()
        {
            DataRepositoryContentUserControl userControl = new DataRepositoryContentUserControl();

            userControl.DataRepositoryItemMouseDoubleClick += UserControl_DataRepositoryItemMouseDoubleClick;

            string header1 = GisEditor.LanguageManager.GetStringResource("FolderDataRepositoryUserControlTypeText");
            DataRepositoryGridColumn column1 = new DataRepositoryGridColumn(header1, 70, di => di.Category);

            string header2 = GisEditor.LanguageManager.GetStringResource("CommonSizeText");
            DataRepositoryGridColumn column2 = new DataRepositoryGridColumn(header2, 100);

            column2.CellContentConvertHandler = di =>
            {
                FileDataRepositoryItem fileDataRepositoryItem = di as FileDataRepositoryItem;
                if (fileDataRepositoryItem != null)
                {
                    return(String.Format(CultureInfo.InvariantCulture, "{0:N0} KB"
                                         , (int)Math.Ceiling((double)fileDataRepositoryItem.FileInfo.Length / 1024d)));
                }
                else
                {
                    return(Binding.DoNothing);
                }
            };

            userControl.Columns.Add(column1);
            userControl.Columns.Add(column2);

            return(userControl);
        }
        private void RefreshLocalFiles(FolderDataRepositoryItem folderItem)
        {
            if (folderItem != null && !isUpdating)
            {
                isUpdating = true;
                if (Directory.Exists(folderItem.FolderInfo.FullName))
                {
                    Children.Clear();
                    foreach (var item in GetAllSubItemsFromFolder(folderItem.FolderInfo.FullName))
                    {
                        DataRepositoryItem dataRepositoryItem;
                        if (File.Exists(item))
                        {
                            dataRepositoryItem = new FileDataRepositoryItem(item);
                        }
                        else
                        {
                            dataRepositoryItem = new FolderDataRepositoryItem(item, false);
                        }

                        dataRepositoryItem.Parent     = this;
                        dataRepositoryItem.IsExpanded = GisEditor.DataRepositoryManager.ExpandedFolders.Contains(dataRepositoryItem.Id);
                        Children.Add(dataRepositoryItem);
                    }
                }
                else
                {
                    Parent.Refresh();
                }
                isUpdating = false;
            }
        }
Exemple #3
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            FileDataRepositoryItem fileDataItem = value as FileDataRepositoryItem;

            if (fileDataItem != null)
            {
                return(String.Format(CultureInfo.InvariantCulture, "{0:N0} KB"
                                     , (int)Math.Ceiling((double)fileDataItem.FileInfo.Length / 1024d)));
            }

            return(Binding.DoNothing);
        }
Exemple #4
0
 internal static void PlaceFilesOnMap(FileDataRepositoryItem fileDataItem)
 {
     PlaceFilesOnMap(new string[] { fileDataItem.FileInfo.FullName });
 }