Exemple #1
0
        public static void ShowPhotoIsSavedInSavedPhotos()
        {
            GenericInfoUC genericInfoUc = new GenericInfoUC(3000);

            ((UIElement)genericInfoUc.richTextBox).Visibility   = Visibility.Visible;
            ((UIElement)genericInfoUc.textBlockInfo).Visibility = Visibility.Collapsed;
            RichTextBox richTextBox = genericInfoUc.richTextBox;
            Paragraph   paragraph   = new Paragraph();
            string      text1       = CommonResources.PhotoIsSaved.Replace(".", "") + " ";

            ((PresentationFrameworkCollection <Inline>)paragraph.Inlines).Add((Inline)BrowserNavigationService.GetRunWithStyle(text1, richTextBox));
            Hyperlink hyperlink = HyperlinkHelper.GenerateHyperlink(CommonResources.InTheAlbum, "", (Action <Hyperlink, string>)((hl, str) => Navigator.Current.NavigateToPhotoAlbum(AppGlobalStateManager.Current.LoggedInUserId, false, "SavedPhotos", "", CommonResources.AlbumSavedPictures, 1, "", "", false, 0, false)), ((Control)richTextBox).Foreground, HyperlinkState.Normal);

            ((TextElement)hyperlink).FontSize = (((Control)richTextBox).FontSize);
            ((PresentationFrameworkCollection <Inline>)paragraph.Inlines).Add((Inline)hyperlink);
            ((PresentationFrameworkCollection <Block>)richTextBox.Blocks).Add((Block)paragraph);
            string text2 = "";

            // ISSUE: variable of the null type

            genericInfoUc.ShowAndHideLater(text2, null);
        }
        public void AddComment(List <IOutboundAttachment> attachments, Action <bool> resultCallback, StickerItemData stickerItemData = null, string stickerReferrer = "")
        {
            string str1 = this.ucNewComment.TextBoxNewComment.Text;

            if (this.ReplyAutoForm != null && str1.StartsWith(this.ReplyAutoForm))
            {
                string str2 = this.ReplyAutoForm.Remove(this.ReplyAutoForm.IndexOf(", "));
                string str3 = this._replyToUid > 0L ? "id" : "club";
                long   num  = this._replyToUid > 0L ? this._replyToUid : -this.VM.OwnerId;
                str1 = str1.Remove(0, this.ReplyAutoForm.Length).Insert(0, string.Format("[{0}{1}|{2}], ", str3, num, str2));
            }
            string str4 = str1.Replace("\r\n", "\r").Replace("\r", "\r\n");

            if ((string.IsNullOrWhiteSpace(str4) || str4.Length < 2) && stickerItemData == null)
            {
                if (attachments.Count != 0)
                {
                    List <IOutboundAttachment>       outboundAttachmentList = attachments;
                    Func <IOutboundAttachment, bool> func1 = (Func <IOutboundAttachment, bool>)(a => a.UploadState != OutboundAttachmentUploadState.Completed);
                    if (!Enumerable.Any <IOutboundAttachment>(outboundAttachmentList, (Func <IOutboundAttachment, bool>)func1))
                    {
                        goto label_6;
                    }
                }
                // ISSUE: reference to a compiler-generated field
                resultCallback(false);
                return;
            }
label_6:
            if (str4.Length < 2 && attachments.Count <= 0 && stickerItemData == null)
            {
                return;
            }
            if (this._addingComment)
            {
                // ISSUE: reference to a compiler-generated field
                resultCallback(false);
            }
            else
            {
                this._addingComment = true;
                if (stickerItemData == null)
                {
                    this.ucNewComment.TextBoxNewComment.Text = string.Empty;
                }
                Comment comment1 = new Comment();
                comment1.cid          = 0L;
                comment1.date         = Extensions.DateTimeToUnixTimestamp(DateTime.UtcNow, true);
                comment1.text         = stickerItemData == null ? str4 : "";
                comment1.reply_to_cid = this._replyToCid;
                comment1.reply_to_uid = this._replyToUid;
                comment1.likes        = new Likes()
                {
                    can_like = 0
                };
                List <Attachment> m0List;
                if (stickerItemData != null)
                {
                    m0List = new List <Attachment>()
                    {
                        stickerItemData.CreateAttachment()
                    }
                }
                ;
                else
                {
                    m0List = Enumerable.ToList <Attachment>(Enumerable.Select <IOutboundAttachment, Attachment>(attachments, (Func <IOutboundAttachment, Attachment>)(a => a.GetAttachment())));
                }
                comment1.Attachments = ((List <Attachment>)m0List);
                int num = stickerItemData == null ? 0 : stickerItemData.StickerId;
                comment1.sticker_id = num;
                Comment comment2         = comment1;
                bool    fromGroupChecked = this.ucNewComment.FromGroupChecked;
                comment2.from_id = !fromGroupChecked ? AppGlobalStateManager.Current.LoggedInUserId : this.VM.OwnerId;
                this.VM.AddComment(comment2, attachments.Select <IOutboundAttachment, string>((Func <IOutboundAttachment, string>)(a => a.AttachmentId)).ToList <string>(), fromGroupChecked, (Action <bool, Comment>)((res, createdComment) =>
                {
                    if (res)
                    {
                        Execute.ExecuteOnUIThread((Action)(() =>
                        {
                            CommentItem commentItem = this.CreateCommentItem(createdComment);
                            this._addingComment = false;
                            MyVirtualizingPanel2 virtualizingPanel2 = this.virtPanel;
                            int count = this.virtPanel.VirtualizableItems.Count;
                            List <IVirtualizable> itemsToInsert = new List <IVirtualizable>();
                            itemsToInsert.Add((IVirtualizable)commentItem);
                            //int num = 0;
                            virtualizingPanel2.InsertRemoveItems(count, itemsToInsert, false, null);
                            this._runningCommentsCount = this._runningCommentsCount + 1;
                            this.KeepCommentsCountItemUpToDate();
                            this.ResetReplyFields();
                            resultCallback(true);
                            this.Panel.ScrollToBottom(true);
                        }));
                    }
                    else
                    {
                        Execute.ExecuteOnUIThread((Action)(() =>
                        {
                            GenericInfoUC.ShowBasedOnResult(1, "", null);
                            this._addingComment = false;
                            resultCallback(false);
                        }));
                    }
                }), stickerReferrer);
            }
        }
Exemple #3
0
 public static void ShowPublishResult(GenericInfoUC.PublishedObj publishedObj, long gid = 0, string groupName = "")
 {
     new GenericInfoUC(3000).ShowAndHideLater(GenericInfoUC.GetInfoStr(publishedObj, gid, groupName), null);
 }
Exemple #4
0
 public static void ShowBasedOnResult(int resultCode, string successString = "", VKRequestsDispatcher.Error error = null)
 {
     GenericInfoUC.ShowBasedOnResult((ResultCode)resultCode, successString, error);
 }