private async void Button_Cari_Click(object sender, EventArgs e)
        {
            buttonCari.Enabled = false;
            if (!string.IsNullOrEmpty(boxIDBarang.Text) && buttonCari.Text == "Cari")
            {
                loadingDialog = new LoadingDialog();
                loadingDialog.Show();
                //loadingDialog.Focus();
                loadingDialog.Activate();
                var html = await HttpClient.GetStringAsync(url + boxIDBarang.Text);

                var result = Datas.FromJson(html);

                boxNamaBarang.Text = result.Products[0].nama;
                boxMitra.Text      = result.Products[0].mitra;
                boxKategori.Text   = result.Products[0].kategori;
                boxSatuanInt.Text  = result.Products[0].satuan;
                boxHarga.Text      = result.Products[0].harga;
                boxDeskripsi.Text  = result.Products[0].desc;
                boxJumlah.Text     = result.Products[0].jumlah;
                filename           = result.Products[0].url.Replace("https://kitku.id/productpic/", "").Replace(".jpeg", "");
                //Console.WriteLine(filename);

                // download image
                WebClient client         = new WebClient();
                Stream    stream         = client.OpenRead(result.Products[0].url);
                Bitmap    bitmap; bitmap = new Bitmap(stream);

                if (bitmap != null)
                {
                    productPicture.Image = bitmap;
                }

                stream.Flush();
                stream.Close();
                client.Dispose();

                loadingDialog.dismiss();
                buttonPilihGambar.Enabled = true;
                buttonCari.Text           = "Reset";
                boxIDBarang.ReadOnly      = true;
            }
            else
            {
                boxIDBarang.Text     = "";
                boxIDBarang.ReadOnly = false;
                boxNamaBarang.Text   = "";
                boxMitra.Text        = "";
                boxKategori.Text     = "";
                boxJumlah.Text       = "";
                boxSatuanInt.Text    = "";
                boxHarga.Text        = "";
                boxDeskripsi.Text    = "";
                productPicture.Image = null;
                buttonCari.Text      = "Cari";
            }
            buttonCari.Enabled = true;
        }
        private void Button_UbahGambar_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.RestoreDirectory = true;
            openFileDialog.Title            = "Pilih Gambar";
            openFileDialog.DefaultExt       = "jpg";
            openFileDialog.Filter           = "Image (*.jpg;*.jpeg;)|*.jpg;*.jpeg;";
            openFileDialog.CheckFileExists  = true;
            openFileDialog.CheckPathExists  = true;
            //openFileDialog.ShowDialog();

            /*this.openFileDialog1.Multiselect = true;
             * foreach (String file in openFileDialog1.FileNames)
             * {
             *  MessageBox.Show(file);
             * }*/
            DialogResult dr = openFileDialog.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                foreach (String file in openFileDialog.FileNames)
                {
                    if (openFileDialog.OpenFile().Length < 500 * 1024)
                    {
                        //Console.WriteLine(openFileDialog.FileName);
                        loadingDialog = new LoadingDialog();
                        loadingDialog.Show();
                        try
                        {
                            PictureBox imageControl = productPicture;

                            Image.GetThumbnailImageAbort myCallback =
                                new Image.GetThumbnailImageAbort(ThumbnailCallback);
                            Bitmap myBitmap    = new Bitmap(file);
                            Image  myThumbnail = myBitmap.GetThumbnailImage(300, 300,
                                                                            myCallback, IntPtr.Zero);
                            imageControl.Image = myThumbnail;
                            myBitmap.Dispose();
                            //

                            /*NameValueCollection nvc = new NameValueCollection
                             * {
                             *  { "id", "TTR" },
                             *  { "btn-submit-photo", "Upload" }
                             * };*/
                            string result = UploadImage.HttpUploadFile("https://kitku.id/produk/updatepic/" + filename,
                                                                       openFileDialog.FileName, null);
                            if (result.Contains("Success"))
                            {
                                MessageBox.Show("Gambar berhasil diupload!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("Gambar gagal diupload!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            //Console.WriteLine("https://kitku.id/produk/updatepic/" + filename);
                            //
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Error: " + ex.Message);
                        }
                        loadingDialog.dismiss();
                    }
                    else
                    {
                        MessageBox.Show("Gambar hanya boleh berukuran 500kb atau kurang!", "Peringatan",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }