Ejemplo n.º 1
0
        public ContentTypeModel(ContentType contentType, Action updateFolderDetail)
        {
            ContentType = contentType;
            Folder      = contentType.Folder;
            Description = contentType.Description;

            // add a validation pattern (checked elsewhere to ensure the base folder matches the description, i.e. to avoid any unexpected folders being specified (e.g. c:\)
            // - refer FilePatternValidation
            if (!contentType.IsDatabase)
            {
                Pattern = contentType.Description;
            }

            Extensions = string.Join(", ", contentType.Extensions);

            TextChangedCommand = new ActionCommand(() =>
            {
                // for storage
                contentType.Folder     = Folder;
                contentType.Extensions = Extensions;
                updateFolderDetail();
            });

            FolderExplorerCommand = new ActionCommand(() => FolderUtil.Get(Description, Folder, folder =>
            {
                // for display
                Folder = folder;

                // for storage
                contentType.Folder = folder;
                updateFolderDetail();
            }));
        }
Ejemplo n.º 2
0
        public FolderTypeModel(string description, string folder, Action <string> setFolder)
        {
            Folder      = folder;
            Description = description;

            TextChangedCommand = new ActionCommand(() =>
            {
                // for storage
                setFolder(Folder);
            });

            FolderExplorerCommand = new ActionCommand(() => FolderUtil.Get(Description, Folder, updateFolder =>
            {
                // for display & storage.. storage is triggered via the TextChangedCommand
                Folder = updateFolder;
            }));
        }