protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); MainActivityVM = new MainActivityViewModel(); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); Button insertBtn = FindViewById <Button>(Resource.Id.btn_insert); insertBtn.Click += OnInsertClicked; Button resetBtn = FindViewById <Button>(Resource.Id.btn_reset); resetBtn.Click += OnResetClicked; Button loadBtn = FindViewById <Button>(Resource.Id.btn_load); loadBtn.Click += OnLoadClicked; Button deleteBtn = FindViewById <Button>(Resource.Id.btn_delete); deleteBtn.Click += OnDeleteClicked; }
public MainActivityView(ReservationsHeaderModel reservationsHeader) { InitializeComponent(); mainActivityViewModel = new MainActivityViewModel(reservationsHeader, Navigation); BindingContext = mainActivityViewModel; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); MainActivityVM = new MainActivityViewModel(); Button getBtn = FindViewById <Button>(Resource.Id.btn_get); getBtn.Click += OnGetClicked; Button postBtn = FindViewById <Button>(Resource.Id.btn_post); postBtn.Click += OnPostClicked; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); MainActivityVM = new MainActivityViewModel(); Button serializeBtn = FindViewById <Button>(Resource.Id.btn_serialize); serializeBtn.Click += OnSerializedClicked; Button deserializeBtn = FindViewById <Button>(Resource.Id.btn_deserialize); deserializeBtn.Click += OnDeserializedClicked; }
public void Initialize() { ViewModel = ViewModelProviders.Of(this).Get(Java.Lang.Class.FromType(typeof(MainActivityViewModel))) as MainActivityViewModel; Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); Button SaveText = FindViewById <Button>(Resource.Id.btn_save_text); SaveText.Click += SaveOnClick; FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; //fileLocation = Path.Combine(Xamarin.Essentials.FileSystem.AppDataDirectory, "demo.txt"); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); this.viewModel = new MainActivityViewModel(this); this.FindViewById <Button>(Resource.Id.ButtonReactivePropertyBasics) .ClickAsObservable() .SetCommand(this.viewModel.NavigateReactivePropertyBasicsCommand); this.FindViewById <Button>(Resource.Id.ButtonListAdapter) .ClickAsObservable() .SetCommand(this.viewModel.NavigateListAdapterCommand); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); RecyclerView mRecyclerView = FindViewById <RecyclerView>(Resource.Id.offer_list); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this); mRecyclerView.SetLayoutManager(mLayoutManager); ViewModel = new ViewModelProvider(this).Get(Java.Lang.Class.FromType(typeof(MainActivityViewModel))) as MainActivityViewModel; ViewModel.Offers.CollectionChanged += (sender, e) => { OfferListAdapter mAdapter = new OfferListAdapter(ViewModel.Offers); mAdapter.ItemClick += OnItemClick; mRecyclerView.SetAdapter(mAdapter); }; }