/// <summary> /// Constructor for App class. /// </summary> public App() { InitializeComponent(); // Create a WebContext and add it to the ApplicationLifetimeObjects collection. // This will then be available as 'WebContext.Current'. var webContext = new WebContext(); webContext.Authentication = new FormsAuthentication(); ApplicationLifetimeObjects.Add(webContext); }
public App() { this.Startup += this.Application_Startup; this.UnhandledException += this.Application_UnhandledException; InitializeComponent(); WebContext context = new WebContext(); context.Authentication = new FormsAuthentication(); ApplicationLifetimeObjects.Add(context); }
/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard Silverlight initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { // Display the current frame rate counters. Current.Host.Settings.EnableFrameRateCounter = false; // 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; } RootFrame.Obscured += RootFrame_Obscured; RootFrame.Unobscured += RootFrame_Unobscured; // add XNA async dispatcher with framerate 30fps to application lifetime objects XnaDispatcher = new AsyncDispatcher(TimeSpan.FromTicks(333333)); ApplicationLifetimeObjects.Add(XnaDispatcher); ViewModel = Current.Resources["ViewModel"] as ViewModel; }
/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard XAML initialization InitializeComponent(); // 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; } ApplicationLifetimeObjects.Add(new XNAAsyncDispatcher(TimeSpan.FromMilliseconds(50))); }
/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard Silverlight initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); ApplicationLifetimeObjects.Add(new XNAAsyncDispatcher(TimeSpan.FromMilliseconds(40))); DeviceNetworkInformation.NetworkAvailabilityChanged += new EventHandler <NetworkNotificationEventArgs>(DeviceNetworkInformation_NetworkAvailabilityChanged); /// Load our options /// LoadOptions(); //if (Options.LogXML == true) // SocketServer.SocketClient.ShowDebug = true; if (Options.RunWithScreenLocked == true) { PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled; } CopyToIsolatedStorage(); XMPPClient.OnXMLReceived += new System.Net.XMPP.XMPPClient.DelegateString(XMPPClient_OnXMLReceived); XMPPClient.OnXMLSent += new System.Net.XMPP.XMPPClient.DelegateString(XMPPClient_OnXMLSent); // 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 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; } StartGeoStuff(); GeoTimer = new System.Windows.Threading.DispatcherTimer(); GeoTimer.Interval = TimeSpan.FromSeconds(Options.GeoTimeFrequency); GeoTimer.Tick += new EventHandler(GeoTimer_Tick); GeoTimer.Start(); SocketServer.SocketClient.ShowDebug = true; App.XMPPClient.AutoReconnect = true; App.XMPPClient.OnNewConversationItem += new System.Net.XMPP.XMPPClient.DelegateNewConversationItem(XMPPClient_OnNewConversationItem); App.XMPPClient.FileTransferManager.OnNewIncomingFileTransferRequest += new FileTransferManager.DelegateIncomingFile(FileTransferManager_OnNewIncomingFileTransferRequest); App.XMPPClient.FileTransferManager.OnTransferFinished += new FileTransferManager.DelegateDownloadFinished(FileTransferManager_OnTransferFinished); App.XMPPClient.OnServerDisconnect += new EventHandler(XMPPClient_OnServerDisconnect); }