How to disable universal volume controls in a page - c#

My app plays a track in the background with AudioPlayerAgent and the user can move between pages.
The problem is that I don't want the universal volume controls appear in one of those pages when the user presses the physical volume button. just like how we disable System Tray shell:SystemTray.IsVisible="False". Is it possible?
there is a way to set which controls appear when assigning the track, but this doesn't help in my case:
EnabledPlayerControls controls = EnabledPlayerControls.Pause |
EnabledPlayerControls.Rewind |
EnabledPlayerControls.FastForward;
AudioTrack track = new AudioTrack(
trackUri,
trackTitle,
trackBy,
trackAlbum,
trackAlbumArtUri,
trackTag,
controls);

The experience is intentional that the volume control display is presented in a consistent cross-application experience when the volume buttons are pressed.
There currently is no API for overriding this behavior.
The same is true for example on Windows 8+ (the Volume indicator is now system defined and cannot be overridden/hidden).

From what i found it's not so much appear but be enabled or disabled.
here is the sample code
AudioTrack track = new AudioTrack(
trackUri,
trackTitle,
trackBy,
trackAlbum,
trackAlbumArtUri,
trackTag,
EnabledPlayerControls.None);
Hope it helps

Related

How to simulate keystroke in WPF, but outside the application?

Currently I used this snip code as a result from googling.
var eventArgs = new TextCompositionEventArgs(Keyboard.PrimaryDevice,
new TextComposition(InputManager.Current, Keyboard.FocusedElement, "A"));
eventArgs.RoutedEvent = TextInputEvent;
var flag = InputManager.Current.ProcessInput(eventArgs);
It was working if I used Keyboard.Focus(TxtBox); and the TxtBox will be filled with the Keystroke.
But what I want really achieved is:
1.Drawing a box (for example, I draw box on one of the excel cell)
2.Click on the box coordinate (to change Keyboard Focus)
3.Send Keystroke to clicked excel cell
I have done step 1 and 2.
But I can't find a way to do the third step.
Somehow, the click event (using mouse event) maybe not changing Keyboard Focus automatically.
So, how do I change Keyboard focus, if possible using coordinate ?
Or maybe can I get IInputElement from a coordinate ? and then set keyboard focus to it.
Of course, all of it outside from the main application window of the WPF.
Found it !
At:
Installed InputSimulator via NuGet, no members accessible
It is working in most cases.
I said in most cases, because it is able to type in other window like excel application, but on other custom app window. There might be a case it won't work.
Hope it help for other people, looking for the same thing.

How to prevent auto closing of soft input panel in UWP?

I am facing an unexpected behavior of Keyboard showing and hiding in UWP app working on tablet with windows 10.
After carefully testing again and again i noticed that this issue comes when you have focus on input box and keyboard is opened for it. Now focusing next input needs layout adjustment so that it should not be hidden by keyboard. When you try to focus next element, by default previously opened keyboard hides and now i'm not able to open keyboard un till this new input box lose focus and manually gain focus again.
So for controlling this issue i want to prevent automatic hide and show of keyboard every time i switch focus to new textbox. It should open keyboard once the page load (already found solution using InputPane) and hiding should only be by clicking cancel (x) button.
Please check this video for clearly understanding the issue.
https://www.dropbox.com/s/1c876uwytywio1t/Soft%20Keyboard%20Issue.mp4?dl=0
Please vote this suggestion if anyone else is also facing this issue.
https://wpdev.uservoice.com/forums/110705-universal-windows-platform/suggestions/34170142-inputpane-does-not-open-when-focus-is-shifted-to-n
This issue has been partially resolved in windows 10 version 1803 released on 30th April, 2018. In this version InputPane does not hide and show again and again when focus is shifted from one input element to other.
You may try to put a horizontal-stretched placeholder control (let say, StackPanel) at the bottom of your page, then let it the same size the on-screen keyboard does. That could prevent uncontrolled auto-hide trigger being fired (at least I did that trick on UWP mobile app):
// on the window initialization, remember the input pane
this._inputPane = InputPane.GetForCurrentView()
// then, subscribe to the events
_inputPane.Showing = (sender, args) =>
{
args.EnsuredFocusedElementInView = true; // skip default vertical-shift behavior
this._placeholderPane.Height = args.OccludedRect.Height;
}
_inputPane.Hiding = (sender, args) =>
{
this._placeholderPane.Height = 0;
}
Hope it helps on the Win10 desktop same way as it was on mobile one.
P.S. Yes, initially the placeholder pane is zero-height and collapsed.

How can I disable the virtual keyboard for all my WPF apps?

I saw method to do this for current control but I need to do it for all app. I have touch scren and when i click on some textbox virtual keyboard from windows 7 shown. I don't need it because i how own keyboard in program.
Please help.
Thanks.
Not sure if you got an answer in the few months the question was online, but this worked for me.
First, you need a reference to Microsoft.Ink.dll.
var handle = new WindowInteropHelper(this).Handle;
TextInputPanel panel = new TextInputPanel(handle);
panel.InPlaceVisibleOnFocus = false;
That first line gets a Handle to the window of your app, and then you just need to create the TextInputPanel object and set it's InPlaceVisibleFocus to false. This will no longer show the TIP icon when a textbox is touched.

Disable next/prev buttons in Universal Volume Control (uvc) when using AudioPlayerAgent

I'm currently working on an radio app for WP7 Mango and I want to disable the next and the previous track buttons in the UVC like last.fm did in their app, but I can't figure out how.
Can someone help me with this?
You can select which controls are active in the UVC when you create the track to play in your agent (i.e. from the code which handles the TrackEnded event in the Background Audio Agent).
For example:
EnabledPlayerControls controls = EnabledPlayerControls.Pause |
EnabledPlayerControls.Rewind |
EnabledPlayerControls.FastForward;
AudioTrack track = new AudioTrack(
trackUri,
trackTitle,
trackBy,
trackAlbum,
trackAlbumArtUri,
trackTag,
controls);
...
return track
This will allow you to be able to make the agent skip tracks when your application wants, but Skip won't work by tapping the buttons on the UVC.
(In this example if the user taps and holds the fast-forward and rewind buttons in the UVC, the track will still fast-forward/rewind).
If you don't supply a entire playlist, but only a single MediaHistory , the Previous/Next buttons should be automatically disabled.
The same should apply to the AudioStreamingAgent. If you wish to disable the ability to use the buttons, handle the BackgroundAudioPlayer.Instance.PlayStateChanged event, see WP7 Mango: How to handle skip next/previous from UVC outside of the Audio Playback Agent class library? for details.
Post some code, if you want more detailed help.

Five Questions regarding the use of C# / VisualStudio 2005

I've some questions .. and I really need your help.
I have an application.
First I display a splash screen, a form, and this splash would call another form.
Problem: When the splash form is displayed, if I then open another application on the top of the splash, and then minimize this newly opened application window, the splash screen becomes white. How do I avoid this? I want my splash to be displayed clearly and not affected by any application.
I'm using a DropDownList but I realized that there is 2 types of it . I found "Dropdown" which makes the text inside the DDL editable, and "DropDownList" which doesn't.
Problem: when I tried to use DropDownList control it doesn't allow me to add a default text while DropDown does so I want a DropDownList control which prevent modifying on the text and allow a default text .. what property should I use?
Can I add "?" which denotes to Help button to the FormBorder (with the minimization, maximization, and close buttons )
Can I change the colour of the Formborder from its default colour (blue) ?
One of my application functionality is to copy files from server to phone into a certain folder in memory card.
Problem : can I determine the free size of the MMC to notify the user if it's full while copying.
3) You have to set the "HelpButton" property of the form to true. However the "?" button is only visible if you deactivate the maximize and minimize buttons by setting "MinimizeBox" and "MaximizeBox" to false.
Here are a few...
1) you need to launch the window in another thread so that your app can do what it needs to do to start. When the startup finishes, signal to the splash screen that it can close itself.
2)
dropDownList.SelectedIndex = 0;
4) I would not recommend doing so. It is based on the system color scheme, which the user sets. I would not like an app to decide for itself which scheme to use.
5) if the MMC shows up as a mapped drive you could use one of these techniques
Once again there is no answer to this guys question.
Yes, do as the other guy said and launch the splash screen in its own thread.
There is only one type of ComboBox in .Net, However there is a property called DropDownStyle which sets its functionality.
Yes, I am clueless on how this one works and never needed it.
Yes you betcha, Its called non-client painting. you can find more info on it here http://www.codeplex.com/CustomerBorderForm/Wiki/View.aspx?title=Painting%20NonClient%20Area&referringTitle=Home
I Need more details on this.

Categories

Resources