Exemplo n.º 1
0
        public App()
        {
            this.service = new FirstFloor.XamlSpy.XamlSpyService(this);

            InitializeComponent();
            Suspending += OnSuspending;
        }
Exemplo n.º 2
0
        //"[get your own - http://xamlspy.com/learn/tutorials/connect/winrt]"
#endif

#if WINDOWS_PHONE_APP
        //private TransitionCollection transitions;
#endif

        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
#if USE_XAML_SPY
            this.service = new FirstFloor.XamlSpy.XamlSpyService(this) { Password = XamlSpyServicePassword };
#endif

            this.InitializeComponent();
            this.Suspending += this.OnSuspending;
        }
Exemplo n.º 3
0
        //"[get your own - http://xamlspy.com/learn/tutorials/connect/winrt]"
#endif

#if WINDOWS_PHONE_APP
        //private TransitionCollection transitions;
#endif

        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            PasswordDisableSearchPaneOnFocusHandler.IsSearchEnabled = false;
            DisableSearchPaneOnFocusHandler.IsSearchEnabled = false;
#if USE_XAML_SPY
            this.service = new FirstFloor.XamlSpy.XamlSpyService(this) { Password = XamlSpyServicePassword };
#endif
            this.InitializeComponent();
            this.Suspending += this.OnSuspending;
        }
Exemplo n.º 4
0
        //"[get your own - http://xamlspy.com/learn/tutorials/connect/winrt]"
#endif

        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
#if USE_XAML_SPY
            this.service = new FirstFloor.XamlSpy.XamlSpyService(this) { Password = XamlSpyServicePassword };
#endif
            //DebugSettings.IsOverdrawHeatMapEnabled = true;
            //DebugSettings.EnableFrameRateCounter = true;

            this.InitializeComponent();
            this.Suspending += OnSuspending;
        }
Exemplo n.º 5
0
        //"[get your own - http://xamlspy.com/learn/tutorials/connect/winrt]"
#endif

#if WINDOWS_PHONE_APP
        //private TransitionCollection transitions;
#endif

        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
#if USE_XAML_SPY
            this.service = new FirstFloor.XamlSpy.XamlSpyService(this)
            {
                Password = XamlSpyServicePassword
            };
#endif

            this.InitializeComponent();
            this.Suspending += this.OnSuspending;
        }
Exemplo n.º 6
0
        //"[get your own - http://xamlspy.com/learn/tutorials/connect/winrt]"
#endif

        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
#if USE_XAML_SPY
            this.service = new FirstFloor.XamlSpy.XamlSpyService(this)
            {
                Password = XamlSpyServicePassword
            };
#endif
            //DebugSettings.IsOverdrawHeatMapEnabled = true;
            //DebugSettings.EnableFrameRateCounter = true;

            this.InitializeComponent();
            this.Suspending += OnSuspending;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // 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;
            }

            // Expose EventAggregator as a static member of the App class
            _bootstrapper = Application.Current.Resources["YammerWp8Bootstrapper"] as YammerWp8Bootstrapper;
            EventAgregator = _bootstrapper.EventAggregator;
            #if FALSE
            var service = new FirstFloor.XamlSpy.XamlSpyService
            {
                RemoteAddress = "169.254.80.80",
                RemotePort = 4530,
                Password = "******"
            };
            this.ApplicationLifetimeObjects.Add(service);
            #endif
            _bootstrapper.RegisterConfigurationObject(MyOAuthClientInfo, MyYammerUris);
            InitializePhoneApplication();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            // Do not repeat app initialization when already running, just ensure that
            // the window is active

#if XAMLSPY 
            
            this.service = new FirstFloor.XamlSpy.XamlSpyService(this);
            this.service.StartService();
#endif 
            if (args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                if (!String.IsNullOrEmpty(args.Arguments))
                    ((Frame)Window.Current.Content).Navigate(typeof(ItemDetailPage), args.Arguments);
                Window.Current.Activate();
                return;
            }

            // Load recipe data
            await RecipeDataSource.LoadLocalDataAsync();

            // Register handler for SuggestionsRequested events from the search pane
            SearchPane.GetForCurrentView().SuggestionsRequested += OnSuggestionsRequested;

            // Register handler for CommandsRequested events from the settings pane
            SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;

            // Clear tiles and badges
            TileUpdateManager.CreateTileUpdaterForApplication().Clear();
            BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear();

            // Register for push notifications
            var profile = NetworkInformation.GetInternetConnectionProfile();

            if (profile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess)
            {
                try
                { 
                    var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
                    var buffer = CryptographicBuffer.ConvertStringToBinary(channel.Uri, BinaryStringEncoding.Utf8);
                    var uri = CryptographicBuffer.EncodeToBase64String(buffer);
                    var client = new HttpClient();
                    var response = await client.GetAsync(new Uri("http://ContosoRecipes8.cloudapp.net?uri=" + uri + "&type=tile"));

                    if (!response.IsSuccessStatusCode)
                    {
                        var dialog = new MessageDialog("Unable to open push notification channel");
                        dialog.ShowAsync();
                    }
                }
                catch (Exception )
                {
                    var dialog = new MessageDialog("Unable to open push notification channel");
                //     dialog.ShowAsync();
                }
            }

            // Initialize CurrentAppSimulator
            var file = await Package.Current.InstalledLocation.GetFileAsync("Data\\license.xml");
            await Windows.ApplicationModel.Store.CurrentAppSimulator.ReloadSimulatorAsync(file);
     
            // Create a Frame to act as the navigation context and associate it with
            // a SuspensionManager key
            var rootFrame = new Frame();
            SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

            // If the app was activated from a secondary tile, show the recipe
            if (!String.IsNullOrEmpty(args.Arguments))
            {
                rootFrame.Navigate(typeof(ItemDetailPage), args.Arguments);
                Window.Current.Content = rootFrame;
                Window.Current.Activate();
                return;
            }

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                // Restore the saved session state only when appropriate
                await SuspensionManager.RestoreAsync();
            }

            // If the app was closed by the user the last time it ran, and if "Remember
            // "where I was" is enabled, restore the navigation state
            if (args.PreviousExecutionState == ApplicationExecutionState.ClosedByUser)
            {
                if (ApplicationData.Current.RoamingSettings.Values.ContainsKey("Remember"))
                {
                    bool remember = (bool)ApplicationData.Current.RoamingSettings.Values["Remember"];
                    if (remember)
                        await SuspensionManager.RestoreAsync();
                }
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(GroupedItemsPage), "AllGroups"))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Place the frame in the current Window and ensure that it is active
            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }