I am working on a barcode reader app for Android and Windows. On Android, I receive a system broadcast for every barcode scanned, but on Windows the typical configuration is a keyboard entry sent from the barcode scanner. So what I am trying to do is capture the KeyDown/KeyPress event so that I can add all characters received into a temporary string and then submit to my app as a "barcode read event" as soon as "Enter" is received.
However, I am unable to find KeyDown/KeyPressed events in any of the controls. Is that possible at all? If so, where do I look? The closest (I think) I have gotten is this description of how to use the App lifecycle events: https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/app-lifecycle
Thanks and best regards,
Joerg.
If you are using an Entry you don't need to read all keys, instead you can subscribe to Completed event witch is fired when Enter is readed into the Entry.
So many barcode readers can be configured to insert Enter as last part of barcode readed.
MyBarcodeReader()
{
MyBarCodeEntry.Completed += MyBarCodeEntry_Completed;
}
private void MyBarCodeEntry_Completed(object sender, EventArgs e)
{
/// Do your JOB
}
For windows it is better to hook into the native keyboard system, which makes sure you always receive input.
When using an Entry you're never sure that an entry has focus and is capable of receiving input.
A great tool for this is SharpHook.
Related
I am building an appointment scheduling web app (calendar like) that allows users to leave voice messages (explanations) at certain time points that others can retrieve remotely at their convenience. It works well on PC but I can't get it to work on mobiles anymore. Apparently new security context standards are in place (WebRTC?) and a Secure Context must be provided, but though I am using HTTPS (SSL Site/Domain), I can't get it to work in any of the major browsers. How else can I provide such a Secure Context?
The code I attach is quite popular and used to work well (it still does on laptops!). What can I do to provide the right context on mobile-phones (IOS, Android, Tablets)? Thank you for any help.
navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
//console.log("getUserMedia() success, stream created, initializing Speakit_recorder.js ...");
audioContext = new AudioContext();
//update the format
/* assign to gumStream for later use */
gumStream = stream;
/* use the stream */
input = audioContext.createMediaStreamSource(stream);
/* Create the Recorder object, configure to record mono sound(1channel). Recording 2channels will double the file size */
rec = new Recorder(input,{numChannels:2})
//start the recording process
rec.record();
//console.log("Recording started");
}).catch(function(err) {
//do whatever is necesssary if getUserMedia() fails
});
This might be due to the autoplay changes that landed in Chrome 71. See https://developers.google.com/web/updates/2017/09/autoplay-policy-changes as well as https://bugs.chromium.org/p/chromium/issues/detail?id=835767 for details.
You might want to log audioContext.state is 'running'. If not, you need to call audioContext.resume() on a user action (such as a button click)
I am writing a c# code to test UI in my application. I want to send ENTER from Keyboard.
I already checked TestStack.White.WindowsAPI.KeyboardInput.SpecialKeys. It doesnt contain any method send ENTER.
Thanks.
Any reason you can't use KeyboardInput.SpecialKeys.RETURN ? It should do the same thing and get you what you need.
When running a Unity project as a WebGL app is there way to catch the site's input events (e.g. keypress) once the application is running?
Currently once the Unity app launches it eats keyboard events so that I can't type in to my text boxes on the page. The best workaround I could come up with is to use jQuery to directly read the keypress event:
$('#input_message').keypress(function(evt){
event.preventDefault();
var code = evt.keyCode || evt.which;
var key=String.fromCharCode(code);
$('#input_message').val($('#input_message').val() + key);
});
};
This works for my immediate needs but I'm hoping there is a cleaner way through the Unity API.
Versions
Chrome v43
Unity 5.1.1f1
I would make this a comment if I had enough points but:
You could have your game send the inputs to your site via websockets. I've done similar things with Azure + SignalR
This question has no solution, so if someone comes up here, there is a short path:
By default, Unity WebGL will process all keyboard input send to the page, regardless of whether the WebGL canvas has focus or not. This is done so that a user can start playing a keyboard-based game right away without the need to click on the canvas to focus it first. However, this can cause problems when there are other HTML elements on the page which should receive keyboard input, such as text fields - as Unity will consume the input events before the rest of the page can get them. If you need to have other HTML elements receive keyboard input, you can change this behavior using the WebGLInput.captureAllKeyboardInput property.
This was taken from here.
The property you are looking for is WebGLInput.captureAllKeyboardInput.
Everything about the uploader is working perfectly, but one callback seems to do nothing:
.bind('fileuploadchange', function (e, data) {
console.log("foo");
})
Binding to the change event never returns anything... so my question:
1) Is this a bug? I'm using the most recent version.
2) Is there another/better way to detect when files are manually removed from the upload queue (something more elegant than reading DOM elements)?
There might be a bit of misunderstanding in what the fileuploadchange event does.
The admittedly limited documentation for the change event states:
Callback for change events of the fileInput collection.
That means it's an event callback for the native change event of all the file input elements of the fileupload widget.
This event only fires if the user selects one or more files via the file picker dialog that is displayed after clicking on the file input button.
Technically, the basic fileupload library doesn't keep track of a queue.
It's up to the UI implementation to handle this, via the various callbacks provided by the basic library.
Until the user actually starts the file upload, there is technically nothing the basic library could keep track of.
And as soon as a file upload is started, the done and fail events are your basic building blocks.
By the way, the sample UI implementation handles the removal of items that have not been started yet by triggering a manual fail event.
this record plugin stops to work for us with current version of chrome under macOS
Chrome: Version 23.0.1271.97
MacOS: 10.8.2
http://connect.soundcloud.com/examples/recording.html
how to reproduce:
click record
allow using your microphone
-> recording don't start
(In fact sometimes it works (20% of cases for me))
and also sometimes there is an error in console
PepperFlashPlayer.plugin: 0x2A052 is not valid resource ID.
Please help us, we use it for production and a lot of users can not record sound
regards, Dmitry
My investigation show:
sometimes the "SampleDataEvent.SAMPLE_DATA" event not triggered (or not assigned) in flash.
To solve this issue I do:
Added to event handler "StatusEvent.STATUS" (or call manually if microphone unmuted):
tti = setInterval(applySampleData, 100);
Added function:
protected function applySampleData() : void {
microphone.removeEventListener(SampleDataEvent.SAMPLE_DATA, recordSampleDataHandler);
microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, recordSampleDataHandler);
}
And in function "recordSampleDataHandler" (it's SampleDataEvent.SAMPLE_DATA listener):
if(tti) { clearInterval(tti); tti = 0; }
Try this.