コード例 #1
0
 private Controller()
 {
     CurrentProject = new WorkbenchProject();
     Interfaces.Events.DataChangedEvent += On_DataChanged;
     OnProjectLoaded     += Project_OnProjectLoaded;
     projectFileTreeModel = new ProjectFileTree();
     //InitializeSettings();
 }
コード例 #2
0
        private void buttonRunNHTemplateTest_Click(object sender, RoutedEventArgs args)
        {
            // Setup log4net
            log4net.Config.XmlConfigurator.Configure();

            //hibernatemapping hm = Utility.Open("nhtest.xml");

            var project = new WorkbenchProject();

            project.Load(@"..\..\..\ArchAngel.Templates\NHibernate\Northwind\Northwind.wbproj",
                         new NullVerificationIssueSolver(),
                         false, @"..\..\..\ArchAngel.Templates\NHibernate\Template\NHibernate.AAT.DLL");
            SharedData.CurrentProject = project;

            MappingSet mappingSet = project.Providers[0].GetAllObjectsOfType(typeof(MappingSet).FullName).OfType <MappingSet>().First();
            var        entitySet  = mappingSet.EntitySet;

            if (Directory.Exists("Output") == false)
            {
                Directory.CreateDirectory("Output");
            }

            foreach (var entity in entitySet.Entities)
            {
                if (Utility.SkipEntity(entity))
                {
                    continue;
                }

                try
                {
                    string xml = Utility.CreateMappingXMLFrom(entity, "Test", "Test", true, "", DefaultCascadeTypes.none, true);
                    File.WriteAllText(Path.Combine("Output", entity.Name + ".xml"), xml);
                }
                catch (Exception e)
                {
                    //string msg = string.Format("Exception: {0}\nMessage: {1}\nStack: {2}", e.GetType(), e.Message, e.StackTrace);

                    StringBuilder sb        = new StringBuilder();
                    Exception     currentEx = e.InnerException;
                    sb.AppendLine(e.ToString());
                    while (currentEx != null)
                    {
                        sb.AppendLine("Inner Exception:");
                        sb.AppendLine(currentEx.ToString());
                        currentEx = currentEx.InnerException;
                    }

                    File.WriteAllText(Path.Combine("Output", entity.Name + ".xml"), sb.ToString());
                }
            }

            Process.Start("Output");

            Application.Current.Shutdown();
        }
コード例 #3
0
        public void CreateNewProject(string projectOutputPath, string projectTemplate, string projectFilename)
        {
            CurrentProject            = new WorkbenchProject();
            SharedData.CurrentProject = CurrentProject;

            CurrentProject.NewProject(projectOutputPath, projectTemplate, projectFilename);

            RaiseTemplateLoadedEvent();
            RaiseProjectLoadedEvent();
        }
コード例 #4
0
        private void SetupController()
        {
            controller = mocks.StrictMock <IController>();
            ProjectSettings settings = new ProjectSettings();

            settings.OutputPath = TempUserPath;
            WorkbenchProject project = new WorkbenchProject();

            project.ProjectSettings = settings;
            Expect.Call(controller.GetTempFilePathForComponent(ComponentKey.Workbench_FileGenerator)).IgnoreArguments().Return(@"C:\Temp").Repeat.Any();
            Expect.Call(controller.CurrentProject).Return(project).Repeat.Any();
        }
コード例 #5
0
        private void SetupController()
        {
            controller = mocks.DynamicMock <IController>();
            Expect.Call(controller.GetTempFilePathForComponent(ComponentKey.Workbench_FileGenerator)).IgnoreArguments().Return("C:/Temp").Repeat.Any();
            Settings.Default.PerformMergeAnalysis = true;
            //Expect.Call(controller.SettingGet(Controller.SettingNames.PerformMergeAnalysis)).Return(true).Repeat.Any();
            ProjectSettings settings = new ProjectSettings();

            settings.OutputPath = "C:\\doesnotexist";
            WorkbenchProject project = new WorkbenchProject();

            project.ProjectSettings = settings;
            Expect.Call(controller.CurrentProject).Return(project);
        }
コード例 #6
0
        public virtual bool OpenProjectFile(string file)
        {
            log.DebugFormat("Attempting to load project file \"{0}\"", file);
            BusyPopulating = true;
            BeforeOpenProjectFile();
            bool result = false;

            try
            {
                CurrentProject            = new WorkbenchProject();
                SharedData.CurrentProject = CurrentProject;
                result = CurrentProject.Load(file, VerificationIssueSolver);

                if (!result)
                {
                    System.Windows.Forms.MessageBox.Show("Load unsuccessful");
                }
                RaiseTemplateLoadedEvent();
                RaiseProjectLoadedEvent();
            }
            catch (OldVersionException ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message, "Out-Of-Date Template", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
                result = false;
            }
            //catch (Exception e)
            //{
            //    ErrorReportingService.ReportUnhandledException(e);
            //    result = false;
            //}
            finally
            {
                AfterOpenProjectFile(result, CurrentProject.ProjectFile);
            }
            BusyPopulating = false;
            return(result);
        }