Exemplo n.º 1
0
        public static void StartProject()
        {
            XmlNodeList nodeList = Project.GetNodes(Project.ProjectRootNodeName + "/shells/*");

            foreach (XmlNode p in nodeList)
            {
                Shell shell = OpenShell(p);
                if (shell.MainControl == null)
                {
                    string controlKind          = Project.GetNodeAttributeValue(p, "controlkind", null);
                    ShellDeserializerDelegate d = GetShellDeserializer(controlKind);
                    if (d != null)
                    {
                        if (!shell.SetControl(d(shell.ShellId, p)))
                        {
                            // return "Error: unable to create shell control.";
                        }
                    }
                }
            }
            Shell s = GetShell(ConsoleShellId);

            if (s != null)
            {
                s.SetActive();
            }
        }
Exemplo n.º 2
0
 internal static void ScanTypeForShellDeserializers(Type targetType)
 {
     foreach (MethodInfo info in targetType.GetMethods(BindingFlags.Public | BindingFlags.Static))
     {
         foreach (Attribute attr in Attribute.GetCustomAttributes(info))
         {
             if (attr.GetType() == typeof(ShellDeserializerAttribute))
             {
                 try {
                     ShellDeserializerAttribute shellAttr = (ShellDeserializerAttribute)attr;
                     string name = shellAttr.Name;
                     if (ShellDeserializers.ContainsKey(name))
                     {
                         ShellDeserializers.Remove(name);
                     }
                     ShellDeserializerDelegate d = (ShellDeserializerDelegate)info.CreateDelegate(typeof(ShellDeserializerDelegate));
                     ShellDeserializers.Add(name, d);
                 } catch (Exception e) {
                     Settings.BugReport("Problem with shell deserializer: " + e.Message);
                 }
             }
         }
     }
 }