public void OpenProject() { PrimaryProjectUiWorkingContextManagerProxy = TiaStarter.m_ViewApplicationContext.GetPrimaryProjectUiWorkingContextManagerProxy(); PrimaryProjectManagerProxy = PrimaryProjectUiWorkingContextManagerProxy.PrimaryProjectManager; PrimaryProjectManagerProxy.ProjectOpened += PrimaryProjectManagerProxy_ProjectOpened; var proxy = Program.app.TiaProjectManagerProxy; object project = null; //proxy.OpenProjectReadWrite(path, out project); PrimaryProjectManagerProxy.OpenProjectReadWrite(path, out project); }
private void CreateWorkingContextHierarchy() { m_BusinessLogicApplicationContext = new WorkingContext(false, WorkingContextEnvironment.Application, AppId, "Project" ); m_BusinessLogicApplicationContext.ConstructServiceEvent += m_BusinessLogicApplicationContext_ConstructServiceEvent; m_BusinessLogicApplicationContext.ServiceLoadedEvent += m_BusinessLogicApplicationContext_ServiceLoadedEvent; m_BusinessLogicApplicationContext.ServiceAddedEvent += m_BusinessLogicApplicationContext_ServiceAddedEvent; m_BusinessLogicApplicationContext.WorkingContextChildCreatedEvent += M_BusinessLogicApplicationContext_WorkingContextChildCreatedEvent; m_BusinessLogicApplicationContext.AutoLoadDlcs(); WorkingContextProxy wcp = new WorkingContextProxy(m_BusinessLogicApplicationContext); PlatformServiceContainer psc = wcp.PlatformServiceContainer; m_ViewApplicationContext = new WorkingContext(true, WorkingContextEnvironment.Application, AppId, "Project" ); m_ViewApplicationContext.SiblingInBusinessLogicContext = m_BusinessLogicApplicationContext; m_ViewApplicationContext.ConstructServiceEvent += M_ViewApplicationContext_ConstructServiceEvent; m_ViewApplicationContext.ServiceLoadedEvent += M_ViewApplicationContext_ServiceLoadedEvent; m_ViewApplicationContext.ServiceAddedEvent += M_ViewApplicationContext_ServiceAddedEvent; m_ViewApplicationContext.AutoLoadDlcs(); PersistenceWorkingContext = new WorkingContext(m_ViewApplicationContext, WorkingContextEnvironment.Persistence); PrimaryProjectUiWorkingContextManagerProxy = m_ViewApplicationContext.GetPrimaryProjectUiWorkingContextManagerProxy(); PrimaryProjectManagerProxy = PrimaryProjectUiWorkingContextManagerProxy.PrimaryProjectManager; }
public void OpenProject() { Console.WriteLine("OpenProject"); PrimaryProjectUiWorkingContextManagerProxy = TiaStarter.m_ViewApplicationContext.GetPrimaryProjectUiWorkingContextManagerProxy(); PrimaryProjectManagerProxy = PrimaryProjectUiWorkingContextManagerProxy.PrimaryProjectManager; PrimaryProjectManagerProxy.ProjectOpened += PrimaryProjectManagerProxy_ProjectOpened; var proxy = TiaStarter.m_BusinessLogicApplicationContext.GetTiaProjectManagerProxy(); object project = null; //proxy.OpenProjectReadWrite(path, out project); try { PrimaryProjectManagerProxy.OpenProjectReadWrite(path, out project); }catch (Exception ex) { Console.WriteLine(ex); } }