-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainWindow.xaml.cs
39 lines (37 loc) · 1.29 KB
/
MainWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using FolderThumbnailExplorer.ViewModel;
using System;
using System.Collections.Generic;
using System.Windows;
namespace FolderThumbnailExplorer
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public static MainViewModel MainVM { get; private set; } = new MainViewModel();
public MainWindow(string path)
{
App.Logger.Info("Loading MainWindow and its components...");
MainVM.MainPageViewModel.PATHtoShow = path; //Command line argument.
DataContext = MainVM;
Left = Properties.Settings.Default.WindowLeft;
Top = Properties.Settings.Default.WindowTop;
Width = Properties.Settings.Default.WindowWidth;
Height = Properties.Settings.Default.WindowHeight;
InitializeComponent();
this.Closed += MainWindow_Closed;
App.Logger.Info("MainWindow loaded.");
App.Logger.Info("The Application has started and is ready to use.");
}
private void MainWindow_Closed(object? sender, EventArgs e)
{
App.Logger.Info("Closing all windows.");
//Make a copy of windows list so it won't change during the enumeration.
List<Window> windows2Close = new List<Window>(MainPageViewModel.wnds);
foreach (Window wnd in windows2Close)
wnd.Close();
App.Logger.Info("All windows closed without errors.");
}
}
}