Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Home);

            try
            {
                LinearLayout butActivity     = FindViewById <LinearLayout>(Resource.Id.linearBtnActivity);
                LinearLayout butTask         = FindViewById <LinearLayout>(Resource.Id.linearBtnTask);
                LinearLayout butGroup        = FindViewById <LinearLayout>(Resource.Id.linearBtnGroup);
                LinearLayout butNotification = FindViewById <LinearLayout>(Resource.Id.linearBtnNotify);

                butActivity.Click += delegate {
                    Intent ActivityIntent = new Intent(this, typeof(ActivityActivity));
                    StartActivity(ActivityIntent);
                    Finish();
                };

                butTask.Click += delegate {
                    Intent TaskIntent = new Intent(this, typeof(TaskActivity));
                    StartActivity(TaskIntent);
                    Finish();
                };

                butGroup.Click += delegate {
                    Intent GroupIntent = new Intent(this, typeof(GroupActivity));
                    StartActivity(GroupIntent);
                    Finish();
                };

                butNotification.Click += delegate {
                    Intent NotifyIntent = new Intent(this, typeof(NotifyActivity));
                    StartActivity(NotifyIntent);
                    Finish();
                };

                ImageView btnSearchChores = FindViewById <ImageView>(Resource.Id.imgSearch);
                btnSearchChores.Click += delegate {
                    Intent ChoresIntent = new Intent(this, typeof(ChoresActivity));
                    StartActivityForResult(ChoresIntent, ACTIVITY_FOR_CHORESSCREEN);
                };

                Button btnComplete = FindViewById <Button>(Resource.Id.btnComplete);
                btnComplete.Click += delegate {
                    _progDlg              = ProgressDialog.Show(this, "", GetString(Resource.String.msg_wait), true, true);
                    _progDlg.CancelEvent += (object sender, EventArgs e) => {
                    };

                    WebService.changeTaskState(this, -1, _taskList[_selTaskId].taskId, 2, 1);
                };

                updateUserInfo();
                runBackground();
                changeButtonState(false);
            }
            catch (Exception e) {
            }
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.TaskDetail);

            _flagTask = Intent.GetIntExtra("fromTask", 0);

            Button butActionJob = FindViewById <Button> (Resource.Id.btnAction);

            butActionJob.Click += delegate {
                if (_flagTask == 1)
                {
                    if (_status == 0)
                    {
                        _progDlg              = ProgressDialog.Show(this, "", GetString(Resource.String.msg_wait), true, true);
                        _progDlg.CancelEvent += (object sender, EventArgs e) => {
                        };

                        WebService.doStartTask(this, _taskId, _userBidList[_listItemId].userId);
                    }
                    else if (_status == 1 || _status == 2)
                    {
                        _progDlg              = ProgressDialog.Show(this, "", GetString(Resource.String.msg_wait), true, true);
                        _progDlg.CancelEvent += (object sender, EventArgs e) => {
                        };

                        WebService.doEndTask(this, _taskId);
                    }
                }
            };

            Button butClose = FindViewById <Button> (Resource.Id.btnCancel);

            butClose.Click += delegate {
                if (_flagTask == 1 && _status == 2)
                {
                    _progDlg              = ProgressDialog.Show(this, "", GetString(Resource.String.msg_wait), true, true);
                    _progDlg.CancelEvent += (object sender, EventArgs e) => {
                    };

                    WebService.changeTaskState(this, -1, _taskId, 1, 0);
                }
                else
                {
                    SetResult(Result.Canceled);
                    Finish();
                }
            };

            _taskId = Intent.GetIntExtra("taskId", -1);

            TextView txtName = FindViewById <TextView> (Resource.Id.txtTaskName);

            txtName.Text = Intent.GetStringExtra("taskName");

            TextView txtDescription = FindViewById <TextView> (Resource.Id.txtTaskDescription);

            txtDescription.Text = Intent.GetStringExtra("taskDescription");

            TextView txtGroupName = FindViewById <TextView> (Resource.Id.txtGroupName);

            txtGroupName.Text = Intent.GetStringExtra("groupName");

            TextView txtUserName = FindViewById <TextView> (Resource.Id.txtUserName);

            txtUserName.Text = Intent.GetStringExtra("userName");

            TextView txtPoints = FindViewById <TextView> (Resource.Id.txtPoints);

            txtPoints.Text = Intent.GetIntExtra("points", 0).ToString();

            TextView txtPriority = FindViewById <TextView> (Resource.Id.txtPriority);

            txtPriority.Text = getPriorityString(Intent.GetIntExtra("priority", 0));

            TextView txtPostDate = FindViewById <TextView> (Resource.Id.txtPostDate);

            txtPostDate.Text = Intent.GetStringExtra("postDate");

            TextView txtFinishDate = FindViewById <TextView> (Resource.Id.txtFinishDate);

            txtFinishDate.Text = Intent.GetStringExtra("finishDate");

            _status = Intent.GetIntExtra("status", 0);
            TextView txtStatus = FindViewById <TextView> (Resource.Id.txtTaskStatus);

            txtStatus.Text = "(" + Global.getTaskStatus(_status) + ")";

            bool bButtonEnabled = false;

            if (_flagTask == 1)
            {
                FindViewById <TextView> (Resource.Id.txtTaskTitle).Text = "Task Detail";

                if (_status == 0)
                {
                    runBackground();
                }
                else if (_status == 1)
                {
                    butActionJob.Text = "Finish";
                    bButtonEnabled    = true;
                }
                else if (_status == 2)
                {
                    butActionJob.Text = "Finish";
                    butClose.Text     = "Reset";
                    bButtonEnabled    = true;
                }
            }
            else
            {
                FindViewById <TextView> (Resource.Id.txtTaskTitle).Text = "Post User: "******"postusername");
            }

            changeButtonState(bButtonEnabled);
        }