diff --git a/BackupEssentials/BackupEssentials.csproj b/BackupEssentials/BackupEssentials.csproj index b262fed..d1d8c77 100644 --- a/BackupEssentials/BackupEssentials.csproj +++ b/BackupEssentials/BackupEssentials.csproj @@ -88,6 +88,10 @@ <Compile Include="Pages\BackupLocations.xaml.cs"> <DependentUpon>BackupLocations.xaml</DependentUpon> </Compile> + <Compile Include="Pages\BackupLocationsEdit.xaml.cs"> + <DependentUpon>BackupLocationsEdit.xaml</DependentUpon> + </Compile> + <Compile Include="Pages\IPageShowData.cs" /> <Compile Include="TestingWindow.xaml.cs"> <DependentUpon>TestingWindow.xaml</DependentUpon> </Compile> @@ -113,6 +117,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Pages\BackupLocationsEdit.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Simple Styles.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> diff --git a/BackupEssentials/MainWindow.xaml.cs b/BackupEssentials/MainWindow.xaml.cs index bd352f0..1cc6fce 100644 --- a/BackupEssentials/MainWindow.xaml.cs +++ b/BackupEssentials/MainWindow.xaml.cs @@ -1,18 +1,22 @@ using BackupEssentials.Controls; +using BackupEssentials.Pages; using System; -using System.Reflection; using System.Windows; +using System.Windows.Controls; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media; namespace BackupEssentials{ public partial class MainWindow : Window{ + public static MainWindow Instance { get; private set; } + private new Rect RestoreBounds = new Rect(); private bool IsMaximized = false; public MainWindow(){ InitializeComponent(); + Instance = this; } private void ButtonWindowCloseClick(object sender, RoutedEventArgs e){ @@ -68,9 +72,17 @@ namespace BackupEssentials{ } btn.IsChecked = true; + ShowPage(GetType().Assembly.GetType("BackupEssentials."+btn.ClickPage,false)); + } - Type pageType = GetType().Assembly.GetType("BackupEssentials."+btn.ClickPage,false); - ContentFrame.Navigate(pageType == null ? null : AppPageManager.GetPage(pageType)); + public void ShowPage(Type pageType){ + ShowPage(pageType,null); + } + + public void ShowPage(Type pageType, object data){ + Page page = null; + ContentFrame.Navigate(pageType == null ? null : page = AppPageManager.GetPage(pageType)); + if (page is IPageShowData)((IPageShowData)page).OnShow(data); } } } diff --git a/BackupEssentials/Pages/IPageShowData.cs b/BackupEssentials/Pages/IPageShowData.cs new file mode 100644 index 0000000..d73e5c2 --- /dev/null +++ b/BackupEssentials/Pages/IPageShowData.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BackupEssentials.Pages{ + interface IPageShowData{ + void OnShow(object data); + } +}