Windows.UI.Popups.MessageDialog does not work for Windows 10 IoT - win-universal-app

await new Windows.UI.Popups.MessageDialog("Test").ShowAsync();
Has anyone else noticed this? Is there an easy work around ?

I have the some problem and I did't found any trick. I made myself a MessageDialog with a and It's not so hard to build it. Try do take a look this http://bitaware.altervista.org/messagedialog-for-iot/
The unique problem is that it do not work across platforms. If you would this behavior you have to get a condition
string platform = AnalyticsInfo.VersionInfo.DeviceFamily;
if (platform == "Windows.IoT")
{
//Your code for IoT
}
else
{
//Your code for other devices
}
I know is not elegant but I think we have no other choice.
I hope it was helpful

Related

Nodejs global hotkey execution

I was wondering if anyone could point me in the right direction. I'm building a Node app that I want to execute some hotkeys on the computer it's running on to start & stop an OBS stream based on hotkeys.
I was wondering if this is possible as I've only been able to find out of date and non-working solutions.
Thanks.
You can do it easily in AutoHotKey, but if it is Node you need, Node you'll get.
Probably quite a few Node Package Managers (NPM's) that will fit the bill, if you check github, I'm betting someone has made a little something something.
Lo and behold, I did it for you : hott - Global hotkeys for Windows, with node
Seems a tad overkill to me, using "iohook" should work wonders; hook it up in the semi-old fashion JS way of the event, something like so :
The only way I am fairly certain will work is plain and simple event listening :
const ioHook = require('iohook');
ioHook.on("keypress", event => {
if(event.keychar == 'a') {
console.log(event);
} else {
console.log("Press a");
}
});
ioHook.start();

What is more efficient one function with an if statement or two functions? (Node.js)

So I created this jsperf test which leaves me still clueless
http://jsperf.com/testing-extra-function-vs-if-statement
Basically I have two different searches and items that are able to be created, now I can have option 1:
2 functions:
export.create_item_1 ... and export.create_item_2... to be called from the clientside which is more code on the serverside but less thinking...
or option 2 is to have less code but more thinking/nesting:
export.create_item () {
var item = req.query.item;
if(item == 1) {
method1();
}
if(item == 2) {
method2();
}
}
Not sure which one is more efficient for the server side... is more code but less thinking/nesting or less code with an if statement... I am assuming option 1
I wouldn't worry about optimizations like this unless you have determined that it is a major bottleneck in your application. More likely than not, other things will be your bottleneck before issues like this.
Either way, running the jsperf in Chrome (or viewing the Chrome results from others) is all you should really need to do to answer your question.

Coded ui test in a multithreaded scenario and control not found.

As you all know Coded ui playback can be kind of slow depending on the controls you're querying.
To try and solve this issue I am looking at adding some multithreading capabilities to the test.
Here is a for loop which works successfully, now converted to a Parallel.For - only the control cannot be found (not at all).
Parallel.For(0, totalItems, (i, loopState) =>
{
DxLookup.OpenPopup();
var cell = _popupGrid.GetCell(viewName, column.ColumnName, i);
cell.DrawHighlight();
if (cell.ValueAsString == item)
{
found = true;
loopState.Stop();
}
});
The code fails on the DxLookup.OpenPopup - because the control is not found. Looks like it could be thread related.
How is it possible to access a test control from another thread then?
I am not too sure about Coded UI playback supports multi-threading capabilities check this link for playback related information
Configure Playback
you may try come other techniques to speedup the playback
what kind of app are you trying to test? if it's a winforms app multithrreading is problematic.
try testing wheter you can locate tha main app window or any kind of control. if not you'll know it's a threading problem. if you can locate any kind of control just not the desired control you'll be able to tweak the search configurations to loacte the control.
hope this helps

symfony2 get firewall name on login page

I'd want to use a login page to access different firewalls, so I need to get information about the firewall I'm logging in.
In my controller I'd use
$this->container->get('security.context')->getToken()->getProviderKey()
but as an anonymous user I don't have access to getProviderKey method.
I could also parse
_security.xxx.target_path
to get xxx firewall but I'm looking for a more general solution if it exists at all.
Any idea?
As of symfony 3.2, you can now get the current firewall configuration using the following:
public function indexAction(Request $request)
{
$firewall = $this->container
->get('security.firewall.map')
->getFirewallConfig($request)
->getName();
}
Ref: http://symfony.com/blog/new-in-symfony-3-2-firewall-config-class-and-profiler
For Symfony 3.4 I wrote this to avoid referencing the non-public "security.firewall.map" service:
$firewallName = null;
if (($firewallContext = trim($request->attributes->get("_firewall_context", null))) && (false !== ($firewallContextNameSplit = strrpos($firewallContext, ".")))) {
$firewallName = substr($firewallContext, $firewallContextNameSplit + 1);
}
(Referencing "security.firewall.map" on 3.4 will throw an exception.)
Edit: This will not work in a custom exception controller function.
I was doing a little research on this myself recently so that I could send this information in an XACML request as part of the environment.
As far as I can tell from GitHub issues like this one:
https://github.com/symfony/symfony/issues/14435
There is currently no way to reliably get the information out of Symfony except the dirty compiler pass hack suggested on the linked issue. It does appear from the conversation on these issues, they are working on making this available, however, the status is still open, so we will have to be patient and wait for it to be provided.
#Adambean's answer is pretty elegant, but I'd write it as a one-liner:
$firewallName = array_slice(explode('.', trim($request->attributes->get('_firewall_context'))), -1)[0];
The difference is that $firewallName will always be a string (which may be empty).
Also, please note that this answer (like #Adambean's) doesn't work for a firewall with a dot in its name.

can't into OnChar() when deal with WM_KEYDOWN in 'PreTranslateMessage' function

For some reason, I need to do something when I get WM_KEYDOWN message in PreTranslateMessage, So I do something like this:
if(WM_KEYDOWN == pMsg->message && pMsg->hwnd == GetSafeHwnd())
{
SendMessage(pMsg->message,pMsg->wParam,pMsg->lParam);
return TRUE;
}
After doing so, I find there is no way to get into OnChar function, It's bad.
Anybody knows why and how to solve this problem? Help will be greatly appreciated.
When you return TRUE from PreTranslateMessage() then the message won't be processed further. You do this for every keystroke, so none will be processed and can never generate a WM_CHAR message. In other words, you got what you ask for. It also looks like you are sending the message to yourself. Hard to suggest an alternative, the code doesn't make sense.
Why will you send the same message to yourself? If all you want to do is do some processing and let the message pass through all you need to do in the 'if' statement is do your processing and let the normal message chaining work. This way the message will dispatched for further processing and eventually reach your onChar.
so your code should be something like this:
void YourWnd::PreTranslateMessage(MSG *pMsg)
{
if(WM_KEYDOWN == pMsg->message && pMsg->hwnd == GetSafeHwnd())
{
processKeyDown();
}
return CWnd::PreTranslateMessage(pMsg);
}
Why PreTranslateMessage? What possible reason would you have to do it in PreTranslateMessage?
PreTranslateMessage as the name suggests pretlanslate messages containing hot/shortcut keys.
Using it as some kind of a bandage very frequently leads to disaster sooner or later.
Could you please tell us what you are trying to achieve? Somebody will be able to come up with better solution.

Resources