private void SetupViews(View view, bool init)
        {
            _spentTimeTextView      = view.FindViewById <TextView> (Resource.Id.spentTimeTextView);
            _spentTimeTextView.Text = _task.UnaccountedWorkTime?.ToString();

            _startDateTextView      = view.FindViewById <TextView> (Resource.Id.startDateTextView);
            _startDateTextView.Text = _task.UnaccountedWorkLog?.StartDate?.ToString();

            _commentEditText      = view.FindViewById <EditText> (Resource.Id.commentEditText);
            _commentEditText.Text = _task.UnaccountedWorkLog?.Comment;

            _cancelButton = view.FindViewById <Button> (Resource.Id.dialogCancelSendingButton);
            _sendButton   = view.FindViewById <Button> (Resource.Id.dialogSendWorklogButton);
            if (init)
            {
                _spentTimeTextView.Click += delegate {
                    var transaction = Dialog.OwnerActivity.FragmentManager.BeginTransaction();
                    var dialog      = new EditSpentTimeDialogFragment(_task);
                    dialog.Show(transaction, "");
                };
                _cancelButton.Click += delegate {
                    Dismiss();
                };
                _sendButton.Click += delegate {
                    // TODO: apply new settings for worklog before sending!
                    _taskProvider.SendTaskWorklog(_task);
                    Dismiss();
                };
            }
        }
示例#2
0
 private void SetupButtons()
 {
     // TODO: implement sending worklogs for tasks of current date or for all at once??
     _sendAllWorklogsButton.Click += delegate {
         var tasks = _taskProvider.GetTasksForDate(_currentDate);
         if (null == tasks)
         {
             return;
         }
         // TODO: add some sign for user about sending and change @sendStatusImageButton image on success or fail
         foreach (var task in tasks)
         {
             _taskProvider.SendTaskWorklog(task);
         }
     };
     _previousDateButton.Click += async delegate {
         _currentDate = _currentDate.AddDays(-1);
         await CurrentDateChanged();
     };
     _nextDateButton.Click += async delegate {
         _currentDate = _currentDate.AddDays(1);
         await CurrentDateChanged();
     };
 }