protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.EditTask); taskID = Intent.GetIntExtra("taskID", 0); WebServiceClientManager.InitializeWebServiceClient(typeof(TaskModel)); client = WebServiceClientManager.TaskClient; WebServiceClientManager.InitializeWebServiceClient(typeof(UserModel)); clientUser = WebServiceClientManager.UserClient; if (taskID > 0) { client.GetByIDAsync(taskID); client.GetByIDCompleted += GetByIDTaskCompleted; } clientUser.GetAllAsync(); clientUser.GetAllUsersCompleted += GetAllUsersCompleted; title = FindViewById <EditText>(Resource.Id.titleEdit); description = FindViewById <EditText>(Resource.Id.descriptionEdit); workingHours = FindViewById <EditText>(Resource.Id.workingHoursEdit); //responsible = FindViewById<Spinner>(Resource.Id.responsibleEdit); status = FindViewById <Spinner>(Resource.Id.statusEdit); Button save = FindViewById <Button>(Resource.Id.saveTask); Button delete = FindViewById <Button>(Resource.Id.deleteTask); Button details = FindViewById <Button>(Resource.Id.detailsTask); Button logworks = FindViewById <Button>(Resource.Id.logworksTask); Button comments = FindViewById <Button>(Resource.Id.commentsTask); Button cancel = FindViewById <Button>(Resource.Id.cancelTask); save.Click += SaveButtonOnClick; delete.Click += DeleteButtonOnClick; details.Click += DetailsButtonOnClick; logworks.Click += LogworksButtonOnClick; comments.Click += CommentsButtonOnClick; cancel.Click += delegate { Finish(); }; // responsible spinner //responsible.ItemSelected += ResponsibleItemSelected; //ArrayAdapter responsibleAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, users); //responsibleAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); //responsible.Adapter = responsibleAdapter; //responsible.Adapter = new ResponsibleSpinnerAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, users); // status spinner status.ItemSelected += StatusItemSelected; ArrayAdapter statusAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.status_array, Android.Resource.Layout.SimpleSpinnerItem); statusAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); status.Adapter = statusAdapter; }
// SAVE private void SaveButtonOnClick(object sender, EventArgs e) { if (userModel == null) { userModel = new UserModel(); } userModel.Username = username.Text; userModel.Password = password.Text; userModel.FirstName = firstName.Text; userModel.LastName = lastName.Text; userModel.IsAdmin = admin.Checked; client.GetAllAsync(); client.GetAllUsersCompleted += CheckUsernameCompleted; if (userCheck == null) { client.SaveAsync(userModel); client.SaveCompleted += SaveUserCompleted; } else { RunOnUiThread(() => errors.Text = "Username already exists!"); } }
// LIST VIEW protected void PopulateListView() { client.GetAllAsync(); client.GetAllUsersCompleted += ListViewPopulatedCompleted; }
// LOGIN private void LoginButtonOnClick(object sender, EventArgs eventArgs) { client.GetAllAsync(); client.GetAllUsersCompleted += LoginCompleted; }