I have a Page Ingredients.xaml with a GridView. This GridView displays a list of Ingredient objects. For each item, an image is displayed by binding to a string property of the Ingredient object containing the file's path (in the app's local folder).
When I click on an item, the app navigates to Ingredient.xaml, a details page, where the image as well as all the details are displayed. There is functionality to set a new image or replace/remove the current one.
When there is no image yet, everything works like a charm. However, as soon as a file exists already, I get the following error when trying to either delete or replace the current file:
"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))".
At first I thought the Image in Ingredient.xaml was the issue, since it was still showing the image I was trying to delete. So i added the following line to the code:
this.ingredientImage.Source = null;
The code was still throwing the exception, though. So I tried something else: I removed the Image from the GridView in Ingredients.xaml. The only place the image is shown not is in Ingredient.xaml. When I try to replace/delete the image, Image.Source is set to null and the file is successfully replaced/deleted.
Apparently the Image in the GridView on the previous Page is still blocking the file, but I have no idea how I could release the file when I navigate away.
Related
Currently for my back button I'm using window.history.back() which, in itself is working properly. My issue is with an iframe that I have for refreshing sessions, example
<iframe src="https://example.com/some/path?gcp-iap-mode=SESSION_REFRESHER" style="width:0;height:0;border:0; border:none;"></iframe>
Path in my project represents current url, so it keeps changing every time I change locations. Now, with the source the iframe has, it keeps throwing 404 and getting into my history so instead of clicking back button once, I have to do it at least two times - first times it fails as it tries to reach randompath?gcp-iap-mode=SESSION_REFRESHER and then it goes to proper path.
My question is, is there a way for me to check the "back" value, to see if the "back" value has a specific query (for example gcp-iap-mode part), or check if it's the same as a current location (duplicate) so I can skip that entry (and couple of back steps) and go back to a different path in history stack?
Seems an issue like this is common in iframes. I tried looking at it from a wrong perspective, by looking for ways to change history where the only thing that needed to be changed is the iframe itself.
Basically when we only change the src attribute of the iframe it gets rendered again and again and the src gets pushed to history stack. What we needed here was the iframe to unmount and the soultion to all of that was pretty simple - add a key prop to the iframe.
This is a blog page that helped me, so if somebody wants to read more:
https://www.aleksandrhovhannisyan.com/blog/react-iframes-back-navigation-bug/
In my application I have some modules which should have the possibility to upload images.
I created a child component for handling the image uploading, for easy reuse.
The problem is when I upload image from one of the child components it is always displayed in the first component instance.
I have replicated the issue here:
https://stackblitz.com/edit/angular-ivy-6ug9f6
Anyone knows what the problem is?
Both of your file inputs have the same id, so when you click the second label, it refers back to the first input. Try generating a dynamic id for each input and that should do the trick.
I am using Visual Studio 2010 and coding in VB.
I have a form with a WebBrowser object in it.
I have control over the HTML on the pages.
I need the user to be able to select a portion of text in the WebBrowser object and save it.
In the save process, I need to capture the selected text, the ID of the HTML element that contains the selected text, and the URL. Then when the user goes back to that page, the program can place an icon on the page right next to that object.
I do not have any code to accomplish this yet, I do not have much experience with the WebBrowser object so I didn't even know where to start. I can however give the names of my form objects and inform you that all of the html elements have an ID.
Form : frmContent
WebBrowser : wbContent
I am guessing that I could even record coordinates of the selected portion of text instead of the html element. Either way, the final outcome needs to save a list of these locations paired with their url so that for every saved "bookmark", there will be an icon placed on the page of that url in the saved location of the page.
Found that this works rather well for me.
GetElementFromPoint(e.ClientMousePosition)
I was able to set this to a variable and then able to get the attributes from the element.
Dim bookmarkElement = wbContent.Document.GetElementFromPoint(e.ClientMousePosition)
Dim elementID = bookmarkElement.GetAttribute("id").ToString()
Problem solved.
The new thumbnail feature works great when inserting a new file.
Is there a way to update the thumbnail for an existing file?
I did not manage to update the thumbnail (in Java) using the files().patch() or files().update() methods.
I don't get any error message, but the thumbnail in Google Drive is just not changing when uploading a new thumbnail.
File file = drive.files().get(fileId).execute();
String encodedImage = Base64.encodeBase64URLSafeString(imageData);
Thumbnail thumbnail = new Thumbnail();
thumbnail.setImage(encodedImage);
thumbnail.setMimeType("image/png");
file.setThumbnail(thumbnail);
drive.files().update(fileId, file).execute();
Update:
As I am using exactly the same code for inserting a file with thumbnail (which works) and updating the file as shown in the code snippet above (which will not update the thumbnail) it may make sense that you use my app to perform both operations.
Login to www.ultradox.com
Copy one of the examples.
This will create a new file on your Google Drive with the correct thumbnail
(as it triggers the insert file method with thumbnail).
Click on the "Customize" button
Scroll down and click on the thumbnail image to upload a new thumbnail
= Thumbnail not changed, but update should be triggered.
So probably something shows up in your logs?
The current behavior is that updates to metadata alone do not allow a change in the thumbnail. So changes to the metadata alone do not take the thumbnail change. I am not sure this is the best behavior, and we will try to improve it to:
Allow the thumbnail update
Report an error rather than appearing to succeed
Does anybody know how to get image data from inside custom report item?
I want to enable users of my component to set image (background image for example) for the component to use. I've managed to create property with ImageSource type, but I reason that I need to read Source and Value, and than retrive the image data itself(since there is nothing in the ImageSource interface to access it).
I suspect that there should be a common interface for all types of sources, but if I need to use something like EmbeddedImageCollection that is also fine.
Thanks!
in Short : View Code and copy and paste the tag into the embedded images tag