/// <summary> /// Die anzuzeigende Seite wechseln /// Erstellt neue Instanzen anstatt existierende wieder zu verwenden, da es Probleme mit dem .net Framework gab /// </summary> /// <param name="label">Der Titel der neuen Seite</param> /// <param name="pageType">Der Typ der neuen Seite</param> /// <param name="args">Parameter für den Konstruktor der neuen Seite</param> public void switchPage(string label, Type pageType, params object[] args) { try { KPage page = (KPage)Activator.CreateInstance(pageType, args); Frame frame = new Frame(); Toolbar toolbar = new Toolbar(frame, page); ScrollableFrame scrollableFrame = new ScrollableFrame(); ExtScrollViewer extScrollViewer = scrollableFrame.createScrollableFrame(frame); frame.Margin = new Thickness(15, 0, 0, 0); DockPanel.SetDock(toolbar.dpToolbarPanel, Dock.Top); frame.Content = page; page.parentFrame = frame; page.parentToolbar = toolbar; page.parentScrollViewer = extScrollViewer; page.defineToolbarContent(); this.contentPanel.Children.Clear(); this.contentPanel.Children.Add(toolbar.dpToolbarPanel); this.contentPanel.Children.Add(extScrollViewer); this.lbPageTitle.Content = label; } catch { } }
/// <summary> /// Erzeugt eine neue Seitenansicht mit einfacher Seite /// </summary> /// <param name="label">Titel der Seite</param> /// <param name="page">Instanz der anzuzeigenden Seite</param> public SinglePage(string label, KPage page) { MainWindow mainWindow = Application.Current.MainWindow as MainWindow; Frame frame = new Frame(); Toolbar toolbar = new Toolbar(frame, page); ScrollableFrame scrollableFrame = new ScrollableFrame(); ExtScrollViewer scrollViewer = scrollableFrame.createScrollableFrame(frame); DockPanel.SetDock(toolbar.dpToolbarPanel, Dock.Top); mainWindow.subNavigation.Children.Clear(); frame.Margin = new Thickness(15, 0, 0, 0); frame.Content = page; page.parentFrame = frame; page.parentToolbar = toolbar; page.parentScrollViewer = scrollViewer; page.defineToolbarContent(); mainWindow.contentPanel.Children.Clear(); mainWindow.contentPanel.Children.Add(toolbar.dpToolbarPanel); mainWindow.contentPanel.Children.Add(scrollViewer); mainWindow.lbPageTitle.Content = label; }
/// <summary> /// Erzeugt eine neue Seitenansicht mit einfacher Seite /// </summary> /// <param name="label">Titel der Seite</param> /// <param name="page">Instanz der anzuzeigenden Seite</param> public SinglePage(string label, KPage page) { MainWindow mainWindow = Application.Current.MainWindow as MainWindow; Frame frame = new Frame(); Toolbar toolbar = new Toolbar(frame, page); ScrollableFrame scrollableFrame = new ScrollableFrame(); ExtScrollViewer scrollViewer = scrollableFrame.createScrollableFrame(frame); DockPanel.SetDock(toolbar.dpToolbarPanel, Dock.Top); mainWindow.subNavigation.Children.Clear(); frame.Margin = new Thickness(15, 0, 0, 0); frame.Content = page; page.parentFrame = frame; page.parentToolbar = toolbar; page.parentScrollViewer = scrollViewer; page.defineToolbarContent(); mainWindow.contentPanel.Children.Clear(); mainWindow.contentPanel.Children.Add(toolbar.dpToolbarPanel); mainWindow.contentPanel.Children.Add(scrollViewer); mainWindow.lbPageTitle.Content = label; }