/// <summary> /// Shows a window for the specified model. /// </summary> /// <param name="rootModel">The root model.</param> /// <param name="context">The context.</param> /// <param name="settings">The optional window settings.</param> public virtual void ShowWindow(object rootModel, object context = null, IDictionary <string, object> settings = null) { NavigationWindow navWindow = null; var application = System.Windows.Application.Current; if (application?.MainWindow != null) { navWindow = application.MainWindow as NavigationWindow; } if (navWindow != null) { var window = this.CreatePage(rootModel, context, settings); navWindow.Navigate(window); } else { this.CreateWindow(rootModel, false, context, settings).Show(); } }
private void StartDeriving() { Dispatcher.BeginInvoke(new Action(() => // move to UI thread { NavigationWindow root = FindRoot(); root.Navigate(new DerivingPage((page) => { OnNandFound(); PageExtension next = null; // move to next page (after the task is complete) page.Dispatcher.BeginInvoke(new Action(() => // move to UI thread again... { next = new Finish(); page.FindRoot().Navigate(next); })).Wait(); // must wait, otherwise a race condition may occur return(next); })); KeepAlive = false; })).Wait(); }
private void Application_Startup(object sender, StartupEventArgs e) { configurationRoot = new ConfigurationBuilder().AddJsonFile("Properties/appsettings.json").Build(); RuntimeSettings.PreStartAction(); InjectContainer.Init(configurationRoot, RuntimeSettings); navigationWindow = new NavigationWindow { ShowsNavigationUI = false, ResizeMode = ResizeMode.NoResize, WindowState = WindowState.Normal, WindowStyle = WindowStyle.None }; navigationWindow.Title = "Seac Runtime"; var viewModel = new ViewModels.MainPageViewModel(); MainPage mainPage = new MainPage(viewModel); viewModel.Source = new AuthPage(mainPage, new AuthViewModel(InjectContainer.Resolve <IAuthClient>(), InjectContainer.Resolve <IBaseTokenService>(), mainPage, InjectContainer.Resolve <INotificationService>())); navigationWindow.Navigate(mainPage); navigationWindow.Show(); }
public void ShowWindow(Type viewModel) { NavigationWindow navigationWindow = null; var application = Application.Current; if (application != null && application.MainWindow != null) { navigationWindow = application.MainWindow as NavigationWindow; } if (navigationWindow != null) { //Create Page navigationWindow.Navigate(CreatePage(Startup.Container.Resolve(viewModel))); } else { //Create Window var window = CreateWindow(Startup.Container.Resolve(viewModel)); window?.Show(); } }
/// <summary> /// Shows a window for the specified model. /// </summary> /// <param name="rootModel">The root model.</param> /// <param name="context">The context.</param> /// <param name="settings">The optional window settings.</param> public virtual async Task ShowWindowAsync(object rootModel, object context = null, IDictionary <string, object> settings = null) { NavigationWindow navWindow = null; var application = Application.Current; if (application != null && application.MainWindow != null) { navWindow = application.MainWindow as NavigationWindow; } if (navWindow != null) { var window = await CreatePageAsync(rootModel, context, settings); navWindow.Navigate(window); } else { var window = await CreateWindowAsync(rootModel, false, context, settings); window.Show(); } }
protected override void OnStartingUp(StartingUpCancelEventArgs e) { // Setup the application window. _window = new NavigationWindow(); _window.TopMost = true; _window.CanResize = false; _window.WindowStyle = WindowStyle.None; _window.WindowState = WindowState.Maximized; Mouse.OverrideCursor = Cursor.None; _isFirstMouseClick = true; //Navigate to your page _window.Navigate(new Uri(screenSaverPage, false, true)); _window.Show(); _window.Focus(); base.OnStartingUp(e); // Add keyboard and mouse event handlers _window.AddHandler(Keyboard.KeyDownEventID, new KeyEventHandler(DoSSKeyDown), true); _window.AddHandler(Mouse.MouseRightButtonDownEventID, new MouseButtonEventHandler(DoSSMouseRightButtonDown), true); _window.AddHandler(Mouse.MouseLeftButtonDownEventID, new MouseButtonEventHandler(DoSSMouseLeftButtonDown), true); _window.AddHandler(Mouse.MouseWheelEventID, new MouseWheelEventHandler(DoSSMouseWheel), true); _window.AddHandler(Mouse.MouseMoveEventID, new MouseEventHandler(DoSSMouseMove), true); }
void OnMenuListPage(object sender, RoutedEventArgs e) { navWindow.Navigate(new Uri("RecipeListPage.xaml", UriKind.RelativeOrAbsolute)); }
/// <summary> /// Navigates the NavigationWindow to the specified object, and waits until the Application is Idle /// </summary> /// <param name="navigationWindow">NavigationWindow to Navigate</param> /// <param name="destination">Object to Navigate to</param> internal static void NavigateToObject(NavigationWindow navigationWindow, object destination) { navigationWindow.Navigate(destination); DispatcherHelper.DoEvents(0, DispatcherPriority.ApplicationIdle); }
private void Back(object sender, RoutedEventArgs e) { _navigationWindow.Navigate(new Menu(_navigationWindow, this)); }
private void ExtractClicked(object sender, RoutedEventArgs e) { DirectoryInfo root = new DirectoryInfo(Path.Text); root.Create(); // ensure that the folder exists List <ProgressTask> tasks = new List <ProgressTask>(); if (TicketCheckbox.IsChecked == true) { DirectoryInfo ticketDir = HACGUIKeyset.GetTicketsDirectory(Preferences.Current.DefaultConsoleName); // TODO: load console name from continuous location List <string> foundTickets = new List <string>(); foreach (Nca nca in SelectedNcas.Select(n => n.Nca)) { if (nca.Header.HasRightsId) { string rightsId = nca.Header.RightsId.ToHexString(); string ticketFileName = rightsId + ".tik"; FileInfo sourceTikFileInfo = ticketDir.GetFile(ticketFileName); if (sourceTikFileInfo.Exists) { FileInfo destinationTikFileInfo = root.GetFile(ticketFileName); if (!foundTickets.Contains(rightsId)) { foundTickets.Add(rightsId); destinationTikFileInfo.CreateAndClose(); LocalFile sourceTikFile = new LocalFile(sourceTikFileInfo.FullName, OpenMode.Read); LocalFile destinationTikFile = new LocalFile(destinationTikFileInfo.FullName, OpenMode.Write); sourceTikFile.GetSize(out long size); destinationTikFile.SetSize(size); tasks.Add(new CopyTask($"Copying {ticketFileName}...", new FileStorage(sourceTikFile), new FileStorage(destinationTikFile))); } } } } } foreach (SwitchFsNca nca in SelectedNcas) { FileInfo destinationNcaFileInfo = root.GetFile(nca.Filename); destinationNcaFileInfo.CreateAndClose(); LocalFile destinationNcaFile = new LocalFile(destinationNcaFileInfo.FullName, OpenMode.Write); IStorage source = nca.Nca.BaseStorage; tasks.Add(new RunTask($"Allocating space for {nca.Filename}...", new Task(() => { source.GetSize(out long size); destinationNcaFile.SetSize(size); }))); tasks.Add(new CopyTask($"Copying {nca.Filename}...", source, new FileStorage(destinationNcaFile), false)); } ProgressView view = new ProgressView(tasks); NavigationWindow window = new NavigationWindow { ShowsNavigationUI = false // get rid of the t r a s h }; window.Navigate(view); TaskManagerPage.Current.Queue.Submit(tasks); window.Owner = Window.GetWindow(this); window.ShowDialog(); }
private void OnMenuRolodexPage(object sender, EventArgs e) { navWindow.Navigate(new Uri("RecipeRolodex.xaml", UriKind.RelativeOrAbsolute)); }
private void btn_next_Click(object sender, RoutedEventArgs e) { NavigationWindow root = FindRoot(); // Reset SDService so that it's ready for later SDService.ResetHandlers(); SDService.Stop(); root.Navigate(new DerivingPage((page) => { // setup key derivation task and execute it asynchronously on the next page Array.Copy(SBK, HACGUIKeyset.Keyset.SecureBootKey, 0x10); Array.Copy(TSECKeys[0], HACGUIKeyset.Keyset.TsecKey, 0x10); FileStream boot0 = HACGUIKeyset.TempBOOT0FileInfo.OpenRead(); boot0.Seek(0x180000, SeekOrigin.Begin); // Seek to keyblob area for (int i = 0; i < 32; i++) { boot0.Read(HACGUIKeyset.Keyset.EncryptedKeyblobs[i], 0, 0xB0); boot0.Seek(0x150, SeekOrigin.Current); // skip empty region } boot0.Seek(0x100000, SeekOrigin.Begin); List <HashSearchEntry> searches = new List <HashSearchEntry> { new HashSearchEntry(NintendoKeys.MasterKeySourceHash, 0x10), new HashSearchEntry(NintendoKeys.KeyblobMacKeySourceHash, 0x10) }; Dictionary <byte[], byte[]> hashes = boot0.FindKeyViaHash(searches, new SHA256Managed(), 0x10, 0x40000); Array.Copy(hashes[NintendoKeys.MasterKeySourceHash], HACGUIKeyset.Keyset.MasterKeySource, 0x10); Array.Copy(hashes[NintendoKeys.KeyblobMacKeySourceHash], HACGUIKeyset.Keyset.KeyblobMacKeySource, 0x10); HACGUIKeyset.Keyset.DeriveKeys(); // Copy package1 into seperate file boot0.Seek(0x100000, SeekOrigin.Begin); FileStream pkg1stream = HACGUIKeyset.TempPkg1FileInfo.Create(); boot0.CopyToNew(pkg1stream, 0x40000); boot0.Close(); pkg1stream.Seek(0, SeekOrigin.Begin); // reset position HACGUIKeyset.RootTempPkg1FolderInfo.Create(); Package1 pkg1 = new Package1(HACGUIKeyset.Keyset, pkg1stream); // Extracting package1 contents FileStream NXBootloaderStream = HACGUIKeyset.TempNXBootloaderFileInfo.Create(); FileStream SecureMonitorStream = HACGUIKeyset.TempSecureMonitorFileInfo.Create(); FileStream WarmbootStream = HACGUIKeyset.TempWarmbootFileInfo.Create(); pkg1.Pk11.OpenNxBootloader().CopyToNew(NXBootloaderStream); pkg1.Pk11.OpenSecureMonitor().CopyToNew(SecureMonitorStream); pkg1.Pk11.OpenWarmboot().CopyToNew(WarmbootStream); searches = new List <HashSearchEntry> { new HashSearchEntry(NintendoKeys.Pkg2KeySourceHash, 0x10), new HashSearchEntry(NintendoKeys.TitleKekSourceHash, 0x10), new HashSearchEntry(NintendoKeys.AesKekGenerationSourceHash, 0x10) }; SecureMonitorStream.Seek(0, SeekOrigin.Begin); hashes = SecureMonitorStream.FindKeyViaHash(searches, new SHA256Managed(), 0x10); Array.Copy(hashes[NintendoKeys.Pkg2KeySourceHash], HACGUIKeyset.Keyset.Package2KeySource, 0x10); Array.Copy(hashes[NintendoKeys.TitleKekSourceHash], HACGUIKeyset.Keyset.TitlekekSource, 0x10); Array.Copy(hashes[NintendoKeys.AesKekGenerationSourceHash], HACGUIKeyset.Keyset.AesKekGenerationSource, 0x10); HACGUIKeyset.Keyset.DeriveKeys(); // derive the additional keys obtained from package1 // close shit NXBootloaderStream.Close(); SecureMonitorStream.Close(); WarmbootStream.Close(); pkg1stream.Close(); PageExtension next = null; // move to next page (after the task is complete) page.Dispatcher.BeginInvoke(new Action(() => // move to UI thread { next = new PickNANDPage(); page.FindRoot().Navigate(next); })).Wait(); // must wait, otherwise a race condition may occur return(next); // return the page we are navigating to })); }
private void StartButtonPressed(object sender, RoutedEventArgs e) { NavigationWindow root = FindRoot(); root.Navigate(new PickConsolePage()); }