Ejemplo n.º 1
0
Archivo: Main.cs Proyecto: noxe/eXpand
        public static void Main(string[] args) {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += OnException;
            try {
                var appSetting = ConfigurationManager.AppSettings["debug"];
                if (appSetting != null && appSetting.ToLower() == "true") {
                    Debugger.Break();
                }
                var pathInfo = new PathInfo(args);
                Tracing.Tracer.LogSeparator("PathInfo");
                Tracing.Tracer.LogText(pathInfo.ToString());
                Tracing.Tracer.LogSeparator("PathInfo");
                CheckAssemblyFile(pathInfo);
                var modelControllerBuilder = new ModelControllerBuilder();
                var settingsStorageOnRegistry = new SettingsStorageOnRegistry(@"Software\Developer Express\eXpressApp Framework\Model Editor");
                modelEditorForm = new ModelEditorForm(modelControllerBuilder.GetController(pathInfo), settingsStorageOnRegistry);
                modelEditorForm.Disposed += (sender, eventArgs) => ((IModelEditorSettings)modelEditorForm).ModelEditorSaveSettings();
                modelEditorForm.SetCaption(Path.GetFileName(pathInfo.LocalPath));

                Application.Run(modelEditorForm);
            } catch (Exception exception) {
                HandleException(exception);
            }

        }
Ejemplo n.º 2
0
 public ModelEditorViewController GetController(PathInfo pathInfo) {
     var storePath = Path.GetDirectoryName(pathInfo.LocalPath);
     var fileModelStore = new FileModelStore(storePath, Path.GetFileNameWithoutExtension(pathInfo.LocalPath));
     var applicationModulesManager = GetApplicationModulesManager(pathInfo);
     var modelApplication = GetModelApplication(applicationModulesManager, pathInfo, fileModelStore);
     return GetController(fileModelStore, modelApplication);
 }
Ejemplo n.º 3
0
 void AddLayers(ModelApplicationBase modelApplication, ApplicationModulesManager applicationModulesManager, PathInfo pathInfo) {
     var resourceModelCollector = new ResourceModelCollector();
     var dictionary = resourceModelCollector.Collect(applicationModulesManager.Modules.Select(@base => @base.GetType().Assembly), null);
     AddLayersCore(dictionary.Where(pair => !PredicateLastLayer(pair, pathInfo)), modelApplication);
     ModelApplicationBase lastLayer = modelApplication.CreatorInstance.CreateModelApplication();
     modelApplication.AddLayer(lastLayer);
 }
Ejemplo n.º 4
0
        public static void Main(string[] args) {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += OnException;
            try {
                var strings = args;
                if (args.Length>3&&args[0]=="d"){
                    MessageBox.Show("Attach to this proccess");
                    strings = args.Skip(1).ToArray();
                }
                var pathInfo = new PathInfo(strings);
                Tracing.Tracer.LogSeparator("PathInfo");
                Tracing.Tracer.LogText(pathInfo.ToString());
                Tracing.Tracer.LogSeparator("PathInfo");
                CheckAssemblyFile(pathInfo);
                var modelControllerBuilder = new ModelControllerBuilder();
                var settingsStorageOnRegistry = new SettingsStorageOnRegistry(@"Software\Developer Express\eXpressApp Framework\Model Editor");
                _modelEditorForm = new ModelEditorForm(modelControllerBuilder.GetController(pathInfo), settingsStorageOnRegistry);
                _modelEditorForm.Disposed += (sender, eventArgs) => ((IModelEditorSettings)_modelEditorForm).ModelEditorSaveSettings();
                _modelEditorForm.SetCaption(Path.GetFileName(pathInfo.LocalPath));

                Application.Run(_modelEditorForm);
            } catch (Exception exception) {
                HandleException(exception);
            }

        }
Ejemplo n.º 5
0
Archivo: Main.cs Proyecto: noxe/eXpand
 static void CheckAssemblyFile(PathInfo pathInfo) {
     if (!File.Exists(pathInfo.AssemblyPath)) {
         pathInfo.AssemblyPath = Path.Combine(Environment.CurrentDirectory, pathInfo.AssemblyPath);
         if (!File.Exists(pathInfo.AssemblyPath)) {
             throw new Exception(String.Format("The file '{0}' couldn't be found.", pathInfo.AssemblyPath));
         }
     }
 }
Ejemplo n.º 6
0
 ModelApplicationBase GetModelApplication(ApplicationModulesManager applicationModulesManager, PathInfo pathInfo, FileModelStore fileModelStore) {
     var modelApplication = ModelApplicationHelper.CreateModel(XafTypesInfo.Instance, applicationModulesManager.DomainComponents, applicationModulesManager.Modules, applicationModulesManager.ControllersManager, Type.EmptyTypes, fileModelStore.GetAspects(), null, null);
     AddLayers(modelApplication, applicationModulesManager, pathInfo);
     ModelApplicationBase lastLayer = modelApplication.CreatorInstance.CreateModelApplication();
     fileModelStore.Load(lastLayer);
     ModelApplicationHelper.AddLayer(modelApplication, lastLayer);
     return modelApplication;
 }
Ejemplo n.º 7
0
 ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo) {
     string assemblyPath = Path.GetDirectoryName(pathInfo.AssemblyPath);
     var designerModelFactory = new DesignerModelFactory();
     var moduleFromFile = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, assemblyPath);
     ReflectionHelper.Reset();
     XafTypesInfo.HardReset();
     XpoTypesInfoHelper.ForceInitialize();
     return designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath);
 }
Ejemplo n.º 8
0
        void AddLayers(ModelApplicationBase modelApplication, ApplicationModulesManager applicationModulesManager, PathInfo pathInfo)
        {
            var resourceModelCollector = new ResourceModelCollector();
            var resourceInfos          = resourceModelCollector.Collect(applicationModulesManager.Modules.Select(@base => @base.GetType().Assembly), null).Where(pair => !MatchLastLayer(pair, pathInfo));

            AddLayersCore(resourceInfos, modelApplication);
            ModelApplicationBase lastLayer = modelApplication.CreatorInstance.CreateModelApplication();

            ModelApplicationHelper.AddLayer(modelApplication, lastLayer);
        }
Ejemplo n.º 9
0
        ModelApplicationBase GetModelApplication(ApplicationModulesManager applicationModulesManager, PathInfo pathInfo, FileModelStore fileModelStore)
        {
            var modelApplication = ModelApplicationHelper.CreateModel(XafTypesInfo.Instance, applicationModulesManager.DomainComponents, applicationModulesManager.Modules, applicationModulesManager.ControllersManager, Type.EmptyTypes, fileModelStore.GetAspects(), null, null);

            AddLayers(modelApplication, applicationModulesManager, pathInfo);
            Tracing.Tracer.LogText("AddLayers");
            ModelApplicationBase lastLayer = modelApplication.CreatorInstance.CreateModelApplication();

            fileModelStore.Load(lastLayer);
            ModelApplicationHelper.AddLayer(modelApplication, lastLayer);
            return(modelApplication);
        }
Ejemplo n.º 10
0
 bool PredicateLastLayer(KeyValuePair<string, ResourceInfo> pair, PathInfo pathInfo) {
     var name = pair.Key.EndsWith(ModelStoreBase.ModelDiffDefaultName) ? ModelStoreBase.ModelDiffDefaultName : pair.Key.Substring(pair.Key.LastIndexOf(".") + 1);
     bool nameMatch = (name.EndsWith(Path.GetFileNameWithoutExtension(pathInfo.LocalPath) + ""));
     bool assemblyMatch = Path.GetFileNameWithoutExtension(pathInfo.AssemblyPath) == pair.Value.AssemblyName;
     return nameMatch && assemblyMatch;
 }
Ejemplo n.º 11
0
 ApplicationModulesManager GetApplicationModulesManager(PathInfo pathInfo) {
     string assemblyPath = Path.GetDirectoryName(pathInfo.AssemblyPath);
     var designerModelFactory = new DesignerModelFactory();
     var moduleFromFile = designerModelFactory.CreateModuleFromFile(pathInfo.AssemblyPath, assemblyPath);
     return designerModelFactory.CreateModulesManager(moduleFromFile, pathInfo.AssemblyPath);
 }
Ejemplo n.º 12
0
 ModelApplicationBase GetModelApplication(ApplicationModulesManager applicationModulesManager, PathInfo pathInfo, FileModelStore fileModelStore) {
     var modelsManager = new ApplicationModelsManager(applicationModulesManager.Modules, applicationModulesManager.ControllersManager, applicationModulesManager.DomainComponents, null, fileModelStore.GetAspects());
     var modelApplication = (ModelApplicationBase)modelsManager.CreateModel(modelsManager.CreateApplicationCreator(), null, false);
     AddLayers(modelApplication, applicationModulesManager, pathInfo);
     return modelApplication;
 }