BlipFace.Service.Communication.BlipCommunication.AddUpdateAsync C# (CSharp) Метод

AddUpdateAsync() публичный Метод

Asynchronicznie dodaje status do blipa
public AddUpdateAsync ( string content, string imagePath ) : void
content string treść statusu
imagePath string ścieżka do pliku z obrazem
Результат void
        public void AddUpdateAsync(string content, string imagePath)
        {
            string query = "/updates";

            string fileName = Path.GetFileName(imagePath);

            HttpMultipartMimeForm form = new HttpMultipartMimeForm();
            form.Add("update[body]", content);

            using (MemoryStream ms = new MemoryStream())
            {
                Image img = Image.FromFile(imagePath);

                img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

                byte[] imageBytes = ms.ToArray();

                HttpContent pic = HttpContent.Create(imageBytes, "application/octet-stream");

                form.Add("update[picture]", fileName, pic);

                lock (httpAsyncClientLock)
                {
                    //jako state przekazujemy cały obiekt,aby można było pobrać później z niego ResponseMessage
                    blipHttpClientAsync.BeginSend(
                        new HttpRequestMessage("POST", new Uri(query, UriKind.Relative), form.CreateHttpContent()),
                        new AsyncCallback(AfterAddStatusAsync), blipHttpClientAsync);
                }
            }
        }

Same methods

BlipCommunication::AddUpdateAsync ( string content ) : void