Exemplo n.º 1
0
        async UniTask OnChanged(object source, FileSystemEventArgs args, string root)
        {
            await UniTask.SwitchToMainThread();

            //Change
            if (File.Exists(args.FullPath) || Directory.Exists(args.FullPath))
            {
                //Directory change
                if (File.GetAttributes(args.FullPath) == FileAttributes.Directory)
                {
                    OnDirectoryChanged?.Invoke(args.FullPath, root);
                }
                //File change
                else
                {
                    string fileExtension = $"*{Path.GetExtension(args.FullPath)}";
                    for (int i = 0; i < FileExtensions.Length; i++)
                    {
                        if (fileExtension == FileExtensions[i])
                        {
                            OnFileChanged?.Invoke(args.FullPath, root);
                            break;
                        }
                    }
                }
            }
            //Remove
            else
            {
                OnDeleted?.Invoke(args.FullPath, root);
            }
        }
Exemplo n.º 2
0
 public void CleanUp()
 {
     if (!Removeable)
     {
         throw new System.Exception("Tried to remove unremovable point");
     }
     OnDeleted?.Invoke(this);
 }
Exemplo n.º 3
0
 public bool DeleteAward(string title)
 {
     if (!AwardsStorage.DeleteAward(title))
     {
         return(false);
     }
     OnDeleted?.Invoke(title);
     return(true);
 }
Exemplo n.º 4
0
 public bool DeleteUser(String name)
 {
     if (!UsersStorage.DeleteUser(name))
     {
         return(false);
     }
     OnDeleted?.Invoke(name);
     return(true);
 }
Exemplo n.º 5
0
        private async Task Delete(int id)
        {
            var region = Regions.FirstOrDefault(p => p.Id.Equals(id));

            var confirmed = await Js.InvokeAsync <bool>("confirm", $"Are you sure you want to delete the region with name: {region.Name}?");

            if (confirmed)
            {
                await OnDeleted.InvokeAsync(id);
            }
        }
        private async Task Delete(int id)
        {
            var car = Cars.FirstOrDefault(p => p.Id.Equals(id));

            var confirmed = await Js.InvokeAsync <bool>("confirm", $"Delete car with id: {car.Id}?");

            if (confirmed)
            {
                await OnDeleted.InvokeAsync(id);
            }
        }
Exemplo n.º 7
0
        private async Task Delete(Guid id)
        {
            var product = Products.FirstOrDefault(p => p.Id.Equals(id));

            var confirmed = await Js.InvokeAsync <bool>("confirm", $"Are you sure you want to delete {product.Name} product?");

            if (confirmed)
            {
                await OnDeleted.InvokeAsync(id);
            }
        }
Exemplo n.º 8
0
        private async Task Delete(int id)
        {
            var apartment = Apartments.FirstOrDefault(p => p.Id.Equals(id));

            var confirmed = await Js.InvokeAsync <bool>("confirm", $"Are you sure you want to delete the apartment with Id: {apartment.Id}?");

            if (confirmed)
            {
                await OnDeleted.InvokeAsync(id);
            }
        }
        private async Task Delete(int id)
        {
            var manufacturer = Manufacturers.FirstOrDefault(p => p.Id.Equals(id));

            var confirmed = await Js.InvokeAsync <bool>("confirm", $"Delete: {manufacturer.Name}?");

            if (confirmed)
            {
                await OnDeleted.InvokeAsync(id);
            }
        }
Exemplo n.º 10
0
        private async Task Delete(int id)
        {
            var house = Houses.FirstOrDefault(p => p.Id.Equals(id));

            var confirmed = await Js.InvokeAsync <bool>("confirm", $"Are you sure you want to delete the house with Id: {house.Id}?");

            if (confirmed)
            {
                await OnDeleted.InvokeAsync(id);
            }
        }
Exemplo n.º 11
0
        private void FileSystemWatcher_Deleted(object sender, FileSystemEventArgs e)
        {
            Load();
            //kill
            var guid = Path.GetFileNameWithoutExtension(e.Name);

            if (Guid.TryParse(guid, out var result))
            {
                Dev2Logger.Info($"Trigger deleted '{guid}'", GlobalConstants.ServerWorkspaceID.ToString());
                OnDeleted?.Invoke(result);
            }
        }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="info">要删除的数据id</param>
        /// <param name="logonInfo">登录的用户信息</param>
        /// <returns></returns>
        public ResultView Delete(T info, TokenLogonInfo logonInfo)
        {
            if (info == null)
            {
                throw ApiException.EmptyData("无法找到要删除的数据");
            }
            string id = info.Id.ToString();

            _logger.LogTrace($"逻辑删除 ==> 类型为:[{typeof(T).FullName}]\t删除ID为:[{id}]");
            try
            {
                // 判断对应数据是否可以删除.
                DeleteRemoveCheck(info);
                OnDeleteRemoveCheck?.Invoke(info, logonInfo);
                DeleteCheck(info);
                OnDeleteCheck?.Invoke(info, logonInfo);
                // 逻辑删除的前置操作
                DeleteRemoving(info, logonInfo);
                Deleting(info, logonInfo);
                // 逻辑删除前置事件处理
                OnDeleting?.Invoke(info, logonInfo);
                // 设置逻辑删除状态
                info.UpdateDate  = DateTime.Now;
                info.UpdaterId   = logonInfo.Id;
                info.UpdaterName = logonInfo.Name;
                info.IsDelete    = true;

                // 持久化数据
                _Dal.UpdateObject(info);
                // 逻辑删除的后置处理
                Deleted(info, logonInfo);
                DeleteRemoved(info, logonInfo);
                // 逻辑删除后置事件处理
                OnDeleted?.Invoke(info, logonInfo);
                // 返回保存结果
                return(ResultView.Success(id));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"逻辑删除异常 ==> 类型为:[{typeof(T).FullName}]\t删除ID为:[{id}]\r\n删除对象:[{info.ToJson()}]");
                throw;
            }
        }
Exemplo n.º 13
0
 void ISubscriptionObserver.OnDeleted(ISubscription subscription)
 {
     OnDeleted.InvokeSafe(subscription);
 }
Exemplo n.º 14
0
 internal void RaiseOnDeleted()
 {
     OnDeleted?.Invoke(this);
 }
Exemplo n.º 15
0
 public virtual void Delete()
 {
     OnDeleted?.Invoke();
 }
Exemplo n.º 16
0
 public virtual void Delete()
 {
     From.Disconnect(this, false);
     To.Disconnect(this, false);
     OnDeleted?.Invoke();
 }
        protected async Task OnDeleteClicked()
        {
            await Http.DeleteAsync($"api/cart/lines/{Details.Id}");

            await OnDeleted.InvokeAsync(Details);
        }
Exemplo n.º 18
0
 public void CallOnDeleted(Guid guid)
 {
     OnDeleted?.Invoke(guid);
 }