Good Day
I am creating toast notifications from within a PowerShell script and there is a "more information" button that I have added as an action.
<toast>
<actions>
<action arguments="http://google.com" content="more information" activationType="protocol" />
<action arguments="dismiss" content="" activationType="system"/>
</actions>
</toast>
This works fine however it launches Microsoft Edge Chromium without bringing it to the foreground. So if you already have Edge open it feels at first glance like clicking the button on the notification did nothing. The page does open, just not in your face like you'd hope when asking for "more information". I am hoping to have it show up on top and right in your face as my users vary WILDLY in skill/knowledge.
I am looking for a solution where I can do one of the following:
Have something in PowerShell know that the user clicked that button and action the request manually with code rather than letting Windows handle it.
Have the button bring the website to the top.
Create a custom protocol that performs the action differently. I read something loose about this however was not able to understand what was meant by it, and it was just an off hand comment with no context, only including it in case it inspires someone more knowledgably then myself.
I thought at first it may be behavior related to Edge itself however typing "http://google.com" into a Windows Run Dialog absolutely brings it to the front. (as I expect it too)
In case its a factor. PowerShell 5.1 is preferred however 7 is an option for me.
Thanks for any help you may be able to provide.
---Addtional Info---
This is for all sites launched from a toast notification using this method. I unfortunately do not have anything to use to test a non custom notification to see if it does the same thing or not.
The XML above is used to create the toast notification. Here is the PowerShell code that might help make more sense of it.
$ToastTitle = "TOAST NOTIFICATION"
$Signature = "From TEAMNAME"
$BannerImage = "C:\temp\toast-test\toast.jpg"
$EventTitle = "Testing Title"
$EventText = "This is where there would normally be info. This is just a test though."
$site = "http://google.com/"
$MoreInfoTitle = "More Information"
$FirstName = (net user $env:USERNAME /domain | Select-String "Full Name").ToString().Split(",")[-1].trim()
if ($FirstName) {
$CustomHello = "$CustomHello $FirstName"
}
#Specify Launcher App ID, the App that will claim ownership of the toast notification, doesn't affect functionality.
$LauncherID = "AppName"
#Load Assemblies
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
#Build XML Template
[xml]$toastTemplate = #"
<toast duration="long" scenario="reminder">
<visual>
<binding template="ToastGeneric">
<text>$CustomHello</text>
<text>$ToastTitle</text>
<text placement="attribution">$Signature</text>
<image placement="hero" src="$BannerImage"/>
<group>
<subgroup>
<text hint-style="title" hint-wrap="true" >$EventTitle</text>
</subgroup>
</group>
<group>
<subgroup>
<text hint-style="body" hint-wrap="true" >$EventText</text>
</subgroup>
</group>
</binding>
</visual>
<audio src="ms-winsoundevent:notification.default"/>
</toast>
"#
[xml]$ToastActionSnooze = #"
<toast>
<actions>
<input id="SnoozeTimer" type="selection" title="Select a Snooze Interval" defaultInput="15">
<selection id="15" content="15 Minutes"/>
<selection id="30" content="30 Minutes"/>
<selection id="60" content="1 Hour"/>
<selection id="120" content="2 Hours"/>
<selection id="240" content="4 Hours"/>
</input>
<action arguments="$site" content="$MoreInfoTitle" activationType="protocol" />
<action activationType="system" arguments="snooze" hint-inputId="SnoozeTimer" content="" id="test-snooze"/>
<action arguments="dismiss" content="" activationType="system"/>
</actions>
</toast>
"#
[xml]$ToastAction = #"
<toast>
<actions>
<action arguments="$site" content="$MoreInfoTitle" activationType="protocol" />
<action arguments="dismiss" content="" activationType="system"/>
</actions>
</toast>
"#
#If the Snooze parameter was passed, add additional XML elements to Toast
If ($Snooze) {
[void]$ToastTemplate.toast.AppendChild($ToastTemplate.ImportNode($ToastActionSnooze.toast.actions, $true))
}
else {
[void]$ToastTemplate.toast.AppendChild($ToastTemplate.ImportNode($ToastAction.toast.actions, $true))
}
#Prepare XML
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::New()
$ToastXml.LoadXml($ToastTemplate.OuterXml)
#Prepare and Create Toast
$ToastMessage = [Windows.UI.Notifications.ToastNotification]::New($ToastXML)
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($LauncherID).Show($ToastMessage)```
You nearly had it right. Just take this LauncherId
$LauncherID = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
and use this last line of code:
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($LauncherID).Show($ToastMessage)
Related
I'm creating Xamarin.Forms App and it has a service that runs in the background monitoring if any messages arrive. If a message arrives, the service should open the App.
I tried to open the App using Intent (Dependency Service) and I also tried using Xamarin.Essentials. Neither way worked.
My last attempt was with Xamarin.Essentials and gave the following error:
[Error][1]
[1]: https://i.stack.imgur.com/5jPGf.png
This is my code using Intent (Dependency Service):
//Intent (Dependency Service)
string teste = "com.saferit.saferproject";
openAppManager = DependencyService.Get<IAppHandler>();
openAppManager.Initialize(teste);
openAppManager.LaunchApp();
[enter image description here][2]
[2]: https://i.stack.imgur.com/lLx3g.png
This is my native code for Android
public void LaunchApp()
{
Intent intent = new Intent();
intent.SetClassName(Package, "activity");
intent.AddFlags(ActivityFlags.NewTask);
Xamarin.Forms.Forms.Context.StartActivity(intent);
}
[Complete Native Code][3]
[3]: https://i.stack.imgur.com/G4zOV.png
This is my AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.saferit.saferproject" android:installLocation="preferExternal">
<uses-sdk android:minSdkVersion="27" android:targetSdkVersion="29" />
<!--<application android:label="SaferProject.Android"></application>-->
<application android:label="com.saferit.saferproject" android:icon="#drawable/logo">
<activity android:icon="#drawable/logo" android:label="com.saferit.saferproject" android:name="com.saferit.saferproject">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="com.saferit.saferproject" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
This is my attempt using Xamarin.Essential:
//Xamarin.Essentials
var appname = "com.saferit.saferproject://";
var supportsUri = await Launcher.CanOpenAsync(appname);
if (supportsUri)
await Launcher.OpenAsync(appname);
Looking for here at stackoverflow I found this question:
Open Notification list page when user clicks on navigation
I tried to implement it on my App but I also couldn't get it to work.
In all three cases the errors are very similar.
I think the problem is in the configuration of the URI of my App.
Can someone help me?
I am using shared view model to get values from socket across an activity, with help of observing a live-data instance, and navigation component to navigate between fragments so there's a situation where i show a payment receipt value then user clicks pay this fragment should navigate to another fragment and destroy the first one but what's actually happening it's still alive due to shared view model live-data instance that i was observing, so how to kill this fragment instance when navigating to another fragment
so first i was in trip status -> payment -> thanks
here's my navigation code
private fun updateTripStatusUI(isPayed: Boolean = false) {
if (isPayed) {
findNavController(R.id.navigationFragment).popBackStack()
findNavController(R.id.navigationFragment).navigate(
TripStatusFragmentDirections.actionTripStatusFragmentToThanksFragment()
)
} else
findNavController(R.id.navigationFragment).navigate(TripStatusFragmentDirections.actionGlobalPaymentFragment())
}
and here's my graph
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/trip_graph"
app:startDestination="#id/tripStatusFragment">
<fragment
android:id="#+id/tripStatusFragment"
android:name="package.TripStatusFragment"
android:label="fragment_trip_status"
tools:layout="#layout/fragment_trip_status">
<action
android:id="#+id/action_tripStatusFragment_to_thanksFragment"
app:destination="#id/thanksFragment"
app:enterAnim="#anim/nav_default_enter_anim"
app:exitAnim="#anim/nav_default_exit_anim"
app:popEnterAnim="#anim/popup_enter"
app:popExitAnim="#anim/popup_exit" />
</fragment>
<fragment
android:id="#+id/paymentFragment"
android:name="package.PaymentFragment"
android:label="PaymentFragment"
tools:layout="#layout/fragment_payment" />
<fragment
android:id="#+id/thanksFragment"
android:name="package.ThanksFragment"
android:label="ThanksFragment"
tools:layout="#layout/fragment_thanks" />
<action
android:id="#+id/action_global_paymentFragment"
app:destination="#id/paymentFragment"
app:enterAnim="#anim/nav_default_enter_anim"
app:exitAnim="#anim/nav_default_exit_anim"
app:popEnterAnim="#anim/nav_default_pop_enter_anim"
app:popExitAnim="#anim/nav_default_pop_exit_anim" />
</navigation>
and in ThanksFragment i navigate back to TripStatusFragment with this line
findNavController().navigate(R.id.tripStatusFragment)
I'm trying to set a test license token in an Outlook add-in. According to the documentation, I have to set it in the SourceLocation in the manifest file:
<Form xsi:type="ItemRead">
<DesktopSettings>
<SourceLocation DefaultValue="https://localhost:3000?et=%3Cr%3E%0A%20%20%3..."/>
<RequestedHeight>250</RequestedHeight>
</DesktopSettings>
</Form>
The problem is, when I try to get the URL query params, it won't work. window.location looks like this:
https://localhost:3000/?et=
Any idea why it's happening?
When I update the source location of the Action ShowTaskpane, it won't start the addin:
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="messageReadTaskPaneUrl" />
</Action>
...
<bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://localhost:3000?et=%3Cr%3E%0A%20%20%...">
If I set it like this, when I start the addin, it says:
Sorry, but we can't start this add-in because it isn't set up properly.
I use the following test token:
<r>
<t
aid="WA907006056"
pid="{4FB601F2-5469-4542-B9FC-B96345DC8B39}"
cid="32F3E7FC559F4F49"
did="{0672BAE9-B41B-48FE-87F1-7F4D3DD3F3B1}"
ts="30"
et="Trial"
ad="2012-01-12T21:58:13Z"
ed="2019-06-30T21:58:13Z"
sd="2012-01-12T00:00:00Z"
test="true"
te="2019-06-30T02:49:34Z" />
<d>VNNAnf36IrkyUVZlihQJNdUUZl/YFEfJOeldWBtd3IM=</d>
</r>
And use the following service to encode the url:
https://www.urlencoder.org/
The problem is with URL encoding. When encoding the token, you have to remove all the new lines. Otherwise, it will throw an error. So, before encoding, take the token...
<r>
<t
aid="WA907006056"
pid="{4FB601F2-5469-4542-B9FC-B96345DC8B39}"
cid="32F3E7FC559F4F49"
did="{0672BAE9-B41B-48FE-87F1-7F4D3DD3F3B1}"
ts="30"
et="Trial"
ad="2012-01-12T21:58:13Z"
ed="2019-06-30T21:58:13Z"
sd="2012-01-12T00:00:00Z"
test="true"
te="2019-06-30T02:49:34Z" />
<d>VNNAnf36IrkyUVZlihQJNdUUZl/YFEfJOeldWBtd3IM=</d>
</r>
and remove all the new lines like this:
<r> <t aid="WA907006056" pid="{4FB601F2-5469-4542-B9FC-B96345DC8B39}" cid="32F3E7FC559F4F49" did="{0672BAE9-B41B-48FE-87F1-7F4D3DD3F3B1}" ts="30" et="Trial" ad="2012-01-12T21:58:13Z" ed="2019-06-30T21:58:13Z" sd="2012-01-12T00:00:00Z" test="true" te="2019-06-30T02:49:34Z" /> <d>VNNAnf36IrkyUVZlihQJNdUUZl/YFEfJOeldWBtd3IM=</d> </r>
Finally encode it and add to all the source locations.
I have created a custom control (hidden text box with some predefined value), where I want to set visibility=false(), controlName="Mycustom", default value="This is my custom control" in XBL file. So that whenever we use that custom control from Orbeon Form Builder, it will come with all default values with no need to set anything.
XBL:
<xbl:xbl xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
<metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
<display-name lang="en">Epson Custom Controls</display-name>
</metadata>
<xbl:binding id="fr-custom" element="fr|custom" >
<metadata xmlns="http://orbeon.org/oxf/xml/form-builder">
<display-name lang="en">My Custom Control</display-name>
<icon lang="en">
<small-icon>/forms/orbeon/builder/images/input.png</small-icon>
<large-icon>/forms/orbeon/builder/images/input.png</large-icon>
</icon>
<templates>
<bind xxf:whitespace="trim"/>
<view>
<xf:input id="myCustom" ref="" xmlns="">
<xf:label>My Custom lable</xf:label>
<xf:hint ref=""/>
<xf:help ref=""/>
<xf:alert ref=""/>
</xf:input>
</view>
</templates>
</metadata>
</xbl:binding>
</xbl:xbl>
Using above control I want hidden text box with value='This is my custom control' and its control name should be Mycustom.
Update
I have tried with below changes, but it is not working
<templates>
<bind xxf:whitespace="trim" relevant="false()" xxf:default="'This is my custom control'"/>
<view>
<xf:input id="myCustom" ref="" xmlns="">
<xf:label>Success Message</xf:label>
<xf:hint ref=""/>
<xf:help ref=""/>
<xf:alert ref=""/>
</xf:input>
</view>
</templates>
With above changes now its working (control is hidden with some default value).
Can you please let me know how to put if condition
properties-local.xml:
<property as="xs:string" name="oxf.fr.detail.process.save-final-custom.*.*">
require-uploads
then validate-all
then save
if({xxf:instance('fr-form-instance')//customMessage} != null)
{
then success-message(message = "{xxf:instance('fr-form-instance')//customMessage}")
}
recover error-message("database-error")
</property>
Here I want to override this success-message if it properly configured from backed. If it's value is null then want to show OOTB message(don't override).
Update2
Integrated changes in Hybris. below are the changes I have made in Hybris
Create XBL > orbeon > custom > custom.xbl
<bind xxf:whitespace="trim" relevant="false()" xxf:default="'This is my custom control'"/>
Issue :- When we select custom control, it will bind without any lable/message/visibility etc. But if I refresh left control panel then label start appearing on the form. but still default message is not set.
Let's take the items you mentioned one by one:
visibility="false()" – I imagine you're referring to the relevant attribute in XForms, instead of the visibility attribute. (Form Builder calls this "visibility", because this is what it is, but in XForms, the attribute is relevant.) This can be done by having inside the <templates> a <bind relevant="false()"/>.
controlName="Mycustom" – You can't set the id of the control in XBL. (BTW, when using Form Builder, the XForms id is inferred from the control name defined by the form author in Form Builder.) The id is set by whoever uses the control, not whoever defines it, otherwise, for one, this would prevent you from having multiple instances of that control in the form.
default value="This is my custom control" – As in #1 above, you can do this with <bind xxf:default="'This is my custom control'">. Note the added single quotes, as the value of xxf:default is an XPath expression.
as per title, can someone help?
just an example:
<system.ftpServer>
<security>
<ipSecurity>
<add ipAddress="1.2.3.4" subnetMask="255.255.255.0" />
</ipSecurity>
</security>
</system.ftpServer>
I would like to add a tag as the first element to stop the elements delegated from its parent.
and a after as well.
So it will look like this:
<system.ftpServer>
<security>
<ipSecurity>
<clear />
<remove ipAddress="1.1.1.1" />
<add ipAddress="1.2.3.4" subnetMask="255.255.255.0" />
</ipSecurity>
</security>
</system.ftpServer>
Without resorting to xml manipulation, the following answer may help you get started with this problem:
Add a 'clear' element to WebDAV authoringRules using powershell
This approach might not be recommended but if you want to do it using xml then here is how you can do it.
$filepath = "C:\scripts\so\webdavconfig.xml"
$xml = [xml](get-Content -Path $filepath)
$elem = $xml.CreateElement("clear");
$elem2 = $xml.CreateElement("remove");
$attr = $xml.CreateAttribute("ipAddress");
$attr.Value="1.1.1.1";
$elem2.Attributes.Append($attr);
$xmlnode = $xml."system.ftpserver".security.ipSecurity
$xmlnode.AppendChild($elem);
$xmlnode.AppendChild($elem2);
$xml.Save($filepath);
$xml."system.ftpserver".security.ipSecurity