Hi
I tried playing midi file in my windows phone 8 app but got no result, is there a way to play midi files in my app.
when user click on the text in listbox, cmb appears that shows the play button.My midi file is in my
root folder/assets
see my code below
xaml
xaml.cs
CustomMessageBox cmb;
private void Item1_Tapped(object sender, System.Windows.Input.GestureEventArgs e)
{
// create new Stack panel
StackPanel sp = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Vertical };
//get policy text from file
string hymns = getHymn1();
//Create new label
TextBlock tb = new TextBlock()
{
Text = hymns,
TextWrapping = TextWrapping.Wrap,
FontSize = 20,
};
//Create new Scroll viewer
ScrollViewer sv = new ScrollViewer()
{
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
Height = 700,
};
// add texblock in scroll viewer
sv.Content = tb;
//Add the controls to stack panel
sp.Children.Add(sv);
cmb = new CustomMessageBox()
{
// Set its content
Content = sp,
Opacity = 15.0,
// Left button of message box Button
LeftButtonContent = "Back",
// Right button of message box
RightButtonContent = "Play" //Play MIDI file here when clicked
};
//Show the message box...
cmb.Show();
}
private string getHymn1()
{
using (StreamReader s = new StreamReader("Hymn1.txt"))
{
return s.ReadToEnd();
}
}
Kindly help
Replies
Know the answer? Post it — somebody with the same question will find it here.