lkpcarbon.blogg.se

Teechart save to bitmap file
Teechart save to bitmap file











teechart save to bitmap file

Private void objImage_DownloadCompleted(object sender, EventArgs e)Įxpanding on Chris Baxter's solution, this Converter uses the local version if it exists, otherwise downloads it and saves the file. ObjImage.DownloadCompleted += objImage_DownloadCompleted Public void SavePhoto(string istrImagePath)īitmapImage objImage = new BitmapImage(new Uri(istrImagePath, UriKind.RelativeOrAbsolute)) You will likely also want to add another EventHandler for DownloadFailed in order to gracefully handle any error cases.Īdded full sample class based on Ben's comment: public partial class MainWindow : Window Using (var filestream = new FileStream(photolocation, FileMode.Create)) String photolocation = photoID.ToString() + ".jpg" //file nameĮ(BitmapFrame.Create((BitmapImage)sender)) JpegBitmapEncoder encoder = new JpegBitmapEncoder() Where that handler will look something like: private void objImage_DownloadCompleted(object sender, EventArgs e)

teechart save to bitmap file teechart save to bitmap file

objImage.DownloadCompleted += objImage_DownloadCompleted If you check the following property, the value will likely be TRUE objImage.IsDownloadingĪs such, you much attach a listener to the DownloadCompleted event handler and move all processing to that EventHandler. When you create your BitmapImage from a Uri, time is required to download the image.













Teechart save to bitmap file