none
Grab FTP File Path

    Question

  • Hello Everyone,


    I am working on one window store application.


    In that there is one situation, where i want to change the color of the image programmatically, I found some source code for the same


           private async void Button_Click_1(object sender, RoutedEventArgs e)
            {
                FileOpenPicker picker = new FileOpenPicker();
                picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                picker.FileTypeFilter.Add(".png");
                StorageFile file = await picker.PickSingleFileAsync();

                if (file != null)
                {
                    using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read))
                    {
                        BitmapDecoder decoder = await BitmapDecoder.CreateAsync(fileStream);

                        PixelDataProvider pixelData = await decoder.GetPixelDataAsync(
                            BitmapPixelFormat.Bgra8,    
                            BitmapAlphaMode.Straight,
                            new BitmapTransform(),
                            ExifOrientationMode.IgnoreExifOrientation,
                            ColorManagementMode.DoNotColorManage);

                        byte[] sourcePixels = pixelData.DetachPixelData();
                        await ThreadPool.RunAsync(new WorkItemHandler(
                            (IAsyncAction action) =>
                            {
                                sourcePixels = SwitchColor(sourcePixels, decoder.PixelWidth, decoder.PixelHeight, Colors.Red, Colors.Cyan);
                            }
                            ));

                        var writeableBitmap = new WriteableBitmap((int)decoder.PixelWidth, (int)decoder.PixelHeight);
                        using (Stream stream = writeableBitmap.PixelBuffer.AsStream())
                        {
                            await stream.WriteAsync(sourcePixels, 0, sourcePixels.Length);
                        }

                        // Redraw the image
                        image.Source = writeableBitmap;
                    }
                }
            }

    Now, in above source code,

    FileOpenPicker picker = new FileOpenPicker();
                picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                picker.FileTypeFilter.Add(".png");
                StorageFile file = await picker.PickSingleFileAsync();

    FileOpenPicker is used, but i am having a situation, where i need to grab a file path from FTP or else application folder only. So how can i apply that file path in this situation, Please help me asap.

    Thanks,

    Nik

    Saturday, August 02, 2014 3:27 AM

Answers

All replies