/// <summary> /// Method can be invoked in PRISM MEF module registration to register a new document (viewmodel) /// type and its default file extension. The result of this call is an <seealso cref="IDocumentType"/> /// object and a <seealso cref="RegisterDocumentTypeEvent"/> event to inform listers about the new /// arrival of the new document type. /// </summary> /// <param name="key"></param> /// <param name="description"></param> /// <param name="fileFilterName"></param> /// <param name="defaultFilter"></param> /// <param name="fileOpenMethod"></param> /// <param name="createDocumentMethod"></param> /// <param name="t"></param> /// <param name="sortPriority"></param> /// <returns></returns> public IDocumentType RegisterDocumentType(string key, string description, string fileFilterName, string defaultFilter, FileOpenDelegate fileOpenMethod, CreateNewDocumentDelegate createDocumentMethod, Type t, int sortPriority = 0) { try { Messaging.Output.Append(string.Format("{0} Registering document type: {1} ...", DateTime.Now.ToLongTimeString(), description)); var newFileType = new DocumentType(key, description, fileFilterName, defaultFilter, fileOpenMethod, createDocumentMethod, t, sortPriority); _DocumentTypes.Add(newFileType); _DocumentTypes.Sort(i => i.SortPriority, ListSortDirection.Ascending); return(newFileType); } catch (Exception exp) { Messaging.Output.AppendLine(exp.Message); Messaging.Output.AppendLine(exp.StackTrace); } finally { Messaging.Output.AppendLine("Done."); } return(null); }
/// <summary> /// Method can be invoked in PRISM MEF module registration to register a new document (viewmodel) /// type and its default file extension. The result of this call is an <seealso cref="IDocumentType"/> /// object and a <seealso cref="RegisterDocumentTypeEvent"/> event to inform listers about the new /// arrival of the new document type. /// </summary> /// <param name="Key"></param> /// <param name="Description"></param> /// <param name="FileFilterName"></param> /// <param name="DefaultFilter"></param> /// <param name="FileOpenMethod"></param> /// <param name="CreateDocumentMethod"></param> /// <param name="t"></param> /// <param name="sortPriority"></param> /// <returns></returns> public IDocumentType RegisterDocumentType(string Key, string Description, string FileFilterName, string DefaultFilter, FileOpenDelegate FileOpenMethod, CreateNewDocumentDelegate CreateDocumentMethod, Type t, int sortPriority = 0) { var newFileType = new DocumentType(Key, Description, FileFilterName, DefaultFilter, FileOpenMethod, CreateDocumentMethod, t, sortPriority); this.mDocumentTypes.Add(newFileType); this.mDocumentTypes.Sort(i => i.SortPriority, System.ComponentModel.ListSortDirection.Ascending); return(newFileType); }
/// <summary> /// Method can be invoked in PRISM MEF module registration to register a new document (viewmodel) /// type and its default file extension. The result of this call is an <seealso cref="IDocumentType"/> /// object and a <seealso cref="RegisterDocumentTypeEvent"/> event to inform listers about the new /// arrival of the new document type. /// </summary> /// <param name="key"></param> /// <param name="description"></param> /// <param name="fileFilterName"></param> /// <param name="defaultFilter"></param> /// <param name="fileOpenMethod"></param> /// <param name="createDocumentMethod"></param> /// <param name="t"></param> /// <param name="sortPriority"></param> /// <returns></returns> public IDocumentType RegisterDocumentType(string key, string description, string fileFilterName, string defaultFilter, FileOpenDelegate fileOpenMethod, CreateNewDocumentDelegate createDocumentMethod, Type t, int sortPriority = 0) { var newFileType = new DocumentType(key, description, fileFilterName, defaultFilter, fileOpenMethod, createDocumentMethod, t, sortPriority); _mDocumentTypes.Add(newFileType); _mDocumentTypes.Sort(i => i.SortPriority, ListSortDirection.Ascending); return(newFileType); }
/// <summary> /// Class constructor. /// </summary> /// <param name="key"></param> /// <param name="description"></param> /// <param name="fileFilterName"></param> /// <param name="defaultFilter"></param> /// <param name="fileOpenMethod"></param> /// <param name="classType"></param> /// <param name="sortPriority"></param> public DocumentType(string key, string description, string fileFilterName, string defaultFilter, FileOpenDelegate fileOpenMethod, CreateNewDocumentDelegate createDocumentMethod, Type classType, int sortPriority = 0) { this.Key = key; this.Description = description; this.FileFilterName = fileFilterName; this.SortPriority = sortPriority; this.DefaultFilter = defaultFilter; this.FileOpenMethod = fileOpenMethod; this.CreateDocumentMethod = createDocumentMethod; this.ClassType = classType; this.FileTypeExtensions = null; }