I'm using this code to show a toastnotifcation in my application:
var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText02);
var image = toastXml.GetElementsByTagName("image")[0];
var title = toastXml.GetElementsByTagName("text")[0];
var text = toastXml.GetElementsByTagName("text")[1];
image.Attributes[1].AppendChild(toastXml.CreateTextNode("ms-appx:///Assets/Images/logovboardnotif.png"));
title.AppendChild(toastXml.CreateTextNode("Board"));
text.AppendChild(toastXml.CreateTextNode(message));
var toastnotifier = ToastNotificationManager.CreateToastNotifier();
var toastnotification = new ToastNotification(toastXml);
toastnotifier.Show(toastnotification);
My problem is when the toast is shown, there's a small logo (azure color):
How can I hide this logo?
UPDATE 1
According to Programming Windows® 8 Apps with HTML, CSS, and JavaScript by Microsoft Press There are no means to override this; the branding attribute in the XML is ignored for toasts.
You have to set branding attributte to none, default is logo. See here try the below given code.
var xml = #"<toast>
<visual>
<binding template=""ToastImageAndText02"" branding=""none"">
<image id=""1"" src=""{0}""/>
<text id=""1"">{1}</text>
<text id=""2"">{2}</text>
</binding>
</visual>
</toast>";
xml = string.Format(xml, "ms-appx:///Assets/Images/logovboardnotif.png", "Board", message);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
var toastnotification = new ToastNotification(xmlDoc);
ToastNotificationManager.CreateToastNotifier().Show(toastnotification);
Related
In the code below $('#initialModel') is a button which opens up a file loader and $('#initialModelImage') is my canvas and am trying to load the image dynamically on to the canvas from the file uploader ,but am not able to see the uploaded image on the canvas.Could someone help me correct my code.Thanks.
$('#initialModel').on('change',function(e){
var modelFile=document.querySelector('#initialModel').files[0];
var reader=new FileReader();
if (modelFile)
reader.readAsDataURL(modelFile);
else
$('#initialModelImage').src = "";
reader.onloadend = function (_file)
{
var canv=document.getElementById("initialModelImage");
var ctx = canv.getContext('2d');
ctx.drawImage(reader.result,640,480);
}
});
I want to put an image from SQLite but the code below does't work:
var imageView = Ti.UI.createImageView({
image:services.fieldByName('image')
});
do this to convert the blob to a string before saving it
var stringToSaveInDatabase = Ti.Utils.base64encode(thumbBlob).toString();
when you are ready to add it to a view, do this
var imageBlob = Ti.Utils.base64decode(stringRetrievedFromDatabase);
Ti.UI.createImageView({ image:imageBlob });
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Utils-method-base64encode
Is there a way to Edit the TextColor of the text inside Toasts in Windows8 ?
Created like this.
var toastXml = new XmlDocument();
var title = toastXml.CreateElement("toast");
var visual = toastXml.CreateElement("visual");
visual.SetAttribute("version", "1");
visual.SetAttribute("lang", "en-US");
var binding = toastXml.CreateElement("binding");
binding.SetAttribute("template", "ToastImageAndText02");
image.SetAttribute("src", ActualPathToSet);
//Here the Text is assigned
var heading = toastXml.CreateElement("text");
heading.SetAttribute("id", "1");
heading.InnerText = R.GetResourceString("Hello World");
title.AppendChild(visual);
visual.AppendChild(binding);
binding.AppendChild(image);
binding.AppendChild(heading);
var toast = new ToastNotification(toastXml);
I have created a toast like above and want to change the TextColor property.
using C# +XAML + Win8
Change foreground color in manifest file.
I think this is not possible because the Toast Notification is a system internal function and the color is given by the user setting background color.
Hi am using the following code, the live tiles works fine but what i found the small logo is always there on there left bottom of the tile, how can i get rid of it? see this
XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImageAndText01);
XmlDocument squareTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquarePeekImageAndText01);
XmlNodeList textElements = tileXml.GetElementsByTagName("text");
textElements[0].AppendChild(tileXml.CreateTextNode(_serviceOrderItems.Count.ToString()));
XmlNodeList imageElements = tileXml.GetElementsByTagName("image");
XmlElement imageElement = (XmlElement)imageElements[0];
imageElement.SetAttribute("src", "ms-appx:///Assets/Image310X150.jpg");
imageElement.SetAttribute("alt", "Aker Solutions");
XmlNodeList squareImageElements = squareTileXml.GetElementsByTagName("image");
XmlElement squareImageElement = (XmlElement)squareImageElements.Item(0);
squareImageElement.SetAttribute("src", "ms-appx:///Assets/Image150X150.jpg");
squareImageElement.SetAttribute("alt", "Aker Solutions");
IXmlNode subnode = tileXml.ImportNode(squareTileXml.GetElementsByTagName("binding")[0], true);
tileXml.GetElementsByTagName("visual")[0].AppendChild(subnode);
TileNotification tile = new TileNotification(tileXml);
TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);
Set branding="none"
<?xml version="1.0" encoding="UTF-8"?>
<tile>
<visual lang="en-US">
<binding template="TileSquareImage" branding="none">
<image id="1" src="http://abc..../xx.png"/>
</binding>
<binding template="TileWideImageAndText01" branding="none">
<image id="1" src="http://abc.../yy.png"/>
<text id="1">Test message</text>
</binding>
</visual>
</tile>
Edit
Just noticed the comments that you can set the branding attribute on the visual or binding node.
tileXml.getElementsByTagName('visual')[0].setAttribute('branding', 'none');
There is a small logo property on the tile that controls this. However the documentation states:
If this image is not provided, the small logo of this secondary tile's parent app is used.
Since a small logo is also required for your app there is no way to turn it off. A workaround is to set the small logo to a completely transparent 30 by 30 pixel png.
var tile = new Windows.UI.StartScreen.SecondaryTile(newTileID, newTileShortName, newTileDisplayName, TileActivationArguments, newTileOptions, uriLogo);
tile.smallLogo = new Windows.Foundation.Uri("ms-appx:///images/smallLogoBlank.png");
I have a Galleriffic slideshow on my page. Right now the "large" image links to the next image in the slideshow. How can I make it link to an external file instead?
First, you have to add a hidden div or span tag to your unordered list:
<li>
<a class="thumb" href="/imageurl/image.gif">imageititle</a>
<span id="project-path" style="display:none;">example_path</span>
</li>
Then, add this code to your galleriffic.js file. You are grabbing the path from the span element:
addImage: function(listItem, thumbExists, insert, position) {
var $li = ( typeof listItem === "string" ) ? $(listItem) : listItem;
var $aThumb = $li.find('a.thumb');
** var $path = $li.find('#project-path');
** var projectPath = $path.text();
var slideUrl = $aThumb.attr('href');
var title = $aThumb.attr('title');
var $caption = $li.find('.caption').remove();
var hash = $aThumb.attr('name');
Then, you add the value to the image variable:
var imageData = {
** projectPath:projectPath,
title:title,
slideUrl:slideUrl,
caption:$caption,
hash:hash,
gallery:this,
index:position
};
Now tell the gallery to change the link w/ new path on the full-size gallery images:
// Construct new hidden span for the image
var newSlide = this.$imageContainer
.append('<span class="image-wrapper current"><a class="advance-link" rel="history" href="/project/'+imageData.projectPath+'" title="'+imageData.title+'"> </a></span>')
.find('span.current').css('opacity', '0');
And comment out the gallery click action here, so that your user can just use the normal link wrapping the image:
newSlide.find('a')
.append(imageData.image)
//.click(function(e) {
//gallery.clickHandler(e, this);
//})
;
yep - at http://prestondentalgroup.com.au/downloads.html
The hyperlinks on the slide images allow viewer to open/save a PDF doc.
Works nicely (once I deciphered how to write example_path and to substitute /project/ with the URL of the PDF file (including subfolders).
So to link to readme.pdf from the site's images/downloads/ folder,
example_path becomes images/downloads/readme.pdf
and
/project/ becomes http:/prestondentalgroup.com.au/