Пример #1
0
        private void ReFreshPostCard(PostCard postCard)
        {
            progressValue.Caption              = PostCard.CountProcessed.ToString();
            progressMax.Caption                = PostCard.CountPreProcessed.ToString();
            pathProcessProgress.EditValue      = PostCard.CountProcessed;
            repositoryItemProgressBar1.Maximum = PostCard.CountPreProcessed;
            progressValue.Refresh();
            progressMax.Refresh();
            pathProcessProgress.Refresh();
            if (postCard.ThumbnailImage != null && postCard.Node != null)
            {
                postCard.Node.SetValue(state, "");
                postCard.Node.ImageIndex = postCard.Node.SelectImageIndex = 1;
            }

            if (postCard.State == "文件无法打开")
            {
                postCard.Remove();
            }
            if (postCard.FinishedFile.Exists && postCard.Node != null)
            {
                postCard.Node.SetValue(state, "已处理");
                postCard.Node.ImageIndex = postCard.Node.SelectImageIndex = 5;
            }

            if (postCard.Node != null && postCard.Node == treeList1.FocusedNode)
            {
                ReFreshMyNode();
            }
            Application.DoEvents();
        }
Пример #2
0
 private void postCard_EndPreprocess(PostCard sender)
 {
     barStaticItem1.Caption = "";
     //BeginInvoke(new delegateSetImage(setMyImage),sender.Node, 2);
     //reFreshPostCard(sender);
     BeginInvoke(new DelegatereFreshPostCard(ReFreshPostCard), sender);
 }
Пример #3
0
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var text = context.Activity.AsMessageActivity().Text.ToLower();

            switch (text)
            {
            case "next":
                _page++;
                break;

            case "previous":
                _page--;
                break;

            case "exit":
                context.Done <object>(null);
                return;
            }

            var client   = new RestClient("https://jsonplaceholder.typicode.com");
            var request  = new RestRequest($"/posts?_limit=5&_page={_page}", Method.GET);
            var response = await client.ExecuteTaskAsync <List <Post> >(request);

            var prompt = context.MakeMessage();

            prompt.AttachmentLayout = AttachmentLayoutTypes.List;
            foreach (var item in response.Data)
            {
                prompt.Attachments.Add(PostCard.Build(item.title, item.body, DateTime.Now));
            }

            prompt.Attachments.Add(PostCard.BuildAction());

            await context.PostAsync(prompt);
        }
Пример #4
0
 private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
 {
     PostCard.RemoveAll();
     groupAlbumPrint.Visibility    = LayoutVisibility.Never;
     groupPostCard.Visibility      = LayoutVisibility.Always;
     layoutControlItem8.Visibility = LayoutVisibility.Always;
     groupPostCard.Selected        = true;
 }
Пример #5
0
        /// <summary>
        /// Populate a stnadard sentItem model from database into a Postcard object
        /// </summary>
        /// <param name="sentItem"></param>
        /// <returns></returns>
        private PostCard PopulatePostCardItem(SentItem sentItem)
        {
            var postcard = new PostCard();

            postcard.FrontHtml   = sentItem.FrontHtml;
            postcard.BackHtml    = sentItem.BackHtml;
            postcard.ToAddress   = this.GetAddressFromRecipientProfile(sentItem.RecipientProfile);
            postcard.FromAddress = this.GetAddressFromRecipientProfile(sentItem.FromRecipient);
            return(postcard);
        }
Пример #6
0
 private void SendPostCard(PostCard postcard)
 {
     var response = lobClient.Postcards.Create(new
     {
         to = new
         {
             name            = postcard.ToAddress.Name,
             address_line1   = postcard.ToAddress.AddressLine1,
             address_line2   = postcard.ToAddress.AddressLine2,
             address_country = postcard.ToAddress.Country,
             address_city    = postcard.ToAddress.City,
             address_state   = postcard.ToAddress.State,
             address_zip     = postcard.ToAddress.AreaCode
         },
         front = postcard.FrontHtml,
         back  = postcard.BackHtml,
         size  = "4x6"
     });
 }
Пример #7
0
        /// <summary>
        /// Post a card
        /// </summary>
        /// <param name="card">Card data</param>
        /// <returns>Url of the created card</returns>
        public GetCard Post(PostCard card)
        {
            if (string.IsNullOrEmpty(StoreId))
            {
                throw new Exception("You can't specify an empty storeId");
            }

            var request = new RestRequest("v1/stores/{storeId}/cards", Method.POST);

            request.AddUrlSegment("storeId", StoreId);
            request.RequestFormat = DataFormat.Json;

            var serializer = new JsonSerializer
            {
                NullValueHandling = NullValueHandling.Ignore
            };

            string bodyContent;

            using (var writer = new StringWriter())
            {
                serializer.Serialize(writer, card);
                bodyContent = writer.ToString();
            }

            request.AddParameter("application/json", bodyContent, ParameterType.RequestBody);

            GetCard createdCard;

            try
            {
                createdCard = DeserializeGet(_client.ExecuteRequest(request, HttpStatusCode.Created).Content);
            }
            catch (KeyNotFoundException)
            {
                throw new Exception("No Store found with ID : " + StoreId);
            }

            return(createdCard);
        }
Пример #8
0
        //TreeListNode currentNode;
        private void treeList1_FocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e)
        {
            cutMyPicture.Enabled   = false;
            recutMyPicture.Enabled = false;
            _currentPostCard       = null;
            _currentPostCardAlbum  = null;
            if (e.Node != null && e.Node.Tag != null)
            {
                if (e.Node.Tag.GetType().Name == "PostCard")
                {
                    _currentPostCard              = (PostCard)e.Node.Tag;
                    groupAlbumPrint.Visibility    = LayoutVisibility.Never;
                    groupPostCard.Visibility      = LayoutVisibility.Always;
                    layoutControlItem8.Visibility = LayoutVisibility.Always;
                    groupPostCard.Selected        = true;
                }
                else if (e.Node.Tag.GetType().Name == "PostCardAlbum")
                {
                    foreach (var tmpPostCard in ((PostCardAlbum)e.Node.Tag).PostCards)
                    {
                        if (tmpPostCard.FinishedFile.Exists == false)
                        {
                            tmpPostCard.Node.Selected = true;
                            return;
                        }
                    }

                    _currentPostCardAlbum         = (PostCardAlbum)e.Node.Tag;
                    groupAlbumPrint.Visibility    = LayoutVisibility.Always;
                    groupPostCard.Visibility      = LayoutVisibility.Never;
                    layoutControlItem8.Visibility = LayoutVisibility.Never;
                    groupAlbumPrint.Selected      = true;
                }
            }

            ReFreshMyNode();
        }
Пример #9
0
        private void SubmitMyPicture(object sender, EventArgs e)
        {
            if (_currentPostCard != null)
            {
                _currentPostCard.EnterQueue();
                PostCard tmpPostCard = null;
                tmpPostCard = _currentPostCard.ParentPostCardAlbum.GetNotCat();
                if (tmpPostCard == null)
                {
                    foreach (TreeListNode tmpNode in treeList1.Nodes)
                    {
                        if (tmpNode.Tag != null && tmpNode.Tag.GetType().Name == "PostCardAlbum")
                        {
                            tmpPostCard = ((PostCardAlbum)tmpNode.Tag).GetNotCat();
                            if (tmpPostCard != null)
                            {
                                break;
                            }
                        }
                    }
                }

                if (tmpPostCard == null)
                {
                    splashScreenManager2.ShowWaitForm();
                    Thread.Sleep(1000);
                    splashScreenManager2.CloseWaitForm();
                }
                else
                {
                    tmpPostCard.Node.Selected = true;
                }

                ReFreshMyNode();
            }
        }
Пример #10
0
    private void CreatePostsCards()
    {
        Vector3 position = new Vector3(0f, 0f, 0f);

        if (TimelineService.posts.Length > 0)
        {
            postCard.SetActive(true);
            NMPostCard.SetActive(true);
            noPostsCard.SetActive(false);
        }
        else
        {
            NMPostCard.SetActive(false);
            postCard.SetActive(false);
            noPostsCard.SetActive(true);
        }

        if (END_POST_INDEX >= TimelineService.posts.Length)
        {
            moreCard.SetActive(false);
        }
        else
        {
            moreCard.SetActive(true);
        }

        for (int i = START_POST_INDEX; i < END_POST_INDEX; i++)
        {
            Post       currentPost = TimelineService.posts[i];
            GameObject currentCard;

            if (currentPost.text_msg.Length >= 3)
            {
                currentCard = postCard;
            }
            else
            {
                currentCard = NMPostCard;
            }

            position = currentCard.transform.position;
            position = new Vector3(position.x, position.y, position.z);
            GameObject card = (GameObject)Instantiate(currentCard, position, Quaternion.identity);
            card.transform.SetParent(GameObject.Find("List").transform, false);

            PostCard postCardScript = card.GetComponent <PostCard>();
            postCardScript.UpdatePost(TimelineService.posts[i]);
        }

        GameObject showMoreCard = (GameObject)Instantiate(moreCard, position, Quaternion.identity);

        showMoreCard.transform.SetParent(GameObject.Find("List").transform, false);

        Destroy(moreCard);
        moreCard = showMoreCard;

        postCard.SetActive(false);
        NMPostCard.SetActive(false);

        AlertsService.removeLoadingAlert();
    }
Пример #11
0
 private void PostCard_BeginPreprocess(PostCard sender)
 {
     barStaticItem1.Caption = "正在预处理" + sender.SourceFile.Name;
     BeginInvoke(new DelegateSetImage(SetMyImage), sender.Node, 2);
 }
Пример #12
0
 private void PostCard_EndProcess(PostCard sender)
 {
     barStaticItem1.Caption = "";
     BeginInvoke(new DelegatereFreshPostCard(ReFreshPostCard), sender);
     //Application.DoEvents();
 }
Пример #13
0
 private void PostCard_BeginRecut(PostCard sender)
 {
     sender.Node.SelectImageIndex = sender.Node.ImageIndex = 1;
     sender.Node.SetValue(state, "");
     BeginInvoke(new DelegatereFreshPostCard(ReFreshPostCard), sender);
 }