Exemplo n.º 1
0
 private string GetDateAndInfoText()
 {
     return(UIStringFormatterHelper.FormatDateTimeForUI(this._notification.date) + " " + this.GetLocalizableText());
 }
Exemplo n.º 2
0
 private void Share(long groupId = 0, string groupName = "")
 {
     this._ds.Hide();
     this._viewModel.ShareToGroup(UIStringFormatterHelper.CorrectNewLineCharacters(this._sharePostUC.Text), groupId, groupName);
 }
        private void ReadNavigateButtons()
        {
            ((Collection <NavigateButton>) this._navigateButtons).Clear();
            if (this._group.members_count > 0)
            {
                NavigateButton navigateButton1 = new NavigateButton();
                navigateButton1.ButtonType = NavigateButtonType.Subscribers;
                string str = UIStringFormatterHelper.FormatForUIShort((long)this._group.members_count);
                navigateButton1.ButtonTitle = str;
                NavigateButton navigateButton2 = navigateButton1;
                navigateButton2.ButtonSubtitle = this._group.GroupType != GroupType.PublicPage ? UIStringFormatterHelper.FormatNumberOfSomething(this._group.members_count, GroupResources.OneMemberFrm, GroupResources.TwoFourMembersFrm, GroupResources.FiveMembersFrm, false, null, false) : UIStringFormatterHelper.FormatNumberOfSomething(this._group.members_count, GroupResources.OneSubscriberFrm, GroupResources.TwoFourSubscribersFrm, GroupResources.FiveSubscribersFrm, false, null, false);
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton2);
            }
            if (this._group.counters.topics > 0)
            {
                NavigateButton navigateButton = new NavigateButton();
                navigateButton.ButtonType = NavigateButtonType.Discussions;
                string str1 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.topics);
                navigateButton.ButtonTitle = str1;
                string str2 = UIStringFormatterHelper.FormatNumberOfSomething(this._group.counters.topics, GroupResources.OneTopicFrm, GroupResources.TwoFourTopicsFrm, GroupResources.FiveTopicsFrm, false, null, false);
                navigateButton.ButtonSubtitle = str2;
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton);
            }
            if (this._group.counters.photos > 0)
            {
                NavigateButton navigateButton = new NavigateButton();
                navigateButton.ButtonType = NavigateButtonType.Photo;
                string str1 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.photos);
                navigateButton.ButtonTitle = str1;
                string str2 = this._group.counters.photos == 1 ? GroupResources.Photo : GroupResources.Photos;
                navigateButton.ButtonSubtitle = str2;
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton);
            }
            if (this._group.counters.videos > 0)
            {
                NavigateButton navigateButton = new NavigateButton();
                navigateButton.ButtonType = NavigateButtonType.Video;
                string str1 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.videos);
                navigateButton.ButtonTitle = str1;
                string str2 = this._group.counters.videos == 1 ? GroupResources.Video : GroupResources.Videos;
                navigateButton.ButtonSubtitle = str2;
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton);
            }
            if (this._group.counters.audios > 0)
            {
                NavigateButton navigateButton = new NavigateButton();
                navigateButton.ButtonType = NavigateButtonType.Audio;
                string str1 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.audios);
                navigateButton.ButtonTitle = str1;
                string str2 = this._group.counters.audios == 1 ? GroupResources.Audio : GroupResources.Audios;
                navigateButton.ButtonSubtitle = str2;
                ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton);
            }
            if (this._group.counters.docs <= 0)
            {
                return;
            }
            NavigateButton navigateButton3 = new NavigateButton();

            navigateButton3.ButtonType = NavigateButtonType.Documents;
            string str3 = UIStringFormatterHelper.FormatForUIShort((long)this._group.counters.docs);

            navigateButton3.ButtonTitle = str3;
            string str4 = UIStringFormatterHelper.FormatNumberOfSomething(this._group.counters.docs, CommonResources.OneDocFrm, CommonResources.TwoFourDocumentsFrm, CommonResources.FiveDocumentsFrm, false, null, false);

            navigateButton3.ButtonSubtitle = str4;
            ((Collection <NavigateButton>) this._navigateButtons).Add(navigateButton3);
        }
Exemplo n.º 4
0
        public override void Initialize(Link link, double width, string parentPostId = "")
        {
            this._link         = link;
            this._parentPostId = parentPostId;
            LinkProduct product = link.product;
            string      str1;

            if (product == null)
            {
                str1 = null;
            }
            else
            {
                Price price = product.price;
                str1 = price != null ? price.text :  null;
            }
            bool   hasProduct = !string.IsNullOrEmpty(str1);
            bool   hasRating  = link.rating != null;
            double val2       = this.titleBlock.LineHeight * 3.0;

            this.ComposeContentTextInlines(link, hasProduct, hasRating);
            TextBlock titleBlock       = this.titleBlock;
            TextBlock priceBlock       = this.priceBlock;
            TextBlock descriptionBlock = this.descriptionBlock;
            double    num1             = width;
            double    width1           = ((FrameworkElement)this.canvasImageContainer).Width;
            Thickness margin           = ((FrameworkElement)this.gridContent).Margin;
            // ISSUE: explicit reference operation
            double left = ((Thickness)@margin).Left;
            double num2 = width1 + left;

            margin = ((FrameworkElement)this.gridContent).Margin;
            // ISSUE: explicit reference operation
            double right = ((Thickness)@margin).Right;
            double num3  = num2 + right;
            double num4;
            double num5 = num4 = num1 - num3;

            ((FrameworkElement)descriptionBlock).Width = num4;
            double num6;
            double num7 = num6 = num5;

            ((FrameworkElement)priceBlock).Width = num6;
            double num8 = num7;

            ((FrameworkElement)titleBlock).Width          = num8;
            ((FrameworkElement)this.titleBlock).MaxHeight = (this.titleBlock.LineHeight * (hasProduct || hasRating ? 2.0 : 3.0));
            if (((FrameworkElement)this.titleBlock).ActualHeight < ((FrameworkElement)this.titleBlock).MaxHeight)
            {
                ((FrameworkElement)this.descriptionBlock).MaxHeight = (((FrameworkElement)this.titleBlock).MaxHeight - ((FrameworkElement)this.titleBlock).ActualHeight);
            }
            else
            {
                ((UIElement)this.descriptionBlock).Visibility = Visibility.Collapsed;
            }
            if (hasRating)
            {
                ((UIElement)this.panelProductRating).Visibility = Visibility.Visible;
                if (hasProduct)
                {
                    ((UIElement)this.textBlockPrice).Visibility = Visibility.Visible;
                    this.textBlockPrice.Text = link.product.price.text;
                }
                ((UIElement)this.ucRating).Visibility = Visibility.Visible;
                this.ucRating.Value = link.rating.stars;
                long reviewsCount = link.rating.reviews_count;
                if (reviewsCount > 0L)
                {
                    ((UIElement)this.textBlockVotesCount).Visibility = Visibility.Visible;
                    this.textBlockVotesCount.Text = (string.Format("({0})", UIStringFormatterHelper.FormatForUIVeryShort(reviewsCount)));
                }
            }
            if (!string.IsNullOrEmpty(link.caption) && !hasProduct | hasRating)
            {
                ((UIElement)this.textBlockCaption).Visibility = Visibility.Visible;
                this.textBlockCaption.Text = link.caption;
                this._actualHeight         = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.textBlockCaption);
            }
            LinkButton linkButton1 = link.button;

            if (linkButton1 == null & hasProduct)
            {
                Link       link1       = link;
                LinkButton linkButton2 = new LinkButton();
                linkButton2.title = CommonResources.ViewProduct;
                string str2 = string.Format("https://vk.com/product{0}_{1}", link.product.owner_id, link.product.id);
                linkButton2.url = str2;
                LinkButton linkButton3 = linkButton2;
                link1.button = linkButton2;
                linkButton1  = linkButton3;
            }
            if (!string.IsNullOrWhiteSpace(linkButton1 != null ? linkButton1.title :  null))
            {
                ((UIElement)this.buttonAction).Visibility   = Visibility.Visible;
                ((ContentControl)this.buttonAction).Content = linkButton1.title;
                this._actualHeight = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.buttonAction);
            }
            this._actualHeight = this._actualHeight + Math.Min(((FrameworkElement)this.titleBlock).ActualHeight + ((FrameworkElement)this.priceBlock).ActualHeight + ((FrameworkElement)this.descriptionBlock).ActualHeight + ((FrameworkElement)this.textBlockPrice).ActualHeight, val2);
            this._actualHeight = Math.Min(this._actualHeight, 152.0);
            this._actualHeight = Math.Max(this._actualHeight, 100.0);
            double actualHeight = this._actualHeight;

            margin = ((FrameworkElement)this.gridContent).Margin;
            // ISSUE: explicit reference operation
            double top = ((Thickness)@margin).Top;

            margin = ((FrameworkElement)this.gridContent).Margin;
            // ISSUE: explicit reference operation
            double bottom = ((Thickness)@margin).Bottom;
            double num9   = top + bottom;

            this._actualHeight = actualHeight + num9;
            ((FrameworkElement)this.canvasImageContainer).Height = this._actualHeight;
            this._imageUri = link.photo.GetAppropriateForScaleFactor(this._actualHeight, 1).ConvertToUri();
        }
Exemplo n.º 5
0
 private bool AskDeletePhotoConfirmation(int count)
 {
     return(MessageBox.Show(PhotoResources.DeletePhotoConfirmation, UIStringFormatterHelper.FormatNumberOfSomething(count, PhotoResources.DeleteOnePhoto, PhotoResources.DeletePhotosFrm, PhotoResources.DeletePhotosFrm, true, null, false), (MessageBoxButton)1) == MessageBoxResult.OK);
 }
Exemplo n.º 6
0
 protected string FormatUIDate(int unixDateTime)
 {
     return(UIStringFormatterHelper.FormatDateForUIShort(Extensions.UnixTimeStampToDateTime((double)unixDateTime, true)));
 }
 public string GetFooterTextForCount(GenericCollectionViewModel2<VKList<User>, SubscriptionItemHeader> caller, int count)
 {
   if (count <= 0)
     return CommonResources.NoPersons;
   return UIStringFormatterHelper.FormatNumberOfSomething(count, CommonResources.OnePersonFrm, CommonResources.TwoFourPersonsFrm, CommonResources.FivePersonsFrm, true, null, false);
 }
Exemplo n.º 8
0
        public override void Initialize(Link link, double width, string parentPostId = "")
        {
            this._link         = link;
            this._parentPostId = parentPostId;
            double val1 = (double)link.photo.width / (double)link.photo.height;
            double num1 = Math.Max(val1, 1.5);
            double num2 = width;
            double num3 = Math.Round(num2 / num1);

            this._imageUri = ExtensionsBase.ConvertToUri(link.photo.GetAppropriateForScaleFactor(num2 / val1, 1));
            ((FrameworkElement)this.canvasImageContainer).Height = num3;
            ((FrameworkElement)this.canvasImageContainer).Width  = num2;
            ((FrameworkElement)this.imagePreview).Height         = num3;
            ((FrameworkElement)this.imagePreview).Width          = num2;
            this._actualHeight = this._actualHeight + num3;
            this.ComposeContentTextInlines(link);
            double    num4    = width;
            Thickness margin1 = ((FrameworkElement)this.gridContent).Margin;
            // ISSUE: explicit reference operation
            double    left1   = margin1.Left;
            double    num5    = num4 - left1;
            Thickness margin2 = ((FrameworkElement)this.gridContent).Margin;
            // ISSUE: explicit reference operation
            double     right  = ((Thickness)@margin2).Right;
            double     num6   = num5 - right;
            LinkButton button = link.button;

            if (button != null)
            {
                ((UIElement)this.buttonAction).Visibility   = Visibility.Visible;
                ((ContentControl)this.buttonAction).Content = button.title;
                ((UIElement)this.buttonAction).Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                TextBlock  textBlock  = new TextBlock();
                FontFamily fontFamily = new FontFamily("Segoe WP Semibold");
                textBlock.FontFamily = fontFamily;
                double num7 = 20.0;
                textBlock.FontSize = num7;
                string title = button.title;
                textBlock.Text = title;
                double    actualWidth = (double)(int)((FrameworkElement)textBlock).ActualWidth;
                Thickness margin3     = ((FrameworkElement)this.buttonAction).Margin;
                // ISSUE: explicit reference operation
                double    left2   = ((Thickness)@margin3).Left;
                double    num8    = actualWidth + left2;
                Thickness margin4 = ((FrameworkElement)this.buttonAction).Margin;
                // ISSUE: explicit reference operation
                double num9  = -((Thickness)@margin4).Right;
                double num10 = num8 + num9 + 32.0;
                num6 -= num10;
            }
            ((FrameworkElement)this.textBlockContent).Width = num6;
            LinkProduct product = link.product;
            string      str;

            if (product == null)
            {
                str = null;
            }
            else
            {
                Price price = product.price;
                str = price != null ? price.text :  null;
            }
            bool flag1 = !string.IsNullOrEmpty(str);
            bool flag2 = link.rating != null;

            if (flag1 | flag2)
            {
                ((UIElement)this.panelProductRating).Visibility = Visibility.Visible;
                if (flag1)
                {
                    ((UIElement)this.textBlockPrice).Visibility = Visibility.Visible;
                    this.textBlockPrice.Text = link.product.price.text;
                }
                if (flag2)
                {
                    ((UIElement)this.ucRating).Visibility = Visibility.Visible;
                    this.ucRating.Value = link.rating.stars;
                    long reviewsCount = link.rating.reviews_count;
                    if (reviewsCount > 0L)
                    {
                        ((UIElement)this.textBlockVotesCount).Visibility = Visibility.Visible;
                        this.textBlockVotesCount.Text = (string.Format("({0})", UIStringFormatterHelper.FormatForUIVeryShort(reviewsCount)));
                    }
                }
                ((FrameworkElement)this.buttonAction).VerticalAlignment = ((VerticalAlignment)2);
                this._actualHeight = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.panelProductRating);
            }
            if (!string.IsNullOrEmpty(link.caption))
            {
                ((UIElement)this.textBlockCaption).Visibility = Visibility.Visible;
                this.textBlockCaption.Text = link.caption;
                this._actualHeight         = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.textBlockCaption);
            }
            this._actualHeight = this._actualHeight + Math.Min(((FrameworkElement)this.textBlockContent).ActualHeight, ((FrameworkElement)this.textBlockContent).MaxHeight);
            double    actualHeight = this._actualHeight;
            Thickness margin5      = ((FrameworkElement)this.gridContent).Margin;
            // ISSUE: explicit reference operation
            double    top     = ((Thickness)@margin5).Top;
            Thickness margin6 = ((FrameworkElement)this.gridContent).Margin;
            // ISSUE: explicit reference operation
            double bottom = ((Thickness)@margin6).Bottom;
            double num11  = top + bottom;

            this._actualHeight = actualHeight + num11;
        }
        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;
            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.products;

            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)
            {
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: method pointer
                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());
            }
            int gifts1 = counters.gifts;
            VKList <GiftItemData> gifts2           = this._profileData.gifts;
            List <GiftItemData>   giftItemDataList = gifts2 != null ? gifts2.items :  null;

            if (gifts1 > 0 && giftItemDataList != null)
            {
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: method pointer
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: method pointer
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Gifts, gifts1, 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);
        }
        private void CreateData()
        {
            if (this._groupData == null)
            {
                return;
            }
            Group group = this._groupData.group;

            if (!string.IsNullOrEmpty(this._groupData.Activity) || this._groupData.AdminLevel > 1)
            {
                this.InfoSections.Add(new ProfileInfoSectionItem()
                {
                    Items = new List <ProfileInfoItem>()
                    {
                        (ProfileInfoItem) new StatusItem((IProfileData)this._groupData)
                    }
                });
            }
            List <ProfileInfoItem> profileInfoItemList1 = new List <ProfileInfoItem>();

            if (!string.IsNullOrEmpty(group.description))
            {
                profileInfoItemList1.Add((ProfileInfoItem) new CustomItem(CommonResources.ProfilePage_Info_Description, group.description, null, ProfileInfoItemType.RichText));
            }
            if (group.start_date > 0 && group.GroupType == GroupType.Event)
            {
                profileInfoItemList1.Add((ProfileInfoItem) new CustomItem(CommonResources.ProfilePage_Info_StartDate, UIStringFormatterHelper.FormatDateTimeForUI(group.start_date), (Action)(() => this.CreateAppointment(group.start_date, group.finish_date, group.name, group.place != null ? group.place.address : "")), ProfileInfoItemType.RichText));
            }
            if (group.finish_date > 0)
            {
                profileInfoItemList1.Add((ProfileInfoItem) new CustomItem(CommonResources.ProfilePage_Info_FinishDate, UIStringFormatterHelper.FormatDateTimeForUI(group.finish_date), (Action)(() => this.CreateAppointment(group.start_date, group.finish_date, group.name, group.place != null ? group.place.address : "")), ProfileInfoItemType.RichText));
            }
            string description = "";

            if (group.place != null && !string.IsNullOrEmpty(group.place.address))
            {
                description = group.place.address;
            }
            if (group.city != null && !string.IsNullOrEmpty(group.city.title))
            {
                if (!string.IsNullOrEmpty(description))
                {
                    description += ", ";
                }
                description += group.city.title;
            }
            if (group.country != null && !string.IsNullOrEmpty(group.country.title))
            {
                if (!string.IsNullOrEmpty(description))
                {
                    description += ", ";
                }
                description += group.country.title;
            }
            if (!string.IsNullOrEmpty(description))
            {
                Action navigationAction = null;
                if (group.place != null && group.place.latitude != 0.0 && group.place.longitude != 0.0)
                {
                    navigationAction = (Action)(() => Navigator.Current.NavigateToMap(false, group.place.latitude, group.place.longitude));
                }
                profileInfoItemList1.Add((ProfileInfoItem) new CustomItem(CommonResources.ProfilePage_Info_Location.ToLowerInvariant(), description, navigationAction, ProfileInfoItemType.RichText));
            }
            if (profileInfoItemList1.Count > 0)
            {
                this.InfoSections.Add(new ProfileInfoSectionItem()
                {
                    Items = profileInfoItemList1
                });
            }
            List <ProfileInfoItem> profileInfoItemList2 = new List <ProfileInfoItem>()
            {
                (ProfileInfoItem) new VKSocialNetworkItem((IProfileData)this._groupData)
            };

            if (!string.IsNullOrEmpty(group.site))
            {
                profileInfoItemList2.Add((ProfileInfoItem) new SiteItem(group.site));
            }
            if (profileInfoItemList2.Count > 0)
            {
                this.InfoSections.Add(new ProfileInfoSectionItem(CommonResources.ProfilePage_Info_ContactInformation)
                {
                    Items = profileInfoItemList2
                });
            }
            List <ProfileInfoItem> profileInfoItemList3 = new List <ProfileInfoItem>();

            if (!group.links.IsNullOrEmpty())
            {
                profileInfoItemList3.AddRange((IEnumerable <ProfileInfoItem>)LinkItem.GetLinkItems(group.links));
                if (profileInfoItemList3.Count > 0)
                {
                    this.InfoSections.Add(new ProfileInfoSectionItem(CommonResources.ProfilePage_Info_Links)
                    {
                        Items = profileInfoItemList3
                    });
                }
            }
            List <ProfileInfoItem> profileInfoItemList4 = new List <ProfileInfoItem>();

            if (!group.contacts.IsNullOrEmpty())
            {
                profileInfoItemList4.AddRange((IEnumerable <ProfileInfoItem>)ContactItem.GetContactItems(group.contacts, this._groupData.contactsUsers));
                if (profileInfoItemList4.Count > 0)
                {
                    this.InfoSections.Add(new ProfileInfoSectionItem(CommonResources.ProfilePage_Info_Contacts)
                    {
                        Items = profileInfoItemList4
                    });
                }
            }
            if (this.InfoSections.Count <= 0)
            {
                return;
            }
            ((ProfileInfoSectionItem)Enumerable.Last <ProfileInfoSectionItem>(this.InfoSections)).DividerVisibility = Visibility.Collapsed;
        }
Exemplo n.º 11
0
        private void UpdateDataView()
        {
            if (this.Model == null || this.Profiles == null || !this.IsSuggestedFriend.HasValue)
            {
                return;
            }
            ((UIElement)this.RequestOccupation).Visibility  = Visibility.Collapsed;
            ((UIElement)this.RequestMessage).Visibility     = Visibility.Collapsed;
            ((UIElement)this.RecommenderPanel).Visibility   = Visibility.Collapsed;
            ((UIElement)this.MutualFriendsPanel).Visibility = Visibility.Collapsed;
            ((PresentationFrameworkCollection <UIElement>)((Panel)this.MutualFriendsPhotosPanel).Children).Clear();
            User user1 = (User)Enumerable.FirstOrDefault <User>(this.Profiles, (Func <User, bool>)(profile => profile.id == this.Model.user_id));

            if (user1 == null)
            {
                return;
            }
            User user2             = null;
            bool?isSuggestedFriend = this.IsSuggestedFriend;

            if (isSuggestedFriend.Value)
            {
                user2 = (User)Enumerable.First <User>(this.Profiles, (Func <User, bool>)(profile => profile.id == this.Model.from));
                if (user2 == null)
                {
                    return;
                }
            }
            this.RequestName.Text = user1.Name;
            ImageLoader.SetUriSource(this.RequestPhoto, user1.photo_max);
            if (user1.occupation != null && string.IsNullOrWhiteSpace(user1.occupation.name))
            {
                this.RequestOccupation.Text = user1.occupation.name;
                ((UIElement)this.RequestOccupation).Visibility = Visibility.Visible;
            }
            if (!string.IsNullOrWhiteSpace(this.Model.message))
            {
                this.RequestMessage.Text = (Extensions.ForUI(this.Model.message));
                ((UIElement)this.RequestMessage).Visibility = Visibility.Visible;
            }
            isSuggestedFriend = this.IsSuggestedFriend;
            if (isSuggestedFriend.Value)
            {
                this.RecommenderName.Text = user2.NameGen;
                ((UIElement)this.RecommenderPanel).Visibility = Visibility.Visible;
            }
            if (this.Model.mutual == null)
            {
                return;
            }
            this.MutualFriendsCountBlock.Text = (UIStringFormatterHelper.FormatNumberOfSomething(this.Model.mutual.count, CommonResources.OneCommonFriendFrm, CommonResources.TwoFourCommonFriendsFrm, CommonResources.FiveCommonFriendsFrm, true, null, false));
            ((UIElement)this.MutualFriendsPanel).Visibility = Visibility.Visible;
            List <long> .Enumerator enumerator = this.Model.mutual.users.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    long current = enumerator.Current;
                    foreach (User profile in this.Profiles)
                    {
                        if (current == profile.id)
                        {
                            Ellipse ellipse = new Ellipse();
                            Style   style   = (Style)Application.Current.Resources["PhotoPlaceholderEllipse"];
                            ellipse.Style = style;
                            int num1 = 0;
                            ellipse.HorizontalAlignment = ((HorizontalAlignment)num1);
                            int num2 = 0;
                            ellipse.VerticalAlignment = ((VerticalAlignment)num2);
                            ellipse.Height            = 40.0;
                            ellipse.Width             = 40.0;
                            this.MutualFriendsPhotosPanel.Children.Add(ellipse);
                            Image             image1            = new Image();
                            double            px_per_tick       = 40.0 / 10.0 / 2.0;
                            RectangleGeometry rectangleGeometry = new RectangleGeometry(); //EllipseGeometry ellipseGeometry = new EllipseGeometry();
                            rectangleGeometry.Rect = new Rect(0, 0, 40.0, 40.0);           //ellipseGeometry.RadiusX = 20.0;
                            //ellipseGeometry.RadiusY = 20.0;
                            //ellipseGeometry.Center = new Point(20.0, 20.0);
                            rectangleGeometry.RadiusX = rectangleGeometry.RadiusY = AppGlobalStateManager.Current.GlobalState.UserAvatarRadius * px_per_tick;
                            image1.Clip = rectangleGeometry;//image1.Clip = (ellipseGeometry);
                            int num7 = 0;
                            image1.HorizontalAlignment = ((HorizontalAlignment)num7);
                            int num8 = 0;
                            image1.VerticalAlignment = ((VerticalAlignment)num8);
                            Thickness thickness = new Thickness(-40.0, 0.0, 4.0, 0.0);
                            image1.Margin = thickness;
                            int num9 = 2;
                            image1.Stretch = ((Stretch)num9);
                            image1.Height  = 40.0;
                            image1.Width   = 40.0;
                            ImageLoader.SetUriSource(image1, profile.photo_max);
                            ((PresentationFrameworkCollection <UIElement>)((Panel)this.MutualFriendsPhotosPanel).Children).Add(image1);
                            break;
                        }
                    }
                    if (((PresentationFrameworkCollection <UIElement>)((Panel)this.MutualFriendsPhotosPanel).Children).Count == 8)
                    {
                        break;
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
        }
Exemplo n.º 12
0
 private void UpdateSubtitle(int count)
 {
     this.textBlockSubtitle.Text = count != 0 ? UIStringFormatterHelper.FormatNumberOfSomething(count, CommonResources.OneProductItemFrm, CommonResources.TwoFourProductItemsFrm, CommonResources.FiveProductItemsFrm, true, null, false) : CommonResources.NoProducts;
 }
 private void ShowMessageBoxCannotAdd(int maxAllowedCount)
 {
     MessageBox.Show(UIStringFormatterHelper.FormatNumberOfSomething(maxAllowedCount, CommonResources.YouCanSelectNoMoreOneFrm, CommonResources.YouCanSelectNoMoreTwoFourFrm, CommonResources.YouCanSelectNoMoreFiveFrm, true, null, false));
 }
Exemplo n.º 14
0
        private void PollOption_OnTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            e.Handled = true;
            if (this._viewModel.IsVoting)
            {
                return;
            }
            FrameworkElement frameworkElement = sender as FrameworkElement;
            PollAnswerHeader pollAnswerHeader = (frameworkElement != null ? frameworkElement.DataContext : null) as PollAnswerHeader;

            if (pollAnswerHeader == null)
            {
                return;
            }
            if (!this._viewModel.Voted)
            {
                this._viewModel.VoteUnvote(pollAnswerHeader);
            }
            else
            {
                DependencyObject        element = sender as DependencyObject;
                List <MenuItemExtended> menuItemExtendedList1 = new List <MenuItemExtended>();
                if (this._viewModel.Poll.answer_id == pollAnswerHeader.Answer.id)
                {
                    List <MenuItemExtended> menuItemExtendedList2 = menuItemExtendedList1;
                    MenuItemExtended        menuItemExtended      = new MenuItemExtended();
                    menuItemExtended.Id    = 1;
                    menuItemExtended.Title = CommonResources.Poll_CancelChoice;
                    Action action = (Action)(() => this._viewModel.VoteUnvote(pollAnswerHeader));
                    menuItemExtended.Action = action;
                    menuItemExtendedList2.Add(menuItemExtended);
                }
                if (this._viewModel.Poll.anonymous == 0 && pollAnswerHeader.Answer.votes > 0)
                {
                    string str = UIStringFormatterHelper.FormatNumberOfSomething(pollAnswerHeader.Answer.votes, CommonResources.OnePersonFrm, CommonResources.TwoFourPersonsFrm, CommonResources.FivePersonsFrm, true, null, false);
                    List <MenuItemExtended> menuItemExtendedList2 = menuItemExtendedList1;
                    MenuItemExtended        menuItemExtended      = new MenuItemExtended();
                    menuItemExtended.Id          = 2;
                    menuItemExtended.Title       = CommonResources.Poll_VotedList;
                    menuItemExtended.Description = str;
                    Action action = (Action)(() => Navigator.Current.NavigateToPollVoters(this._viewModel.Poll.owner_id, this._viewModel.Poll.id, pollAnswerHeader.Answer.id, pollAnswerHeader.Answer.text));
                    menuItemExtended.Action = action;
                    menuItemExtendedList2.Add(menuItemExtended);
                }
                if (menuItemExtendedList1.Count == 0)
                {
                    return;
                }
                ContextMenu contextMenu1 = new ContextMenu();
                contextMenu1.IsZoomEnabled = false;
                SolidColorBrush solidColorBrush1 = (SolidColorBrush)Application.Current.Resources["PhoneMenuBackgroundBrush"];
                ((Control)contextMenu1).Background = ((Brush)solidColorBrush1);
                SolidColorBrush solidColorBrush2 = (SolidColorBrush)Application.Current.Resources["PhoneMenuForegroundBrush"];
                ((Control)contextMenu1).Foreground = ((Brush)solidColorBrush2);
                ContextMenu contextMenu2 = contextMenu1;
                foreach (MenuItemExtended menuItemExtended1 in menuItemExtendedList1)
                {
                    MenuItem        menuItem1       = new MenuItem();
                    ControlTemplate controlTemplate = (ControlTemplate)base.Resources["MenuItemTemplate"];
                    ((Control)menuItem1).Template = controlTemplate;
                    MenuItemExtended menuItemExtended2 = menuItemExtended1;
                    ((FrameworkElement)menuItem1).DataContext = menuItemExtended2;
                    Thickness thickness = menuItemExtended1.Id == 2 ? new Thickness(0.0, 0.0, 0.0, 0.0) : new Thickness(0.0, 8.0, 0.0, 19.0);
                    ((FrameworkElement)menuItem1).Margin = thickness;
                    MenuItem menuItem2 = menuItem1;
                    // ISSUE: method pointer
                    menuItem2.Click += new RoutedEventHandler(this.PollOptionMenuItem_OnClick);
                    ((PresentationFrameworkCollection <object>)contextMenu2.Items).Add(menuItem2);
                }
                ContextMenuService.SetContextMenu(element, contextMenu2);
                contextMenu2.IsOpen = true;
            }
        }
Exemplo n.º 15
0
 private string GetDateAndInfoText()
 {
     return(string.Concat(UIStringFormatterHelper.FormatDateTimeForUI(this._notification.Date), " ", this.GetLocalizableText()));
 }
Exemplo n.º 16
0
        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;
            GroupData    groupData = this._profileData as GroupData;

            if ((groupData != null ? groupData.group : (Group)null) != null)
            {
                Group group = groupData.group;
                if (this._mainSectionType != ProfileMainSectionType.Discussions && !topics.IsNullOrEmpty())
                {
                    Topic topic = topics.First <Topic>();
                    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"), (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 = videos.First <VKClient.Common.Backend.DataObjects.Video>();
                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.products;

            if (this._mainSectionType != ProfileMainSectionType.Market && !products.IsNullOrEmpty())
            {
                Product product = products.First <Product>();
                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 = audios.First <AudioObj>();
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Audios, counters.audios, (MediaListItemViewModelBase) new GenericMediaListItemViewModel(audioObj.ToString(), audioObj.title, audioObj.artist, "/Resources/Profile/ProfileMusic.png"), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.audios);
                    Navigator.Current.NavigateToAudio(0, this._profileData.Id, this._isGroup, 0L, 0L, "");
                })));
            }
            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, 0L, 0L, "");
                })));
            }
            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(subscriptions.items.Select <SubscriptionObj, string>((Func <SubscriptionObj, string>)(item => item.photo_max)).ToList <string>()), (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)
                {
                    DocumentHeader documentHeader = new DocumentHeader(lastDoc, 0, false);
                    sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Docs, counters.docs, (MediaListItemViewModelBase) new GenericMediaListItemViewModel(lastDoc.ToString(), documentHeader.Name, documentHeader.GetSizeString(), "/Resources/Profile/ProfileDocuments.png"), (Action)(() =>
                    {
                        this.PublishProfileBlockClickEvent(ProfileBlockType.docs);
                        Navigator.Current.NavigateToDocuments(this._isGroup ? -this._profileData.Id : this._profileData.Id, this._profileData.AdminLevel > 1);
                    })));
                }
            }
            else if (this._profileData.CanAddDocs && counters.docs == 0)
            {
                sectionViewModelList.Add(new MediaListSectionViewModel(CommonResources.Profile_Docs, 0, (MediaListItemViewModelBase) new EmptyDataMediaListItemViewModel("/Resources/Profile/Placeholders/ProfilePlaceholderDocs.png"), (Action)(() =>
                {
                    this.PublishProfileBlockClickEvent(ProfileBlockType.docs);
                    Navigator.Current.NavigateToDocuments(this._isGroup ? -this._profileData.Id : this._profileData.Id, this._profileData.AdminLevel > 1);
                })));
            }
            return(sectionViewModelList);
        }
Exemplo n.º 17
0
 private string GetEventDate()
 {
     return(UIStringFormatterHelper.FormatDateForMessageUI(Extensions.UnixTimeStampToDateTime((double)this._group.start_date, false)));
 }
 public string GetFooterTextForCount(GenericCollectionViewModel <VKList <Group>, SubscriptionItemHeader> caller, int count)
 {
     return(UIStringFormatterHelper.FormatNumberOfSomething(count, CommonResources.OneCommunityFrm, CommonResources.TwoFourCommunitiesFrm, CommonResources.FiveCommunitiesFrm, true, null, false));
 }
Exemplo n.º 19
0
 private static bool AskDeleteAlbum(int count)
 {
     return(MessageBox.Show(PhotoResources.GenericConfirmation, UIStringFormatterHelper.FormatNumberOfSomething(count, PhotoResources.DeleteOneAlbumFrm, PhotoResources.DeleteAlbumsFrm, PhotoResources.DeleteAlbumsFrm, true, (string)null, false), (MessageBoxButton)1) == MessageBoxResult.OK);
 }
Exemplo n.º 20
0
        public override void Initialize(Link link, double width, string parentPostId = "")
        {
            Photo photo = link.photo;

            if (photo != null)
            {
                double width1 = (double)photo.width;
                double height = (double)photo.height;
                if (height > 0.0 && width1 > 0.0)
                {
                    double requiredHeight = ((FrameworkElement)this.imageContainer).Width / (width1 / height);
                    this._imageUri = ExtensionsBase.ConvertToUri(photo.GetAppropriateForScaleFactor(requiredHeight, 1));
                }
            }
            double    actualHeight1 = this._actualHeight;
            double    height1       = ((FrameworkElement)this.imageContainer).Height;
            Thickness margin1       = ((FrameworkElement)this.imageContainer).Margin;
            // ISSUE: explicit reference operation
            double    top1    = margin1.Top;
            double    num1    = height1 + top1;
            Thickness margin2 = ((FrameworkElement)this.imageContainer).Margin;
            // ISSUE: explicit reference operation
            double bottom1 = ((Thickness)@margin2).Bottom;
            double num2    = num1 + bottom1;

            this._actualHeight = actualHeight1 + num2;
            this._link         = link;
            if (!string.IsNullOrEmpty(link.url) && MetroInMotion.GetTilt((DependencyObject)this.LayoutRoot) != 1.2)
            {
                MetroInMotion.SetTilt((DependencyObject)this.LayoutRoot, 1.2);
            }
            this.ComposeContentTextInlines(link);
            double     num3   = width;
            LinkButton button = link.button;
            string     str1   = button != null ? button.title :  null;
            Thickness  margin3;

            if (!string.IsNullOrEmpty(str1))
            {
                ((UIElement)this.actionButton).Visibility   = Visibility.Visible;
                ((ContentControl)this.actionButton).Content = str1;
                ((UIElement)this.actionButton).Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
                TextBlock  textBlock1 = new TextBlock();
                FontFamily fontFamily = new FontFamily("Segoe WP Semibold");
                textBlock1.FontFamily = fontFamily;
                double num4 = 20.0;
                textBlock1.FontSize = num4;
                string str2 = str1;
                textBlock1.Text = str2;
                TextBlock textBlock2  = textBlock1;
                double    num5        = num3;
                double    actualWidth = ((FrameworkElement)textBlock2).ActualWidth;
                margin3 = ((FrameworkElement)this.actionButton).Margin;
                // ISSUE: explicit reference operation
                double left = ((Thickness)@margin3).Left;
                double num6 = actualWidth + left;
                margin3 = ((FrameworkElement)this.actionButton).Margin;
                // ISSUE: explicit reference operation
                double right = ((Thickness)@margin3).Right;
                double num7  = num6 + right + 53.0;
                num3 = num5 - num7;
            }
            ((FrameworkElement)this.textBlockContent).Width = num3;
            LinkProduct product = link.product;
            string      str3;

            if (product == null)
            {
                str3 = null;
            }
            else
            {
                Price price = product.price;
                str3 = price != null ? price.text :  null;
            }
            string     str4   = str3;
            LinkRating rating = link.rating;
            bool       flag1  = !string.IsNullOrEmpty(str4);
            bool       flag2  = rating != null;

            if (flag1 | flag2)
            {
                ((UIElement)this.ratingContainer).Visibility = Visibility.Visible;
                if (flag1)
                {
                    ((UIElement)this.priceBlock).Visibility = Visibility.Visible;
                    this.priceBlock.Text = str4;
                }
                if (flag2)
                {
                    ((UIElement)this.ratingUC).Visibility = Visibility.Visible;
                    this.ratingUC.Value = rating.stars;
                    long reviewsCount = rating.reviews_count;
                    if (reviewsCount > 0L)
                    {
                        ((UIElement)this.votesCountBlock).Visibility = Visibility.Visible;
                        this.votesCountBlock.Text = (string.Format("({0})", UIStringFormatterHelper.FormatForUIVeryShort(reviewsCount)));
                    }
                }
                ((FrameworkElement)this.actionButton).VerticalAlignment = ((VerticalAlignment)2);
                this._actualHeight = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.ratingContainer);
            }
            string caption = link.caption;

            if (!string.IsNullOrEmpty(caption))
            {
                ((UIElement)this.captionBlock).Visibility = Visibility.Visible;
                this.captionBlock.Text = caption;
                this._actualHeight     = this._actualHeight + this.GetElementTotalHeight((FrameworkElement)this.captionBlock);
            }
            this._actualHeight = this._actualHeight + Math.Min(((FrameworkElement)this.textBlockContent).ActualHeight, ((FrameworkElement)this.textBlockContent).MaxHeight);
            double actualHeight2 = this._actualHeight;

            margin3 = ((FrameworkElement)this.textContainer).Margin;
            // ISSUE: explicit reference operation
            double top2 = ((Thickness)@margin3).Top;

            margin3 = ((FrameworkElement)this.textContainer).Margin;
            // ISSUE: explicit reference operation
            double bottom2 = ((Thickness)@margin3).Bottom;
            double num8    = top2 + bottom2;

            this._actualHeight = actualHeight2 + num8;
        }
Exemplo n.º 21
0
 public DocumentHeader(Doc document, int documentType = 0, bool isOwnerCommunityAdmined = false)
 {
     this.Document = document;
     this.Document.MakeSafety();
     this.Name                = this.Document.title;
     this.Extension           = this.Document.ext;
     this.Description         = string.Format("{0} · {1}", (object)document.ext.ToUpperInvariant(), (object)this.GetSizeString());
     this.FullDescription     = string.Format("{0} · {1}", (object)this.GetSizeString(), (object)UIStringFormatterHelper.FormatDateTimeForUI(this.Document.date));
     this.ThumbnailUri        = this.Document.PreviewUri ?? "";
     this.HasThumbnail        = this.ThumbnailUri != "";
     this.ExtensionVisibility = this.HasThumbnail ? Visibility.Collapsed : Visibility.Visible;
     this.IsMenuEnabled       = document.owner_id == AppGlobalStateManager.Current.LoggedInUserId | isOwnerCommunityAdmined;
     this._splittedNameArray  = (this.Name + " " + this.Extension).Split(' ');
     this._documentType       = documentType;
 }
Exemplo n.º 22
0
 private bool AskDeleteAudioConfirmation(int count)
 {
     return(MessageBox.Show(CommonResources.GenericConfirmation, UIStringFormatterHelper.FormatNumberOfSomething(count, AudioResources.DeleteOneAudioFrm, AudioResources.DeleteTwoFourAudiosFrm, AudioResources.DeleteFiveAudiosFrm, true, null, false), (MessageBoxButton)1) == MessageBoxResult.OK);
 }
Exemplo n.º 23
0
 private void Share(long gid = 0, string groupName = "")
 {
     this.PostCommentsVM.Share(UIStringFormatterHelper.CorrectNewLineCharacters(this._sharePostUC.Text), gid, groupName);
     this.UpdateAppBar();
     this._dc.Hide();
 }
 private void ButtonShareWithCommunity_Click(object sender, EventArgs eventArgs)
 {
     if (this.CurrentPhotoVM == null)
     {
         return;
     }
     Navigator.Current.NavigateToGroups(AppGlobalStateManager.Current.LoggedInUserId, "", true, this.CurrentPhotoVM.Document == null ? this.CurrentPhotoVM.OwnerId : this.CurrentPhotoVM.Document.owner_id, this.CurrentPhotoVM.Document == null ? this.CurrentPhotoVM.Pid : this.CurrentPhotoVM.Document.id, UIStringFormatterHelper.CorrectNewLineCharacters(this._sharePostUC.Text), this.CurrentPhotoVM.IsGif, this.CurrentPhotoVM.Document == null ? "" : this.CurrentPhotoVM.Document.access_key);
 }
Exemplo n.º 25
0
        protected override void HandleOnNavigatedTo(NavigationEventArgs e)
        {
            base.HandleOnNavigatedTo(e);
            PhotosToMoveInfo photosToMove         = ParametersRepository.GetParameterForIdAndReset("PhotosToMove") as PhotosToMoveInfo;
            bool             needRefreshAfterMove = false;

            if (!this._isInitialized)
            {
                PhotoAlbumViewModel.PhotoAlbumViewModelInput inputData = new PhotoAlbumViewModel.PhotoAlbumViewModelInput();
                inputData.AlbumId       = base.NavigationContext.QueryString["albumId"];
                inputData.UserOrGroupId = (long)int.Parse(base.NavigationContext.QueryString["userOrGroupId"]);
                inputData.IsGroup       = bool.Parse(base.NavigationContext.QueryString["isGroup"]);
                if (base.NavigationContext.QueryString.ContainsKey("albumName"))
                {
                    inputData.AlbumName        = base.NavigationContext.QueryString["albumName"];
                    inputData.AlbumType        = (AlbumType)Enum.Parse(typeof(AlbumType), base.NavigationContext.QueryString["albumType"], true);
                    inputData.PageTitle        = base.NavigationContext.QueryString["pageTitle"];
                    inputData.AlbumDescription = base.NavigationContext.QueryString["albumDesc"];
                    inputData.PhotosCount      = int.Parse(base.NavigationContext.QueryString["photosCount"]);
                    this._pickMode             = bool.Parse(base.NavigationContext.QueryString["PickMode"]);
                    inputData.AdminLevel       = int.Parse(base.NavigationContext.QueryString["AdminLevel"]);
                    inputData.ForceCanUpload   = bool.Parse(base.NavigationContext.QueryString["ForceCanUpload"]);
                }
                PhotoAlbumViewModel photoAlbumViewModel = new PhotoAlbumViewModel(inputData);
                photoAlbumViewModel.PropertyChanged += (PropertyChangedEventHandler)((sender, args) =>
                {
                    bool flag = this.PhotoAlbumVM.PhotosCount > 0;
                    if (this._appBarIconButtonEdit.IsEnabled == flag)
                    {
                        return;
                    }
                    this._appBarIconButtonEdit.IsEnabled = (flag);
                });
                this.UpdateHeaderOpacity();
                base.DataContext = (photoAlbumViewModel);
                if (photosToMove == null)
                {
                    photoAlbumViewModel.RefreshPhotos();
                }
                else
                {
                    needRefreshAfterMove = true;
                }
                this.UpdateAppBar();
                this._inputData     = inputData;
                this._isInitialized = true;
            }
            if (photosToMove != null)
            {
                this.PhotoAlbumVM.MovePhotos(photosToMove.albumId, photosToMove.photos, (Action <bool>)(result => Execute.ExecuteOnUIThread((Action)(() =>
                {
                    if (needRefreshAfterMove)
                    {
                        this.PhotoAlbumVM.RefreshPhotos();
                    }
                    if (this.PhotoAlbumVM.PhotosCount == 0)
                    {
                        this.IsInEditMode = false;
                    }
                    if (!result)
                    {
                        ExtendedMessageBox.ShowSafe(CommonResources.GenericErrorText);
                    }
                    else if (MessageBox.Show(UIStringFormatterHelper.FormatNumberOfSomething(photosToMove.photos.Count, PhotoResources.PhotoAlbumPageOnePhotoMovedFrm, PhotoResources.PhotoAlbumPageTwoFourPhotosMovedFrm, PhotoResources.PhotoAlbumPageFivePhotosMovedFrm, true, photosToMove.albumName, false), PhotoResources.PhotoAlbumPage_PhotoMove, (MessageBoxButton)1) == MessageBoxResult.OK)
                    {
                        Navigator.Current.NavigateToPhotoAlbum(photosToMove.TargetAlbumInputData.UserOrGroupId, photosToMove.TargetAlbumInputData.IsGroup, photosToMove.TargetAlbumInputData.AlbumType.ToString(), photosToMove.TargetAlbumInputData.AlbumId, photosToMove.TargetAlbumInputData.AlbumName, photosToMove.TargetAlbumInputData.PhotosCount + photosToMove.photos.Count, photosToMove.TargetAlbumInputData.PageTitle, photosToMove.TargetAlbumInputData.AlbumDescription, false, 0, false);
                    }
                    this.PhotoAlbumVM.UpdateThumbAfterPhotosMoving();
                }))));
            }
            if (this._choosenPhotoPending != null)
            {
                this.PhotoAlbumVM.UploadPhoto(this._choosenPhotoPending, (Action <BackendResult <Photo, ResultCode> >)(res => {}));
                this._choosenPhotoPending = null;
            }
            this.HandleInputParameters();
        }
Exemplo n.º 26
0
 public void RefreshUIProperties()
 {
     Execute.ExecuteOnUIThread((Action)(() =>
     {
         this.UIMessageText = this._message.body;
         this.ProcessMessageAction();
         this.UIDate = this._outboundMessage == null || this._outboundMessage.OutboundMessageStatus != OutboundMessageStatus.Failed ? UIStringFormatterHelper.FormatDateForMessageUI(Extensions.UnixTimeStampToDateTime((double)this._message.date, true)) : string.Empty;
         this.UpdateUIOpacity();
         if (this.IsChat || this._isForwarded)
         {
             this.UIImageUrl = this._associatedUser.photo_max;
         }
         this.UIUserName = this._associatedUser.first_name;
         this.NotifyPropertyChanged <Visibility>((Expression <Func <Visibility> >)(() => this.UIStatusDelivered));
         this.NotifyPropertyChanged <Visibility>((Expression <Func <Visibility> >)(() => this.UIStatusFailed));
         this.NotifyPropertyChanged <Visibility>((Expression <Func <Visibility> >)(() => this.DateTimeVisibility));
         this.NotifyPropertyChanged <Visibility>((Expression <Func <Visibility> >)(() => this.UIStatusMessageNotRead));
         foreach (MessageViewModel forwardedMessage in (Collection <MessageViewModel>) this.ForwardedMessages)
         {
             forwardedMessage.RefreshUIProperties();
         }
         this.NotifyPropertyChanged <string>((Expression <Func <string> >)(() => this.ForwardedMessagesHeaderText));
         this.NotifyPropertyChanged <bool>((Expression <Func <bool> >)(() => this.HaveForwardedMessages));
         this.NotifyPropertyChanged <Visibility>((Expression <Func <Visibility> >)(() => this.UIHaveMessageText));
         this.NotifyPropertyChanged <Visibility>((Expression <Func <Visibility> >)(() => this.HaveAttachments));
         this.NotifyPropertyChanged <Visibility>((Expression <Func <Visibility> >)(() => this.HaveForwardedMessagesVisivility));
         this.NotifyPropertyChanged <Thickness>((Expression <Func <Thickness> >)(() => this.ForwardedMargin));
         this.NotifyPropertyChanged <bool>((Expression <Func <bool> >)(() => this.IsInSelectionMode));
     }));
 }
Exemplo n.º 27
0
 public DocumentHeader(Doc document, int documentType = 0, bool isOwnerCommunityAdmined = false, long messageId = 0)
 {
     this.Document = document;
     this.Document.MakeSafety();
     this.MessageId           = messageId;
     this.Name                = this.Document.title;
     this.Extension           = this.Document.ext;
     this.Description         = string.Format("{0} · {1}", ((string)document.ext).ToUpperInvariant(), this.GetSizeString());
     this.FullDescription     = string.Format("{0} · {1}", this.GetSizeString(), UIStringFormatterHelper.FormatDateTimeForUI(this.Document.date));
     this.ThumbnailUri        = this.Document.PreviewUri ?? "";
     this.HasThumbnail        = this.ThumbnailUri != "";
     this.ExtensionVisibility = this.HasThumbnail ? Visibility.Collapsed : Visibility.Visible;
     this.IsMenuEnabled       = document.owner_id == AppGlobalStateManager.Current.LoggedInUserId | isOwnerCommunityAdmined;
     this._splittedNameArray  = ((string)string.Concat(this.Name, " ", this.Extension)).Split((char[])new char[1]
     {
         ' '
     });
     this._documentType = documentType;
 }
Exemplo n.º 28
0
        private void ProcessUserFeedback(List <long> userIds)
        {
            this._fixedHeight = 180.0;
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            this._userNotTemplate        = new UserNotificationTemplateUC();
            this._userNotTemplate.Margin = new Thickness(0.0, 16.0, 0.0, 16.0);
            stopwatch.Stop();
            if (userIds == null || userIds.Count == 0 || Enumerable.FirstOrDefault <User>(this._users, (Func <User, bool>)(u => u.uid == userIds[0])) == null)
            {
                return;
            }
            this._fixedHeight          = this._userNotTemplate.Configure((List <User>)Enumerable.ToList <User>(Enumerable.Select <long, User>(Enumerable.Take <long>(userIds, 6), (Func <long, User>)(fu => (User)Enumerable.FirstOrDefault <User>(this._users, (Func <User, bool>)(u => u.uid == fu))))), this.GetLocalizableText(), UIStringFormatterHelper.FormatDateTimeForUI(this._notification.Date), this.GetHighlightedText(), this.GetThumb(), this._notification.NotType, userIds.Count, this._showEarlierReplies, null) + 16.0;
            this._userNotTemplate.Tap += ((EventHandler <System.Windows.Input.GestureEventArgs>)((s, e) => this.ProcessNavigationTap()));
        }
Exemplo n.º 29
0
 private void ReadActionButtons()
 {
     ((Collection <ActionButton>) this._actionButtons).Clear();
     if (this._group.PostponedPostsCount > 0)
     {
         ((Collection <ActionButton>) this._actionButtons).Add(new ActionButton(UIStringFormatterHelper.FormatNumberOfSomething(this._group.PostponedPostsCount, CommonResources.PostponedNews_OnePostponedPostFrm, CommonResources.PostponedNews_TwoFourPostponedPostsFrm, CommonResources.PostponedNews_FivePostponedPostsFrm, true, null, false), ActionButtonType.Postponed));
     }
     if (this._group.SuggestedPostsCount > 0)
     {
         ((Collection <ActionButton>) this._actionButtons).Add(new ActionButton(UIStringFormatterHelper.FormatNumberOfSomething(this._group.SuggestedPostsCount, CommonResources.SuggestedNews_OneSuggestedPostFrm, CommonResources.SuggestedNews_TwoFourSuggestedPostsFrm, CommonResources.SuggestedNews_FiveSuggestedPostsFrm, true, null, false), ActionButtonType.Suggested));
     }
     this.NotifyPropertyChanged <Visibility>((() => this.ActionButtonsSeparatorVisibility));
 }
Exemplo n.º 30
0
        private void ConfigureHeaderText(List <User> users, string actionText, string hightlightedText, int totalUsersCount)
        {
            if (users.Count <= 0)
            {
                return;
            }
            Run run1 = new Run();

            run1.Text = (users[0].Name);
            ((PresentationFrameworkCollection <Inline>) this.textBlockHeader.Inlines).Add((Inline)run1);
            if (users.Count >= 2 && totalUsersCount == 2)
            {
                Run        run2       = new Run();
                FontFamily fontFamily = new FontFamily("Segoe WP SemiLight");
                ((TextElement)run2).FontFamily = fontFamily;
                Brush brush = (Brush)Application.Current.Resources["PhoneVKSubtleBrush"];
                ((TextElement)run2).Foreground = brush;
                Run run3 = run2;
                run3.Text = (" " + CommonResources.And + " ");
                ((PresentationFrameworkCollection <Inline>) this.textBlockHeader.Inlines).Add((Inline)run3);
                Run    run4 = new Run();
                string name = users[1].Name;
                run4.Text = name;
                ((PresentationFrameworkCollection <Inline>) this.textBlockHeader.Inlines).Add((Inline)run4);
            }
            else if (totalUsersCount > 2)
            {
                int      number   = totalUsersCount - 1;
                string[] strArray = UIStringFormatterHelper.FormatNumberOfSomething(number, CommonResources.AndOneOtherFrm, CommonResources.AndTwoFourOthersFrm, CommonResources.AndFiveOthersFrm, true, null, false).Split(new string[1]
                {
                    number.ToString()
                }, StringSplitOptions.None);
                Run        run2        = new Run();
                FontFamily fontFamily1 = new FontFamily("Segoe WP SemiLight");
                ((TextElement)run2).FontFamily = fontFamily1;
                Brush brush1 = (Brush)Application.Current.Resources["PhoneVKSubtleBrush"];
                ((TextElement)run2).Foreground = brush1;
                Run run3 = run2;
                run3.Text = (" " + strArray[0].Trim() + " ");
                Run        run4        = new Run();
                FontFamily fontFamily2 = new FontFamily("Segoe WP Semibold");
                ((TextElement)run4).FontFamily = fontFamily2;
                Brush brush2 = (Brush)Application.Current.Resources["PhoneVKSubtleBrush"];
                ((TextElement)run4).Foreground = brush2;
                Run run5 = run4;
                run5.Text = (number.ToString());
                Run        run6        = new Run();
                FontFamily fontFamily3 = new FontFamily("Segoe WP SemiLight");
                ((TextElement)run6).FontFamily = fontFamily3;
                Brush brush3 = (Brush)Application.Current.Resources["PhoneVKSubtleBrush"];
                ((TextElement)run6).Foreground = brush3;
                Run run7 = run6;
                run7.Text = (" " + strArray[1].Trim());
                ((PresentationFrameworkCollection <Inline>) this.textBlockHeader.Inlines).Add((Inline)run3);
                ((PresentationFrameworkCollection <Inline>) this.textBlockHeader.Inlines).Add((Inline)run5);
                ((PresentationFrameworkCollection <Inline>) this.textBlockHeader.Inlines).Add((Inline)run7);
            }
            Run        run8        = new Run();
            FontFamily fontFamily4 = new FontFamily("Segoe WP SemiLight");

            ((TextElement)run8).FontFamily = fontFamily4;
            Brush brush4 = (Brush)Application.Current.Resources["PhoneVKSubtleBrush"];

            ((TextElement)run8).Foreground = brush4;
            Run run9 = run8;

            run9.Text = (" " + actionText);
            ((PresentationFrameworkCollection <Inline>) this.textBlockHeader.Inlines).Add((Inline)run9);
            if (string.IsNullOrEmpty(hightlightedText))
            {
                return;
            }
            Run    run10 = new Run();
            string str   = " " + hightlightedText;

            run10.Text = str;
            ((PresentationFrameworkCollection <Inline>) this.textBlockHeader.Inlines).Add((Inline)run10);
        }