Exemple #1
0
		CurrentItemsCollection FillCurrentRow( DataRow row)
		{
			CurrentItemsCollection ci = new CurrentItemsCollection();
			if (row != null) {
				CurrentItem c = null;
				foreach (DataColumn dc in table.Columns) {
					c = new CurrentItem(dc.ColumnName,dc.DataType);
					c.Value = row[dc.ColumnName];
					ci.Add(c);
				}
			}
			return ci;
		}
        /*
        public override CurrentItemsCollection FillDataRow(int pos)
        {
            CurrentItemsCollection ci = new CurrentItemsCollection();
        	var obj = CurrentFromPosition(pos);
            if (obj != null)
            {
                CurrentItem currentItem = null;
                foreach (PropertyDescriptor pd in this.listProperties)
                {
                    currentItem = new CurrentItem();
                    currentItem.ColumnName = pd.Name;
                    currentItem.DataType = pd.PropertyType;
                    
                    var propValue = FollowPropertyPath(obj,pd.Name);
                    if (propValue != null)
                    {
                        currentItem.Value = propValue.ToString();
                    }
                    else
                    {
                        currentItem.Value = String.Empty;
                    }
                    ci.Add(currentItem);
                }
            }
            return ci;
        }
*/

       
		public override CurrentItemsCollection FillDataRow()
		{
            CurrentItemsCollection ci = base.FillDataRow();
			if (current != null) {
				CurrentItem c = null;
				foreach (PropertyDescriptor pd in this.listProperties)
				{
					c = new CurrentItem(pd.Name,pd.PropertyType);
                    var s = pd.GetValue(this.Current);
                    if (s != null)
                    {
                        c.Value = s.ToString();
                    }
                    else
                    {
                        c.Value = String.Empty;
                    }
					ci.Add(c);
				}
			}
			return ci;
		}
Exemple #3
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            CurrentItem.BindValueChanged(currentItemChanged, true);
        }
 public override CurrentItemsCollection FillDataRow(int pos)
 {
 	CurrentItemsCollection ci = new CurrentItemsCollection();
 	var obj = CurrentFromPosition(pos);
 	if (obj != null)
 	{
 		CurrentItem currentItem = null;
 		foreach (PropertyDescriptor pd in this.listProperties)
 		{
 		    currentItem = new CurrentItem(pd.Name, pd.PropertyType);
 			PropertyPath prop = obj.ParsePropertyPath(pd.Name);
 			if (prop != null)
 			{
 				var pp = prop.Evaluate(obj);
                 if (pp != null)
                 {
                    currentItem.Value = pp.ToString(); 
                 }
 			}
 			ci.Add(currentItem);
 		}
 	}
 	return ci;
 }
        public void LoadNextSlice()
        {
            if (LazyItems.Count > 0)
            {
                return;
            }
            if (IsWorking)
            {
                return;
            }
            if (_isLastSliceLoaded)
            {
                return;
            }

            if (CurrentItem is TLBroadcastChat && !(CurrentItem is TLChannel))
            {
                Status = string.Empty;
                if (Items.Count == 0)
                {
                    IsEmptyList = true;
                    NotifyOfPropertyChange(() => IsEmptyList);
                }

                return;
            }

            IsWorking = true;
            MTProtoService.SearchAsync(
                CurrentItem.ToInputPeer(),
                TLString.Empty,
                InputMessageFilter,
                new TLInt(0), new TLInt(0), new TLInt(0), new TLInt(_lastMinId), new TLInt(Constants.FileSliceLength),
                messages => BeginOnUIThread(() =>
            {
                if (messages.Messages.Count == 0 ||
                    messages.Messages.Count < Constants.FileSliceLength)
                {
                    _isLastSliceLoaded = true;
                }

                if (messages.Messages.Count > 0)
                {
                    _lastMinId = messages.Messages.Min(x => x.Index);
                }
                AddMessages(messages.Messages.ToList());

                Status = string.Empty;
                if (Items.Count == 0)
                {
                    IsEmptyList = true;
                    NotifyOfPropertyChange(() => IsEmptyList);
                }

                IsWorking = false;
            }),
                error =>
            {
                Execute.ShowDebugMessage("messages.search error " + error);
                Status    = string.Empty;
                IsWorking = false;
            });
        }