protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var button = FindViewById <Button>(Resource.Id.getMembers); button.Click += async(sender, e) => { _members = await new MembersService().GetAll(); LoadMembers(_members); }; var btnClear = FindViewById <Button>(Resource.Id.btnClear); btnClear.Click += (sender, e) => { _members = Enumerable.Empty <Member>().ToList(); LoadMembers(_members); }; var btnLogin = FindViewById <Button>(Resource.Id.btnLogin); btnLogin.Click += (sender, e) => { LoginScreenControl <CredentialsProvider> .Activate(this); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); FindViewById <Button>(Resource.Id.loginButton).Click += (sender, e) => LoginScreenControl <TestCredentialsProvider> .Activate(this); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); LoginScreenControl <CredentialsProvider> .Activate(this); //Login Screen function, If theres errors delete this and the credentials provider class var path = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var dbPath = Path.Combine(path, "counters.db3"); DatabaseHelper.CreateDatabase(dbPath); await ViewModelLocator.Counters.LoadCountersAsync(); _drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); //Set hamburger items menu SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu); //setup navigation view _navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); //handle navigation _navigationView.NavigationItemSelected += (sender, e) => { e.MenuItem.SetChecked(true); // Switch statement for nav buttons switch (e.MenuItem.ItemId) { case Resource.Id.nav_counters: ListItemClicked(0); break; case Resource.Id.nav_about: ListItemClicked(1); break; case Resource.Id.nav_Add: ListItemClicked(2); break; case Resource.Id.nav_Sort: ListItemClicked(3); break; } _drawerLayout.CloseDrawers(); }; //if first time you will want to go ahead and click first item. if (savedInstanceState == null) { ListItemClicked(0); } }
void LoginClick(object sender, EventArgs e) { LoginScreenControl <TestCredentialsProvider> .Activate(this); }