Beispiel #1
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are being GPU accelerated with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;
            }

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            SmartDispatcher.Initialize(Deployment.Current.Dispatcher);
        }
Beispiel #2
0
 public App()
 {
     this.Startup            += this.Application_Startup;
     this.Exit               += this.Application_Exit;
     this.UnhandledException += this.Application_UnhandledException;
     SmartDispatcher.Initialize(Deployment.Current.Dispatcher);
     InitializeComponent();
 }
Beispiel #3
0
        private void InitializePhoneApplication()
        {
            if (phoneApplicationInitialized)
                return;

            RootFrame = new TransitionFrame();
            RootFrame.Navigated += CompleteInitializePhoneApplication;
            RootFrame.NavigationFailed += RootFrame_NavigationFailed;

            SmartDispatcher.Initialize(Deployment.Current.Dispatcher);

            phoneApplicationInitialized = true;
        }
Beispiel #4
0
        public App()
        {
            Application.Current.ApplicationLifetimeObjects.Add(new WebContext());
            this.Startup            += ApplicationStartup;
            this.Exit               += ApplicationExit;
            this.UnhandledException += ApplicationUnhandledException;

            SmartDispatcher.Initialize(Deployment.Current.Dispatcher);
            Current.Host.Content.Resized +=
                ApplicationSizeKeeper.OnApplicationResize;
            InitializeComponent();
            /*WebContext context = new WebContext();*/
            Application.Current.ApplicationLifetimeObjects.Add(WebContextBase.Current);
            WebContextBase.Current.Authentication = new FormsAuthentication();
        }
Beispiel #5
0
        private async Task PrepareWindow(IActivatedEventArgs args)
        {
            SmartDispatcher.Initialize(new SmartDispatcherRT());
            var grid = Window.Current.Content as Grid;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active

            if (grid == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                RootFrame            = new Frame();
                RootFrame.Navigated += RootFrame_Navigated;
                //Associate the frame with a SuspensionManager key
                SuspensionManager.RegisterFrame(RootFrame, "AppFrame");

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }

                // Place the frame in the current Window
                grid = new Grid();
                grid.Children.Add(RootFrame);
                if (ProgressIndicator is UIElement)
                {
                    grid.Children.Add((UIElement)ProgressIndicator);
                }
                Window.Current.Content = grid;

                DoPlatformDependentInitialization();
            }
            else
            {
                RootFrame = grid.Children[0] as Frame;
            }
        }
Beispiel #6
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            LoadCustomStyles();

            var c = (Current.Resources["PhoneAccentBrush"] as SolidColorBrush).Color;


            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            SmartDispatcher.Initialize();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display memory usage counters
                MemoryDiagnosticsHelper.Start(TimeSpan.FromMilliseconds(100), true);

                // Display the metro grid helper.
                MetroGridHelper.IsVisible = true;

                // Display the current frame rate counters
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }
        }
        public static void InitApplication([NotNull] PhoneApplicationFrame rootFrame)
        {
            if (rootFrame == null)
            {
                throw new ArgumentNullException("rootFrame");
            }

            var stopwatch = Stopwatch.StartNew();

            Debug.WriteLine("Bootstrapper::InitApplication started");
            SmartDispatcher.Initialize(rootFrame.Dispatcher);
            RegisterDependencies(rootFrame);
            Debug.WriteLine("Bootstrapper::InitApplication resolving uri mapper at {0} ms",
                            stopwatch.ElapsedMilliseconds.ToString(CultureInfo.InvariantCulture));
            rootFrame.UriMapper = Container.Resolve <TimeTableUriMapper>();
            Debug.WriteLine("Bootstrapper::InitApplication ended in {0} ms",
                            stopwatch.ElapsedMilliseconds.ToString(CultureInfo.InvariantCulture));
        }
Beispiel #8
0
        /// <summary>
        /// Creates a new <see cref="App"/> instance.
        /// </summary>
        public App()
        {
            RadDragAndDropManager.ExecutionMode = DragExecutionMode.Legacy;
            InitializeComponent();

            if (Application.Current.IsRunningOutOfBrowser)
            {
                StyleManager.ApplicationTheme = new Telerik.Windows.Controls.MetroTheme();
                SmartDispatcher.Initialize(Deployment.Current.Dispatcher);

                // Create a WebContext and add it to the ApplicationLifetimeObjects
                // collection.  This will then be available as WebContext.Current.
                WebContext webContext = new WebContext();
                webContext.Authentication = new FormsAuthentication();

                this.ApplicationLifetimeObjects.Add(webContext);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            SmartDispatcher.Initialize(Deployment.Current.Dispatcher);

            CurrentTheme = ThemeSettings.Instance.CurrentTheme;

            isoSettings = IsolatedStorageSettings.ApplicationSettings;
            SetRefreshImageSource();

            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            SetTheme();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Current.Host.Settings.EnableFrameRateCounter = true;

                // MetroGridHelper.IsVisible = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }
        }
Beispiel #10
0
        //
        // The Run method is the entry point of a background task.
        //
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            Debug.WriteLine("Background " + taskInstance.Task.Name + " Starting...");
            SmartDispatcher.Initialize(new NoDispatcher());
            //
            // Associate a cancellation handler with the background task.
            //
            taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled);

            //
            // Get the deferral object from the task instance, and take a reference to the taskInstance;
            //
            _deferral     = taskInstance.GetDeferral();
            _taskInstance = taskInstance;

            var appContext = new AppContext(new PlatformServices.PlatformServices(), new NoView());

            _downloadManager = appContext.Downloads;

            _periodicTimer = ThreadPoolTimer.CreatePeriodicTimer(new TimerElapsedHandler(PeriodicTimerCallback), TimeSpan.FromMilliseconds(500));
        }
Beispiel #11
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            SmartDispatcher.Initialize();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            SecurePasswordTester();
            NetworkTester();
            StorageTester();
        }
Beispiel #12
0
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            SmartDispatcher.Initialize(RootFrame.Dispatcher);

            this.PromptForMarketplaceReview();
        }
Beispiel #13
0
 private void Application_Launching(object sender, LaunchingEventArgs e)
 {
     SmartDispatcher.Initialize(RootFrame.Dispatcher);
 }
Beispiel #14
0
 public MainPage()
 {
     this.InitializeComponent();
     SmartDispatcher.Initialize(this.Dispatcher);
     this.SizeChanged += MainPage_SizeChanged;
 }
Beispiel #15
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     SmartDispatcher.Initialize(Deployment.Current.Dispatcher);
     this.RootVisual = new MainPage();
 }