protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.CreateContact); // Change Title of Screen this.Title = "Create Contact"; // Set the Button and Fields AddButton = FindViewById <Button>(Resource.Id.ContactComfirmButton); Name = FindViewById <EditText>(Resource.Id.NameField); Number = FindViewById <EditText>(Resource.Id.NumberField); Email = FindViewById <EditText>(Resource.Id.EmailField); // Load User data TempUser = Classes.InitialController.Load(); // Create your application here // On Addbutton click call AddContact AddButton.Click += delegate { AddContact(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ViewContact); TempUser = Classes.InitialController.Load(); this.Title = TempUser.name; // Create your application here Phone = FindViewById <TextView>(Resource.Id.PhoneView); Email = FindViewById <TextView>(Resource.Id.EmailView); GetInfo(); }
private void CheckFirstRun() { const string PREFS_NAME = "PrefsFile"; const string PrefVersionCodeKey = "version_code"; int DoesntExist = -1; // Get Current Version of Application int currentVersionCode = Application.Context.PackageManager.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0).VersionCode; ISharedPreferences prefs = GetSharedPreferences(PREFS_NAME, FileCreationMode.Private); int savedVersionCode = prefs.GetInt(PrefVersionCodeKey, DoesntExist); // If current version then its a normal run. if (currentVersionCode == savedVersionCode) { // Normal Run Load User Profile TempUser = Classes.InitialController.Load(); return; } else if (savedVersionCode == DoesntExist) { // New Install or User Cleared Shared Preferences // Initialize MainController for Contacts database and initialize user. Classes.InitialController main = new Classes.InitialController(); TempUser = new Classes.User(); } else if (currentVersionCode > savedVersionCode) { // Upgrade of Application Load User Profile TempUser = Classes.InitialController.Load(); } // Update shared preferences with current version code prefs.Edit().PutInt(PrefVersionCodeKey, currentVersionCode).Apply(); }