InitializeWithDispatcher() public static method

Initializes the framework using the current dispatcher.
public static InitializeWithDispatcher ( ) : void
return void
コード例 #1
0
        protected override void Configure()
        {
            _phoneContainer = new PhoneContainer();
            _analytics      = new FlurryAnalytics();

            RegisterConventions();

            _phoneContainer.RegisterPhoneServices(RootFrame);

            RegisterServices();
            RegisterViews();

            RegisterStorageHandlers();
            RegisterNavigationCoercion();

            Execute.InitializeWithDispatcher();

            LoadLanguagesAsync();

            Telerik.Windows.Controls.LocalizationManager.GlobalStringLoader = new ResourceLoader();
            Log.Init(new DebugLogger());
            InitErrorHandler();

            RootFrame.Navigating += RootFrameNavigating;
            RootFrame.Navigated  += RootFrameNavigated;
        }
コード例 #2
0
        /// <summary>
        /// Called by the bootstrapper's constructor at runtime to start the framework.
        /// </summary>
        protected virtual void StartRuntime()
        {
            Execute.InitializeWithDispatcher();
            EventAggregator.DefaultPublicationThreadMarshaller = Execute.OnUIThread;

            EventAggregator.HandlerResultProcessing = (target, result) => {
                var coroutine = result as IEnumerable <IResult>;
                if (coroutine != null)
                {
                    var viewAware = target as IViewAware;
                    var view      = viewAware != null?viewAware.GetView() : null;

                    var context = new ActionExecutionContext {
                        Target = target, View = (DependencyObject)view
                    };

                    Coroutine.BeginExecute(coroutine.GetEnumerator(), context);
                }
            };

            AssemblySource.Instance.AddRange(SelectAssemblies());

            if (useApplication)
            {
                Application = Application.Current;
                PrepareApplication();
            }

            Configure();
            IoC.GetInstance     = GetInstance;
            IoC.GetAllInstances = GetAllInstances;
            IoC.BuildUp         = BuildUp;
        }
コード例 #3
0
        /// <summary>
        /// Invoked when the application creates a window.
        /// </summary>
        /// <param name="args">Event data for the event.</param>
        protected override void OnWindowCreated(WindowCreatedEventArgs args)
        {
            base.OnWindowCreated(args);

            // Because dispatchers are tied to windows Execute will fail in
            // scenarios when the app has multiple windows open (though contract
            // activation, this keeps Excute up to date with the currently activated window

            args.Window.Activated += (s, e) => Execute.InitializeWithDispatcher();
        }
コード例 #4
0
        /// <summary>
        /// Called by the bootstrapper's constructor at runtime to start the framework.
        /// </summary>
        protected virtual void StartRuntime()
        {
            Execute.InitializeWithDispatcher();

            EventAggregator.DefaultPublicationThreadMarshaller = Execute.OnUIThread;
            AssemblySource.Instance.AddRange(SelectAssemblies());

            PrepareApplication();
            Configure();

            IoC.GetInstance     = GetInstance;
            IoC.GetAllInstances = GetAllInstances;
            IoC.BuildUp         = BuildUp;
        }
コード例 #5
0
        /// <summary>
        /// Creates an instance of the bootstrapper.
        /// </summary>
        public Bootstrapper()
        {
            if (IsInDesignMode)
            {
                return;
            }

            Execute.InitializeWithDispatcher();
            AssemblySource.Instance.AddRange(SelectAssemblies());

            Application = Application.Current;
            PrepareApplication();

            Configure();
            IoC.GetInstance     = GetInstance;
            IoC.GetAllInstances = GetAllInstances;
            IoC.BuildUp         = BuildUp;
        }
コード例 #6
0
        /// <summary>
        /// Called by the bootstrapper's constructor at runtime to start the framework.
        /// </summary>
        protected virtual void StartRuntime()
        {
            Execute.InitializeWithDispatcher();
            EventAggregator.DefaultPublicationThreadMarshaller = Execute.OnUIThread;

            EventAggregator.HandlerResultProcessing = (target, result) => {
#if !SILVERLIGHT || SL5 || WP8
                var task = result as System.Threading.Tasks.Task;
                if (task != null)
                {
                    result = new IResult[] { task.AsResult() };
                }
#endif

                var coroutine = result as IEnumerable <IResult>;
                if (coroutine != null)
                {
                    var viewAware = target as IViewAware;
                    var view      = viewAware != null?viewAware.GetView() : null;

                    var context = new ActionExecutionContext {
                        Target = target, View = (DependencyObject)view
                    };

                    Coroutine.BeginExecute(coroutine.GetEnumerator(), context);
                }
            };

            AssemblySource.Instance.AddRange(SelectAssemblies());

            PrepareApplication();
            Configure();

            IoC.GetInstance     = GetInstance;
            IoC.GetAllInstances = GetAllInstances;
            IoC.BuildUp         = BuildUp;
        }