Пример #1
0
 /// <summary>
 /// A factory method (Not really a factory) that initializes a new project type
 /// with the specified properties and returns it.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="name"></param>
 /// <param name="type"></param>
 /// <param name="defaultPN"></param>
 /// <returns></returns>
 public static ProjectType InitType(string id, string name, string type, string defaultPN)
 {
     ProjectType pt = new ProjectType();
     pt.ID = id;
     pt.Name = name;
     pt.Type = type;
     pt.DefaultProjectName = defaultPN;
     return pt;
 }
Пример #2
0
 /// <summary>
 /// Adds a thumbnail to the project type and configures the uri used
 /// to determine the location of the thumbnail to be indeterminate on whether
 /// it is absolute or relative. This overload is mainly meant for code breverity.
 /// </summary>
 /// <param name="location"></param>
 /// <param name="pt"></param>
 /// <returns></returns>
 public static ProjectType AddThumbnail(string location, ProjectType pt)
 {
     BitmapImage logo = new BitmapImage();
     logo.BeginInit();
     logo.UriSource = new Uri(location, UriKind.RelativeOrAbsolute);
     logo.EndInit();
     pt.Icon = logo;
     return pt;
 }
 /// <summary>
 /// A method to register a type of project.
 /// 
 /// Note that in any place where a project type is used,
 /// ProjectType typeA;
 /// ProjectTypeRegistry.RegisteredTypes.TryGetValue(typeUsedInContext.ID, typeA);
 /// (typeUsedInContext == typeA) is always true
 /// </summary>
 /// <param name="typeToRegister"></param>
 public static void RegisterProjectType(ProjectType typeToRegister)
 {
     if (typeToRegister == null) throw new ArgumentNullException();
     if (String.IsNullOrEmpty(typeToRegister.ID.Trim())) throw new ArgumentException("New project type to be registered's ID string is Null! This is... Unacceptable!!!");
     if (!RegisteredTypes.ContainsKey(typeToRegister.ID))
     {
         RegisteredTypes.Add(typeToRegister.ID, typeToRegister);
         if(TypesChanged != null) TypesChanged(new EventArgs(), typeToRegister);
     }
 }
Пример #4
0
 public static void Reg(ProjectType pt)
 {
     Register(pt);
 }
Пример #5
0
 /// <summary>
 /// Registers the project type with the static class ProjectTypeRegistry.
 /// </summary>
 /// <param name="pt"></param>
 public static void Register(ProjectType pt)
 {
     Projects.ProjectTypeRegistry.RegisterProjectType(pt);
 }
 public void OnProjectsChanged(EventArgs e, ProjectType p)
 {
     ProjectTypes.Add(p);
 }