Пример #1
0
        public NewsFeedIgnoreItemData GetIgnoreItemData()
        {
            NewsItem newsItem = this._newsItemWithInfo.NewsItem;
            List <VKClient.Common.Backend.DataObjects.Video> videoList1;

            if (newsItem == null)
            {
                videoList1 = (List <VKClient.Common.Backend.DataObjects.Video>)null;
            }
            else
            {
                VKList <VKClient.Common.Backend.DataObjects.Video> video = newsItem.video;
                videoList1 = video != null ? video.items : (List <VKClient.Common.Backend.DataObjects.Video>)null;
            }
            List <VKClient.Common.Backend.DataObjects.Video> videoList2 = videoList1;

            if (videoList2 == null || videoList2.Count <= 0)
            {
                return((NewsFeedIgnoreItemData)null);
            }
            VKClient.Common.Backend.DataObjects.Video video1 = videoList2[0];
            long itemId = videoList2.Count == 1 ? video1.id : BaseFormatterHelper.GetLastMidnight((long)newsItem.date, false);

            return(new NewsFeedIgnoreItemData("video", video1.owner_id, itemId));
        }
Пример #2
0
        public static string GetVideoUri(VKClient.Common.Backend.DataObjects.Video video, int resolution, out bool isExternal)
        {
            isExternal = false;
            if (video == null || video.files == null || video.files.Count == 0)
            {
                return("");
            }
            KeyValuePair <string, string> keyValuePair = video.files.Last <KeyValuePair <string, string> >();

            if (resolution > 0)
            {
                foreach (KeyValuePair <string, string> file in video.files)
                {
                    if (file.Key.Contains(resolution.ToString()))
                    {
                        keyValuePair = file;
                        break;
                    }
                }
            }
            string str = keyValuePair.Value;

            isExternal = keyValuePair.Key == "external";
            if (keyValuePair.Key.StartsWith("flv"))
            {
                return("");
            }
            return(str);
        }
Пример #3
0
        private void InitResolutionsCollection()
        {
            Execute.ExecuteOnUIThread(delegate
            {
                VKClient.Common.Backend.DataObjects.Video expr_06 = this.Video;
                if (((expr_06 != null) ? expr_06.files : null) != null)
                {
                    using (Dictionary <string, string> .KeyCollection.Enumerator enumerator = this.Video.files.Keys.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            string current = enumerator.Current;
                            this.AddIfNeeded(current, 240);
                            this.AddIfNeeded(current, 360);
                            this.AddIfNeeded(current, 480);
                            this.AddIfNeeded(current, 720);
                            this.AddIfNeeded(current, 1080);
                        }
                    }
                    if (this.Resolutions.Count > 0)
                    {
                        IEnumerable <VideoResolution> arg_C0_0 = this.Resolutions;
                        Func <VideoResolution, int> arg_C0_1   = new Func <VideoResolution, int>((r) => { return(r.Resolution); });

                        this._resolution = (Enumerable.FirstOrDefault <VideoResolution>(Enumerable.OrderByDescending <VideoResolution, int>(arg_C0_0, arg_C0_1), (VideoResolution r) => r.Resolution <= this.DesiredResolution) ?? this.Resolutions[0]);
                    }
                }
            });
        }
Пример #4
0
        public void Handle(VideoUploaded message)
        {
            List <Attachment> attachments = this._attachments;
            Attachment        m0;

            if (attachments == null)
            {
                m0 = null;
            }
            else
            {
                Func <Attachment, bool> func = (Func <Attachment, bool>)(a =>
                {
                    if (a.video != null)
                    {
                        return(a.video.guid == message.guid);
                    }
                    return(false);
                });
                m0 = Enumerable.FirstOrDefault <Attachment>(attachments, (Func <Attachment, bool>)func);
            }
            Attachment attachment = (Attachment)m0;

            if (attachment == null)
            {
                return;
            }
            VKClient.Common.Backend.DataObjects.Video video = attachment.video;
            video.id          = message.SaveVidResp.video_id;
            video.title       = message.SaveVidResp.title;
            video.description = message.SaveVidResp.description;
            video.owner_id    = message.SaveVidResp.owner_id;
            video.access_key  = message.SaveVidResp.access_key;
        }
Пример #5
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            bool flag = true;

            if (!this._isInitialized)
            {
                this._ownerId = long.Parse(((Page)this).NavigationContext.QueryString["OwnerId"]);
                this._videoId = long.Parse(((Page)this).NavigationContext.QueryString["VideoId"]);
                string accessKey    = ((Page)this).NavigationContext.QueryString["AccessKey"];
                string videoContext = "";
                if (((Page)this).NavigationContext.QueryString.ContainsKey("VideoContext"))
                {
                    videoContext = ((Page)this).NavigationContext.QueryString["VideoContext"];
                }
                VKClient.Common.Backend.DataObjects.Video parameterForIdAndReset = ParametersRepository.GetParameterForIdAndReset("Video") as VKClient.Common.Backend.DataObjects.Video;
                StatisticsActionSource actionSource = (StatisticsActionSource)Enum.Parse(typeof(StatisticsActionSource), ((Page)this).NavigationContext.QueryString["VideoSource"]);
                this.InitializeCommentVM();
                VideoCommentsViewModel commentsViewModel = new VideoCommentsViewModel(this._ownerId, this._videoId, accessKey, parameterForIdAndReset, actionSource, videoContext);
                commentsViewModel.PageLoadInfoViewModel.LoadingStateChangedCallback = new Action(this.OnLoadingStateChanged);
                base.DataContext = (commentsViewModel);
                commentsViewModel.Reload(true);
                this.RestoreUnboundState();
                this._isInitialized = true;
                flag = false;
            }
            if (!flag && (!e.IsNavigationInitiator || e.NavigationMode != NavigationMode.New))
            {
                WallPostVMCacheManager.TryDeserializeInstance(this._commentVM);
            }
            this.ProcessInputData();
            this.UpdateAppBar();
        }
Пример #6
0
        public static AddEditVideoViewModel CreateForEditVideo(long ownerId, long videoId, VKClient.Common.Backend.DataObjects.Video video = null)
        {
            AddEditVideoViewModel vm = new AddEditVideoViewModel();

            vm._ownerId      = ownerId;
            vm._videoId      = videoId;
            vm._isInEditMode = true;
            if (video != null)
            {
                vm.InitializeWithVideo(video);
            }
            else
            {
                VideoService.Instance.GetVideoById(ownerId, videoId, "", delegate(BackendResult <List <VKClient.Common.Backend.DataObjects.Video>, ResultCode> res)
                {
                    if (res.ResultCode == ResultCode.Succeeded)
                    {
                        VKClient.Common.Backend.DataObjects.Video vid = Enumerable.First <VKClient.Common.Backend.DataObjects.Video>(res.ResultData);
                        Execute.ExecuteOnUIThread(delegate
                        {
                            vm.InitializeWithVideo(vid);
                        });
                    }
                });
            }
            return(vm);
        }
Пример #7
0
 private void Configure()
 {
     if (this._newsPost.NewsItem.pid != 0L && this._newsPost.NewsItem.post_type == "photo")
     {
         long aid = this._newsPost.NewsItem.aid;
         this._photo = new Photo()
         {
             pid       = this._newsPost.NewsItem.pid,
             aid       = aid,
             src_big   = this._newsPost.NewsItem.src_big,
             src_small = this._newsPost.NewsItem.src_small,
             src_xbig  = this._newsPost.NewsItem.src_xbig,
             src_xxbig = this._newsPost.NewsItem.src_xxbig,
             width     = this._newsPost.NewsItem.width,
             height    = this._newsPost.NewsItem.height,
             owner_id  = this._newsPost.NewsItem.owner_id
         };
     }
     if (this._newsPost.NewsItem.vid == 0L || !(this._newsPost.NewsItem.post_type == "video"))
     {
         return;
     }
     this._video = new VKClient.Common.Backend.DataObjects.Video()
     {
         vid       = this._newsPost.NewsItem.vid,
         duration  = this._newsPost.NewsItem.duration,
         image_big = this._newsPost.NewsItem.image_big,
         owner_id  = this._newsPost.NewsItem.owner_id
     };
 }
Пример #8
0
 private void FireEditedEvent()
 {
     VKClient.Common.Backend.DataObjects.Video basedOnCurrentState = this.CreateVideoBasedOnCurrentState();
     EventAggregator.Current.Publish(new VideoEdited()
     {
         Video = basedOnCurrentState
     });
 }
Пример #9
0
 private void InitializeWithVideo(VKClient.Common.Backend.DataObjects.Video video)
 {
     this.Name                  = video.title;
     this.Description           = video.description;
     this.ViewVideoPrivacyVM    = new EditPrivacyViewModel(CommonResources.AddEditVideo_WhoCanView, video.PrivacyViewInfo, "", null);
     this.CommentVideoPrivacyVM = new EditPrivacyViewModel(CommonResources.AddEditVideo_WhoCanComment, video.PrivacyCommentInfo, "", null);
     this._localThumbPath       = video.photo_320;
 }
Пример #10
0
 public VideoMediaListItemViewModel(VKClient.Common.Backend.DataObjects.Video video)
     : base(ProfileMediaListItemType.Video)
 {
     this._video   = video;
     this.ImageUri = video.photo_640 ?? video.photo_320 ?? video.photo_130;
     this.Title    = video.title;
     this.Duration = UIStringFormatterHelper.FormatDuration(video.duration);
 }
Пример #11
0
        public override Attachment GetAttachment()
        {
            Attachment attachment = new Attachment();

            attachment.type = "video";
            VKClient.Common.Backend.DataObjects.Video video = this._video;
            attachment.video = video;
            return(attachment);
        }
Пример #12
0
        private string GetThumb()
        {
            WallPost parsedParent1 = this._notification.ParsedParent as WallPost;

            if (parsedParent1 != null && !((IList)parsedParent1.attachments).IsNullOrEmpty())
            {
                Attachment attachment = (Attachment)Enumerable.FirstOrDefault <Attachment>(parsedParent1.attachments, (Func <Attachment, bool>)(a =>
                {
                    if (!(a.type == "photo"))
                    {
                        return(a.type == "video");
                    }
                    return(true);
                }));
                if (attachment != null)
                {
                    if (attachment.photo != null)
                    {
                        return(attachment.photo.src);
                    }
                    if (attachment.video != null)
                    {
                        return(attachment.video.image);
                    }
                }
            }
            Photo parsedParent2 = this._notification.ParsedParent as Photo;

            if (parsedParent2 != null)
            {
                return(parsedParent2.src);
            }
            VKClient.Common.Backend.DataObjects.Video parsedParent3 = this._notification.ParsedParent as VKClient.Common.Backend.DataObjects.Video;
            if (parsedParent3 != null)
            {
                return(parsedParent3.image);
            }
            Comment parsedParent4 = this._notification.ParsedParent as Comment;

            if (parsedParent4 != null)
            {
                if (parsedParent4.photo != null)
                {
                    return(parsedParent4.photo.src);
                }
                if (parsedParent4.video != null)
                {
                    return(parsedParent4.video.image);
                }
                if (parsedParent4.market != null)
                {
                    return(parsedParent4.market.thumb_photo);
                }
            }
            return("");
        }
Пример #13
0
        private string GetThumb()
        {
            WallPost wallPost = this._notification.ParsedParent as WallPost;

            if (wallPost != null && !wallPost.attachments.IsNullOrEmpty())
            {
                Attachment attachment = wallPost.attachments.FirstOrDefault <Attachment>((Func <Attachment, bool>)(a =>
                {
                    if (!(a.type == "photo"))
                    {
                        return(a.type == "video");
                    }
                    return(true);
                }));
                if (attachment != null)
                {
                    if (attachment.photo != null)
                    {
                        return(attachment.photo.src);
                    }
                    if (attachment.video != null)
                    {
                        return(attachment.video.image);
                    }
                }
            }
            Photo photo = this._notification.ParsedParent as Photo;

            if (photo != null)
            {
                return(photo.src);
            }
            VKClient.Common.Backend.DataObjects.Video video = this._notification.ParsedParent as VKClient.Common.Backend.DataObjects.Video;
            if (video != null)
            {
                return(video.image);
            }
            Comment comment = this._notification.ParsedParent as Comment;

            if (comment != null)
            {
                if (comment.photo != null)
                {
                    return(comment.photo.src);
                }
                if (comment.video != null)
                {
                    return(comment.video.image);
                }
                if (comment.market != null)
                {
                    return(comment.market.thumb_photo);
                }
            }
            return("");
        }
Пример #14
0
        private void _view_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            string postType = this._newsItemData.NewsItem.post_type;

            if (!(postType == "post"))
            {
                if (!(postType == "photo"))
                {
                    if (!(postType == "video"))
                    {
                        if (!(postType == "topic"))
                        {
                            if (postType == "note" || !(postType == "market"))
                            {
                                return;
                            }
                            CurrentMarketItemSource.Source = MarketItemSource.feed;
                            Navigator.Current.NavigateToProduct(this._newsItemData.NewsItem.source_id, this._newsItemData.NewsItem.id);
                            e.Handled = true;
                        }
                        else
                        {
                            Navigator.Current.NavigateToGroupDiscussion(Math.Abs(this._newsItemData.NewsItem.source_id), this._newsItemData.NewsItem.post_id, this._newsItemData.NewsItem.text, this._newsItemData.NewsItem.comments.count, true, this._newsItemData.NewsItem.comments.can_post == 1);
                            e.Handled = true;
                        }
                    }
                    else
                    {
                        VKClient.Common.Backend.DataObjects.Video video = new VKClient.Common.Backend.DataObjects.Video()
                        {
                            vid = this._newsItemData.NewsItem.vid, duration = this._newsItemData.NewsItem.duration, image_big = this._newsItemData.NewsItem.image_big, owner_id = this._newsItemData.NewsItem.owner_id
                        };
                        Navigator.Current.NavigateToVideoWithComments(video, video.owner_id, video.vid, "");
                        e.Handled = true;
                    }
                }
                else
                {
                    long  aid   = this._newsItemData.NewsItem.aid;
                    Photo photo = new Photo()
                    {
                        pid = this._newsItemData.NewsItem.pid, aid = aid, src_big = this._newsItemData.NewsItem.src_big, src_small = this._newsItemData.NewsItem.src_small, src_xbig = this._newsItemData.NewsItem.src_xbig, src_xxbig = this._newsItemData.NewsItem.src_xxbig, width = this._newsItemData.NewsItem.width, height = this._newsItemData.NewsItem.height, owner_id = this._newsItemData.NewsItem.owner_id
                    };
                    Navigator.Current.NavigateToPhotoWithComments(photo, null, this._newsItemData.NewsItem.owner_id, photo.pid, "", false, false);
                    e.Handled = true;
                }
            }
            else
            {
                Navigator.Current.NavigateToWallPostComments(this._newsItemData.NewsItem.post_id, this._newsItemData.NewsItem.source_id, true, 0, 0, "");
                e.Handled = true;
            }
        }
Пример #15
0
 public LikesAndCommentsItem(double width, Thickness margin, VKClient.Common.Backend.DataObjects.Video video, Action commentsTapped)
     : base(width, margin, new Thickness())
 {
     this._video = video;
     if (this._video.likes == null)
     {
         this._video.likes = new Likes();
     }
     this._itemType             = LikesAndCommentsItem.ItemType.Video;
     this._commentsTappedAction = commentsTapped;
     this.Initialize();
 }
Пример #16
0
        private List <IVirtualizable> GetMoreOtherVideoItems()
        {
            List <IVirtualizable>      virtualizableList  = new List <IVirtualizable>();
            IVideoCatalogItemUCFactory catalogItemFactory = ServiceLocator.Resolve <IVideoCatalogItemUCFactory>();
            VKList <VKClient.Common.Backend.DataObjects.Video> otherVideos = this.OtherVideosVM.OtherVideos;
            List <Group> groupList = new List <Group>();
            List <User>  userList  = new List <User>();

            if (otherVideos.profiles != null)
            {
                userList.AddRange((IEnumerable <User>)Enumerable.Select <User, User>(otherVideos.profiles, (Func <User, User>)(profile => new User()
                {
                    id         = profile.id,
                    first_name = profile.first_name,
                    last_name  = profile.last_name
                })));
            }
            if (otherVideos.groups != null)
            {
                groupList.AddRange((IEnumerable <Group>)Enumerable.Select <Group, Group>(otherVideos.groups, (Func <Group, Group>)(profile => new Group()
                {
                    id   = profile.id,
                    name = profile.name
                })));
            }
            IEnumerator <VKClient.Common.Backend.DataObjects.Video> enumerator = ((IEnumerable <VKClient.Common.Backend.DataObjects.Video>)Enumerable.Skip <VKClient.Common.Backend.DataObjects.Video>(otherVideos.items, 3)).GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    VKClient.Common.Backend.DataObjects.Video video = enumerator.Current;
                    List <User>  knownUsers  = userList;
                    List <Group> knownGroups = groupList;
                    UCItem       ucItem      = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() =>
                    {
                        UserControlVirtualizable controlVirtualizable = catalogItemFactory.Create(video, knownUsers, knownGroups, StatisticsActionSource.video_recommend, this.CreateVideoContext(otherVideos.context));
                        ((System.Windows.Controls.Panel)(controlVirtualizable as CatalogItemUC).GridLayoutRoot).Background = ((Brush)(Application.Current.Resources["PhoneNewsBackgroundBrush"] as SolidColorBrush));
                        return(controlVirtualizable);
                    }), new Func <double> (() => catalogItemFactory.Height), null, 0.0, false);
                    virtualizableList.Add((IVirtualizable)ucItem);
                }
            }
            finally
            {
                if (enumerator != null)
                {
                    enumerator.Dispose();
                }
            }
            return(virtualizableList);
        }
Пример #17
0
        public UserControlVirtualizable Create(VKClient.Common.Backend.DataObjects.Video video, List <User> knownUsers, List <Group> knownGroups, StatisticsActionSource actionSource, string context)
        {
            CatalogItemViewModel catalogItemViewModel1 = new CatalogItemViewModel(new VideoCatalogItem(video), knownUsers, knownGroups, false)
            {
                ActionSource = new StatisticsActionSource?(actionSource),
                VideoContext = context
            };
            CatalogItemUC        catalogItemUc         = new CatalogItemUC();
            CatalogItemViewModel catalogItemViewModel2 = catalogItemViewModel1;

            catalogItemUc.DataContext = (object)catalogItemViewModel2;
            return((UserControlVirtualizable)catalogItemUc);
        }
Пример #18
0
 public VideoHeader(VKClient.Common.Backend.DataObjects.Video video, List <MenuItemData> menuItems = null, List <User> knownUsers = null, List <Group> knownGroups = null, StatisticsActionSource source = StatisticsActionSource.undefined, string context = "", bool pickMode = false, long albumId = 0, long messageId = 0)
 {
     this.VKVideo   = video;
     this.MessageId = messageId;
     this.SetMenuItems(menuItems);
     this._knownUsers   = knownUsers ?? new List <User>();
     this._knownGroups  = knownGroups ?? new List <Group>();
     this._pickMode     = pickMode;
     this._albumId      = albumId;
     this._actionSource = source;
     this._context      = context;
     EventAggregator.Current.Subscribe(this);
 }
        public override Attachment GetAttachment()
        {
            Attachment attachment = new Attachment();

            attachment.type = "video";
            VKClient.Common.Backend.DataObjects.Video video = new VKClient.Common.Backend.DataObjects.Video();
            video.image_big = this.ResourceUri;
            Guid guid = this.Guid;

            video.guid = guid;
            int duration = this.Duration;

            video.duration   = duration;
            attachment.video = video;
            return(attachment);
        }
Пример #20
0
        public void Handle(VideoUploaded message)
        {
            List <Attachment> source = this._attachments;
            Attachment        attachment1;

            if (source == null)
            {
                attachment1 = (Attachment)null;
            }
            else
            {
                Func <Attachment, bool> predicate = (Func <Attachment, bool>)(a =>
                {
                    if (a.video != null)
                    {
                        return(a.video.guid == message.guid);
                    }
                    return(false);
                });
                attachment1 = source.FirstOrDefault <Attachment>(predicate);
            }
            Attachment attachment2 = attachment1;

            if (attachment2 == null)
            {
                return;
            }
            VKClient.Common.Backend.DataObjects.Video video = attachment2.video;
            long videoId = message.SaveVidResp.video_id;

            video.id = videoId;
            string title = message.SaveVidResp.title;

            video.title = title;
            string description = message.SaveVidResp.description;

            video.description = description;
            long ownerId = message.SaveVidResp.owner_id;

            video.owner_id = ownerId;
            string accessKey = message.SaveVidResp.access_key;

            video.access_key = accessKey;
        }
Пример #21
0
 public override void Load(Action <ResultCode> callback)
 {
     VKClient.Common.Backend.DataObjects.Video video = this.Video;
     if ((video != null ? video.files : null) != null && this.Video.files.Count > 0)
     {
         callback(ResultCode.Succeeded);
     }
     else
     {
         VideoService.Instance.GetVideoById(this.OwnerId, this.VideoId, this._accessKey, (Action <BackendResult <List <VKClient.Common.Backend.DataObjects.Video>, ResultCode> >)(res =>
         {
             ResultCode resultCode = res.ResultCode;
             if (resultCode == ResultCode.Succeeded)
             {
                 if (res.ResultData.Any <VKClient.Common.Backend.DataObjects.Video>())
                 {
                     int num         = this.Video == null ? 1 : 0;
                     this.Video      = res.ResultData[0];
                     this._catItemVM = new CatalogItemViewModel(new VideoCatalogItem(this.Video), new List <User>(), new List <Group>(), false);
                     this.NotifyVideoDurationPropertiesChanged();
                     if (num != 0)
                     {
                         this.PublishOpenVideoEvent();
                     }
                     this.UpdateOwnerInfo();
                     this.UpdateDescription();
                     this.InitResolutionsCollection();
                     this.NotifyPropertiesChanged();
                 }
                 else
                 {
                     resultCode = ResultCode.VideoNotFound;
                 }
             }
             Action <ResultCode> action = callback;
             if (action == null)
             {
                 return;
             }
             int num1 = (int)resultCode;
             action((ResultCode)num1);
         }));
     }
 }
Пример #22
0
        public VideoCommentsViewModel(long ownerId, long videoId, string accessKey, VKClient.Common.Backend.DataObjects.Video video = null, StatisticsActionSource actionSource = StatisticsActionSource.news, string videoContext = "")
        {
            this.Resolutions                   = new List <VideoResolution>();
            this._knownCommentsCount           = -1;
            this._lastTimeCompletedPlayRequest = DateTime.MinValue;

            this.OwnerId       = ownerId;
            this.VideoId       = videoId;
            this._accessKey    = accessKey;
            this.Video         = video;
            this._actionSource = actionSource;
            this._videoContext = videoContext;
            if (this.Video != null)
            {
                this._catItemVM = new CatalogItemViewModel(new VideoCatalogItem(this.Video), new List <User>(), new List <Group>(), false);
                this.PublishOpenVideoEvent();
            }
            this.UpdateOwnerInfo();
            this.UpdateDescription();
            this.InitResolutionsCollection();
            EventAggregator.Current.Subscribe(this);
        }
Пример #23
0
        private void HandleShowAll()
        {
            VKList <VideoCatalogItem> catalogItems = new VKList <VideoCatalogItem>();

            List <VKClient.Common.Backend.DataObjects.Video> .Enumerator enumerator = this._videos.items.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    VKClient.Common.Backend.DataObjects.Video current = enumerator.Current;
                    catalogItems.items.Add(new VideoCatalogItem(current));
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            catalogItems.profiles = this._newsItemWithInfo.Profiles;
            catalogItems.groups   = this._newsItemWithInfo.Groups;
            catalogItems.count    = this._videos.items.Count;
            Navigator.Current.NavigateToVideoList(catalogItems, 2, "", Guid.NewGuid().ToString(), "", "");
        }
Пример #24
0
        public static string GetVideoUri(VKClient.Common.Backend.DataObjects.Video video, int resolution, out bool isExternal)
        {
            isExternal = false;
            if (video == null || video.files == null || video.files.Count == 0)
            {
                return("");
            }
            KeyValuePair <string, string> keyValuePair = (KeyValuePair <string, string>)Enumerable.Last <KeyValuePair <string, string> >(video.files);

            if (resolution > 0)
            {
                Dictionary <string, string> .Enumerator enumerator = video.files.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        KeyValuePair <string, string> current = enumerator.Current;
                        if (((string)current.Key).Contains(resolution.ToString()))
                        {
                            keyValuePair = current;
                            break;
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
            }
            string str = keyValuePair.Value;

            isExternal = keyValuePair.Key == "external";
            if (((string)keyValuePair.Key).StartsWith("flv"))
            {
                return("");
            }
            return(str);
        }
Пример #25
0
 public static void PlayVideo(VKClient.Common.Backend.DataObjects.Video video, Action callback, int resolution, StatisticsActionSource actionSource = StatisticsActionSource.news, string videoContext = "")
 {
     if ((video != null ? video.files :  null) == null || video.files.Count == 0)
     {
         callback.Invoke();
         ExtendedMessageBox.ShowSafe(video == null || video.processing != 0 ? CommonResources.ProcessingVideoError : CommonResources.Conversation_VideoIsNotAvailable);
     }
     else
     {
         bool   isExternal;
         string uri = VideoPlayerHelper.GetVideoUri(video, resolution, out isExternal);
         if (string.IsNullOrEmpty(uri))
         {
             callback.Invoke();
             ExtendedMessageBox.ShowSafe(video.processing == 0 ? CommonResources.Conversation_VideoIsNotAvailable : CommonResources.ProcessingVideoError);
         }
         else
         {
             EventAggregator current        = EventAggregator.Current;
             VideoPlayEvent  videoPlayEvent = new VideoPlayEvent();
             videoPlayEvent.Position = StatisticsVideoPosition.start;
             int num1 = resolution;
             videoPlayEvent.quality = num1;
             string globallyUniqueId = video.GloballyUniqueId;
             videoPlayEvent.id = globallyUniqueId;
             int num2 = (int)actionSource;
             videoPlayEvent.Source = (StatisticsActionSource)num2;
             string str = videoContext;
             videoPlayEvent.Context = str;
             current.Publish(videoPlayEvent);
             ThreadPool.QueueUserWorkItem((WaitCallback)(o =>
             {
                 Thread.Sleep(500);
                 VideoPlayerHelper.PlayVideo(uri, isExternal, resolution, callback);
             }));
         }
     }
 }
Пример #26
0
        public NewsFeedIgnoreItemData GetIgnoreItemData()
        {
            NewsItem newsItem = this._newsPost.NewsItem;
            string   postType = newsItem.post_type;
            string   type     = "";
            long     sourceId = newsItem.source_id;
            long     itemId   = 0;

            if (postType == "photo" || postType == "photo_tag" || postType == "wall_photo")
            {
                if (!(postType == "photo") && !(postType == "wall_photo"))
                {
                    if (postType == "photo_tag")
                    {
                        type = "tag";
                    }
                }
                else
                {
                    type = "photo";
                }
                Photo photo = this._photo;
                itemId = photo != null ? photo.id : BaseFormatterHelper.GetLastMidnight((long)newsItem.date, false);
            }
            else if (postType == "video")
            {
                type = "video";
                VKClient.Common.Backend.DataObjects.Video video = this._video;
                itemId = video != null ? video.id : BaseFormatterHelper.GetLastMidnight((long)newsItem.date, false);
            }
            if (!string.IsNullOrEmpty(type) && sourceId != 0L && itemId != 0L)
            {
                return(new NewsFeedIgnoreItemData(type, sourceId, itemId));
            }
            return(null);
        }
 public VideoNewsItemDescViewModel(VKClient.Common.Backend.DataObjects.Video video, bool isBig)
 {
     this._video     = video;
     this._catItemVM = new CatalogItemViewModel(new VideoCatalogItem(video), new List <User>(), new List <Group>(), false);
     this._isBig     = isBig;
 }
Пример #28
0
        private List <IVirtualizable> GenereateVirtualizableItemsToAdd()
        {
            List <IVirtualizable> virtualizableList = new List <IVirtualizable>();

            if (!this._commentsAreLoaded)
            {
                LikesInfo likesInfo1 = new LikesInfo();
                likesInfo1.count        = this.VM.LikesCount;
                likesInfo1.repostsCount = this.VM.RepostsCount;
                List <long>     likesAllIds = this.VM.LikesAllIds;
                List <UserLike> m0List      = (likesAllIds != null ? Enumerable.ToList <UserLike>(Enumerable.Select <long, UserLike>(likesAllIds, (Func <long, UserLike>)(uid => new UserLike()
                {
                    uid = uid
                }))) :  null) ?? new List <UserLike>();
                likesInfo1.users = ((List <UserLike>)m0List);
                LikesInfo       likesInfo2 = likesInfo1;
                double          width1     = 480.0;
                Thickness       margin1    = new Thickness();
                LikedObjectData objectData = new LikedObjectData();
                objectData.OwnerId = this.VM.OwnerId;
                objectData.ItemId  = this.VM.ItemId;
                objectData.Type    = (int)this.VM.LikeObjectType;
                LikesInfo   likesInfo3   = likesInfo2;
                int         num1         = this.VM.CanRepost ? 1 : 0;
                int         num2         = this.VM.UserLiked ? 1 : 0;
                User        loggedInUser = AppGlobalStateManager.Current.GlobalState.LoggedInUser;
                List <User> users        = this.VM.Users;
                this._likesItem = new LikesItem(width1, margin1, objectData, likesInfo3, num1 != 0, num2 != 0, loggedInUser, users);
                virtualizableList.Add((IVirtualizable)this._likesItem);
                ISupportOtherVideos otherVideosVm = this.OtherVideosVM;
                List <VKClient.Common.Backend.DataObjects.Video> videoList;
                if (otherVideosVm == null)
                {
                    videoList = null;
                }
                else
                {
                    VKList <VKClient.Common.Backend.DataObjects.Video> otherVideos = otherVideosVm.OtherVideos;
                    videoList = otherVideos != null ? otherVideos.items :  null;
                }
                if (videoList != null && otherVideosVm.OtherVideos.items.Count > 0)
                {
                    VKList <VKClient.Common.Backend.DataObjects.Video> otherVideos = otherVideosVm.OtherVideos;
                    List <Group> groupList = new List <Group>();
                    List <User>  userList  = new List <User>();
                    if (otherVideos.profiles != null)
                    {
                        userList.AddRange((IEnumerable <User>)Enumerable.Select <User, User>(otherVideos.profiles, (Func <User, User>)(profile => new User()
                        {
                            id         = profile.id,
                            first_name = profile.first_name,
                            last_name  = profile.last_name
                        })));
                    }
                    if (otherVideos.groups != null)
                    {
                        groupList.AddRange((IEnumerable <Group>)Enumerable.Select <Group, Group>(otherVideos.groups, (Func <Group, Group>)(profile => new Group()
                        {
                            id   = profile.id,
                            name = profile.name
                        })));
                    }
                    double    width2  = 480.0;
                    Thickness margin2 = new Thickness(0.0, 0.0, 0.0, 8.0);
                    Func <UserControlVirtualizable> func1 = (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable) new TextSeparatorUC()
                    {
                        Text = CommonResources.OtherVideos
                    });
                    // ISSUE: variable of the null type
                    double landscapeWidth1 = 0.0;
                    int    num3            = 0;
                    //Func<UserControlVirtualizable> getUserControlFunc1;
                    UCItem ucItem1 = new UCItem(width2, margin2, func1, (Func <double>)(() => 56.0), null, landscapeWidth1, num3 != 0);
                    virtualizableList.Add((IVirtualizable)ucItem1);
                    IVideoCatalogItemUCFactory catalogItemFactory = ServiceLocator.Resolve <IVideoCatalogItemUCFactory>();
                    IEnumerator <VKClient.Common.Backend.DataObjects.Video> enumerator = ((IEnumerable <VKClient.Common.Backend.DataObjects.Video>)Enumerable.Take <VKClient.Common.Backend.DataObjects.Video>(otherVideos.items, 3)).GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            VKClient.Common.Backend.DataObjects.Video video = enumerator.Current;
                            List <User>  knownUsers  = userList;
                            List <Group> knownGroups = groupList;
                            UCItem       ucItem2     = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() =>
                            {
                                UserControlVirtualizable controlVirtualizable = catalogItemFactory.Create(video, knownUsers, knownGroups, StatisticsActionSource.video_recommend, this.CreateVideoContext(otherVideos.context));
                                ((System.Windows.Controls.Panel)(controlVirtualizable as CatalogItemUC).GridLayoutRoot).Background = ((Brush)(Application.Current.Resources["PhoneNewsBackgroundBrush"] as SolidColorBrush));
                                return(controlVirtualizable);
                            }), new Func <double> (() => catalogItemFactory.Height), null, 0.0, false);
                            virtualizableList.Add((IVirtualizable)ucItem2);
                        }
                    }
                    finally
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                    double    width3  = 480.0;
                    Thickness margin3 = new Thickness();
                    Func <UserControlVirtualizable> func2 = (Func <UserControlVirtualizable>)(() => new UserControlVirtualizable());
                    // ISSUE: variable of the null type
                    double landscapeWidth2 = 0.0;
                    int    num4            = 0;
                    //Func<UserControlVirtualizable> getUserControlFunc2;
                    UCItem ucItem3 = new UCItem(width3, margin3, func2, (Func <double>)(() => 8.0), null, landscapeWidth2, num4 != 0);
                    virtualizableList.Add((IVirtualizable)ucItem3);
                    if (otherVideos.items.Count > 3)
                    {
                        this._moreVideosUCItem = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable) new CategoryFooterShortUC()
                        {
                            TapAction = new Action(this.MoreVideos_OnTap)
                        }), (Func <double>)(() => 64.0), null, 0.0, false);
                        virtualizableList.Add((IVirtualizable)this._moreVideosUCItem);
                    }
                }
                int totalCommentsCount = this.VM.TotalCommentsCount;
                this._commentsCountSeparatorUC = new TextSeparatorUC()
                {
                    Text = CommentsItemsGeneratorHelper.GetTextForCommentsCount(totalCommentsCount)
                };
                this._commentsCountItem = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable)this._commentsCountSeparatorUC), (Func <double>)(() => 56.0), null, 0.0, false);
                virtualizableList.Add((IVirtualizable)this._commentsCountItem);
            }
            if (this.CommentsCountForReload > 0 && !ListExtensions.IsNullOrEmpty((IList)this.VM.Comments))
            {
                ShowMoreCommentsUC showMoreCommentsUc = new ShowMoreCommentsUC();
                double             num = 54.0;
                ((FrameworkElement)showMoreCommentsUc).Height = num;
                Action action = (Action)(() => this._loadMoreCommentsItem_Tap(null, null));
                showMoreCommentsUc.OnClickAction = action;
                string textFor = CommentsItemsGeneratorHelper.GetTextFor(this.CommentsCountForReload);
                showMoreCommentsUc.Text = textFor;
                ShowMoreCommentsUC showMoreCommentsUC = showMoreCommentsUc;
                this._loadMoreCommentsItem = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable)showMoreCommentsUC), (Func <double>)(() => 54.0), null, 0.0, false);
                virtualizableList.Add((IVirtualizable)this._loadMoreCommentsItem);
            }
            long        num5         = -1;
            CommentItem commentItem1 = Enumerable.FirstOrDefault <IVirtualizable>(this.virtPanel.VirtualizableItems, (Func <IVirtualizable, bool>)(i => i is CommentItem)) as CommentItem;

            if (commentItem1 != null)
            {
                num5 = commentItem1.Comment.cid;
            }
            List <Comment> .Enumerator enumerator1 = this.VM.Comments.GetEnumerator();
            try
            {
                while (enumerator1.MoveNext())
                {
                    Comment current = enumerator1.Current;
                    if (current.cid != num5)
                    {
                        CommentItem commentItem2 = this.CreateCommentItem(current);
                        virtualizableList.Add((IVirtualizable)commentItem2);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            finally
            {
                enumerator1.Dispose();
            }
            ((UIElement)this.ucNewComment).Opacity          = (this.VM.CanComment ? 1.0 : 0.6);
            ((UIElement)this.ucNewComment).IsHitTestVisible = this.VM.CanComment;
            return(virtualizableList);
        }
        private List <MediaListSectionViewModel> CreateMediaItems()
        {
            List <MediaListSectionViewModel> sectionViewModelList = new List <MediaListSectionViewModel>();

            if (this._profileData == null)
            {
                return(sectionViewModelList);
            }
            Counters counters  = this._profileData.counters;
            Photo    lastPhoto = this._profileData.lastPhoto;

            if ((this._mainSectionType != ProfileMainSectionType.Photos || this._profileData.photos == null || this._profileData.photos.items.Count == 0) && lastPhoto != null)
            {
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Photos, counters.photos, (MediaListItemViewModelBase) new PhotoAlbumMediaListItemViewModel(lastPhoto), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.photos);
                    Navigator.Current.NavigateToPhotoAlbums(false, this._profileData.Id, this._isGroup, this._profileData.AdminLevel);
                })));
            }
            else if (this._isGroup && this._profileData.CanAddPhotos && counters.photos == 0)
            {
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Photos, 0, (MediaListItemViewModelBase) new EmptyDataMediaListItemViewModel("/Resources/Profile/Placeholders/ProfilePlaceholderPhotos.png"), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.photos);
                    Navigator.Current.NavigateToPhotoAlbums(false, this._profileData.Id, this._isGroup, this._profileData.AdminLevel);
                })));
            }
            List <Topic> topics = this._profileData.topics;
            Group        group  = this._profileData as Group;

            if (group != null)
            {
                //GroupData profileData = this._profileData as GroupData;
                //if ((profileData != null ? profileData.group : null) != null)
                //{
                //    Group group = profileData.group;
                if (this._mainSectionType != ProfileMainSectionType.Discussions && !topics.IsNullOrEmpty())
                {
                    Topic topic = (Topic)Enumerable.First <Topic>(topics);
                    sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Discussions, counters.topics, (MediaListItemViewModelBase) new GenericMediaListItemViewModel(topic.ToString(), topic.title, UIStringFormatterHelper.FormatNumberOfSomething(topic.comments, CommonResources.OneMessageFrm, CommonResources.TwoFourMessagesFrm, CommonResources.FiveMessagesFrm, true, null, false), "/Resources/Profile/ProfileTopic.png", ProfileBlockType.discussions), (Action)(() => Navigator.Current.NavigateToGroupDiscussions(group.id, "", group.admin_level, false, group.CanCreateTopic))));
                }
                else if (this._profileData.CanAddTopics && counters.topics == 0)
                {
                    sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Discussions, 0, (MediaListItemViewModelBase) new EmptyDataMediaListItemViewModel("/Resources/Profile/Placeholders/ProfilePlaceholderTopics.png"), (Action)(() => Navigator.Current.NavigateToGroupDiscussions(group.id, "", group.admin_level, false, group.CanCreateTopic))));
                }
            }
            List <VKClient.Common.Backend.DataObjects.Video> videos = this._profileData.videos;

            if (this._mainSectionType != ProfileMainSectionType.Videos && !videos.IsNullOrEmpty())
            {
                VKClient.Common.Backend.DataObjects.Video video = Enumerable.First <VKClient.Common.Backend.DataObjects.Video>(videos);
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Videos, counters.videos, (MediaListItemViewModelBase) new VideoAlbumMediaListItemViewModel(video), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.videos);
                    Navigator.Current.NavigateToVideo(false, this._profileData.Id, this._isGroup, this._profileData.AdminLevel > 1);
                })));
            }
            else if (this._isGroup && this._profileData.CanAddVideos && counters.videos == 0)
            {
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Videos, counters.topics, (MediaListItemViewModelBase) new EmptyDataMediaListItemViewModel("/Resources/Profile/Placeholders/ProfilePlaceholderVideos.png"), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.videos);
                    Navigator.Current.NavigateToVideo(false, this._profileData.Id, this._isGroup, this._profileData.AdminLevel > 1);
                })));
            }
            List <Product> products = this._profileData.goods == null ? null : this._profileData.goods.items;//todo:bugfix VKLIST

            if (this._mainSectionType != ProfileMainSectionType.Market && !products.IsNullOrEmpty())
            {
                Product product = (Product)Enumerable.First <Product>(products);
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Products, counters.market, (MediaListItemViewModelBase) new ProductsAlbumMediaListItemViewModel(product), (Action)(() => { })));
            }
            else if (this._isGroup && this._profileData.CanAddProducts && counters.market == 0)
            {
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Videos, counters.topics, (MediaListItemViewModelBase) new EmptyDataMediaListItemViewModel("/Resources/Profile/Placeholders/ProfilePlaceholderVideos.png"), (Action)(() => { })));
            }
            List <AudioObj> audios = this._profileData.audios;

            if (this._mainSectionType != ProfileMainSectionType.Audios && !audios.IsNullOrEmpty())
            {
                AudioObj audioObj = (AudioObj)Enumerable.First <AudioObj>(audios);
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Audios, counters.audios, (MediaListItemViewModelBase) new GenericMediaListItemViewModel(audioObj.ToString(), audioObj.title, audioObj.artist, "/Resources/Profile/ProfileMusic.png", ProfileBlockType.audios), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.audios);
                    Navigator.Current.NavigateToAudio(0, this._profileData.Id, this._isGroup, 0, 0, "");
                })));
            }
            else if (this._isGroup && this._profileData.CanAddAudios && counters.audios == 0)
            {
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Audios, 0, (MediaListItemViewModelBase) new EmptyDataMediaListItemViewModel("/Resources/Profile/Placeholders/ProfilePlaceholderAudios.png"), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.audios);
                    Navigator.Current.NavigateToAudio(0, this._profileData.Id, this._isGroup, 0, 0, "");
                })));
            }
            VKList <SubscriptionObj> subscriptions = this._profileData.subscriptions;
            int titleCounter = counters.pages + counters.groups + counters.subscriptions;

            if (subscriptions != null && titleCounter > 0)
            {
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Subscriptions, titleCounter, (MediaListItemViewModelBase) new SubscriptionsMediaListItemViewModel((List <string>)Enumerable.ToList <string>(Enumerable.Select <SubscriptionObj, string>(subscriptions.items, new Func <SubscriptionObj, string>((item) => { return(item.photo_max); })))), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.subscriptions);
                    Navigator.Current.NavigateToSubscriptions(this._profileData.Id);
                })));
            }
            Doc lastDoc = this._profileData.lastDoc;

            if (lastDoc != null)
            {
                if (this._profileData.Id == AppGlobalStateManager.Current.LoggedInUserId || this._isGroup)
                {
                    sectionViewModelList.Add(this.GetDocumentsModel(lastDoc, counters.docs));
                }
            }
            else if (this._profileData.CanAddDocs && counters.docs == 0)
            {
                sectionViewModelList.Add(this.GetDocumentsEmptyModel());
            }

            List <GiftItemData> giftItemDataList = this._profileData.gifts != null ? this._profileData.gifts.items : null;

            if (counters.gifts > 0 && giftItemDataList != null)
            {
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Gifts, counters.gifts, new GiftsMediaListItemViewModel((List <string>)Enumerable.ToList <string>(Enumerable.Select <GiftItemData, string>(Enumerable.Where <GiftItemData>(giftItemDataList, new Func <GiftItemData, bool>((item) => { return(item != null); })), new Func <GiftItemData, string>((item) => { return(item.gift.thumb_256); })))), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.gifts);
                    Navigator.Current.NavigateToGifts(this._profileData.Id, this._profileData.FirstName, this._profileData.NameGen);
                })));
            }
            return(sectionViewModelList);
        }
Пример #30
0
        private void ProcessInputData()
        {
            Photo parameterForIdAndReset1 = ParametersRepository.GetParameterForIdAndReset("PickedPhoto") as Photo;

            if (parameterForIdAndReset1 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment)OutboundPhotoAttachment.CreateForChoosingExistingPhoto(parameterForIdAndReset1, 0, false, PostType.WallPost));
            }
            VKClient.Common.Backend.DataObjects.Video parameterForIdAndReset2 = ParametersRepository.GetParameterForIdAndReset("PickedVideo") as VKClient.Common.Backend.DataObjects.Video;
            if (parameterForIdAndReset2 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundVideoAttachment(parameterForIdAndReset2));
            }
            AudioObj parameterForIdAndReset3 = ParametersRepository.GetParameterForIdAndReset("PickedAudio") as AudioObj;

            if (parameterForIdAndReset3 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundAudioAttachment(parameterForIdAndReset3));
            }
            Doc parameterForIdAndReset4 = ParametersRepository.GetParameterForIdAndReset("PickedDocument") as Doc;

            if (parameterForIdAndReset4 != null)
            {
                this._commentVM.AddAttachment((IOutboundAttachment) new OutboundDocumentAttachment(parameterForIdAndReset4));
            }
            List <Stream> parameterForIdAndReset5 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotos") as List <Stream>;
            List <Stream> parameterForIdAndReset6 = ParametersRepository.GetParameterForIdAndReset("ChoosenPhotosPreviews") as List <Stream>;

            if (parameterForIdAndReset5 != null)
            {
                for (int index = 0; index < parameterForIdAndReset5.Count; ++index)
                {
                    Stream stream1       = parameterForIdAndReset5[index];
                    Stream stream2       = parameterForIdAndReset6[index];
                    long   userOrGroupId = 0;
                    int    num1          = 0;
                    Stream previewStream = stream2;
                    int    num2          = 0;
                    this._commentVM.AddAttachment((IOutboundAttachment)OutboundPhotoAttachment.CreateForUploadNewPhoto(stream1, userOrGroupId, num1 != 0, previewStream, (PostType)num2));
                }
                this.GroupDiscussionVM.SetInProgress(true, CommonResources.WallPost_UploadingAttachments);
                this._commentVM.UploadAttachments();
            }
            FileOpenPickerContinuationEventArgs parameterForIdAndReset7 = ParametersRepository.GetParameterForIdAndReset("FilePicked") as FileOpenPickerContinuationEventArgs;

            if ((parameterForIdAndReset7 == null || !parameterForIdAndReset7.Files.Any <StorageFile>()) && !ParametersRepository.Contains("PickedPhotoDocuments"))
            {
                return;
            }
            object parameterForIdAndReset8 = ParametersRepository.GetParameterForIdAndReset("FilePickedType");
            IReadOnlyList <StorageFile> storageFileList = parameterForIdAndReset7 != null ? parameterForIdAndReset7.Files : (IReadOnlyList <StorageFile>)ParametersRepository.GetParameterForIdAndReset("PickedPhotoDocuments");
            AttachmentType result;

            if (parameterForIdAndReset8 == null || !Enum.TryParse <AttachmentType>(parameterForIdAndReset8.ToString(), out result))
            {
                return;
            }
            foreach (StorageFile file in (IEnumerable <StorageFile>)storageFileList)
            {
                if (result != AttachmentType.VideoFromPhone)
                {
                    if (result == AttachmentType.DocumentFromPhone || result == AttachmentType.DocumentPhoto)
                    {
                        this._commentVM.AddAttachment((IOutboundAttachment) new OutboundUploadDocumentAttachment(file));
                        this._commentVM.UploadAttachments();
                    }
                }
                else
                {
                    this._commentVM.AddAttachment((IOutboundAttachment) new OutboundUploadVideoAttachment(file, true, 0L));
                    this._commentVM.UploadAttachments();
                }
            }
        }