Пример #1
0
        public async override Task ProcessAsync()
        {
            var content = await TagOutput.GetChildContentAsync();

            TagOutput.Content.SetHtmlContent(content);

            if (InputType == InputTypes.Checkbox)
            {
                PreContent.SetHtmlContent(new HtmlString("<label for=\"" + EncodeAttribute(InputID) + "\">"));
                PostContent.SetHtmlContent(new HtmlString(EncodeHTML(Label) + "</label>"));
                TagName = "div";
                this.AddClass("checkbox");
            }
            else
            {
                if (Label != null)
                {
                    PreElement.SetHtmlContent(new HtmlString("<label for=\"" + EncodeAttribute(InputID) + "\">" + Label + "</label>"));
                }
            }

            if (HelpMessage != null)
            {
                PostElement.SetHtmlContent(new HtmlString("<small id=\"" + EncodeAttribute(InputID) + "Help\" class=\"form-text text-muted\">" + HelpMessage + "</small>"));
            }
        }
Пример #2
0
 /// <summary>
 /// Changes <see cref="TagHelperOutput"/> to generate nothing.
 /// </summary>
 /// <remarks>
 /// Sets <see cref="TagName"/> to <c>null</c>, and clears <see cref="PreElement"/>, <see cref="PreContent"/>,
 /// <see cref="Content"/>, <see cref="PostContent"/>, and <see cref="PostElement"/> to suppress output.
 /// </remarks>
 public void SuppressOutput()
 {
     TagName = null;
     PreElement.Clear();
     PreContent.Clear();
     Content.Clear();
     PostContent.Clear();
     PostElement.Clear();
 }
Пример #3
0
    public PostElement loadAddress(string address)
    {
        Address = address;
        StreamReader r    = new StreamReader(Address);
        string       json = r.ReadToEnd();
        PostElement  res  = JsonConvert.DeserializeObject <PostElement>(json);

        r.Close();
        return(res);
    }
Пример #4
0
        public void InsertTechnologyRadarPost(PostElement postElement)
        {
            using (var redisClient = new RedisClient("mtl-ba584:6379"))
            {
                var redis = redisClient.As<PostElement>();
                var currentPosts = redis.Lists["technologyradar"];

                currentPosts.Add(postElement);

            }
        }
Пример #5
0
        public void InsertDailyPost(PostElement postElement)
        {
            using (var redisClient = new RedisClient("mtl-ba584:6379"))
            {
                var redis = redisClient.As<PostElement>();
                var currentPosts = redis.Lists["dailyposts"];

                currentPosts.Add(postElement);

            }
        }
Пример #6
0
    public async System.Threading.Tasks.Task AddPost(string json)
    {
        PostData    data      = JsonConvert.DeserializeObject <PostData>(json);
        GameObject  postClone = UIHelper.PushAndGetPrefabToParent(postElementPrefab, postContent.transform, 0);
        PostElement pe        = postClone.GetComponent <PostElement>();

        pe = await pe.LoadFromData(data);

        pe.updateAll();
        StartCoroutine(UpdatePostPostion(postClone));
    }
Пример #7
0
    public void Post()
    {
        postData.uid      = CommunityUserDataHandler.Instance.user.uid;
        postData.postText = postText.text;

        // Add postElementPrefab to main scene
        clone = UIHelper.PushAndGetPrefabToParent(postElementPrefab, postContent.transform, 0);
        PostElement pe = clone.GetComponent <PostElement>();

        pe.LoadFromData(postData, true);

        PostData.UploadPostData(postData);

        // Clear
        postData.imageNames = new List <string>();

        StartCoroutine(SiblingUpdate());
        pe.updateAll();
    }
Пример #8
0
    public void Post()
    {
        clone = UIHelper.PushAndGetPrefabToParent(post, content.transform, 0);
        PostElement pe = clone.GetComponent <PostElement>();

        pe.postText = postText.text;

        // Upload Text
        FirebaseStorage  storage     = FirebaseStorage.DefaultInstance;
        StorageReference postTextRef = storage.RootReference.Child("posts/" + "username" + "/" + "nextID" + "/" + "postText");

        byte[] postTextbytes = Encoding.ASCII.GetBytes(pe.postText);

        postTextRef.PutBytesAsync(postTextbytes).ContinueWith((Task <StorageMetadata> task) => {
            if (task.IsFaulted || task.IsCanceled)
            {
                Debug.Log(task.Exception.ToString());
                // Uh-oh, an error occurred!
            }
            else
            {
                // Metadata contains file metadata such as size, content-type, and md5hash.
                StorageMetadata metadata = task.Result;
                string md5Hash           = metadata.Md5Hash;
                Debug.Log("Finished uploading...");
                Debug.Log("md5 hash = " + md5Hash);
            }
        });

        if (imgBoard.transform.childCount > 0)   //there're images
        {
            foreach (Transform child in imgBoard.transform)
            {
                pe.ImageQueue.Add(child.gameObject.GetComponent <Image>());
            }
        }

        StartCoroutine(SiblingUpdate());
        pe.updateAll();
    }