示例#1
0
        protected override void OnCreate(Bundle savedInstance)
        {
            base.OnCreate(savedInstance);
            SetContentView(R.Layouts.MainLayout);
            main = this;

            PreferenceManager.SetDefaultValues(this, R.Xmls.preferences, false);
            ISharedPreferences sharedPrefs = PreferenceManager.GetDefaultSharedPreferences(this);
            sharedPrefs.RegisterOnSharedPreferenceChangeListener(this);

            var btnTopPilots = FindViewById<Button>(R.Ids.btnPilotStats);
            btnTopPilots.Click += delegate
            {
                var topPilotsIntent = new Intent(this, typeof(TopPilotsActivity));
                StartActivity(topPilotsIntent);
            };
            var btnOnlinePilots = FindViewById<Button>(R.Ids.btnOnlinePilots);
            btnOnlinePilots.Click += delegate
            {
                var onlinePilotsIntent = new Intent(this, typeof(OnlinePilotsActivity));
                StartActivity(onlinePilotsIntent);
            };
            var btnStationInventories = FindViewById<Button>(R.Ids.btnStationInventories);
            btnStationInventories.Click += delegate
            {
                var stationInventoriesIntent = new Intent(this, typeof(StationInventoryActivity));
                StartActivity(stationInventoriesIntent);
            };
            var btnItemStocks = FindViewById<Button>(R.Ids.btnItemStocks);
            btnItemStocks.Click += delegate
            {
                var itemStocksIntent = new Intent(this, typeof(ItemStocksActivity));
                StartActivity(itemStocksIntent);
            };

            var btnMyPilotStats = FindViewById<Button>(R.Ids.btnMyPilotStats);
            string pilotName = sharedPrefs.GetString("pref_pilotname", "");
            OnSharedPreferenceChanged(sharedPrefs, "pref_pilotname");
            btnMyPilotStats.Click += delegate
            {
                var pilotDetails = new Intent(this, typeof(PilotDetailActivity));
                string curPilotName = sharedPrefs.GetString("pref_pilotname", "");
                pilotDetails.PutExtra("pilotID", long.MinValue);
                pilotDetails.PutExtra("pilotName", curPilotName);
                StartActivity(pilotDetails);
            };

            CheckForUpdate();
        }