Ejemplo n.º 1
0
        private static void WriteWindowWithPropertiesFile(FileInfo windowFileInfo)
        {
            string windowName = windowFileInfo.Name.Substring(0, windowFileInfo.Name.Length - 3);

            ClassFileWriter.MethodDefinition onPropertiesSetDefinition = new ClassFileWriter.MethodDefinition
            {
                VisibilityModifier = ClassFileWriter.VisibilityModifier.Protected,
                Modifier           = ClassFileWriter.MethodDefinition.MethodModifier.Override,
                ReturnType         = "void",
                Name = "OnPropertiesSet",
                Body = "// Subscribe to CurrentProperties change events here"
            };

            ClassFileWriter.MethodDefinition unsubscribeFromPropertiesDefinition = new ClassFileWriter.MethodDefinition
            {
                VisibilityModifier = ClassFileWriter.VisibilityModifier.Protected,
                Modifier           = ClassFileWriter.MethodDefinition.MethodModifier.Override,
                ReturnType         = "void",
                Name = "UnsubscribeFromProperties",
                Body = "// Unsubscribe from CurrentProperties change events here"
            };

            ClassFileWriter.ClassDefinition propertiesDefinition = new ClassFileWriter.ClassDefinition
            {
                Attributes = new List <string> {
                    "Serializable"
                },
                Name           = "Properties",
                Superclass     = "WindowProperties",
                AdditionalBody = "// Add your custom properties here"
            };

            ClassFileWriter.ClassDefinition classDefinition = new ClassFileWriter.ClassDefinition
            {
                Imports = new List <string> {
                    "Muui", "System"
                },
                Name               = windowName,
                Superclass         = "BaseWindowController",
                SuperclassGenerics = new List <string> {
                    $"{windowName}.Properties"
                },
                InnerClasses = new List <ClassFileWriter.ClassDefinition> {
                    propertiesDefinition
                },
                Methods = new List <ClassFileWriter.MethodDefinition>
                {
                    onPropertiesSetDefinition,
                    unsubscribeFromPropertiesDefinition
                }
            };

            ClassFileWriter.WriteClassFile(windowFileInfo, classDefinition);
        }
Ejemplo n.º 2
0
        private static void WriteWindowWithoutPropertiesFile(FileInfo windowFileInfo)
        {
            string windowName = windowFileInfo.Name.Substring(0, windowFileInfo.Name.Length - 3);

            ClassFileWriter.ClassDefinition classDefinition = new ClassFileWriter.ClassDefinition
            {
                Imports = new List <string> {
                    "Muui"
                },
                Name       = windowName,
                Superclass = "BaseWindowController"
            };

            ClassFileWriter.WriteClassFile(windowFileInfo, classDefinition);
        }
Ejemplo n.º 3
0
        private static void WritePanelWithoutPropertiesFile(FileInfo panelFileInfo)
        {
            string panelName = panelFileInfo.Name.Substring(0, panelFileInfo.Name.Length - 3);

            ClassFileWriter.ClassDefinition classDefinition = new ClassFileWriter.ClassDefinition
            {
                Imports = new List <string> {
                    "Muui"
                },
                Name       = panelName,
                Superclass = "BasePanelController"
            };

            ClassFileWriter.WriteClassFile(panelFileInfo, classDefinition);
        }
Ejemplo n.º 4
0
        private static void WritePanelPresenterWithPropertiesFile(FileInfo panelFileInfo)
        {
            string   panelName         = panelFileInfo.Name.Substring(0, panelFileInfo.Name.Length - 3);
            string   presenterName     = $"{panelName}Presenter";
            string   presenterPath     = Path.Combine(panelFileInfo.Directory.FullName, $"{presenterName}.cs");
            FileInfo presenterFileInfo = new FileInfo(presenterPath);

            ClassFileWriter.ClassDefinition classDefinition = new ClassFileWriter.ClassDefinition
            {
                Imports = new List <string> {
                    "Muui"
                },
                Name               = presenterName,
                Superclass         = "BasePresenter",
                SuperclassGenerics = new List <string> {
                    panelName, $"{panelName}.Properties"
                }
            };

            ClassFileWriter.WriteClassFile(presenterFileInfo, classDefinition);
        }