Windows 8 Silverlight IApplicationService等效于winRT

Windows 8 Silverlight IApplicationService等效于winRT,windows-8,windows-runtime,Windows 8,Windows Runtime,我开始将WindowsPhone7应用程序移植到Windows8,他们正在使用IApplicationService继承的类来启动停止服务。如何在Windows8中实现同样的功能。我在下面附上windows phone代码。请帮帮我。它的阻塞部分似乎有点困难 public class ApplicationService : IApplicationService { private IApplicationService _logger;

我开始将WindowsPhone7应用程序移植到Windows8,他们正在使用IApplicationService继承的类来启动停止服务。如何在Windows8中实现同样的功能。我在下面附上windows phone代码。请帮帮我。它的阻塞部分似乎有点困难

      public class ApplicationService : IApplicationService
      {
           private IApplicationService _logger;
           private IApplicationService _dataSourceManager;
           public void StartService(ApplicationServiceContext context)
           {
                  _logger = new Logger();
                  _dataSourceManager = new DataSourceManager();
                  _logger.StartService(context);
                  _dataSourceManager.StartService(context);
           }  
           private IApplicationService LoadService(string assemblyName, string typename)
           {
                    var parts = Deployment.Current.Parts;
                    if (parts.Any(part => part.Source.StartsWith(assemblyName)))
                    {
                             var assembly = Assembly.Load(assemblyName);
                             Type type = assembly.GetType(typename);
                             return Activator.CreateInstance(type, new[] {   
                             SynchronizationContext.Current }) as IApplicationService;
                    }
                    return null;
           }
           public void StopService()
          {
                  Current.StopService();
                 _dataSourceManager.StopService();
                 _logger.StopService(); // stop last because other services depend on it
                 _logger = null;
                 _dataSourceManager = null;
           }
}