I have a kind of alarm on my App.
It's working fine, but when it finishes all I want is to pop-up the notification. I have a button to dismiss and another one to snooze. Both of them open the app once tapped. I don't want this behavior. All I need is to snooze it or dismiss it and that's it.
Is it possible?
Here is how I'm doing it:
var xmlString = #"<toast launch='args' scenario='alarm'>
<visual>
<binding template='ToastGeneric'>
<text>" + alertAction + #"</text>
<text>" + alertBody + #"</text>
</binding>
</visual>
<actions>
<action arguments = 'snooze'
content = 'Snooze' />
<action arguments = 'dismiss'
content = 'Dismiss' />
</actions>
</toast>";
var doc = new Windows.Data.Xml.Dom.XmlDocument();
doc.LoadXml(xmlString);
var toast = new ScheduledToastNotification(doc, DateTimeOffset.Now.AddMinutes(durationInMinutes), new TimeSpan(0, 0, 300), 5);
toast.Id = id;
ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast);
Your current action will generate a ToastButton type, which is normal activationType & will active the app when tapped. If you don't want to active the app, declare activationType to system.
Try to use
<actions hint-systemCommands = 'SnoozeAndDismiss' />
or add activationType="system" in each of action
<actions>
<action activationType="system"
arguments = 'snooze'
content = 'Snooze' />
<action activationType="system"
arguments = 'dismiss'
content = 'Dismiss' />
</actions>
Related
I have a problem with user controls:
My VB.Net application AppliTest uses a PlusMinus user control.
In the application, I need at some point to treat each control according to its TypeName.
This works fine before obfuscation with Obfuscar ( c.Name=PM_Large c.Type=PlusMinus ). c is the control.
After obfuscation, the instance name of my user control is correct, but the TypeName has been obfuscated ( c.Name=PM_Large c.Type=뢕 ). Note that all is correct with windows controls like Label, TextBox ...
I searched in the Obfuscar configuration possibilities without success.
Here are my settings for Obfuscar:
SkipType name="AppliTest .PlusMinus"
Var name = "KeepPublicApi" value="false"
Var name = "HidePrivateApi" value="true"
Var name = "RenameProperties" value="true"
Var name = "RenameFields" value="true"
Var name = "UseUnicodeNames" value="true"
Var name = "HideStrings" value="true"
Var name = "OptimizeMethods" value="true"
Var name = "ReuseNames" value="true"
Var name = "UseKoreanNames" value="true"
Is there a solution, either to make the type name protected, or to prevent Obfuscar from obfuscating the type name?
I have a screen with a table handling a many-to-many relationship towards an entity (simple, 2 fields) for which 1 single record is defined yet.
I created standard browser screen for the associated entity and defined openType = DIALOG for the action table "add" of the previous screen.
Then the dialog window is too much compacted in height (see screenshot below), I suppose this is because there is not enough entities to display so the height calculation is wrong.
If I do "analyse layout" on the dialog window I get the following warning :
[WARN] Nested component 'contactEmailsTable'
Nested component has relative height 100.0% inside window with undefined height
As a workaround, I tried to set manually table height in studio, no chance.
Did not see in studio where to set manually window height so I tried to redefined it through overriding of init method (see below), no chance.
#Override
public void init(Map<String, Object> params) {
super.init(params);
int unit = getHeightUnits();
float height = getHeight();
switch(unit) {
case UNITS_PIXELS:
setHeight(""+height * 1.10f+"px");
case UNITS_PERCENTAGE:
setHeight(""+Math.min(100, height + 0.10f)+"%");
}
}
Hereunder the xml of the said dialog.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
caption="msg://browseCaption"
class="com.busy.busyapp.gui.contactemail.ContactEmailBrowse"
focusComponent="contactEmailsTable"
lookupComponent="contactEmailsTable"
messagesPack="com.busy.busyapp.gui.contactemail">
<dsContext>
<collectionDatasource id="contactEmailsDs"
class="com.busy.busyapp.entity.ContactEmail"
view="_local">
<query>
<![CDATA[select e from busyapp$ContactEmail e]]>
</query>
</collectionDatasource>
</dsContext>
<layout expand="contactEmailsTable"
spacing="true">
<filter id="filter"
applyTo="contactEmailsTable"
datasource="contactEmailsDs">
<properties include=".*"/>
</filter>
<table id="contactEmailsTable"
presentations="true"
width="100%">
<actions>
<action id="create"/>
<action id="edit"/>
<action id="remove"/>
<action id="excel"/>
</actions>
<columns>
<column id="label"/>
<column id="email"/>
</columns>
<rows datasource="contactEmailsDs"/>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn"
action="contactEmailsTable.create"/>
<button id="editBtn"
action="contactEmailsTable.edit"/>
<button id="removeBtn"
action="contactEmailsTable.remove"/>
<button id="excelBtn"
action="contactEmailsTable.excel"/>
</buttonsPanel>
</table>
</layout>
The following examples show how to manage dialog window dimensions.
Open a screen as a dialog with defined width and height:
openEditor(entity, OpenType.DIALOG.width(480).height(320));
Set the width and height of a screen in its controller:
#Override
public void init(Map<String, Object> params) {
getDialogOptions().setWidth(480).setHeight(320);
}
The same in XML descriptor:
<dsContext/>
<dialogMode width="480" height="320"/>
<layout/>
Specify that the screen should be always opened as a dialog:
#Override
public void init(Map<String, Object> params) {
getDialogOptions().setForceDialog(true);
}
The same in XML descriptor:
<dsContext/>
<dialogMode forceDialog="true"/>
<layout/>
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);
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 repeater that creates a custom component named "Block." I need to make it so that when the user clicks a button, all of the blocks created by the repeater have their visible field set to false (and then true when the button is clicked again).
Here's some of the code I have right now:
<mx:Repeater id="indPositions" dataProvider="{projectPositions}" startingIndex="0">
<components:block height="24"
width="100%" id="thisBlock" visible="true" horizontalScrollPolicy="off"
oneDay="{oneDay}"
/>
</mx:Repeater>
Here's the button the user will click to show/hide the blocks:
<mx:Button id="showHideButton" label="Show Project" x="{addBlock.x + addBlock.width + 2}" click="showProjectSwitch();" />
Here's the function showProjectSwitch():
public function showProjectSwitch():void {
if (showHideButton.label == "Hide Project")
{
showHideButton.label = "Show Project";
indPositions.visible = false;
thisProject.height = 65;
}
else
{
showHideButton.label = "Hide Project";
indPositions.visible = true;
thisProject.height = projectHeight ;
}
}
I tried setting projectRP.visible="true/false", but it didn't work :(
I also tried wrapping a canvas around the repeater, but when I did that... the repeater only ran once despite the fact I have the startingIndex="0" and the count="16". I then removed the canvas tags and the repeater ran the correct number of times.
Anybody able to help me out?
The easiest way to achieve what you want is just to use databinding, same as you did for the "oneDay" value.
<mx:Repeater id="indPositions" dataProvider="{projectPositions}" startingIndex="0">
<components:block height="24"
width="100%" id="thisBlock" visible="true" horizontalScrollPolicy="off"
oneDay="{oneDay}"
visible="{showBlocks}"
/>
</mx:Repeater>
<mx:Boolean id="showBlocks" />
[Edit for additional clarity]
To change the visibility of the blocks, you need to set the value of showBlocks, like so:
showBlocks = true;
or
showBlocks = false;
Here's how i solved it... since the variable name of "thisBlock" is declared every time a block is made, all that information gets stored in an array. After learning this, i was able to create a for each loop in a function that was called when the show/hide button was pressed... the for each loop goes something like this:
for (var I:int = 0; i < dataprovidername.length; i++)
thisBlock[i].visible = true/flase;
Hope that can help somebody else out in the future.