예제 #1
0
        public FrameworkElement CreateElement(IAppHostServices service)
        {
            LogConfigurator.InitializeForChild();

            ObjectFactory.Bind <ApplicationDispatcher>().ToConstant(new ApplicationDispatcher(Dispatcher.CurrentDispatcher)).InSingletonScope();
            ObjectFactory.Bind <IAnalytics>().ToMethod(context => AnalyticsFactory.Create()).InSingletonScope();
            ObjectFactory.Bind <ISsmsOperations>().ToConstant(service.GetService <ISsmsOperations>()).InSingletonScope();

            m_BrowseScriptsPageControl = new BrowseScriptsPageControl();

            m_ScreenSelectionNotifications = new ScreenSelectionNotifications();
            m_ScreenSelectionNotifications.ShareScreenSelected +=
                (sender, args) => m_BrowseScriptsPageControl.ShowShare(args.ScriptBody);

            var callbacksRegistrationService = service.GetService <ICallbacksRegistrationService>();

            callbacksRegistrationService.Register(m_ScreenSelectionNotifications);

            return(new WindowsFormsHost
            {
                Child = m_BrowseScriptsPageControl
            });
        }