73 lines
1.5 KiB
C#

using System.IO;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Windows.Controls;
using System.Windows.Media;
namespace ShadowStream.Obejeckte;
//Quinn
public class Item
{
//public data
Label name;
string path;
string type;
BitmapImage image;
Button playButton;
bool isFoto;
//initilise the item
public Item(string path, string type, BitmapImage image, bool isFoto, RoutedEventHandler clickHandler = null)
{
this.path = path;
this.type = type;
this.name = new Label()
{
Name = "name",
Content = System.IO.Path.GetFileName(path),
HorizontalAlignment = HorizontalAlignment.Center,
Foreground = Brushes.White
};
this.image = image;
this.playButton = new Button
{
Content = isFoto ? "Show" : "Play",
HorizontalAlignment = HorizontalAlignment.Center,
Tag = path+"/"+type // Store path or any identifier
};
if (clickHandler != null)
playButton.Click += clickHandler;
this.isFoto = isFoto;
}
//return individual data
public string getLink()
{
return path;
}
public string getFormat()
{
return type;
}
public string getName()
{
return name.Content.ToString();
}
public BitmapImage getImage()
{
return image;
}
public string getType()
{
return type;
}
}