Ejemplo n.º 1
0
        /// <exception cref="Bad">
        /// <see cref="Bad.AccessError"/> if sender if not client/respondent/admin.
        /// </exception>
        /// <exception cref="Bad">
        /// <see cref="Bad.UselessRequest"/> if appeal is resolved.
        /// </exception>
        /// <exception cref="Bad">
        /// <see cref="Bad.UnknownError"/>.
        /// </exception>
        public async Task <AppealMessage> HandleAsync(CreateAppealMessageData data)
        {
            _data = data.Validate();

            await _data.Sender.LoadRoleSetAsync(_userManager);

            CheckAccess();
            CheckAppeal();

            _data.EnsureNoErrors();

            var newMessage = new AppealMessage
            {
                Appeal  = _data.Appeal,
                Sender  = _data.Sender,
                Content = _data.Content,
            };

            try
            {
                await Db.AddAsync(newMessage);

                await Db.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, "Cannot create new AppealMessage!");
                throw Bad.UnknownError;
            }

            OnCreated?.Invoke(newMessage);

            return(newMessage);
        }
Ejemplo n.º 2
0
        public ISnake Create(int initialLength, Vector3Int position, Vector3 direction)
        {
            var instance = Instantiate(_prefab);
            var snake    = instance.GetComponent <ISnake>();

            (snake as Snake).Construct(initialLength, position, direction, _world);
            OnCreated?.Invoke(snake);
            _world.AddItem(snake, false);
            return(snake);
        }
Ejemplo n.º 3
0
        public IBoardTileEntity Create(Vector3 startPosition)
        {
            var boardTileEntity = new BoardTileEntity(startPosition);

            BoardTileModel.AddEntity(boardTileEntity);

            OnCreated?.Invoke(this, boardTileEntity);

            return(boardTileEntity);
        }
Ejemplo n.º 4
0
    protected void Awake()
    {
        LifeSpan    = 0.0f;
        IsActive    = true;
        isDestroyed = false;

        circleCollider = GetComponent <CircleCollider2D>();

        OnCreated?.Invoke(gameObject);

        OnAwake();
    }
Ejemplo n.º 5
0
        public IBoardTileEntity Create(Vector3 startPosition)
        {
            var boardTile = BoardTileCreator.Create(startPosition);

            var boardTileView = BoardTileViewPool.Spawn(boardTile);

            BoardTileViewModel.AddView(boardTile, boardTileView);

            OnCreated?.Invoke(this, boardTile);

            return(boardTile);
        }
Ejemplo n.º 6
0
        private void FileSystemWatcher_Created(object sender, FileSystemEventArgs e)
        {
            Load();
            //start
            var guid = Path.GetFileNameWithoutExtension(e.Name);

            if (Guid.TryParse(guid, out var result))
            {
                Dev2Logger.Info($"Trigger created '{guid}'", GlobalConstants.ServerWorkspaceID.ToString());
                OnCreated?.Invoke(result);
            }
        }
Ejemplo n.º 7
0
    private void Start()
    {
        RestoreDurability();

        if (isInvisibleAtStart)
        {
            SetVisibility(false);
            canDamaged = false;
        }

        OnCreated?.Invoke();
    }
Ejemplo n.º 8
0
        public override void OnResume()
        {
            (Dialog as AlertDialog)?.GetButton((int)DialogButtonType.Positive).SetOnClickListener(new ClickListener(async delegate
            {
                string provider = networkProvider[networkProviderSpinner.SelectedItemPosition];
                string value    = tbPhoneNo.EditText.TrimInput();

                //  Validate phone no
                if (tbPhoneNo.SetError(InputHandler.IsValidPhone(value) ? null : "Invalid phone number"))
                {
                    return;
                }

                //
                var proxy = ProxyFactory.GetProxyInstace();

                if (isEdit)
                {
                    var editInfo = new EditWalletInfo();

                    if (editInfo.Value != value)
                    {
                        editInfo.Value = value;
                    }

                    if (editInfo.Provider != provider)
                    {
                        editInfo.Provider = provider;
                    }

                    if (editInfo.AnyUpdate())
                    {
                        using (Activity.ShowProgress(null, "Saving changes, please hold on..."))
                        {
                            var response = await proxy.ExecuteAsync(API.Endpoints.WalletEndpoints.UpdateWallet(walletInfo.Id, editInfo));
                            if (response.Successful)
                            {
                                //
                                walletInfo.Provider = provider;
                                walletInfo.Value    = value;

                                //
                                OnUpdated?.Invoke(this, walletInfo);

                                //
                                Dialog.Dismiss();
                            }
                            else
                            {
                                Toast.MakeText(Activity, response.GetErrorDescription(), ToastLength.Short).Show();
                            }
                        }
                    }
                }
                else
                {
                    using (Activity.ShowProgress(null, "Creating wallet, please hold on..."))
                    {
                        var response = await proxy.ExecuteAsync(API.Endpoints.WalletEndpoints.CreateWallet(provider, value));
                        if (response.Successful)
                        {
                            OnCreated?.Invoke(this, await response.GetDataAsync <WalletInfo>());

                            //
                            Dialog.Dismiss();
                        }
                        else
                        {
                            Toast.MakeText(Activity, response.GetErrorDescription(), ToastLength.Short).Show();
                        }
                    }
                }
            }));

            base.OnResume();
        }
Ejemplo n.º 9
0
 private void Awake()
 {
     CenterWithPad();
     CalculatePadOffset();
     OnCreated?.Invoke(this);
 }
Ejemplo n.º 10
0
 public void Initialize(Player player)
 {
     this.Player = player;
     OnCreated?.Invoke(this);
 }
Ejemplo n.º 11
0
 public void CallOnCreated(Guid guid)
 {
     OnCreated?.Invoke(guid);
 }
Ejemplo n.º 12
0
 public void Created(CefBrowser bs)
 {
     OnCreated?.Invoke(bs, EventArgs.Empty);
 }
Ejemplo n.º 13
0
 internal void on_OnCreated() =>
 OnCreated?.Invoke();
Ejemplo n.º 14
0
 protected virtual void Start()
 {
     OnCreated?.Invoke(this);
 }
        /// <summary>
        /// 创建一个对象信息
        /// </summary>
        /// <param name="info">新增对象</param>
        /// <param name="logonInfo">登录人信息</param>
        /// <returns></returns>
        public virtual ResultView Create(T info, TokenLogonInfo logonInfo)
        {
            if (info == null)
            {
                ApiException.ThrowBadRequest("新增对象不能为空");
            }
            _logger.LogTrace($"新增一个对象信息 ==> 类型为:[{typeof(T).FullName}]\r\n新增对象:[{info.ToJson()}]");

            try
            {
                // 新增数据前的预制数据
                info.CreateDate   = DateTime.Now;
                info.UpdateDate   = DateTime.Now;
                info.UpdaterId    = logonInfo.Id;
                info.UpdaterName  = logonInfo.Name;
                info.CreaterId    = logonInfo.Id;
                info.CreaterName  = logonInfo.Name;
                info.IsDelete     = false;
                info.ProcessState = ProcessState.Edit;

                #region 保存验证
                // 保存的数据校验
                SavingCheck(info, logonInfo);
                // 判断是否可以执行新增操作
                if (!IsExecuteCreate(info, logonInfo))
                {
                    return(ResultView.Success());
                }
                // 保存数据验证的事件处理
                OnCreateCheck?.Invoke(info, logonInfo);
                OnSaveCheck?.Invoke(info, logonInfo);
                #endregion

                #region 保存的前置处理
                // 新增的前置操作,可以被重写
                Creating(info, logonInfo);
                // 新增/保存的通用前置操作,可以被重写
                Saving(info, logonInfo);
                // 新增时的前置事件处理
                OnCreating?.Invoke(info, logonInfo);
                OnSaving?.Invoke(info, logonInfo);
                #endregion

                // 持久化数据
                _Dal.InsertObject(info);

                #region 保存后置处理
                // 新增的通用后置操作,可以被重写
                Created(info, logonInfo);
                // 新增/保存的通用后置操作,可以被重写
                Saved(info, logonInfo);
                // 新增后的后置事件处理
                OnCreated?.Invoke(info, logonInfo);
                OnSaved?.Invoke(info, logonInfo);
                #endregion

                // 返回保存结果
                return(ResultView.Success(info.IdString));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"新增一个对象信息异常 ==> 类型为:[{typeof(T).FullName}]\r\n操作人信息:[{logonInfo.ToJson()}]\r\n新增对象:[{info.ToJson()}]");
                throw;
            }
        }
Ejemplo n.º 16
0
 private void Start()
 {
     OnCreated?.Invoke();
 }
    private void OnEnable()
    {
        OnCreated += LevelManager.Instance.OnFillableCubeCreated;

        OnCreated?.Invoke(this);
    }
Ejemplo n.º 18
0
 public void NotifyOnCreated()
 {
     OnCreated?.Invoke(this);
 }