Facebook.FacebookMediaStream.SetValue C# (CSharp) Method

SetValue() public method

Sets the value of the media stream.
public SetValue ( Stream value ) : FacebookMediaStream
value Stream The media stream value.
return FacebookMediaStream
        public FacebookMediaStream SetValue(Stream value)
        {
            _value = value;
            return this;
        }

Usage Example

Esempio n. 1
0
        public string UploadToFacebook(MemoryStream ms)
        {
            // TODO: Make progressbar functional for C# Facebook SDK.
            //       Limitation in current C# Facebook SDK makes us unable to track progress of photo uploads.
            this.ProgressBar.Start("Facebook", ms.Length);

            string url = "";

            try {
                ms.Seek(0, SeekOrigin.Begin);

                FacebookMediaStream img = new FacebookMediaStream();
                img.ContentType = "image/png";
                img.FileName    = this.RandomFilename(5) + ".png";
                img.SetValue(ms);

                Dictionary <string, object> photoParams = new Dictionary <string, object>();
                // TODO: Some way to attach a message to an image
                //photoParams["message"] = message;
                photoParams["image"] = img;
                dynamic ret = this.facebookClient.Post("/me/photos", photoParams);

                string photoID = ret.id;
                url = "https://" + "www.facebook.com/photo.php?fbid=" + photoID;

                this.AddLog(url);
            } catch (Exception ex) {
                this.Debug("UploadToFacebook threw " + ex.GetType().FullName + ": '" + ex.Message + "'");
            }

            this.ProgressBar.Done();

            return(url);
        }
All Usage Examples Of Facebook.FacebookMediaStream::SetValue