private void Addd_Click(object sender, RoutedEventArgs e) { NavigationWindow windowss = new NavigationWindow(); windowss.Source = new Uri("Added.xaml", UriKind.Relative); windowss.Show(); }
void NavTo5(object sender, RoutedEventArgs args) { Application currentApp = Application.Current; NavigationWindow nw = currentApp.Windows[0] as NavigationWindow; nw.Source = new Uri("page5.xaml", UriKind.RelativeOrAbsolute); }
private void Pass_Button_Click(object sender, RoutedEventArgs e) { //DataGridRow row = sender as DataGridRow; //try //{ // var rowId = ((DTO.DTOTest)row.DataContext).TestId; // NavigationWindow navWIN = new NavigationWindow(); // navWIN.Content = new StudentPassTest(client, rowId); // navWIN.Show(); //} //catch (Exception exeption) //{ // var ex = exeption.Message; //} for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual) { if (vis is DataGridRow) { if (((System.Windows.FrameworkElement)vis).DataContext is DTOTest) { int testId = ((DTO.DTOTest)((System.Windows.FrameworkElement)vis).DataContext).TestId; NavigationWindow navWIN = new NavigationWindow(); navWIN.Content = new StudentPassTest(client, testId, mw, main, this); navWIN.Show(); mw.Visibility = Visibility.Hidden; } } } }
/// <summary> /// Initializes a new instance of the <see cref="NotifyPropertyChangedBase" /> class. /// </summary> internal WindowViewMediator([NotNull] NavigationWindow window, [NotNull] IViewModel viewModel, [NotNull] IThreadManager threadManager, [NotNull] IViewManager viewManager, [NotNull] IOperationCallbackManager callbackManager) : base(viewModel, threadManager, viewManager, callbackManager) { Should.NotBeNull(window, "window"); _window = window; }
/// <summary> /// 构造一个普通UI导航器 /// </summary> /// <param name="_PWin"></param> /// <param name="_CWin"></param> public Navigationer(P _PWin, C _CWin) { //要打开的窗口的父窗口 ParentWindow = _PWin; //要打卡的窗口 ChildWindow = _CWin; //导航窗口 NavigaionWin = new NavigationWindow(); #region 默认设置 //设置用户是否能关闭窗口 默认为不能 CanClose = true; SetCancelEventHandler(); NavigaionWin.Closing += CancelHandler; //锁定父窗口 IsLockedParentWin = true; //不显示导航栏 ShowsNavigationUI = false; //窗口默认打开位置为屏幕中央 StartupLocation = WindowStartupLocation.CenterScreen; //窗口禁止缩放 WinResizeMode = ResizeMode.NoResize; Icon = new BitmapImage(new Uri(@"Resources\Icon\SpiderProgramA.ico", UriKind.Relative)); #endregion }
public override void ShowWindow(object rootModel, object context = null, IDictionary <string, object> settings = null) { NavigationWindow navigationWindow = (NavigationWindow)null; Application current = Application.Current; if (current != null && current.MainWindow != null) { navigationWindow = current.MainWindow as NavigationWindow; } if (navigationWindow != null) { Page page = this.CreatePage(rootModel, context, settings); navigationWindow.Navigate((object)page); } else { var window = this.CreateWindow(rootModel, false, context, settings); if (settings != null && settings.ContainsKey("donotshow")) { } else { window.Show(); } } }
private void btnFamilyPack_Click(object sender, RoutedEventArgs e) { NavigationWindow navWIN = new NavigationWindow(); navWIN.Content = new FamilyPack(); //navWIN.Show(); }
/// <summary> /// Partie Administration du jeux /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdministration_Click(object sender, RoutedEventArgs e) { NavigationWindow window = new NavigationWindow(); window.Content = new AdministrationViews(); window.Show(); }
private void Button_Click_3(object sender, RoutedEventArgs e) { NavigationWindow window = new NavigationWindow(); window.Source = new Uri("Page3.xaml", UriKind.Relative); window.Show(); }
protected override void OnStartup(StartupEventArgs e) { var gamePage = new GamePage { DataContext = new GamePageViewModel() }; var boardEditor = new BoardEditor { DataContext = new BoardEditorViewModel(Board.DefaultBoard(Variant.AmericanCheckers)) }; var rules = new Rules { DataContext = new RulesViewModel() }; var board = new MainPage(gamePage, boardEditor, rules); MainWindow = new NavigationWindow { Content = board, ShowsNavigationUI = false }; MainWindow.Show(); }
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); destinationTikFile.SetSize(sourceTikFile.GetSize()); 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(() => { destinationNcaFile.SetSize(source.GetSize()); }))); tasks.Add(new CopyTask($"Copying {nca.Filename}...", source, new FileStorage(destinationNcaFile))); } 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 OpenFoodEditPage() { NavigationWindow window = new NavigationWindow(); window.Source = new Uri("FoodEditPage.xaml", UriKind.Relative); window.Show(); }
/// <summary> /// This method shows the final score to the user, and store it in a file if it's a nre record. /// </summary> private void CheckScoreAndFinish() { string newRecord = ""; List <int> recordList = TextTools.GetRecords(); int[] records = recordList.ToArray(); if (records != null && records.Count() > 0) // modify the array to include the new value if it's a record. { if (records.All(x => x < Score)) { recordList.Insert(0, Score); TextTools.SaveRecords(recordList.ToArray()); newRecord = " You got a new record!"; } } else { TextTools.SaveRecords(new int[] { Score }); newRecord = " You got a new record!"; } MessageBox.Show($"You finished the game with a score of: {Score}." + newRecord, "Congratulations!"); Threading.Invoke(() => { NavigationWindow mainWindow = Application.Current.MainWindow as NavigationWindow; mainWindow.NavigationService.Navigate(new StartView()); }); }
private async void btnLogin_Click(object sender, RoutedEventArgs e) { DesktopLogin.Username = txtUsername.Text; DesktopLogin.Password = pwdPassword.Password; int?userID = await DesktopLogin.Authenticate(); // User ID >= 0 means the user exists if (userID != null) { // User ID == 0 means the user exists but is not verified yet by the admin if (userID == 0) { MessageBox.Show(LangResource.NotVerifiedYet); } // Succesful login else { NavigationWindow naviWindow = new NavigationWindow((int)userID); naviWindow.Show(); newWindow = true; this.Close(); } } // Login failed else { MessageBox.Show(LangResource.LoginFailedWPF); } DesktopLogin.Password = null; pwdPassword.Password = null; }
private void btnCombo_Click(object sender, RoutedEventArgs e) { NavigationWindow navWIN = new NavigationWindow(); navWIN.Content = new Combo(); //navWIN.Show(); }
/// <summary> /// Demarrage du jeux /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDemarrer_Click(object sender, RoutedEventArgs e) { NavigationWindow window = new NavigationWindow(); window.Content = new ChoosePartyViews(); window.Show(); }
private void btnAdmin_Click(object sender, RoutedEventArgs e) { NavigationWindow navWIN = new NavigationWindow(); navWIN.Content = new Employee(); //navWIN.Show(); }
public static void NavigateTo(object navigationTarget) { NavigationWindow win = (NavigationWindow)Application.Current.MainWindow; win.Content = navigationTarget; win.Show(); }
private async void btnSave_Click(object sender, RoutedEventArgs e) { try { // Encrypts the user password NewDesktopUser.EncryptedPassword = Encryption.EncryptPassword(NewDesktopUser.Salt, pwdPassword.Password); try { // Create new user NewDesktopUser = _userRepo.Add(NewDesktopUser); await _userRepo.SaveChangesAsync(); } catch (Exception) { MessageBox.Show(LangResource.ErrSaveFailedContent, LangResource.ErrSaveFailedTitle); NewDesktopUser.EncryptedPassword = null; pwdPassword.Password = null; } // Opens up the mainwindow NavigationWindow naviWindow = new NavigationWindow(NewDesktopUser.ID); naviWindow.Show(); this.Close(); } catch (Exception) { // TODO ERROR MESSAGE pwdPassword.Password = null; throw; } }
/// <summary> /// Initializes a new instance of the <see cref="FrameNavigationService" /> class. /// </summary> public WindowNavigationService([NotNull] NavigationWindow window, Func <Type, object> viewFactory) : this(window) { Should.NotBeNull(viewFactory, "viewFactory"); _useUrlNavigation = false; _viewFactory = viewFactory; }
public override void ShowWindow(object rootModel, object context = null, IDictionary <string, object> settings = null) { NavigationWindow navWindow = null; if (Application.Current != null && Application.Current.MainWindow != null) { navWindow = Application.Current.MainWindow as NavigationWindow; } if (navWindow != null) { var window = CreatePage(rootModel, context, settings); navWindow.Navigate(window); } else { var window = GetExistingWindow(rootModel); if (window == null) { window = CreateWindow(rootModel, false, context, settings); _windows.Add(new WeakReference(rootModel), new WeakReference(window)); window.Show(); } else { window.Activate(); window.Focus(); } } }
private void NextButtonClick(object sender, RoutedEventArgs e) { NavigationWindow root = FindNavigationWindow(); // 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 HACGUIKeyset.Keyset.DeriveKeys(); 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.FindNavigationWindow().Navigate(next); })).Wait(); // must wait, otherwise a race condition may occur return(next); // return the page we are navigating to })); }
private bool CheckIfExistNavigationWindow() { if (navigationWindow != null) { return(true); } navigationWindow = (NavigationWindow)Application.Current.MainWindow; if (navigationWindow != null) { // Could be null if the app runs inside a design tool navigationWindow.Navigating += (s, e) => { if (Navigating != null) { Navigating(s, e); } }; return(true); } return(false); }
public void navigateWindowPage(object sender, RoutedEventArgs e) { NavigationWindow window = new NavigationWindow(); window.Source = new Uri("Page1.xaml", UriKind.Relative); window.Show(); }
private void common_rail_injector_Click(object sender, RoutedEventArgs e) { //this.Content = new Pages.Common_Rail_Injector(); if (!CheckWindow()) { string message = "请关闭已开启的检测窗口,同时只允许存在一个检测窗口"; MessageBoxResult dr = MessageBox.Show(message, "提示", MessageBoxButton.OKCancel, MessageBoxImage.Information); if (dr == MessageBoxResult.OK) { return; } return; } //可以实现 NavigationWindow window = new NavigationWindow(); window.Source = new Uri("Pages/Common_Rail_Injector.xaml", UriKind.Relative); window.Height = 1100; window.Width = 1500; /*open NavigationWindow +1s*/ (Application.Current as App).WindowCount++; window.Show(); }
void m_MenuAbout_Click(object sender, RoutedEventArgs e) { var win = new NavigationWindow(); win.Content = new AboutPage(); win.Width = 360; win.Height = 280; win.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; win.Show(); win.NavigationFailed += (w, arg) => arg.Handled = true; bool isFirst = true; win.Navigated += (w, arg) => { if (!isFirst) { win.WindowState = System.Windows.WindowState.Maximized; } isFirst = false; }; win.KeyDown += (w, arg) => { if (arg.Key == Key.Escape || arg.Key == Key.Enter) { win.Close(); } }; }
//NOTE: Don't use IoC to avoid additional dependencies. private void InitializePresenters(bool isRunOnStartup) { NavigationWindow navigationWindow = new NavigationWindow(new PresentationService()); MainWindow = navigationWindow; IRegistryService registryService = new RegistryService(); ISettingsSerializer settingsSerializer = new SettingsSerializer(registryService); IPresenter navigationPresenter = new NavigationPresenter(navigationWindow, settingsSerializer, new KeyboardListener(), new MatchModelMapper(), new PresentationService(), new NavigationServiceBuilder(isRunOnStartup)); TrayView trayView = new TrayView(); IPresenter trayPresenter = new TrayIconPresenter(trayView, settingsSerializer); SettingsWindow settingsWindow = new SettingsWindow(); IPresenter settingsPresenter = new SettingsPresenter(settingsWindow, settingsSerializer); List <IPresenter> presenters = new List <IPresenter> { navigationPresenter, trayPresenter, settingsPresenter }; _presenterManager = new PresenterManager(presenters); _presenterManager.Exited += HandleExited; }
private void AltoShaamButton_Click(object sender, RoutedEventArgs e) { NavigationWindow AltoShaamSite = new NavigationWindow(); AltoShaamSite.Source = new Uri("https://www.alto-shaam.com/en", UriKind.Absolute); AltoShaamSite.ShowDialog(); }
private void mnuRunWizard_Click(object sender, RoutedEventArgs e) { try { JobParameters parms = new JobParameters(); NavigationWindow wizard = new NavigationWindow(); Page startPage = new Wizard.WizardStartPage(ref parms); startPage.ShowsNavigationUI = false; wizard.Content = startPage; wizard.Width = startPage.Width; wizard.ShowDialog(); if (parms.isValid) { this.jobList.Add(parms); grdJobList.Items.Refresh(); } Globals.patientCtx = null; Globals.eclipseAPI.ClosePatient(); wizard = null; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
void dataEntryPage_Return(object sender, ReturnEventArgs <WizardContext> e) { WizardContext dataEntryWizardContext = (WizardContext)e.Result; // Cancel Wizard if data entry page was canceled if (dataEntryWizardContext.Result == WizardResult.Canceled) { OnReturn(new ReturnEventArgs <WizardContext>(new WizardContext(WizardResult.Canceled, null))); return; } // Organize navigation direction if ((WizardNavigationDirection)dataEntryWizardContext.Data == WizardNavigationDirection.Forwards) { this.navigationOrder.Add((PageFunction <WizardResult>) new WizardPage1(this.WizardData)); this.navigationOrder.Add((PageFunction <WizardResult>) new WizardPage2(this.WizardData)); this.navigationOrder.Add((PageFunction <WizardResult>) new WizardPage3(this.WizardData)); } else { this.navigationOrder.Add((PageFunction <WizardResult>) new WizardPage3(this.WizardData)); this.navigationOrder.Add((PageFunction <WizardResult>) new WizardPage2(this.WizardData)); this.navigationOrder.Add((PageFunction <WizardResult>) new WizardPage1(this.WizardData)); } // Navigate to first page this.navigationOrder[0].Return += NavigationHub_Return; NavigationWindow host = (NavigationWindow)Application.Current.MainWindow; host.Navigate(this.navigationOrder[0]); }
//NOTE: Don't use IoC to avoid additional dependencies. private void InitializePresenters(bool isRunOnStartup) { NavigationWindow navigationWindow = new NavigationWindow(new PresentationService()); MainWindow = navigationWindow; IRegistryService registryService = new RegistryService(); ISettingsSerializer settingsSerializer = new SettingsSerializer(registryService); IPresenter navigationPresenter = new NavigationPresenter(navigationWindow, settingsSerializer, new KeyboardListener(), new MatchModelMapper(), new PresentationService(), new NavigationServiceBuilder(isRunOnStartup)); TrayView trayView = new TrayView(); IPresenter trayPresenter = new TrayIconPresenter(trayView, settingsSerializer); SettingsWindow settingsWindow = new SettingsWindow(); IPresenter settingsPresenter = new SettingsPresenter(settingsWindow, settingsSerializer); List<IPresenter> presenters = new List<IPresenter> { navigationPresenter, trayPresenter, settingsPresenter }; _presenterManager = new PresenterManager(presenters); _presenterManager.Exited += HandleExited; }