Exemple #1
0
        public void SetFolderInfo()
        {
            try
            {
                try { if (!Directory.Exists(this.NodePath))
                      {
                          Directory.CreateDirectory(this.NodePath);
                      }
                }
                catch (IOException) { /* DO NOTHING - P. bug #5551: Cannot create directory because already exists. */ }

                int childFolders = FolderService.GetNumChildFolders(this.NodePath);
                int childFiles   = FolderService.GetNumChildFiles(this.NodePath, true);

                OnUiThread(() =>
                {
                    this.Information = String.Format("{0} {1} | {2} {3}",
                                                     childFolders, childFolders == 1 ? UiResources.SingleFolder.ToLower() : UiResources.MultipleFolders.ToLower(),
                                                     childFiles, childFiles == 1 ? UiResources.SingleFile.ToLower() : UiResources.MultipleFiles.ToLower());
                });
            }
            catch (Exception) { }
        }
        public void SetFolderInfo()
        {
            try
            {
                try { if (!Directory.Exists(this.NodePath))
                      {
                          Directory.CreateDirectory(this.NodePath);
                      }
                }
                catch (IOException) { /* DO NOTHING - Cannot create directory because already exists. */ }

                int childFolders = FolderService.GetNumChildFolders(this.NodePath);
                int childFiles   = FolderService.GetNumChildFiles(this.NodePath, true);

                string infoString = ResourceService.UiResources.GetString("UI_EmptyFolder");
                if (childFolders > 0 && childFiles > 0)
                {
                    infoString = string.Format("{0} {1}, {2} {3}",
                                               childFolders, childFolders == 1 ? this.SingleForderString : this.MultipleFordersString,
                                               childFiles, childFiles == 1 ? this.SingleFileString : this.MultipleFilesString);
                }
                else if (childFolders > 0)
                {
                    infoString = string.Format("{0} {1}", childFolders,
                                               childFolders == 1 ? this.SingleForderString : this.MultipleFordersString);
                }
                else if (childFiles > 0)
                {
                    infoString = string.Format("{0} {1}", childFiles,
                                               childFiles == 1 ? this.SingleFileString : this.MultipleFilesString);
                }

                OnUiThread(() => this.Contents = infoString);
            }
            catch (Exception) { }
        }