예제 #1
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ISubscriptionItemHeader subscriptionItemHeader = item as ISubscriptionItemHeader;

            if (subscriptionItemHeader == null)
            {
                return((DataTemplate)null);
            }
            switch (subscriptionItemHeader.SubscriptionItemType)
            {
            case SubscriptionItemType.Subscription:
                return(this.SubscriptionItemTemplate);

            case SubscriptionItemType.Invitation:
                return(this.InvitationItemTemplate);

            default:
                return((DataTemplate)null);
            }
        }
예제 #2
0
 public void LoadData()
 {
     this._isLoaded  = false;
     this._isError   = false;
     this._isLoading = true;
     this.NotifyProperties();
     this._friendsImportProvider.CompleteLogin((Action <bool>)(succeeded =>
     {
         if (!succeeded)
         {
             this._isError   = true;
             this._isLoading = false;
             this._isLoaded  = true;
             this.NotifyProperties();
         }
         else
         {
             FriendsImportHelper.LoadData(this._friendsImportProvider, delegate(FriendsImportResponse response)
             {
                 Execute.ExecuteOnUIThread(delegate
                 {
                     List <ISubscriptionItemHeader> foundUsers = response.FoundUsers;
                     List <ISubscriptionItemHeader> otherUsers = response.OtherUsers;
                     if (foundUsers.Count > 0)
                     {
                         Group <ISubscriptionItemHeader> group = new Group <ISubscriptionItemHeader>("", false);
                         using (List <ISubscriptionItemHeader> .Enumerator enumerator = foundUsers.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ISubscriptionItemHeader current = enumerator.Current;
                                 group.Add(current);
                             }
                         }
                         this.Collection.Add(group);
                     }
                     if (otherUsers.Count > 0)
                     {
                         Group <ISubscriptionItemHeader> group2 = new Group <ISubscriptionItemHeader>(CommonResources.Title_InviteToVK, false);
                         using (List <ISubscriptionItemHeader> .Enumerator enumerator = otherUsers.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 ISubscriptionItemHeader current2 = enumerator.Current;
                                 group2.Add(current2);
                             }
                         }
                         this.Collection.Add(group2);
                     }
                     this._isLoading = false;
                     this._isLoaded  = true;
                     this.NotifyProperties();
                 });
             }, delegate(ResultCode resultCode)
             {
                 this._isError   = true;
                 this._isLoading = false;
                 this._isLoaded  = true;
                 this.NotifyProperties();
             });
         }
     }));
 }