how to delete media library in save picture photo in windows phone c# - windows-phone-8

when delete image from media library, i'am getting access denied error.
this is my code.
using (MediaLibrary _MediaLibrary = new MediaLibrary())
{
foreach (PictureAlbum album in _MediaLibrary.RootPictureAlbum.Albums)
{
if (album.Name == "Saved Pictures")
{
PictureCollection Pictures = album.Pictures;
foreach (Picture _Picture in Pictures)
{
if (_Picture.Name.Contains("Tattoo_" + FavoritesName))
{
File.Delete(_Picture.GetPath());
}
}
}
}

It is not possible to delete pictures from the media library. Some kind of security constrain, I guess.

Related

How do I access the image gallery from a PWA

I need to know how to access the image gallery from a PWA. Currently the PWA will allow me to take pics and upload those on a mobile device but it won't let me access the image gallery and select images. On an actual desktop I can access the image gallery but not from an actual device...I can only access the camera to take photos.
So far I've looked into trying to set my browser to allow access to the image gallery but I don't see a setting on my Chrome browser from my android phone.
Here's the code:
uploadFromFile(event, photoName: string) {
const files = event.target.files;
console.log('Uploading', files);
const file = new Blob([files[0]], { type: 'image/jpeg' });
console.log('file', file);
const { type } = file;
this.imageService.uploadImage(file, photoName, this.currentUser.uid)
.then((url) => {
this.photo0 = url;
console.log('url edit prof', url);
}).catch((error) => {
alert(error.message);
});
}
#capture::file-selector-button {
display: none;
}
#capture {
color: transparent;
}
#capture::before {
content: url("../../../assets/image/SpaghettiPlus2.png");
padding: 140px;
align-items: center;
}
<input type="file" id="capture" accept="image" capture (change)="uploadFromFile($event, 'photo0')" />
It took a while to find this method of uploading pics in a PWA. Using the input for a file picker was the only solution I could find online for allowing PWAs to access pics.
So right now I just want to be able to access the photo gallery on a device in order to upload pics.
The problem is the capture attribute.
According to MDN:
capture was previously a Boolean attribute which, if present, requested that the device's media capture device(s) such as camera or microphone be used instead of requesting a file input.
Also, the value of the accept attribute seems to be wrong (according to MDN). If it doesn't work try accept="image/*" instead.

Adobe Air Application How to clear the data?

We are migrating out Adobe Flex application to Adobe Air application and lots of feature are working fine .But the main issue which we are getting how to clear all the data/record/session after logout?
Login the Adobe Air application with userid/password .
After Successful login just go any menu item .
Click the logout button.
User redirect to login page.
User login again it will show same Window from where user did logout with all the data.
So in Adobe Air how to clear the session data or how to clear all the component when user going to logout?
I add here, as you want, a snippet of code about logout from application:
public function logoutApplication(isSessionDown:Boolean=false):void
{
// This method close other open windows (because in AIR you can open more than one window)
closeOtherWindows();
// Here I want to manage a sessionExpired variable in model locator so I can use for further aim
if (CoreML.getInstance()!=null && CoreML.getInstance().sessionExpired){
ModelLocator.getInstance().sessionExpired=true;
CoreML.getInstance().sessionExpired=false;
}
// Here I remove all opened popup
var listPopUp:IChildList = FlexGlobals.topLevelApplication.systemManager.popUpChildren;
for (var i:int = 0; i < listPopUp.numChildren; i++) {
var curr:IFlexDisplayObject = listPopUp.getChildAt(i) as IFlexDisplayObject;
try {
if (curr != null) {
PopUpManager.removePopUp(curr);
}
}
catch(ex:ExceptionFrontEndHandler) {
// If you arrive here, it isn't a popup
}
}
// here I update my component menu (it's business logic is not important)
if (this.cntComponentMenu != null) {
var newMenuComp:ComponentMenu = new ComponentMenu();
newMenuComp.container=this;
this.cntComponentMenu.removeAllElements();
this.cntComponentMenu.addElement(newMenuComp);
}
// Here I change the state of my main MXML to login and clean the text box (not binded with BO)
this.currentState='login';
if (this.cntLogin!=null){
this.cntLogin.currentState='State1';
this.cntLogin.validateNow();
this.cntLogin.userId.text="";
this.cntLogin.password.text="";
}
if (!isSessionDown) EnvDispatcher.resetInfoSession(this);
else mypackage.ModelLocator.getInstance().logout=true;
}
Here the code in result command of EnvDispatcher.resetInfoSession:
if (this.evt.sender!=null && this.evt.sender is UncertaintyAIR) {
var pnl:MyApplication = this.evt.sender as MyApplication;
pnl.currentState='login';
pnl.validateNow();
pnl.groupLogin.removeAllElements();
LoginDispatcher.logout();
LoginDispatcher.logoutSecure();
mypackage.ModelLocator.getInstance().logout=true;
var loginView:LoginView = new LoginView();
loginView.container=pnl;
pnl.groupLogin.addElement(loginView);
}

PlatformIO Possible key upload_flags & upload_command string option

I work with STM32F429ZI and PlatformIO and i need to upload firmware to specific address like 0x08020000 for example. And I can't find in docs on platformio which key for upload_flags I can use for it, or how I can modify upload_command for it. Thanks.
Right solution is add mbed_app.json to your project root with:
{
"target_overrides": {
"*": {
"target.mbed_app_start" : "0x08020000",
"target.mbed_app_size" : "0x000A0000"
}
}
}
https://os.mbed.com/docs/mbed-os/v5.15/reference/bootloader-configuration.html
This parameters expand to:
MEMORY
{
FLASH (rx) : ORIGIN = 0x8020000, LENGTH = 0xa0000
...
}
on your .ld script and you don't need to change upload_flags and upload_command.

Umbraco Razor Syntax Issue

I have this macro running happily on a live server. It was ok in WebMatrix. Now WebMatrix has updated itself to 2 (refresh), it won't run some macros, this being one of them:-
#{
//Check there are slider image page loaded
var theCount = #Model.Descendants("SliderImagePage").Count();
if (theCount > 0)
{
foreach (var theImagePage in Model.Descendants("SliderImagePage"))
{
var theImage = theImagePage.Media("sliderImage","umbracoFile");
if (theImagePage.IsFirst())
{
#:<div class="slide" style="background-image:url('#Html.Raw(theImage)');display:block;"></div>
} else {
#:<div class="slide" style="background-image:url('#Html.Raw(theImage)');display:none;"></div>
}
}
}
else
{
#: No Picture Image pages set up
}
}
It complains that ":" is not valid at the start of a code block.
I have MVC4 and the Razor Extensions in VS2010. As far as I understand, it's all valid. Can anyone shed any light on why it won't pass validation?
Thanks.
The statements in the foreach loop should run fine without using #: for output:
#{
//Check there are slider image page loaded
var theCount = #Model.Descendants("SliderImagePage").Count();
if (theCount > 0)
{
foreach (var theImagePage in Model.Descendants("SliderImagePage"))
{
var theImage = theImagePage.Media("sliderImage","umbracoFile");
if (theImagePage.IsFirst())
{
<div class="slide" style="background-image:url('#Html.Raw(theImage)');display:block;"></div>
}
else
{
<div class="slide" style="background-image:url('#Html.Raw(theImage)');display:none;"></div>
}
}
}
else
{
#: No Picture Image pages set up
}
}
It looks like you've discovered a compilation issue in Razor. There is a simple workaround; if you remove the '#' character from line 3, the code you gave above compiles in both Razor v1 and Razor v2.
I have opened a bug in the Web pages team's bug database on CodePlex for this, and hopefully it will be addressed in the next version.
HTH,
Clay

saving google map to image from a browser component window inside a c# application

I wanted to save the google map into an image from a webpage.
while i was searching for that i got this program.
http://www.codres.de/downloads/gms.exe[^]
besides other alternatives like print screen i wanted to use a program or map api which can save a specified dimension of google map instead of the screen.
i have used browser component in c# for http access and for displaying certain webpages.
I want to know whether there are options to capture the browser screen to image using any c# functionality or even the browser component would have given such options. just a guess.
i would like to have answers, suggestions on how to capture the map with custom dimension and zoom size to an image.
I used this to get captcha Image from the current page, so you can use similar code just amend the imageID to point to the google map image and use this solution for zooming.
public string newsavefunction(WebBrowser webBrowser1)
{
IHTMLDocument2 doc = (IHTMLDocument2)webBrowser1.Document.DomDocument;
IHTMLControlRange imgRange = (IHTMLControlRange)((HTMLBody)doc.body).createControlRange();
string imagename = string.Empty;
try
{
foreach (IHTMLImgElement img in doc.images)
{
imgRange.add((IHTMLControlElement)img);
imgRange.execCommand("Copy", false, null);
using (Bitmap bmp = (Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap))
{
bmp.Save(#"F:\captchaimages\captchapic.jpg");
}
imagename = img.nameProp;
break;
}
}
catch (System.Exception exp)
{ }
return imagename;
}