private void AddImageClick_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog open = new OpenFileDialog())
            {
                open.Title  = "select Image";
                open.Filter = "Image Files (*.bmp;* .jpg;*.jpeg , * .png) | * .BMP ;*.JPG; * .JPEG ; * .PNG ";
                DialogResult result = openFileDialog1.ShowDialog();
                if (result == DialogResult.OK)
                {
                    ImagePath = openFileDialog1.FileName;
                    var ImagePathPart =
                        ImagePath.Split('\\').ToList();
                    if (ImagePathPart != null && ImagePathPart.Any())
                    {
                        string strImageName =
                            ImagePathPart.Last();
                        lblImagePath.Text = strImageName;
                    }

                    pictureBook.Image   = Infrastructure.ImageUtils.GetThumbnailByImagePath(ImagePath, 135, 135);
                    pictureBook.Visible = true;
                    AddImageClick.Text  = "Change Image";
                }
                else
                {
                    MessageBox.Show("An Error accrued in Selecting Image File ! try agin !", "Error In Selecting Image", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Esempio n. 2
0
 public AlbumDto ToDto()
 {
     return(new AlbumDto
     {
         Id = Id,
         Name = Name,
         Author = Author,
         Year = Year,
         SongInfos = SongInfos.Any() ? SongInfos.Select(s => s.ToDto()).ToList() : new List <SongInfoDto>(),
         ImagePaths = string.IsNullOrEmpty(ImagePath) ?
                      null : ImagePath.Split(';')
     });
 }
Esempio n. 3
0
        private void StartUpload(FileInfo file)
        {
            _uploadedFile = file;
            _fileStream   = _uploadedFile.OpenRead();
            _dataLength   = _fileStream.Length;
            string pathofImage           = ImagePath.Split('/').LastOrDefault();
            var    dataToSend            = _dataLength - _dataSent;
            var    isLastChunk           = dataToSend <= ChunkSize;
            var    isFirstChunk          = _dataSent == 0;
            var    httpHandlerUrlBuilder = new UriBuilder(string.Format("{0}/FileUpload.ashx", _baseUri));

            httpHandlerUrlBuilder.Query = string.Format("{4}file={0}&offset={1}&last={2}&first={3}&Folder={5}",
                                                        pathofImage, _dataSent, isLastChunk, isFirstChunk,
                                                        string.IsNullOrEmpty(httpHandlerUrlBuilder.Query) ? "" : httpHandlerUrlBuilder.Query.Remove(0, 1) + "&", FolderPath);

            var webRequest = (HttpWebRequest)WebRequest.Create(httpHandlerUrlBuilder.Uri);

            webRequest.Method = "POST";
            webRequest.BeginGetRequestStream(WriteToStreamCallback, webRequest);
        }
Esempio n. 4
0
        public VideoLibraryItem(VideoCollection processed)
        {
            Processed = processed;

            var barcodeConfig = processed.BarcodeConfigs.FirstOrDefault();

            if (barcodeConfig == null)
            {
                return;
            }

            StandardBarcodeCreated = File.Exists(barcodeConfig.Barcode_Standard?.FullOutputFile);
            OnePixelBarcodeCreated = File.Exists(barcodeConfig.Barcode_1px?.FullOutputFile);

            ImagePath = StandardBarcodeCreated
                ? Path.GetDirectoryName(barcodeConfig.Barcode_Standard.FullOutputFile)
                : Path.GetDirectoryName(barcodeConfig.Barcode_1px.FullOutputFile);

            if (DateTime.TryParseExact(ImagePath.Split(' ').Last(), "yyyyMMdd_HHmmss", CultureInfo.CurrentCulture, DateTimeStyles.None, out DateTime runDate))
            {
                RunDate = runDate.ToString("f");
            }
        }