Exemplo n.º 1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            NewCollection = new Collection()
            {
                Name = CollectionName.Text,
                Type = ((KeyValuePair<String, String>)CollectionType.SelectedItem).Key,
                Paths = PathsListBox.Items.Cast<String>().ToList()
            };

            if (CollectionArtwork == null)
            {
                NewCollection.Artwork = Resources.DefaultVideoCollectionArtwork;
            }
            else
            {
                NewCollection.Artwork = new Bitmap(CollectionArtwork);
            }

            DialogResult = DialogResult.OK;
        }
Exemplo n.º 2
0
        internal static void CreateCollection(Collection Collection)
        {
            Stream FileStream = new MemoryStream();

            Collection.Artwork.Save(FileStream, System.Drawing.Imaging.ImageFormat.Jpeg);

            FileStream.Seek(0, SeekOrigin.Begin);

            UploadFile Artwork = new UploadFile(FileStream, "Artwork", "artwork.jpg", "image/jpg");

            UploadFile[] Files = new UploadFile[1];
            Files[0] = Artwork;

            HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("http://localhost:32400/manage/collections/add");
            Request.Proxy = new WebProxy("localhost", 8888);
            Request.ServicePoint.Expect100Continue = false;
            Request.KeepAlive = false;
            Request.Timeout = 1000 * 60 * 10;
            HttpWebResponse Response = HttpUploadHelper.Upload(Request, Files, Collection.ToNameValueCollection());
        }