Ejemplo n.º 1
0
 void IHandle <KeyNodeEventArgs> .Handle(KeyNodeEventArgs arg)
 {
     if (arg.Type == KeyNodeEventType.Select)
     {
         this.Content   = arg.Data;
         this.Title     = string.Format("{0}::db{1}::{2}", arg.Data.Parent.RedisClient.RedisConfig.IP, arg.Data.Parent.Index, arg.Data.KeyName);
         this.IsVisible = true;
     }
     else if (arg.Type == KeyNodeEventType.Delete)
     {
         if (this.Content != null && this.Content.Equals(arg.Data))
         {
             this.Content   = null;
             this.IsVisible = false;
         }
     }
 }
Ejemplo n.º 2
0
        private async void LoadKeysAsync(bool needClear)
        {
            if (needClear)
            {
                this.Keys.Clear();
            }

            this._client.Select(this.Index); //选中本节点索引
            var sp = this._client.GetDataBase().Scan(this._offSet, "*", PAGE_SIZE);

            this._offSet = sp.Offset;
            var keys = sp.Data;

            if (keys == null)
            {
                return;
            }
            var lst = await Task.Run(() =>
            {
                List <KeyViewModel> result = new List <RedisClient.KeyViewModel>();
                foreach (var key in keys)
                {
                    var keyType = this._client.Type(key);

                    var vm = KeyViewModel.Create(keyType, key, this);
                    if (vm != null)
                    {
                        result.Add(vm);
                    }
                }
                return(result);
            });

            lst.ForEach(x => this.Keys.Add(x));
            this.DBSize = this._client.GetDataBase(this._dbIdx).Keys().Count;
            this.NotifyOfPropertyChange(() => this.Name);
        }
Ejemplo n.º 3
0
 public KeyNodeEventArgs(KeyViewModel keyValue, KeyNodeEventType type)
 {
     this.Data = keyValue;
     this.Type = type;
 }