// This is the main entry point of the application. static void Main(string[] args) { CurrentPlatform.Init(); PlatformSpecific.SetPlatform(new iOSSpecific()); // if you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. UIApplication.Main(args, null, "AppDelegate"); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); CurrentPlatform.Init(); PlatformSpecific.SetPlatform(new AndroidSpecific()); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button>(Resource.Id.MyButton); Button btnSend = FindViewById <Button>(Resource.Id.btnSend); Button btnGetContacts = FindViewById <Button>(Resource.Id.btnGetContacts); mBtnLogin = FindViewById <Button>(Resource.Id.btnLogin); mTxtMessage = FindViewById <EditText>(Resource.Id.txtMessage); mTxtRecipient = FindViewById <EditText>(Resource.Id.txtSendTo); mTxtUsername = FindViewById <EditText>(Resource.Id.txtUsername); mDdlContacts = FindViewById <Spinner>(Resource.Id.ddlContacts); mDdlContacts.ItemSelected += (sender, e) => { selectedContact((Spinner)sender, e); }; button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); ServiceHelper.GetInstance().RecordClick(count, "Android"); }; btnSend.Click += (sender, e) => { tappedSend((View)sender); }; mBtnLogin.Click += delegate { tappedLogin(); }; btnGetContacts.Click += delegate { tappedGetContacts(); }; string senders = "540255930025"; Intent intent = new Intent("com.google.android.c2dm.intent.REGISTER"); intent.SetPackage("com.google.android.gsf"); intent.PutExtra("app", PendingIntent.GetBroadcast(this, 0, new Intent(), 0)); intent.PutExtra("sender", senders); this.StartService(intent); }
/// <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; PlatformSpecific.SetPlatform(new WinPhoneSpecific()); } }
/// <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() { this.InitializeComponent(); this.Suspending += OnSuspending; PlatformSpecific.SetPlatform(new WinStoreSpecific()); }