Ejemplo n.º 1
0
 private void UpdateCommentsCountItem()
 {
     if (this._commentsCountItem != null)
     {
         if (this._runningCountOfComments != 0)
         {
             this._commentsCountSeparatorUC.Text = this.GetTextForCommentsCount();
         }
         else
         {
             this._panel.RemoveItem((IVirtualizable)this._commentsCountItem);
             this._commentsCountItem = (UCItem)null;
         }
     }
     else
     {
         this._commentsCountItem = this.CreateCommentsCountItem();
         MyVirtualizingPanel2 virtualizingPanel2 = this._panel;
         int index = 2;
         List <IVirtualizable> itemsToInsert = new List <IVirtualizable>();
         itemsToInsert.Add((IVirtualizable)this._commentsCountItem);
         int    num   = 0;
         object local = null;
         virtualizingPanel2.InsertRemoveItems(index, itemsToInsert, num != 0, (IVirtualizable)local);
     }
     SocialDataManager.Instance.UpdateCommentsCount(this._ownerId, this._postId, this._runningCountOfComments);
 }
Ejemplo n.º 2
0
        private double CreateSnippet(double topMargin)
        {
            if (this._link == null)
            {
                return(0.0);
            }
            topMargin += 8.0;
            if (this._isMessage)
            {
                topMargin -= 8.0;
            }
            double num = this._isCommentAttachments ? 0.0 : 8.0;

            if (this._linkItem != null)
            {
                if (this._isMessage)
                {
                    this._linkItem.IsLandscape = this.IsHorizontal;
                }
                else
                {
                    this._linkItem.Margin = new Thickness(num, topMargin, num, 0.0);
                }
            }
            else
            {
                this._linkItem = this.CreateSnippetItem(this._link, topMargin);
                this.VirtualizableChildren.Add((IVirtualizable)this._linkItem);
            }
            return(this._linkItem.FixedHeight);
        }
Ejemplo n.º 3
0
        private double CreateProduct(double topMargin)
        {
            if (this._product == null)
            {
                return(0.0);
            }
            topMargin += this._isMessage ? 0.0 : 8.0;
            double num1 = this._isMessage || this._isCommentAttachments ? 16.0 : 0.0;

            if (this._isMessage)
            {
                if (this._productMessageItem != null)
                {
                    double num2 = num1 - 24.0;
                    this._productMessageItem.Margin      = new Thickness(-num2, topMargin, -num2, 0.0);
                    this._productMessageItem.IsLandscape = this.IsHorizontal;
                }
                else
                {
                    this._productMessageItem = this.CreateSnippetItem(this._product, topMargin);
                    this.VirtualizableChildren.Add((IVirtualizable)this._productMessageItem);
                }
                return(this._productMessageItem.FixedHeight);
            }
            if (this._productItem != null)
            {
                this._productItem.Margin = new Thickness(-num1, topMargin, -num1, 0.0);
            }
            else
            {
                this._productItem = this.CreateSnippetItem(this._product, topMargin);
                this.VirtualizableChildren.Add((IVirtualizable)this._productItem);
            }
            return(this._productItem.FixedHeight);
        }
Ejemplo n.º 4
0
 private double CreatePoll(double topMargin)
 {
     if (this._poll == null)
     {
         return(0.0);
     }
     topMargin += 8.0;
     if (this._pollItem != null)
     {
         this._pollItem.Margin = new Thickness(8.0, topMargin, 8.0, 0.0);
     }
     else
     {
         PollUC tmpUC = new PollUC();
         tmpUC.Initialize(this._poll, 0L);
         this._pollItem = new UCItem(this._verticalWidth - 16.0, new Thickness(8.0, topMargin, 8.0, 0.0), (Func <UserControlVirtualizable>)(() =>
         {
             PollUC pollUc = new PollUC();
             Poll poll     = this._poll;
             long topicId  = 0;
             pollUc.Initialize(poll, topicId);
             return((UserControlVirtualizable)pollUc);
         }), (Func <double>)(() => tmpUC.CalculateTotalHeight()), (Action <UserControlVirtualizable>)null, 0.0, false);
         this.VirtualizableChildren.Add((IVirtualizable)this._pollItem);
     }
     return(this._pollItem.FixedHeight);
 }
Ejemplo n.º 5
0
 private void LoadCommentsFromBuffer()
 {
     Deployment.Current.Dispatcher.BeginInvoke((Action)(() =>
     {
         UCItem ucItem = this._reloadButtonItem;
         this._reloadButtonItem = (UCItem)null;
         int countLoadedOnUi = this.GetCountLoadedOnUI();
         int num1 = 0;
         if (countLoadedOnUi == 0)
         {
             num1 = this._fetchedComments.Count;
         }
         else
         {
             Comment oldestLoaded = this.GetOldestLoadedComment();
             if (oldestLoaded != null)
             {
                 Comment comment = this._fetchedComments.FirstOrDefault <Comment>((Func <Comment, bool>)(c =>
                 {
                     if (c.cid == oldestLoaded.cid)
                     {
                         return(c.from_id == oldestLoaded.from_id);
                     }
                     return(false);
                 }));
                 if (comment != null)
                 {
                     num1 = this._fetchedComments.IndexOf(comment);
                 }
             }
         }
         int num2 = countLoadedOnUi == 0 ? this._countToLoad : this._countToReload;
         List <IVirtualizable> itemsToInsert = new List <IVirtualizable>();
         for (int index = num1 - 1; index >= 0 && num1 - index <= num2; --index)
         {
             CommentItem commentItem = this.CreateCommentItem(this._fetchedComments[index]);
             itemsToInsert.Add((IVirtualizable)commentItem);
         }
         int num3 = countLoadedOnUi + itemsToInsert.Count;
         if (num3 < this._commentsCount)
         {
             UCItem reloadButton = this.CreateReloadButton(Math.Min(this._countToReload, this._commentsCount - num3));
             itemsToInsert.Add((IVirtualizable)reloadButton);
         }
         if (this._commentsCountItem == null)
         {
             this._commentsCountItem = this.CreateCommentsCountItem();
             itemsToInsert.Add((IVirtualizable)this._commentsCountItem);
         }
         itemsToInsert.Reverse(0, itemsToInsert.Count);
         bool keepItemsBelowIndexFixed = true;
         if (this.GetCountLoadedOnUI() == 0)
         {
             keepItemsBelowIndexFixed = false;
         }
         this._panel.InsertRemoveItems(this.GetIndexToInsertItems(), itemsToInsert, keepItemsBelowIndexFixed, (IVirtualizable)ucItem);
         this.CallLoadedCallback();
     }));
 }
Ejemplo n.º 6
0
        private void addItem(string name, FontAwesomeIcon ico, string badges)
        {
            UCItem item = new UCItem(name, ico, badges);

            item.MouseDown += item_MouseDown;
            item.Tag        = ucItems.Count + 1;
            ucItems.Add(item);
            this.menu.Children.Add(item);
        }
Ejemplo n.º 7
0
 private UCItem CreateCommentsCountItem()
 {
     this._commentsCountSeparatorUC = new TextSeparatorUC()
     {
         Text = this.GetTextForCommentsCount()
     };
     this._commentsCountItem = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable)this._commentsCountSeparatorUC), (Func <double>)(() => 56.0), (Action <UserControlVirtualizable>)null, 0.0, false);
     SocialDataManager.Instance.UpdateCommentsCount(this._ownerId, this._postId, this._runningCountOfComments);
     return(this._commentsCountItem);
 }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        private void item_MouseDown(object sender, MouseButtonEventArgs e)
        {
            UCItem item = (UCItem)sender;

            if (this.ucItemSelect != null)
            {
                ucItemSelect.unselect();
            }
            this.ucItemSelect = item;
            this.ucItemSelect.select();

            showUC(item);
        }
Ejemplo n.º 10
0
        private UCItem CreateMapPointSimple(double topMargin)
        {
            double portraitWidth  = this._verticalWidth;
            double landscapeWidth = this._horizontalWidth;

            this._geoItem = new UCItem(portraitWidth, new Thickness(0.0, topMargin, 0.0, 0.0), (Func <UserControlVirtualizable>)(() =>
            {
                MapPointSimpleAttachmentUC simpleAttachmentUc = new MapPointSimpleAttachmentUC();
                Geo geo = this._geo;
                simpleAttachmentUc.Initialize(geo);
                return((UserControlVirtualizable)simpleAttachmentUc);
            }), (Func <double>)(() => MapPointSimpleAttachmentUC.CalculateTotalHeight(this.IsHorizontal ? landscapeWidth : portraitWidth)), null, landscapeWidth, this.IsHorizontal);
            return(this._geoItem);
        }
Ejemplo n.º 11
0
        private UCItem CreateMapPlaceSmall(double topMargin)
        {
            double width          = this._verticalWidth - 16.0;
            double landscapeWidth = this._horizontalWidth - 16.0;

            this._geoItem = new UCItem(width, new Thickness(8.0, topMargin, 8.0, 0.0), (Func <UserControlVirtualizable>)(() =>
            {
                MapPlaceSmallAttachmentUC smallAttachmentUc = new MapPlaceSmallAttachmentUC();
                Geo geo = this._geo;
                smallAttachmentUc.Initialize(geo);
                return((UserControlVirtualizable)smallAttachmentUc);
            }), (Func <double>)(() => 72.0), (Action <UserControlVirtualizable>)null, landscapeWidth, this.IsHorizontal);
            return(this._geoItem);
        }
Ejemplo n.º 12
0
        private UCItem CreateMapPlaceFull(double topMargin)
        {
            double portraitWidth  = this._verticalWidth - 16.0;
            double landscapeWidth = this._horizontalWidth - 16.0;

            this._geoItem = new UCItem(portraitWidth, new Thickness(8.0, topMargin, 8.0, 0.0), (Func <UserControlVirtualizable>)(() =>
            {
                MapPlaceFullAttachmentUC fullAttachmentUc = new MapPlaceFullAttachmentUC();
                Geo geo = this._geo;
                fullAttachmentUc.Initialize(geo);
                return((UserControlVirtualizable)fullAttachmentUc);
            }), (Func <double>)(() => MapPlaceFullAttachmentUC.CalculateTotalHeight(this.IsHorizontal ? landscapeWidth : portraitWidth)), (Action <UserControlVirtualizable>)null, landscapeWidth, this.IsHorizontal);
            return(this._geoItem);
        }
Ejemplo n.º 13
0
 internal void Refresh()
 {
     if (this._loadingInBuffer)
     {
         return;
     }
     this._commentsCount     = -1;
     this._fetchedComments   = new List <Comment>();
     this._user1List         = new List <User>();
     this._user2List         = new List <User>();
     this._commentsCountItem = (UCItem)null;
     this._panel.ClearItems();
     this._wallResponseData = (GetWallPostResponseData)null;
     this.LoadMoreCommentsInUI();
 }
Ejemplo n.º 14
0
        private void ShowHideOverlay(int ind, bool show)
        {
            if (this._isMessage)
            {
                return;
            }
            VirtualizableImage       virtImageByInd       = this.FindVirtImageByInd(ind);
            UCItem                   ucItem               = (virtImageByInd != null ? virtImageByInd.OverlayControl : null) as UCItem;
            UserControlVirtualizable controlVirtualizable = ucItem != null ? ucItem.UC : null;

            if (controlVirtualizable == null)
            {
                return;
            }
            ((UIElement)controlVirtualizable).Opacity = (show ? 1.0 : 0.0);
        }
Ejemplo n.º 15
0
        private UCItem CreateReloadButton(int numberToReload)
        {
            ShowMoreCommentsUC showMoreCommentsUc = new ShowMoreCommentsUC();
            double             num = 54.0;

            showMoreCommentsUc.Height = num;
            Action action = (Action)(() => this.reloadButtonItem_Tap(null, (EventArgs)null));

            showMoreCommentsUc.OnClickAction = action;
            string textFor = this.GetTextFor(numberToReload);

            showMoreCommentsUc.Text  = textFor;
            this._showMoreCommentsUC = showMoreCommentsUc;
            this._reloadButtonItem   = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable)this._showMoreCommentsUC), (Func <double>)(() => 54.0), (Action <UserControlVirtualizable>)null, 0.0, false);
            return(this._reloadButtonItem);
        }
Ejemplo n.º 16
0
        private double CreateProduct(double topMargin)
        {
            if (this._product == null)
            {
                return(0.0);
            }
            topMargin += this._isMessage ? 0.0 : 8.0;
            double num             = this._isMessage || this._isCommentAttachments ? 16.0 : 0.0;
            double width           = this._verticalWidth + num * 2.0;
            double horizontalWidth = this._horizontalWidth + num * 2.0;

            if (this._isMessage)
            {
                if (this._productSmallItem != null)
                {
                    this._productSmallItem.Margin       = new Thickness(-num, topMargin, -num, 0.0);
                    this._productSmallItem.IsHorizontal = this.IsHorizontal;
                }
                else
                {
                    this._productSmallItem = new GenericAttachmentItem(width, new Thickness(-num, topMargin, -num, 0.0), this._attachments.FirstOrDefault <Attachment>((Func <Attachment, bool>)(a => a.market != null)), this._isHorizontal, horizontalWidth, this._hyperlinkId);
                    this.VirtualizableChildren.Add((IVirtualizable)this._productSmallItem);
                }
                return(this._productSmallItem.FixedHeight);
            }
            if (this._productItem != null)
            {
                this._productItem.Margin = new Thickness(-num, topMargin, -num, 0.0);
            }
            else
            {
                Link link = new Link();
                link.title   = this._product.title;
                link.caption = CommonResources.Product;
                link.photo   = new Photo()
                {
                    photo_75 = this._product.thumb_photo
                };
                LinkProduct linkProduct = new LinkProduct(this._product);
                link.product = linkProduct;
                string str = string.Format("http://vk.com/product{0}_{1}", (object)this._product.owner_id, (object)this._product.id);
                link.url          = str;
                this._productItem = this.CreateSnippetItem(link, topMargin);
                this.VirtualizableChildren.Add((IVirtualizable)this._productItem);
            }
            return(this._productItem.FixedHeight);
        }
        private static List <IVirtualizable> CreateVirtualizableItems(IEnumerable <StockItemHeader> stickers)
        {
            List <IVirtualizable> virtualizableList = new List <IVirtualizable>();

            foreach (StockItemHeader sticker1 in stickers)
            {
                UCItem ucItem = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() =>
                {
                    return((UserControlVirtualizable) new StickersPackListItemUC()
                    {
                        DataContext = sticker1
                    });
                }), (Func <double>)(() => 100.0), null, 0.0, false);
                virtualizableList.Add((IVirtualizable)ucItem);
            }
            return(virtualizableList);
        }
Ejemplo n.º 18
0
 private void MoreCommentsAreLoaded(bool result)
 {
     if (!result)
     {
         return;
     }
     Execute.ExecuteOnUIThread((Action)(() =>
     {
         UCItem moreCommentsItem = this._loadMoreCommentsItem;
         IVirtualizable virtualizable = (IVirtualizable)Enumerable.FirstOrDefault <IVirtualizable>(this.virtPanel.VirtualizableItems, (Func <IVirtualizable, bool>)(i => i is CommentItem));
         if (virtualizable == null)
         {
             return;
         }
         this.virtPanel.InsertRemoveItems(this.virtPanel.VirtualizableItems.IndexOf(virtualizable), this.GenereateVirtualizableItemsToAdd(), true, (IVirtualizable)moreCommentsItem);
     }));
 }
Ejemplo n.º 19
0
        void ucItem_Click(object sender, EventArgs e)
        {
            UCItem          ucItem      = (UCItem)sender;
            ProductionModel dataProduct = (ProductionModel)ucItem.Tag;

            flag = 3;
            foreach (Control ctr in flpMenuList.Controls)
            {
                if (ctr.BackColor == Color.FromArgb(0, 153, 51))
                {
                    ctr.BackColor = Color.FromArgb(255, 255, 255);
                    ctr.ForeColor = Color.FromArgb(51, 51, 51);
                }
            }
            ucItem.BackColor = Color.FromArgb(0, 153, 51);
            ucItem.ForeColor = Color.FromArgb(255, 255, 255);
            addItemListDetail(dataProduct);
        }
Ejemplo n.º 20
0
        private void addItemList(string lblName, int i, int CurrentPage)
        {
            if (btnAdd.Visible == false)
            {
                btnAdd.Visible = true;
            }
            txtSearch.Visible = true;
            txtSearch.Tag     = i;
            btnAdd.Tag        = i;
            btBack.Tag        = i;
            btNext.Tag        = i;
            ResizeToOthder();
            int index = 1;

            //string[] str = { "Ice coffee", "VNam Coffee", "Mocha", "Latte", "White Coffee", "Green Tea", "Apple Juice" };
            if (this.TotalPage == 0)
            {
                this.TotalPage = ProductService.GetTotalProducts();
            }
            var dataProduct = ProductService.GetProductsList(CurrentPage);

            if (i == 3)
            {
                flpMenuList.Controls.Clear();
                txtNameMenuList.lblMenuListName.Text = lblName;
                txtNameMenuList.BackColor            = Color.FromArgb(0, 102, 204);
                txtNameMenuList.ForeColor            = Color.FromArgb(255, 255, 255);
                foreach (var data in dataProduct)
                {
                    UCItem ucItem = new UCItem();
                    ucItem.lblItem.Text = data.ProductNameDesc;
                    ucItem.Tag          = data;
                    ucItem.Width        = flpMenuList.Width;
                    ucItem.Click       += ucItem_Click;
                    flpMenuList.Controls.Add(ucItem);
                    index++;
                }
            }
            else
            {
                flpMenuList.Controls.Clear();
                pnDetail.Controls.Clear();
            }
        }
Ejemplo n.º 21
0
 private double CreateMap(double topMargin, bool showMap)
 {
     if (this._geo == null)
     {
         return(0.0);
     }
     topMargin += 8.0;
     if (this._geoItem != null)
     {
         this._geoItem.IsLandscape = this.IsHorizontal;
         this._geoItem.Margin      = new Thickness(0.0, topMargin, 0.0, 0.0);
     }
     else
     {
         this._geoItem = !this._isMessage ? (!(this._geo.type == "place") ? (showMap ? this.CreateMapPointFull(topMargin) : this.CreateMapPointSmall(topMargin)) : (showMap ? this.CreateMapPlaceFull(topMargin) : this.CreateMapPlaceSmall(topMargin))) : this.CreateMapPointSimple(topMargin);
         this.VirtualizableChildren.Add((IVirtualizable)this._geoItem);
     }
     return(this._geoItem.FixedHeight);
 }
Ejemplo n.º 22
0
        private UCItem CreateReloadButton(int numberToReload)
        {
            ShowMoreCommentsUC showMoreCommentsUc = new ShowMoreCommentsUC();
            double             num = 54.0;

            ((FrameworkElement)showMoreCommentsUc).Height = num;
            Action action = (Action)(() => this.reloadButtonItem_Tap(null, null));

            showMoreCommentsUc.OnClickAction = action;
            string textFor = this.GetTextFor(numberToReload);

            showMoreCommentsUc.Text  = textFor;
            this._showMoreCommentsUC = showMoreCommentsUc;
            // 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
            this._reloadButtonItem = new UCItem(480.0, new Thickness(), (Func <UserControlVirtualizable>)(() => (UserControlVirtualizable)this._showMoreCommentsUC), (Func <double>)(() => 54.0), (Action <UserControlVirtualizable>)null, 0.0, false);
            return(this._reloadButtonItem);
        }
Ejemplo n.º 23
0
        private double CreateMoneyTransfer(double topMargin)
        {
            if (this._moneyTransfer == null)
            {
                return(0.0);
            }
            double num1 = 16.0;

            if (this._moneyTransferItem != null)
            {
                double num2 = num1 - 24.0;
                this._moneyTransferItem.Margin      = new Thickness(-num2, topMargin, -num2, 0.0);
                this._moneyTransferItem.IsLandscape = this.IsHorizontal;
            }
            else
            {
                this._moneyTransferItem = this.CreateSnippetItem(this._moneyTransfer, topMargin);
                this.VirtualizableChildren.Add((IVirtualizable)this._moneyTransferItem);
            }
            return(this._moneyTransferItem.FixedHeight);
        }
Ejemplo n.º 24
0
 private void showUC(UCItem item)
 {
     contentPanel.Children.Clear();
     if ((int)item.Tag == 1)
     {
         contentPanel.Children.Add(new ListFacturas(this.TaskbarItemInfo));
     }
     if ((int)item.Tag == 2)
     {
         MessageBox.Show("No implementado");
     }
     if ((int)item.Tag == 3)
     {
         MessageBox.Show("No implementado");
     }
     if ((int)item.Tag == 4)
     {
         contentPanel.Children.Add(new ListCustomers(this.TaskbarItemInfo));
     }
     if ((int)item.Tag == 5)
     {
         contentPanel.Children.Add(new ListItems(this.TaskbarItemInfo));
     }
 }
Ejemplo n.º 25
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);
        }
Ejemplo n.º 26
0
        private void CreateVirtualizableChildren()
        {
            double num = this._isNotificationComment ? 0.0 : 16.0;

            // ISSUE: method pointer
            this._textBlockName = new TextItem(this.Width, new Thickness(74.0, num - 6.0, 0.0, 0.0), this.Name, false, 25.333, "Segoe WP", 0.0, Application.Current.Resources["PhoneNameBlueBrush"] as SolidColorBrush, true, new Action(this.NavigateToSource));
            base.VirtualizableChildren.Add((IVirtualizable)this._textBlockName);
            this._textWidth = this.Width - 74.0;
            if (!string.IsNullOrEmpty(this._comment.text))
            {
                NewsTextItem newsTextItem = new NewsTextItem(this._textWidth, new Thickness(74.0, 28.0 + num, 0.0, 0.0), this._comment.text ?? "", this._preview, null, 0.0, null, 28.0, null, false, 0.0, (HorizontalAlignment)0, "", (TextAlignment)1, false, null, false, false);
                base.VirtualizableChildren.Add((IVirtualizable)newsTextItem);
                Thickness margin = newsTextItem.Margin;
                // ISSUE: explicit reference operation
                this._topMarginDate = ((Thickness)@margin).Top + newsTextItem.FixedHeight + 4.0;
            }
            else
            {
                this._topMarginDate = 28.0 + num;
            }
            if (!((IList)this._comment.Attachments).IsNullOrEmpty())
            {
                string          itemId          = (this._comment.from_id != 0L && this._comment.id > 0L) ? string.Format("{0}_{1}", this._comment.from_id, this._comment.id) : "";
                AttachmentsItem attachmentsItem = new AttachmentsItem(this._textWidth, new Thickness(73.0, this._topMarginDate, 0.0, 0.0), this._comment.Attachments, null, itemId, false, true, false, false, 0.0, false, false, "", null, null, false);
                base.VirtualizableChildren.Add(attachmentsItem);
                this._topMarginDate += attachmentsItem.FixedHeight + 12.0;
            }
            if (!this._isNotificationComment && !this._preview)
            {
                double    arg_2F6_0 = 40.0;
                Thickness arg_2F6_1 = new Thickness(base.Width - 32.0, 5.0, 0.0, 0.0);
                Func <UserControlVirtualizable> arg_2F6_2 = delegate
                {
                    Rectangle expr_05 = new Rectangle();
                    expr_05.Fill = ((SolidColorBrush)Application.Current.Resources["PhoneNewsBackgroundBrush"]);
                    expr_05.HorizontalAlignment = HorizontalAlignment.Right;
                    expr_05.VerticalAlignment   = (0);
                    expr_05.Margin = (new Thickness(-8.0, -4.0, -8.0, -4.0));
                    expr_05.Height = (48.0);
                    expr_05.Width  = (56.0);
                    Rectangle rectangle = expr_05;
                    VKClient.Common.UC.MoreActionsUC expr_85 = new VKClient.Common.UC.MoreActionsUC();
                    expr_85.LayoutRoot.Children.Insert(0, rectangle);
                    expr_85.TapCallback = new Action(this._onMoreOptionsTap);
                    return(expr_85);
                };
                Func <double> arg_2F6_3 = new Func <double>(() => { return(40.0); });

                UCItem uCItem = new UCItem(arg_2F6_0, arg_2F6_1, arg_2F6_2, arg_2F6_3, null, 0.0, false);
                base.VirtualizableChildren.Add(uCItem);
            }
            this._textTimeItem = new TextItem(this._textWidth - 136.0, new Thickness(73.0, this._topMarginDate, 0.0, 0.0), this.DateText, true, 20.0, "Segoe WP", VKConstants.LineHeight, Application.Current.Resources["PhoneVKSubtleBrush"] as SolidColorBrush, true, null);
            base.VirtualizableChildren.Add((IVirtualizable)this._textTimeItem);
            Thickness textMargin = this._textTimeItem.TextMargin;

            // ISSUE: explicit reference operation
            this._height = ((Thickness)@textMargin).Top + this._textTimeItem.FixedHeight;
            if (!string.IsNullOrEmpty(this._highlightedText))
            {
                TextItem textItem = new TextItem(this.Width - 72.0, new Thickness(72.0, this._height, 0.0, 0.0), this._highlightedText, false, 20.0, "Segoe WP", 23.0, Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush, true, null);
                base.VirtualizableChildren.Add((IVirtualizable)textItem);
                this._height = this._height + textItem.FixedHeight;
            }
            if (!string.IsNullOrEmpty(this._thumbSrc))
            {
                base.VirtualizableChildren.Add((IVirtualizable) new VirtualizableImage(80.0, 80.0, new Thickness(77.0, this._height + 6.0, 0.0, 0.0), this._thumbSrc, new Action <VirtualizableImage>(this.OnThumbTap), "", true, true, (Stretch)3, null, -1.0, false, false));
                this._height = this._height + 86.0;
            }
            base.VirtualizableChildren.Add((IVirtualizable) new VirtualizableImage(62.0, 62.0, new Thickness(0.0, num, 0.0, 0.0), this.ImageSrc, new Action <VirtualizableImage>(this.AvaTap), "", true, true, (Stretch)3, null, -1.0, false, true));
        }
Ejemplo n.º 27
0
        private void listViewIds_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewIds.SelectedItems.Count <= 0)
            {
                return;
            }

            panelEditZone.Controls.Clear();

            if (lastSelected != null)
            {
                lastSelected.BackColor = System.Drawing.SystemColors.Window;
            }
            listViewIds.SelectedItems[0].BackColor = Color.Gold;
            lastSelected = listViewIds.SelectedItems[0];

            IniFile configData = new IniFile(String.Format("config/db/{0}.ini", packName));

            String[] data = listViewIds.SelectedItems[0].Text.Split('.');
            selectId = int.Parse(data[0]);

            int index = 0;
            int row   = 0;
            int col   = 0;

            foreach (BiData bikey in pack.data.Keys)
            {
                if (bikey.a != selectId)
                {
                    continue;
                }

                index = 0;
                int   wid      = panelEditZone.Width / 2;
                Point offside  = new Point(8, 20);
                Font  fontsong = new Font("宋体", 10, FontStyle.Regular);
                foreach (String head in pack.header)
                {
                    int indx = pack.GetPackIndexByName(head);
                    if (indx == 0)
                    {
                        continue;
                    }

                    #region 构建控件
                    Label lbl = new Label();
                    lbl.Location = new Point(col * wid + offside.X, row * 30 + offside.Y);
                    lbl.Text     = head;
                    lbl.AutoSize = true;
                    lbl.Font     = fontsong;
                    lbl.Name     = "lbl" + head;
                    panelEditZone.Controls.Add(lbl);

                    Label lbl2 = new Label();
                    lbl2.ForeColor = Color.DarkBlue;
                    lbl2.Location  = new Point(lbl.Location.X + lbl.Width + 5, row * 30 + 3 + offside.Y);
                    lbl2.Text      = pack.comment[indx];
                    int wordscap = (165 - lbl.Width) / 16;
                    if (lbl2.Text.Length > wordscap)
                    {
                        if (wordscap <= 0)
                        {
                            lbl2.Text = "";
                        }
                        else
                        {
                            lbl2.Text = String.Format("{0}...", lbl2.Text.Substring(0, wordscap - 1));
                        }
                    }
                    lbl2.AutoSize = true;
                    panelEditZone.Controls.Add(lbl2);

                    string enums     = configData.IniReadValue(head, "enums");
                    string bind      = configData.IniReadValue(head, "bind");
                    string groupitem = configData.IniReadValue(head, "groupitem");
                    string itemgroup = configData.IniReadValue(head, "itemgroup");
                    string attrcheck = configData.IniReadValue(head, "attrcheck");
                    string hide      = configData.IniReadValue(head, "hide");
                    string timehour  = configData.IniReadValue(head, "timehour");
                    string wisebox   = configData.IniReadValue(head, "wisebox");

                    Control c;
                    if (enums != "") //combox
                    {
                        c = new UCComboBox();
                        (c as UCComboBox).Info = enums;
                    }
                    else if (bind != "") //boxlabel
                    {
                        c = new UCBoxLabel();
                        (c as UCBoxLabel).TableName = bind;
                    }
                    else if (groupitem != "") //combox
                    {
                        c = new UCGroupItem();
                    }
                    else if (attrcheck != "")
                    {
                        c = new UCAttrBox();
                    }
                    else if (itemgroup != "")
                    {
                        c = new UCItem();
                        int indx2 = pack.GetPackIndexByName(itemgroup);
                        (c as UCItem).Type = int.Parse(pack.data[bikey][indx2]);
                    }
                    else if (timehour != "")
                    {
                        c = new UCTimeHour();
                    }
                    else if (wisebox != "")
                    {
                        c = new UCWiseBoxLabel();
                    }
                    else if (hide != "")
                    {
                        row++;
                        col          = 0;
                        lbl.Visible  = false;
                        lbl2.Visible = false;
                        continue;
                    }
                    else //textbox
                    {
                        c = new UCTextBox();
                        if (pack.datatype[indx] == "char")
                        {
                            (c as UCTextBox).TextSize = pack.datasize[indx];
                        }
                    }
                    c.Enabled  = (indx > 1 && (packName != "group_drop" || bikey.a != bikey.b));
                    c.Name     = String.Format("{0}-{1}", head, bikey.b);
                    c.Location = new Point(col * wid + 170 + offside.X, row * 30 + offside.Y);
                    if (c.Height > 30)
                    {
                        row += c.Height / 30;
                        col  = 0;
                    }
                    panelEditZone.Controls.Add(c);
                    #endregion

                    setControlValue(c as IAutoControl, pack.data[bikey][indx]);

                    index++;
                    if (index == 1)
                    {
                        row++;
                        col = 0;
                    }
                    else if (indx < pack.datatype.Count && col == 0 && (pack.datatype[indx] != "char" || pack.datasize[indx] <= 8) && (indx > pack.datatype.Count - 2 || pack.datatype[indx + 1] != "char" || pack.datasize[indx + 1] <= 8))
                    {
                        col++;
                    }
                    else
                    {
                        row++;
                        col = 0;
                    }
                }

                row += 2;
                col  = 0;
                fontsong.Dispose();
            }

            Button tb = new Button();
            tb.Text     = "新建";
            tb.Location = new Point(30, row * 30);
            tb.Click   += buttonAdd_Click;
            panelEditZone.Controls.Add(tb);

            tb          = new Button();
            tb.Text     = "删除";
            tb.Location = new Point(130, row * 30);
            tb.Click   += buttonDelete_Click;
            panelEditZone.Controls.Add(tb);

            tb          = new Button();
            tb.Text     = "保存";
            tb.Location = new Point(230, row * 30);
            tb.Click   += buttonEdit_Click;
            panelEditZone.Controls.Add(tb);

            tb          = new Button();
            tb.Text     = "导出";
            tb.Location = new Point(330, row * 30);
            tb.Click   += buttonExport_Click;
            panelEditZone.Controls.Add(tb);

            tb          = new Button();
            tb.Text     = "导入";
            tb.Location = new Point(430, row * 30);
            tb.Click   += buttonImport_Click;
            panelEditZone.Controls.Add(tb);

            tb          = new Button();
            tb.Text     = "追加导入";
            tb.Location = new Point(530, row * 30);
            tb.Click   += buttonImportAppend_Click;
            panelEditZone.Controls.Add(tb);

            row += 2;

            panelEditZone.Height = (row + 2) * 30;

            searchBase = listViewIds.SelectedIndices[0];
        }
Ejemplo n.º 28
0
        private void GenerateLayoutForWallPost()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            Thickness margin = new Thickness();
            Action    action = null;

            if (this._preview)
            {
                action = new Action(this.OnMoreOptionsTap);
            }
            if (this._originalHeaderItem == null)
            {
                this._originalHeaderItem = new UserOrGroupHeaderItem(this.Width, new Thickness(), this.IsGroupPost, this._wallPost.date, this._fromUser, this._fromGroup, this.ExtraText, this.IconType, this.PostSourcePlatform, this._isFeedbackItem ? null : action, new Action(this.onNavigatedToUserOrGroup), this.ExtraTextEnd);
                this.VirtualizableChildren.Add((IVirtualizable)this._originalHeaderItem);
            }
            this._originalHeaderItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
            margin.Top += this._originalHeaderItem.FixedHeight + 8.0;
            if (!string.IsNullOrEmpty(this._wallPost.text))
            {
                if (this._originalTextItem == null)
                {
                    this._originalTextItem = new NewsTextItem(this.Width - 32.0, new Thickness(16.0, 0.0, 16.0, 0.0), this._wallPost.text, this._preview, (Action)(() => this.NavigateToWallPostWithComments(false)), 21.3, new FontFamily("Segoe WP"), 28.0, (Brush)null, false, 0.0, HorizontalAlignment.Left, this._wallPost.PostId, TextAlignment.Left, true);
                    this.VirtualizableChildren.Add((IVirtualizable)this._originalTextItem);
                }
                this._originalTextItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                margin.Top += this._originalTextItem.FixedHeight + 8.0;
            }
            this.CanShowLikesSeparator = true;
            if ((!this._wallPost.attachments.IsNullOrEmpty() ? 1 : (this._wallPost.geo != null ? 1 : 0)) != 0)
            {
                if (this._originalAttachmentsItem == null)
                {
                    this._originalAttachmentsItem = new AttachmentsItem(this.Width, new Thickness(), this._wallPost.attachments, this._wallPost.geo, this._wallPost.from_id == 0L || this._wallPost.id <= 0L ? "" : string.Format("{0}_{1}", (object)this._wallPost.from_id, (object)this._wallPost.id), this._wallPost.friends_only == 1, false, false, false, 0.0, false, !this._preview, this._wallPost.PostId);
                    this.VirtualizableChildren.Add((IVirtualizable)this._originalAttachmentsItem);
                }
                this._originalAttachmentsItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                margin.Top += this._originalAttachmentsItem.FixedHeight;
                this.CanShowLikesSeparator = !this._originalAttachmentsItem.IsLastAttachmentMedia;
            }
            if (this._wallPost.signer_id != 0L)
            {
                margin.Top += 8.0;
                if (this._originalSignerItem == null)
                {
                    this._originalSignerItem = new LinkToUserOrGroupItem(this.Width, new Thickness(), new long?(this._wallPost.signer_id), this._users, this._groups, null);
                    this.VirtualizableChildren.Add((IVirtualizable)this._originalSignerItem);
                }
                this._originalSignerItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                margin.Top += this._originalSignerItem.FixedHeight;
                this.CanShowLikesSeparator = true;
            }
            if (!this._wallPost.copy_history.IsNullOrEmpty())
            {
                int index = 0;
                foreach (WallPost wallPost in this._wallPost.copy_history)
                {
                    int currentInd = index;
                    WallPostItem.WallPostHistoryVirtItems historyVirtItems = this._historyVirtItemsDict.ContainsKey(currentInd) ? this._historyVirtItemsDict[currentInd] : new WallPostItem.WallPostHistoryVirtItems();
                    bool   isMale;
                    string pic;
                    string name;
                    this.GetNamePicAndSex(wallPost.from_id, out name, out pic, out isMale);
                    int                num1               = WallPostItem.GetIsProfilePhoto(wallPost.attachments, wallPost.post_source) ? 1 : 0;
                    bool               flag               = wallPost.owner_id < 0L;
                    int                num2               = wallPost.IsRepost() ? 1 : 0;
                    int                num3               = isMale ? 1 : 0;
                    int                num4               = flag ? 1 : 0;
                    string             extraText          = WallPostItem.GetExtraText(num1 != 0, num2 != 0, num3 != 0, num4 != 0);
                    string             extraTextEnd       = WallPostItem.GetExtraTextEnd(wallPost.IsReply);
                    PostSource         postSource         = wallPost.post_source;
                    PostSourcePlatform postSourcePlatform = (PostSourcePlatform)(postSource != null ? (int)postSource.GetPlatform() : 0);
                    string             subtitle           = "";
                    if (!string.IsNullOrEmpty(extraText))
                    {
                        subtitle = extraText.ToLowerInvariant();
                    }
                    else if (wallPost.date != 0)
                    {
                        subtitle = UIStringFormatterHelper.FormatDateTimeForUI(VKClient.Common.Utils.Extensions.UnixTimeStampToDateTime((double)wallPost.date, true));
                    }
                    if (!string.IsNullOrEmpty(extraTextEnd))
                    {
                        subtitle += string.Format(" {0}", (object)extraTextEnd);
                    }
                    margin.Top += 8.0;
                    if (historyVirtItems.HeaderItem == null)
                    {
                        historyVirtItems.HeaderItem = new UCItem(this.Width, new Thickness(), (Func <UserControlVirtualizable>)(() =>
                        {
                            RepostHeaderUC repostHeaderUc = new RepostHeaderUC();
                            this._wallRepostInfo          = new WallRepostInfo()
                            {
                                Pic                = pic,
                                Name               = name,
                                Subtitle           = subtitle,
                                PostSourcePlatform = postSourcePlatform,
                                Width              = this.Width - 16.0
                            };
                            WallRepostInfo configuration = this._wallRepostInfo;
                            repostHeaderUc.Configure(configuration, (Action)(() => this.LinkToUserOrGroupTap(currentInd)));
                            return((UserControlVirtualizable)repostHeaderUc);
                        }), (Func <double>)(() => 56.0), (Action <UserControlVirtualizable>)null, 0.0, false);
                        this.VirtualizableChildren.Add((IVirtualizable)historyVirtItems.HeaderItem);
                    }
                    historyVirtItems.HeaderItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                    margin.Top += historyVirtItems.HeaderItem.FixedHeight + 8.0;
                    if (!string.IsNullOrWhiteSpace(wallPost.text))
                    {
                        if (historyVirtItems.TextItem == null)
                        {
                            historyVirtItems.TextItem = new NewsTextItem(this.Width - 32.0, new Thickness(16.0, 0.0, 16.0, 0.0), wallPost.text, this._preview, (Action)(() => this.NavigateToWallPostWithComments(false)), 21.3, new FontFamily("Segoe WP"), 28.0, (Brush)null, false, 0.0, HorizontalAlignment.Left, wallPost.PostId, TextAlignment.Left, true);
                            this.VirtualizableChildren.Add((IVirtualizable)historyVirtItems.TextItem);
                        }
                        historyVirtItems.TextItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                        margin.Top += historyVirtItems.TextItem.FixedHeight + 8.0;
                    }
                    if ((!wallPost.attachments.IsNullOrEmpty() ? 1 : (wallPost.geo != null ? 1 : 0)) != 0)
                    {
                        if (historyVirtItems.AttachmentsItem == null)
                        {
                            string itemId = wallPost.from_id == 0L || wallPost.id <= 0L ? "" : string.Format("{0}_{1}", (object)wallPost.from_id, (object)wallPost.id);
                            historyVirtItems.AttachmentsItem = new AttachmentsItem(this.Width, new Thickness(), wallPost.attachments, wallPost.geo, itemId, wallPost.friends_only == 1, false, false, false, 0.0, false, !this._preview, wallPost.PostId);
                            this.VirtualizableChildren.Add((IVirtualizable)historyVirtItems.AttachmentsItem);
                        }
                        historyVirtItems.AttachmentsItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                        margin.Top += historyVirtItems.AttachmentsItem.FixedHeight;
                        this.CanShowLikesSeparator = !historyVirtItems.AttachmentsItem.IsLastAttachmentMedia;
                    }
                    if (wallPost.signer_id != 0L)
                    {
                        margin.Top += 8.0;
                        if (historyVirtItems.SignerItem == null)
                        {
                            historyVirtItems.SignerItem = new LinkToUserOrGroupItem(this.Width, new Thickness(), new long?(wallPost.signer_id), this._users, this._groups, null);
                            this.VirtualizableChildren.Add((IVirtualizable)historyVirtItems.SignerItem);
                        }
                        historyVirtItems.SignerItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                        margin.Top += historyVirtItems.SignerItem.FixedHeight;
                        this.CanShowLikesSeparator = true;
                    }
                    this._historyVirtItemsDict[index] = historyVirtItems;
                    ++index;
                }
            }
            if (this._preview)
            {
                bool isReply = this._wallPost.IsReply;
                if (!this.IsSuggestedPostponed && !this._isFeedbackItem && !isReply)
                {
                    if (this.CanShowLikesSeparator)
                    {
                        margin.Top += 8.0;
                    }
                    margin.Top = Math.Round(margin.Top);
                    if (this.LikesAndCommentsItem == null)
                    {
                        this.LikesAndCommentsItem = new LikesAndCommentsItem(this.Width, new Thickness(), this._wallPost, (Action)(() => this.NavigateToWallPostWithComments(true)), this._suppressRepostButton, this.CanShowLikesSeparator);
                        this.VirtualizableChildren.Add((IVirtualizable)this.LikesAndCommentsItem);
                    }
                    this.LikesAndCommentsItem.ViewMargin = new Thickness(0.0, margin.Top, 0.0, 0.0);
                    margin.Top += this.LikesAndCommentsItem.FixedHeight;
                }
                else if (isReply)
                {
                    margin.Top += 8.0;
                }
            }
            else
            {
                margin.Top += 8.0;
            }
            if (this._preview && this.IsSuggested && this._wallPost.can_publish == 1)
            {
                margin.Top += 8.0;
                if (this._publishRejectItem == null)
                {
                    this._publishRejectItem = new UCItem(this.Width, margin, (Func <UserControlVirtualizable>)(() =>
                    {
                        PublicRejectUC publicRejectUc     = new PublicRejectUC();
                        publicRejectUc.buttonPublish.Tap += new EventHandler <System.Windows.Input.GestureEventArgs>(this.buttonPublish_Tap);
                        publicRejectUc.buttonDelete.Tap  += new EventHandler <System.Windows.Input.GestureEventArgs>(this.buttonDelete_Tap);
                        return((UserControlVirtualizable)publicRejectUc);
                    }), (Func <double>)(() => 60.0), (Action <UserControlVirtualizable>)null, 0.0, false);
                    this.VirtualizableChildren.Add((IVirtualizable)this._publishRejectItem);
                }
                margin.Top += this._publishRejectItem.FixedHeight;
            }
            this._height = margin.Top;
            if (this._preview && this._showDivideLine)
            {
                this._height = this._height + this.DividerHeight;
            }
            stopwatch.Stop();
        }
Ejemplo n.º 29
0
        private void ucTextBoxKeyBoard1_TextChanged(object sender, EventArgs e)
        {
            TextBox addNew     = (TextBox)sender;
            int     tag        = Convert.ToInt32(addNew.Tag);
            string  textSearch = txtSearch.Text;

            switch (tag)
            {
            case 1:
                UCMenu ucMenu = new UCMenu();
                ucMenu.Dock           = DockStyle.Fill;
                ucMenu.btnSave.Click += ucMenuList_btnSave_Click;
                ucMenu.btnRemove.Hide();
                pnDetail.Controls.Add(ucMenu);
                break;

            case 2:
                btnAdd.Tag = tag;
                int index_group = 1;
                // string[] str = { "COM", "PHO", "HU TIEU", "CHAO", "Coffee", "Tea", "Smoothie" };
                if (tag == 2)
                {
                    var dataCategory = CatalogeService.searchProduct(textSearch, 2).ToList();
                    flpMenuList.Controls.Clear();
                    //txtNameMenuList.Visible = true;
                    txtNameMenuList.lblMenuListName.Text = "Group List";
                    txtNameMenuList.BackColor            = Color.FromArgb(0, 102, 204);
                    txtNameMenuList.ForeColor            = Color.FromArgb(255, 255, 255);
                    foreach (var item in dataCategory)
                    {
                        UCGroupListItem ucGroupListItem = new UCGroupListItem();
                        ucGroupListItem.lblGroupListItemName.Text = item.CategoryName;
                        ucGroupListItem.Tag    = item;
                        ucGroupListItem.Click += ucGroupListItem_Click;
                        flpMenuList.Controls.Add(ucGroupListItem);
                        index_group++;
                    }
                }
                break;

            case 3:
                btnAdd.Tag = tag;
                ResizeToOthder();
                int index_item = 1;
                //string[] str = { "Ice coffee", "VNam Coffee", "Mocha", "Latte", "White Coffee", "Green Tea", "Apple Juice" };
                var dataProduct = ProductService.searchProduct(textSearch, 3).ToList();
                if (tag == 3)
                {
                    flpMenuList.Controls.Clear();
                    txtNameMenuList.lblMenuListName.Text = "ItemList";
                    txtNameMenuList.BackColor            = Color.FromArgb(0, 102, 204);
                    txtNameMenuList.ForeColor            = Color.FromArgb(255, 255, 255);
                    foreach (var data in dataProduct)
                    {
                        UCItem ucItem = new UCItem();
                        ucItem.lblItem.Text = data.ProductNameDesc;
                        ucItem.Tag          = data;
                        ucItem.Click       += ucItem_Click;
                        flpMenuList.Controls.Add(ucItem);
                        index_item++;
                    }
                }
                else
                {
                    flpMenuList.Controls.Clear();
                    pnDetail.Controls.Clear();
                }
                break;

            case 4:
                btnAdd.Tag = tag;
                ResizeToOthder();
                int index_modifier = 1;
                //string[] str = { "No Sugar", "More Sugar", "More Ice", "Less Ice", "More Milk", "Them Bun", "Them Thit" };
                var dataModifire = ModifireService.searchProduct(textSearch, 4).ToList();
                if (tag == 4)
                {
                    flpMenuList.Controls.Clear();
                    //txtNameMenuList.Visible = true;
                    txtNameMenuList.lblMenuListName.Text = "Modifier List";
                    txtNameMenuList.BackColor            = Color.FromArgb(0, 102, 204);
                    txtNameMenuList.ForeColor            = Color.FromArgb(255, 255, 255);
                    foreach (var data in dataModifire)
                    {
                        UCModifierItem ucModifierItem = new UCModifierItem();
                        ucModifierItem.lblModifierItemName.Text = data.ModifireName;
                        ucModifierItem.Tag    = data;
                        ucModifierItem.Click += ucModifierItem_Click;
                        flpMenuList.Controls.Add(ucModifierItem);
                        index_modifier++;
                    }
                }
                else
                {
                    flpMenuList.Controls.Clear();
                    pnDetail.Controls.Clear();
                }
                break;

            case 5:
                break;
            }
        }
Ejemplo n.º 30
0
        private double CreateImageDocs(double topMargin)
        {
            if (this._docImageAttachments.Count == 0)
            {
                return(0.0);
            }
            double top  = topMargin + 8.0;
            int    num  = 0;
            double left = this._isMessage || this._isCommentAttachments ? -16.0 : 0.0;

            if (this._docImageItemsList != null)
            {
                foreach (UCItem docImageItems in this._docImageItemsList)
                {
                    docImageItems.Margin = new Thickness(left, top, 0.0, 0.0);
                    top += docImageItems.FixedHeight;
                    ++num;
                }
            }
            else
            {
                this._docImageItemsList = new List <UCItem>();
                List <IEnumerable <Attachment> > list1 = this._docImageAttachments.Partition <Attachment>(this._isMessage || this._isCommentAttachments ? 1 : 2).ToList <IEnumerable <Attachment> >();
                for (int index = 0; index < list1.Count; ++index)
                {
                    List <Attachment> list2 = list1[index].ToList <Attachment>();
                    Doc doc1 = list2[0].doc;
                    Doc doc2 = (Doc)null;
                    if (list2.Count > 1)
                    {
                        doc2 = list2[1].doc;
                    }
                    UCItem ucItem = new UCItem(this._verticalWidth - left, new Thickness(left, top, 0.0, 0.0), (Func <UserControlVirtualizable>)(() =>
                    {
                        DocImageAttachmentUC imageAttachmentUc = new DocImageAttachmentUC();
                        List <Attachment> attachments          = this._attachments;
                        //Doc doc1 = doc1;
                        //Doc doc2 = doc2;
                        imageAttachmentUc.Initialize(attachments, doc1, doc2);
                        return((UserControlVirtualizable)imageAttachmentUc);
                    }), (Func <double>)(() => 152.0), (Action <UserControlVirtualizable>)null, 0.0, false);
                    if (this._isCommentAttachments)
                    {
                        CurrentMediaSource.GifPlaySource = StatisticsActionSource.comments;
                    }
                    else if (this._isMessage)
                    {
                        CurrentMediaSource.GifPlaySource = StatisticsActionSource.messages;
                    }
                    this.VirtualizableChildren.Add((IVirtualizable)ucItem);
                    this._docImageItemsList.Add(ucItem);
                    top += ucItem.FixedHeight;
                    ++num;
                }
            }
            if (num <= 0)
            {
                return(0.0);
            }
            return(top - topMargin - 8.0);
        }