I wrote a file browser in XAML/C#.
Files are listed in a listView
<ListView Margin="230,0,0,0" Name="listViewContent" ItemsSource="{Binding ContentCollection}">
<ListView.View>
<GridView>
<GridViewColumn Header="Title" Width="290">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Image}" Height="15" Width="15"/>
<TextBlock Text="{Binding Title}" />
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
When the collection is populate, I get the state of each files, in order to know those that are locked : (method from the item class)
public void GetState()
{
try
{
// Get the stateInfo
StateInfo stateInfo = iStateInfoService()).GetStateInfo(itemID);
// Check if the file is locked
if (stateInfo.IsLocked)
{
if (stateInfo.UserName == tConnectionInfoSingleton.Instance().Username)
{
Image = MyRessourceDictionnary["KeyImage"] as BitmapImage;
}
else
{
Image = MyRessourceDictionnary["LockImage"] as BitmapImage;
}
}
}
catch (Exception)
{
}
}
Here are the lines in the RessourceDictionnary :
<BitmapImage x:Uid="KeyImage" x:Key="KeyImage" UriSource="Images/Key.png"/>
<BitmapImage x:Uid="LockImage" x:Key="LockImage" UriSource="Images/Lock.png"/>
Everything works fine on my computer. But it fails on 2 other computers. It doesn't fail when there is no locked file.
I don't understand why it works on my computer and doesn't on others.
My project is compiled with .Net 3.0. On every comuter, .Net 3.5 SP1 is installed.
Is there something missing ?