Hey all I am terrible at MVVM so I hope someone more knowledgeable will be able to answer my question.
I have a app that, when started, first calls the view model (App.xaml) and calls a function that passes images from a folder(s). The issue being that I am unsure how to call more than just that one call:
The code ImageSource(Path.Combine(boxPath, "box1"), TimeSpan.FromHours(1)); is what I am in need of modifying so that I can include calls for all my boxes (1-10) instead of just that one.
How would I modify this in order to call more than one box1? I'd really rather call the boxes from a viewmodel instead of inside the app.xaml but I am not sure if that's possible or not?
I have a app that, when started, first calls the view model (App.xaml) and calls a function that passes images from a folder(s). The issue being that I am unsure how to call more than just that one call:
C#:
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
string boxPath = Environment.CurrentDirectory + @"\boxes";
// set the update interval
var imageSource = new ImageSource(Path.Combine(boxPath, "box1"), TimeSpan.FromHours(1));
var viewModel = new MainWindowViewModel(imageSource);
var window = new MainWindow()
{
DataContext = viewModel
};
window.Closed += (s, a) => { viewModel.Dispose(); };
window.Show();
}
The code ImageSource(Path.Combine(boxPath, "box1"), TimeSpan.FromHours(1)); is what I am in need of modifying so that I can include calls for all my boxes (1-10) instead of just that one.
How would I modify this in order to call more than one box1? I'd really rather call the boxes from a viewmodel instead of inside the app.xaml but I am not sure if that's possible or not?