I want to pair a ble device without windows UI bluetooth pairing dialog. I am using that code but still windows UI interrupts and asks for pin code again
With aw there is a popup window asking user to input PINcode on the device.
but after entering pincode and closed the popup immediately windows UI notification comes up and asks to pair the device again which I don't want.
private void CustomOnPairingRequested(DeviceInformationCustomPairing sender, DevicePairingRequestedEventArgs args)
{
this.Dispatcher.Invoke(() =>
{
this.prgbar.Value = 32;
aw.Closing += (object sendera, System.ComponentModel.CancelEventArgs e) =>
{
args.Accept(aw.pincode_text);
};
aw.Show();
There is a mention to disable auth manager but I can find out how
I can not share the code but I can give you the idea. You have to
disable Authentication Agent.
Supressing System Dialog when pairing Bluetooth devices using Win 7 or Win 10
Related
I am using wpf webview2 to build an app , the webview2 will navigate to my website which has one button to connect to audio , but i want to make it connect to audio automatically , so i tried use code like
document.getElementById("audioBtn").click(); to try to connect to audio.
But seems this doesn't work, i still have to manually click the button rather than trigger the click by script. (maybe due to some browser security policy ?)
I also tried to auto allow the permission in webview2
private void CoreWebView2_PermissionRequested(object sender, CoreWebView2PermissionRequestedEventArgs e) { e.State = CoreWebView2PermissionState.Allow; }
So how can i automatically connect to audio ? Both the WPF application and the web application is mine.. so there is no security risk..
thank you so much...
I also tried to auto allow the permission in webview2
private void CoreWebView2_PermissionRequested(object sender, CoreWebView2PermissionRequestedEventArgs e) { e.State = CoreWebView2PermissionState.Allow; }
You might be trying that click before the content is properly loaded, in which case there will be no document there or element in it.
Assuming this is the problem then you can handle the navigation completed event.
https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2.navigationcompleted?view=webview2-dotnet-1.0.1245.22
Something like:
wv2.CoreWebView2.NavigationCompleted += (s, at) =>
{
wv2.ExecuteScriptAsync("document.getElementById('audioBtn').click();");
};
Before you navigate
i create silverlight windows phone 8.1 project and i need to choose all kind of file from windows phone
i used FileOpenPicker for choose the file it redirect correctly and i can choose the file this is my code
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.List;
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add("*");
openPicker.PickMultipleFilesAndContinue();
And i follow this msdn for receiving select
In my case
if i selecting file and come back to the app its every thing working
if i without select any file and come back using mobile hardware back button my app come to home screen. but it need to stay file picker page
my first page
when i press mobile hardware back button in above screen the page redirect to my first page it need to stay in my second page
thanks
Finally i got the answer and avoid redirection
bool reset;
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
{
if(reset && e.uri.tostring().Equals("MainPage.xaml"))
{
e.Cancel = true;
reset = false
}
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
reset = e.NavigationMode == NavigationMode.Reset;
}
I'm trying to write winforms that reads data from Arduino board. CLR application does not permit threads, so I have to solve this problem with a listener. How can I trigger Listener when a data is available at the port, by using WaitCommEvent
My code is like example2 on this site
Use the DataReceived of your COM Port. User ReadLine method in your com port, example :
private:
System::Void comPort1_DataReceived(System::Object ^sender, System::IO::Ports::SerialDataReceivedEventArgs ^e)
{
System^ data = comPort1->ReadLine();
this->Invoke(gcnew EventHandler(processData));
}
System::Void processData(System::Object ^sender, System::EventArgs ^e)
{
// data receive
}
Using .Net, read this tutorial : http://www.c-sharpcorner.com/uploadfile/eclipsed4utoo/communicating-with-serial-port-in-C-Sharp/.
Does Windows Phone 8 NavigationCacheMode = NavigationCacheMode.Disabled is same as windows 8 RT NavigationCacheMode = NavigationCacheMode.Disabled?
if so then, will page that we navigate back to, is created again (constructor is called) in windows phone 8?
if page is created again then how could i reproduce this scenario in simulator (in case of wp8) ?
As far as i am aware, this does not exist in wp8. There are two ways of controlling this behavior,
1) Call any code that you wish to run every time the page loads in the On page navigated to event, as opposed to calling it in the constructor of the page. The "LoadDataFromOnNavigatedTo()" method below will always get executed when the page loads (including from lock screen)
// Constructor
public MainPage()
{
InitializeComponent();
MessageBox.Show("Data Loaded from constructor");
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
MessageBox.Show("Data Loaded from onnavigated to");
base.OnNavigatedTo(e);
}
2) Preferred option is to use an IoC container, such as the one provided in MVVMLight, and take control of when your ViewModels are instantiated. Then you can choose to instantiate them once and re-use application wide scoped, or in a transient way.
I have a game running in XNA.
In order to create the menus and dialogs I am using windows forms.
My main issue - however, is with my 'Game Over' dialog.
When you die, a message appears asking if you want to try again. When you do - it opens up another instance of xna (so you have two running).
When you select 'Try Again' I would like the first to close and to open a second one.
XNA Game1.cs
GameOver gameover = new GameOver(level, levelManager, kills);
gameover.ShowDialog();
this.Exit();
'GameOver' is the name of the windows form that displays the game over stats.
(This takes the level that the user is on and starts the game at that level)
GameOver.cs (Windows form)
private void button1_Click(object sender, EventArgs e)
{
Visible = false;
Thread thread = new Thread(() =>
{
Game1 game = new Game1(level);
game.Run();
});
thread.Start();
thread.Join();
}
Any help is much appreciated.
i'll sum up the whole thing:
You need to write a reset method that will reset the game window. you can do it by taking all the code in the contractor and put them in another method and call that method in the constructor and in the reset method. make sure you don't leave anything off the reset. any member or connection that need to be initialized.
you can also open a new window and close the current one, but that's not the right way of doing things