Its a new Month so its time for a new demo app and video and this time I wanted to have some Glide stuff to show off with of course some other stuff, but currently I’m stuck in an endless loops of ‘To continue debugging, you will need to restart debugging manually (Ctrl-Shift-F5)’ which I suspect is the result of a problem I’m having getting Glide to work the way I want. Ideally I want a List of mp3 files where I can select one to play, two sliders to control left and right volumes and a play/stop button. I think my problem is with the List of Songs as the Glide documentation mentions a List but I’m having some problems around how to do that. My Glide XML thus far looks like:
<Glide Version="1.0.4">
<Window Name="MainWindow" Width="320" Height="240" BackColor="FFFFFF">
<DataGrid Name="SongList" X="0" Y="0" Width="220" Height="240" Alpha="255" Font="4" RowCount="8" RowHeight="30" Draggable="False" TappableCells="True" SortableHeaders="True" ShowHeaders="True" ShowScrollbar="True" ScrollbarWidth="4" HeadersBackColor="707476" HeadersFontColor="FFFFFF" ItemsBackColor="FFFFFF" ItemsAltBackColor="F4F4F4" ItemsFontColor="000000" SelectedItemBackColor="FFF299" SelectedItemFontColor="000000" GridColor="BFC5C9" ScrollbarBackColor="C0C0C0" ScrollbarScrubberColor="000000"/>
<Slider Name="LeftChannel" X="240" Y="0" Width="30" Height="160" Alpha="255" Direction="vertical" SnapInterval="10" TickInterval="10" TickColor="000000" KnobSize="20" Minimum="0" Maximum="100" Value="0"/>
<Slider Name="RightChannel" X="281" Y="0" Width="30" Height="160" Alpha="255" Direction="vertical" SnapInterval="10" TickInterval="10" TickColor="000000" KnobSize="20" Minimum="0" Maximum="100" Value="0"/>
<Button Name="Play" X="228" Y="180" Width="84" Height="54" Alpha="255" Text="Play" Font="4" FontColor="000000" DisabledFontColor="808080" TintColor="000000" TintAmount="0"/>
</Window>
</Glide>
and then my code to process this stuff look like:
GlideTouch.Initialize();
// Load the Window XML string.
_window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.GlideConfig));
// Resize any loaded Window to the LCD's size.
Glide.FitToScreen = true;
// Assign the Window to MainWindow; rendering it to the LCD.
Glide.MainWindow = _window;
//Get GUI elements
_play = (GHIElectronics.NETMF.Glide.UI.Button)_window.GetChildByName("_play");
_leftChannel = (GHIElectronics.NETMF.Glide.UI.Slider)_window.GetChildByName("LeftChannel");
_rightChannel = (GHIElectronics.NETMF.Glide.UI.Slider)_window.GetChildByName("RightChannel");
_songList = (GHIElectronics.NETMF.Glide.UI.DataGrid)_window.GetChildByName("SongList");
DataGridColumn Songs = new DataGridColumn("Songs", 220);
_songList.AddColumn(Songs);
// Set up event handlers
_play.TapEvent += new OnTap(Play_TapEvent);
_leftChannel.ValueChangedEvent += new OnValueChanged(LeftChannel_ValueChangedEvent);
_rightChannel.ValueChangedEvent += new OnValueChanged(RightChannel_ValueChangedEvent);
_songList.TapCellEvent += new OnTapCell(_songList_TapCellEvent);
I suspect my problem is in setting up the GridData / List
I’m hopping once I have this configured correctly that I can load the list of songs with something like
private void loadSongList()
{
if (sdCard.IsCardMounted)
{
_songList.Clear();
string[] files = sdCard.GetStorageDevice().ListRootDirectoryFiles();
foreach (string file in files)
{
object[] item = new object[1] {file};
DataGridItem song = new DataGridItem(item);
_songList.AddItem(song);
}
}
}
Typically I don’t use Glide so this has been a bit of a learning experience for me which is great as it expands my Gadgeteer skill set, but of course suggestions on how to solve this problem appreciated.
Note I’m using a T35 with a Hydra mainboard.