public void GetData(GenericCollectionViewModel2 <VKList <Photo>, MediaListItemViewModelBase> caller, int offset, int count, Action <BackendResult <VKList <Photo>, ResultCode> > callback)
 {
     if (this._isGroup)
     {
         ProfilesService.Instance.GetPhotos(-this._profileData.Id, this._offset, this._groupData.group.main_album_id, (Action <BackendResult <VKList <Photo>, ResultCode> >)(result =>
         {
             if (result.ResultCode == ResultCode.Succeeded)
             {
                 this._offset = this._offset + count;
             }
             callback(result);
         }));
     }
     else
     {
         ProfilesService.Instance.GetAllPhotos(this._profileData.Id, this._offset, (Action <BackendResult <VKList <Photo>, ResultCode> >)(result =>
         {
             if (result.ResultCode == ResultCode.Succeeded)
             {
                 Photo photo  = result.ResultData.items.LastOrDefault <Photo>();
                 this._offset = photo == null ? this._offset + count : photo.real_offset + 1;
             }
             callback(result);
         }));
     }
 }
 public string GetFooterTextForCount(GenericCollectionViewModel2 <VKList <Product>, TwoInARowItemViewModel <Product> > caller, int count)
 {
     if (this._productsCount <= 0)
     {
         return(CommonResources.NoProducts);
     }
     return(UIStringFormatterHelper.FormatNumberOfSomething(this._productsCount, CommonResources.OneProductFrm, CommonResources.TwoFourProductsFrm, CommonResources.FiveProductsFrm, true, null, false));
 }
 public string GetFooterTextForCount(GenericCollectionViewModel2 <MarketFeedResponse, MarketFeedItem> caller, int count)
 {
     if (this._productsCount == 0)
     {
         return(CommonResources.NoProducts);
     }
     return(UIStringFormatterHelper.FormatNumberOfSomething(this._productsCount, CommonResources.OneProductFrm, CommonResources.TwoFourProductsFrm, CommonResources.FiveProductsFrm, true, null, false));
 }
 public ProfileMarketViewModel()
 {
     this._items   = new ObservableCollection <MediaListItemViewModelBase>();
     this._itemsVM = new GenericCollectionViewModel2 <VKList <Product>, MediaListItemViewModelBase>((ICollectionDataProvider2 <VKList <Product>, MediaListItemViewModelBase>) this)
     {
         LoadCount = 28
     };
 }
Beispiel #5
0
 public ProfileVideosViewModel()
 {
     this._items   = new ObservableCollection <MediaListItemViewModelBase>();
     this._itemsVM = new GenericCollectionViewModel2 <VKList <VKClient.Common.Backend.DataObjects.Video>, MediaListItemViewModelBase>((ICollectionDataProvider2 <VKList <VKClient.Common.Backend.DataObjects.Video>, MediaListItemViewModelBase>) this)
     {
         LoadCount = 28
     };
 }
 public ProfilePhotosViewModel()
 {
     this._items   = new ObservableCollection <MediaListItemViewModelBase>();
     this._itemsVM = new GenericCollectionViewModel2 <VKList <Photo>, MediaListItemViewModelBase>(this)
     {
         LoadCount = 28
     };
     EventAggregator.Current.Subscribe(this);
 }
 public void GetData(GenericCollectionViewModel2 <VKList <Product>, MediaListItemViewModelBase> caller, int offset, int count, Action <BackendResult <VKList <Product>, ResultCode> > callback)
 {
     MarketService.Instance.GetProducts(this._isGroup ? -this._profileData.Id : this._profileData.Id, (long)this._marketAlbumId, count, this._offset, (Action <BackendResult <VKList <Product>, ResultCode> >)(result =>
     {
         if (result.ResultCode == ResultCode.Succeeded)
         {
             this._offset = this._offset + count;
         }
         callback(result);
     }));
 }
Beispiel #8
0
 public void GetData(GenericCollectionViewModel2 <VKList <VKClient.Common.Backend.DataObjects.Video>, MediaListItemViewModelBase> caller, int offset, int count, Action <BackendResult <VKList <VKClient.Common.Backend.DataObjects.Video>, ResultCode> > callback)
 {
     VideoService.Instance.GetVideos(this._profileData.Id, this._isGroup, this._offset, count, (Action <BackendResult <VKList <VKClient.Common.Backend.DataObjects.Video>, ResultCode> >)(result =>
     {
         if (result.ResultCode == ResultCode.Succeeded)
         {
             this._offset = this._offset + count;
         }
         callback(result);
     }), 0, true);
 }
 public ProductsSearchResultsViewModel(long ownerId, long priceFrom, long priceTo, int currencyId, string currencyName, SearchParams searchParams = null)
 {
     this._ownerId               = ownerId;
     this._priceFrom             = priceFrom;
     this._priceTo               = priceTo;
     this._currencyId            = currencyId;
     this._currencyName          = currencyName;
     this._searchVM              = new GenericCollectionViewModel2 <VKList <Product>, TwoInARowItemViewModel <Product> >((ICollectionDataProvider2 <VKList <Product>, TwoInARowItemViewModel <Product> >) this);
     this._searchParamsViewModel = new SearchParamsViewModel((ISupportSearchParams)this);
     if (searchParams != null)
     {
         this._searchParamsViewModel.SearchParams = searchParams;
     }
     EventAggregator.Current.Subscribe((object)this);
 }
        public void RemoveFromCommunity(LinkHeader user)
        {
            this.SetInProgress(true, "");
            Func <LinkHeader, bool> func1;
            Func <LinkHeader, bool> func2;
            Func <LinkHeader, bool> func3;
            Func <LinkHeader, bool> func4;

            GroupsService.Current.HandleRequest(this.CommunityId, user.Id, false, (Action <BackendResult <int, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    LinkHeader linkHeader1 = this.All.Collection.FirstOrDefault <LinkHeader>((func1 = (Func <LinkHeader, bool>)(i => i.Id == user.Id)));
                    if (linkHeader1 != null)
                    {
                        this.All.Delete(linkHeader1);
                    }
                    LinkHeader linkHeader2 = this.Unsure.Collection.FirstOrDefault <LinkHeader>((func2 = (Func <LinkHeader, bool>)(i => i.Id == user.Id)));
                    if (linkHeader2 != null)
                    {
                        this.Unsure.Delete(linkHeader2);
                    }
                    LinkHeader linkHeader3 = this.Friends.Collection.FirstOrDefault <LinkHeader>((func3 = (Func <LinkHeader, bool>)(i => i.Id == user.Id)));
                    if (linkHeader3 != null)
                    {
                        this.Friends.Delete(linkHeader3);
                    }
                    GenericCollectionViewModel2 <VKList <User>, LinkHeader> searchViewModel = this.SearchViewModel;
                    if ((searchViewModel != null ? searchViewModel.GroupedCollection : (ObservableCollection <Group <LinkHeader> >)null) != null && this.SearchViewModel.GroupedCollection.Count > 1)
                    {
                        LinkHeader linkHeader4 = this.SearchViewModel.GroupedCollection[1].FirstOrDefault <LinkHeader>((func4 = (Func <LinkHeader, bool>)(i => i.Id == user.Id)));
                        if (linkHeader4 != null)
                        {
                            this.SearchViewModel.DeleteGrouped(linkHeader4);
                        }
                    }
                }
                else
                {
                    GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", null);
                }
                this.SetInProgress(false, "");
            }))));
        }
Beispiel #11
0
        public static void ShowPopup()
        {
            DialogService dialogService = new DialogService();

            dialogService.AnimationType      = DialogService.AnimationTypes.None;
            dialogService.AnimationTypeChild = DialogService.AnimationTypes.SlideInversed;
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);

            dialogService.BackgroundBrush = (Brush)solidColorBrush;
            int num = 1;

            dialogService.ShowOnFrame = num != 0;
            SearchHintsUC._flyout     = dialogService;
            if (SearchHintsUC._viewModel == null || SearchHintsUC._isReloadScheduled)
            {
                SearchHintsUC._isReloadScheduled = false;
                SearchHintsSearchDataProvider.Reset();
                SearchHintsUC._viewModel = new GenericSearchViewModel <SearchHint, SearchHintHeader>((ISearchDataProvider <SearchHint, SearchHintHeader>) new SearchHintsSearchDataProvider());
                SearchHintsUC._viewModel.LoadData(true, false, true, false, true);
            }
            SearchHintsUC searchHintsUc = new SearchHintsUC();
            GenericCollectionViewModel2 <VKList <SearchHint>, SearchHintHeader> searchVm = SearchHintsUC._viewModel.SearchVM;

            ((FrameworkElement)searchHintsUc).DataContext = searchVm;
            searchHintsUc.searchTextBox.Text = (SearchHintsUC._viewModel.SearchString ?? "");
            SearchHintsUC uc = searchHintsUc;

            ((UIElement)uc.textBlockWatermarkText).Opacity = (string.IsNullOrEmpty(uc.searchTextBox.Text) ? 1.0 : 0.0);
            SearchHintsUC._flyout.Child   = (FrameworkElement)uc;
            SearchHintsUC._flyout.Opened += (EventHandler)((sender, args) => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (!string.IsNullOrWhiteSpace(uc.searchTextBox.Text))
                {
                    return;
                }
                ((Control)uc.searchTextBox).Focus();
            })));
            SearchHintsUC._flyout.Closed += (EventHandler)((sender, args) => ((FrameworkElement)uc).DataContext = null);
            SearchHintsUC._flyout.Show(null);
        }
        public void Handle(CommunityBlockChanged message)
        {
            if (message.CommunityId != this.CommunityId || message.User.ban_info.end_date != 0)
            {
                return;
            }
            LinkHeader linkHeader1 = this.All.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.User.id));

            if (linkHeader1 != null)
            {
                this.All.Delete(linkHeader1);
            }
            LinkHeader linkHeader2 = this.Unsure.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.User.id));

            if (linkHeader2 != null)
            {
                this.Unsure.Delete(linkHeader2);
            }
            LinkHeader linkHeader3 = this.Friends.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.User.id));

            if (linkHeader3 != null)
            {
                this.Friends.Delete(linkHeader3);
            }
            GenericCollectionViewModel2 <VKList <User>, LinkHeader> searchViewModel = this.SearchViewModel;

            if ((searchViewModel != null ? searchViewModel.GroupedCollection : (ObservableCollection <Group <LinkHeader> >)null) == null || this.SearchViewModel.GroupedCollection.Count <= 1)
            {
                return;
            }
            LinkHeader linkHeader4 = this.SearchViewModel.GroupedCollection[1].FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.User.id));

            if (linkHeader4 == null)
            {
                return;
            }
            this.SearchViewModel.GroupedCollection[1].Remove(linkHeader4);
        }
        public void Handle(CommunityManagerChanged message)
        {
            if (message.CommunityId != this.CommunityId)
            {
                return;
            }
            LinkHeader user1 = this.All.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.ManagerId));

            if (user1 != null)
            {
                this.HandleUserChanged(message, user1);
            }
            LinkHeader user2 = this.Unsure.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.ManagerId));

            if (user2 != null)
            {
                this.HandleUserChanged(message, user2);
            }
            LinkHeader user3 = this.Friends.Collection.FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.ManagerId));

            if (user3 != null)
            {
                this.HandleUserChanged(message, user3);
            }
            GenericCollectionViewModel2 <VKList <User>, LinkHeader> searchViewModel = this.SearchViewModel;

            if ((searchViewModel != null ? searchViewModel.GroupedCollection : (ObservableCollection <Group <LinkHeader> >)null) == null || this.SearchViewModel.GroupedCollection.Count <= 1)
            {
                return;
            }
            LinkHeader user4 = this.SearchViewModel.GroupedCollection[1].FirstOrDefault <LinkHeader>((Func <LinkHeader, bool>)(u => u.Id == message.ManagerId));

            if (user4 == null)
            {
                return;
            }
            this.HandleUserChanged(message, user4);
        }
 public void GetData(GenericCollectionViewModel2 <VKList <Product>, TwoInARowItemViewModel <Product> > caller, int offset, int count, Action <BackendResult <VKList <Product>, ResultCode> > callback)
 {
     MarketService.Instance.Search(this._ownerId, 0L, this._searchParamsViewModel.SearchParams, this._query, count, this._productsCount, callback);
 }
 public void GetData(GenericCollectionViewModel2 <MarketFeedResponse, MarketFeedItem> caller, int offset, int count, Action <BackendResult <MarketFeedResponse, ResultCode> > callback)
 {
     MarketService.Instance.GetFeed(this._ownerId, count, this._productsCount, callback);
 }
 public string GetFooterTextForCount(GenericCollectionViewModel2 <VKList <Product>, MediaListItemViewModelBase> caller, int count)
 {
     return("");
 }
Beispiel #17
0
 public string GetFooterTextForCount(GenericCollectionViewModel2 <VKList <VKClient.Common.Backend.DataObjects.Video>, MediaListItemViewModelBase> caller, int count)
 {
     return("");
 }