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.
Related
Context: WinRT, Universal Apps, XAML, C#
I am creating a video player application in which one of the requirements is that the video plays exclusively in fullscreen, and when the video returns from fullscreen, the video should be stopped and the user should be taken to a summary page. Currently I am using MediaElement.IsFullWindow and MediaElement.AreTransportControlsEnabled in order to play the video in fullscreen and it works perfectly well, when the video ends I grab the MediaEnded event and take the user back to the summary page, setting IsFullWindow to false and AreTransportControlsEnabled to false.
The only problem is that Transport Controls have a fullscreen button that takes the user back to the non-fullscreen layout and the video keeps on playing.
On most applications this would be great, but on this one, I need to stop the video when it happens.
Unfortunately, when this happens, IsFullWindow is not set to false, the SizeChanged event for the MediaElement is not fired and there seems to be no other notification that the user has decided to leave fullscreen mode.
So I am trapped in a situation in which I am unable to find out whether the video is truly playing in fullscreen or not.
If I pause the video and the user plays it again, since IsFullWindow is true, it will go back to fullscreen and if I let the video play to the end everything works fine and the user goes to the summary page.
Does anybody have any suggestions on how I may be able to detect this change in order to stop the video?
An alternative solution is not to use transport control provided by media element and create your own custom media controls .
See this MSDN link which explains how to create custom media transport controls
When changed IsFullWindow status fires SizeChanged of Window.Current instead of MediaElement. You just should attach to this event
Window.Current.SizeChanged += this.OnWindowSizeChanged;
and check IsFullWindow of MediaElement when it fired.
private void OnWindowSizeChanged(object sender, WindowSizeChangedEventArgs windowSizeChangedEventArgs)
{
if (!this.mediaElement.IsFullWindow)
{
}
else
{
}
}
I ended up using the Microsoft Player Framework which gives me events and properties to control all I needed without having to write my own code and incur in design work for the video player control assets.
You can overcome this issue by binding, IFullWindow MediaElement property with "TwoWay" mode, and act accordingly to its value on set :)
You may use a DispatcherTimer called every 100 ms, check the status of the IsFullWindow property, and if property value changes, fire an event or call your own function.
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
How to make a touchable notice top bar in windows phone ?
I am new to C# and windows phone world.So may be my question has a simple
way to solve,but I google a lot ,and didn't work out.
here is my purpose: I have a timer running throughout my app,it request a
service for notice info every one hour, and show a "notice bar" on the top of
screen.
it is easy to get the information ,but when I want to show them to the Page,
here is my problem:
1.
I used system tray to show my info.
It works,but then I found there is no touch or click event for Progress
Indication bar.
I even add an event to Touch.FrameReported in App.xaml.cs , but still ,
when i touch the system tray area, the event doesn't fire.
2.
Then I want to use a Dynamic way to achieve it: add a text block to the
current page
I got the current page handler ,but case I only know the current page
handler's type is PhoneApplicationPage, I can't get my Root UI element
(all my page has a root element named "LayoutRoot")
And when I try to use reflect method to get the "LayoutRoot" property,
the return value is null.
The code looks like this :
Type type = PhoneApplicationPageHandler.getType()<
//I checked,the type is my page's type
type.getProperty("LayoutRoot") or type.getField("LayoutRoot")
//they all return null
BTW: LayoutRoot is a grid, and it is described in my page's .xmal file.
Now My option is to make all my page inherit a defalut page ,in this page ,I will
implement a method to fulfill my second way to simulate a "touchable top bar".
but I think this coding is ugly .
So, can anyone tell me :
1.how to add touch event to a SystemTray
or
2.how to get a handler of an ui element which is described in xaml, while I only have a PhoneApplicationPage type handler of that page.
You may use
1) a toast prompt described here http://windowsphonegeek.com/articles/WP7-Toast-Prompt-in-depth
2)or shell toast described here http://www.c-sharpcorner.com/UploadFile/ae35ca/working-with-toast-notification-in%C2%A0windows-phone-7/ according to what suits your requirement the best. 3)You may also create a custom control which you may place on the top on your mainPage and handle its tap event accordingly.
I'm adding a syndication (RSS) feed into a Bing maps application where the data is downloaded and populated on a mouse over event. The download is super fast but of course it has to be downloaded asynchronously meaning the user won't see the tooltip populated until the next time they mouse over that tool tip. I know that, for security reasons, I shouldn't necessarily be able to emulate a mouse-over event, but I know there are other things like this where there is a workaround (for example, if a user is logging in and enters their username and password - there's a workaround so that they can press 'ENTER' without the Login/Submit button having focus).
So first I'm wondering if there's a workaround and, if not...is there an easier way to do this than emulating a synchronous download via coroutines (worth noting: MVVM can not be used here due to the way the nature of the model - Also, each pin has its own tool tip rather than a single custom tool tip where the position would be determined on mouse over via MapLayer.SetPosition)
Thanks!
figured it out - just attach a boolean property on the mouse enter event and to make sure the mouse is still over the element providing the tool tip - on mouse enter set the mouse leave bool to false and the tool tip's IsOpen property to false. When the download has completed - bind your DataContext to the object with relevant data (or however you want to go about this) then, if mouse leave bool is still equal to false, set the IsOpen property = true
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.