الأحد، 22 نوفمبر 2015

عمل برنامج لإختيار أكثر من ملف (Windows Store Apps)

السلام عليكم..

كيف أستطيع إختيار أكثر من ملف عند عمل FilePicker ؟

المثال الموجود لإختيار ملف واحد : 

private async void btn_picker_Click(object sender, RoutedEventArgs e)
{
        FileOpenPicker fp = new FileOpenPicker(); // Opening file picker, by creating an object
        fp.SuggestedStartLocation = PickerLocationId.Desktop; // selecting the default path, by using the same created object

        // Adding the accepted extensions, by using the same created object
        fp.FileTypeFilter.Clear();
        fp.FileTypeFilter.Add(".jpg");
        fp.FileTypeFilter.Add(".jpeg");
        fp.FileTypeFilter.Add(".png");
        fp.FileTypeFilter.Add(".bmp");
        fp.FileTypeFilter.Add(".gif");

        StorageFile file = await fp.PickSingleFileAsync();
        // if the file/files was selected, then do..
        if (file != null)
        {
                // Displaying name of selected images in image label.
                lbl_path1.Visibility = Visibility.Visible; // Change the text mode from Invisible to Visible
                lbl_path1.Text = file.Name; // Printing the file name inside the label

                IRandomAccessStream filestream = await file.OpenAsync(FileAccessMode.Read);
                BitmapImage phot = new BitmapImage(); // phot1 => (Photo) it's an object name
                phot.SetSource(filestream);
                MyImage1.Source = phot;
        }
}

*المطلوب : إني أعمل الدالة تختار أكثر من ملف، ما هي الطريقة وأتمنى شرح بسيط لها.. شكراً لكم.



from حسوب I/O - الأكثر شيوعاً http://ift.tt/1Lu1zKy

ليست هناك تعليقات:

إرسال تعليق

دائماً، رأيكم يهمنا،