Ejemplo n.º 1
0
        public void AutoShowUserTaskDialog(AutoShowDialogData dialogData)
        {
            var dataRepository     = _context.GetDataRepository();
            var userTaskListResult = dataRepository.GetContainer <UserTaskListResult>(DataKey.UserTaskListResult);
            var task = _context.GetTaskManager();

            var remoteApi = _context.GetRemoteAPI();

            userTaskListResult.ClearNotInvalidate();
            remoteApi.RequestUserTaskList();

            task.ExecuteTask(() =>
            {
                var data = userTaskListResult.Read();
                dialogData.SetDialogDataState(DialogDataState.Wait);
                return(data != null);
            },
                             () =>
            {
                var data = userTaskListResult.Read();
                if (data == null)
                {
                    dialogData.SetDialogDataState(DialogDataState.Failed);
                    return;
                }

                var res = data.res;
                if (res == null)
                {
                    dialogData.SetDialogDataState(DialogDataState.Failed);
                    return;
                }

                if (res.code == ResultCode.OK)
                {
                    var taskList = data.user_task_state;
                    if (taskList == null || taskList.Count <= 0)
                    {
                        dialogData.SetDialogDataState(DialogDataState.Failed);
                        return;
                    }

                    ShowDialog <UIWindow>(DialogName.UserTaskDialog, true, true,
                                          (dialog) =>
                    {
                        dialogData.SetDialogDataState(DialogDataState.Ok);
                        dialogData.SetCurrentShowDialog(dialog);
                    });
                }
                else
                {
                    dialogData.SetDialogDataState(DialogDataState.Failed);
                }
            }, null
                             );
        }
Ejemplo n.º 2
0
        public void InitAutoShowDialogDataQueue()
        {
            _autoShowDialogDatas.Clear();

            foreach (var k in _autoShowDialogNameAndFunc)
            {
                var data = new AutoShowDialogData();
                data.DialogName        = k.Key;
                data.DialogShow        = (int)DialogDataState.Null;
                data.Trigger           = k.Key == _fristDialogName;
                data.Action            = k.Value;
                data.CurrentShowDialog = null;
                _autoShowDialogDatas.Enqueue(data);
            }
        }
Ejemplo n.º 3
0
        public void AutoShowCheckinDialog(AutoShowDialogData dialogData)
        {
            var remoteAPI      = _context.GetRemoteAPI();
            var task           = _context.GetTaskManager();
            var dataRepository = _context.GetDataRepository();
            var checkinConfigResultContainer =
                dataRepository.GetContainer <CheckinConfigResult>(DataKey.CheckinConfigResult);

            checkinConfigResultContainer.ClearNotInvalidate();
            remoteAPI.RequestCheckinConfig();
            task.ExecuteTask(
                () =>
            {
                var data = checkinConfigResultContainer.Read();
                dialogData.SetDialogDataState(DialogDataState.Wait);
                return(data != null);
            },
                () =>
            {
                var data = checkinConfigResultContainer.Read();
                if (data == null)
                {
                    dialogData.SetDialogDataState(DialogDataState.Failed);
                    return;
                }
                var config = data.checkin_config;
                if (config == null)
                {
                    dialogData.SetDialogDataState(DialogDataState.Failed);
                    return;
                }
                var checkinItems = config.checkin_item;
                var todayChecked = false;

                if (checkinItems != null)
                {
                    for (int i = 0; i < checkinItems.Count; i++)
                    {
                        var c = checkinItems[i];
                        if (config.current_day == c.day)
                        {
                            todayChecked = c.status == CheckinStatus.Checked;
                            break;
                        }
                    }
                }

                if (todayChecked)
                {
                    dialogData.SetDialogDataState(DialogDataState.Failed);
                    return;
                }

                ShowDialog <UIWindow>(DialogName.CheckinDialog, true, true,
                                      (dialog) =>
                {
                    dialogData.SetDialogDataState(DialogDataState.Ok);
                    dialogData.SetCurrentShowDialog(dialog);
                });
            }, null);
        }
Ejemplo n.º 4
0
 public bool ContainAutoShowDialogData(AutoShowDialogData data)
 {
     return(_autoShowDialogDatas.Contains(data));
 }