public Task Initialize(INavigationContext rootContext) { ClearNavigationHistory(); _activeFrame = new NavigationFrame { Context = rootContext }; return _activeFrame.Context.Activate(); }
public NavigatorSinglePage() { this.rootFrame = Application.Current.MainWindow.Content as NavigationFrame; this.rootFrame.Navigated += RootFrame_Navigated; }
private async void ApplicationBase_Startup(object sender, StartupEventArgs e) { this.isInitialized = true; ParamPassing.Configure(e.Args, x => { x.IsSingleInstance = this.IsSingleInstance; x.BringToFront = this.ShouldBringToFront; x.RandomSelectInstance = true; x.DataSeparator = '\n'; x.ParameterPassedCallback = new Action <string[]>(args => this.OnActivated(args)); x.ExitDelegate = () => { this.ShutdownMode = ShutdownMode.OnExplicitShutdown; this.Shutdown(); }; }); if (this.IsSingleInstance && ParamPassing.AreOtherInstanceActive) { if (ParamPassing.BringToFront()) { this.ShutdownMode = ShutdownMode.OnExplicitShutdown; this.Shutdown(); } } else { if (this.IsSinglePage) { WindowType windowType = null; var window = Common.CreateWindow(ref windowType); window.ContentTemplateSelector = new CauldronTemplateSelector(); window.MinHeight = 353; window.MinWidth = 502; window.ShowInTaskbar = true; window.Topmost = false; window.WindowStartupLocation = WindowStartupLocation.Manual; window.WindowState = WindowState.Normal; window.Icon = await UnsafeNative.ExtractAssociatedIcon(Assembly.GetEntryAssembly().Location).ToBitmapImageAsync(); window.Title = ApplicationInfo.ApplicationName; PersistentWindowInformation.Load(window, this.GetType()); window.SizeChanged += (s, e1) => { if (window.WindowState == WindowState.Normal) { PersistentWindowProperties.SetHeight(window, e1.NewSize.Height); PersistentWindowProperties.SetWidth(window, e1.NewSize.Width); } }; window.Closing += (s, e1) => PersistentWindowInformation.Save(window, this.GetType()); window.Show(); window.Content = this; window.Activate(); await this.OnPreload(); var rootFrame = new NavigationFrame(); rootFrame.DataContext = this; window.Content = rootFrame; window.InputBindings.Add(new KeyBinding(new RelayCommand(async() => { await rootFrame.GoBack(); }, () => rootFrame.CanGoBack), Key.Back, ModifierKeys.None)); } else if (this.GetType().GetCustomAttribute <ViewAttribute>() != null || Application.Current.Resources.Contains($"View_{this.GetType().Name}")) { this.Navigator.As <Navigator>()?.NavigateInternal <ApplicationBase>(this, null, null); await this.OnPreload(); Application.Current.MainWindow.Activate(); } await this.OnStartup(new LaunchActivatedEventArgs(e.Args)); this.Navigator.TryClose(this); if (Application.Current.MainWindow != null) { Application.Current.MainWindow.AddHookParameterPassing(); Application.Current.MainWindow.Activate(); } } }
private async Task ExecuteNavigationAction(PathResolution resolution) { var newFrames = (await FindNavigationFrames(resolution).ConfigureAwait(false)).ToList(); if (newFrames.Count > 0) { PushCurrentFrameOntoStack(); } foreach (var frame in newFrames) { // make frame the new active frame frame.Parent = _activeFrame; _activeFrame = frame; // activate the context await frame.Context.Activate().ConfigureAwait(false); } }
public async Task Forward() { if (_logicalForwardStack.Count > 0) { _logicalBackStack.Push(_activeFrame); _activeFrame = _logicalForwardStack.Pop(); await _activeFrame.Context.Activate(); } }
public Navigator() { this.rootFrame = Window.Current.Content as NavigationFrame; this.rootFrame.Navigated += RootFrame_Navigated; }
private void MBtnPension_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new PensionPage()); // Open Pension page in dock panel }
private void MBtnIncome_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new IncomePage()); // Open Annual page in dock panel }
public void changemainframein(int mainframekey, int direction) // direction 1 is right 2 is left { ThicknessAnimation moveinright = new ThicknessAnimation() { From = new Thickness(6200, 0, 0, 50), To = new Thickness(4200, 0, 0, 50), Duration = TimeSpan.FromMilliseconds(500), AccelerationRatio = 0.4 }; ThicknessAnimation moveinleft = new ThicknessAnimation() { From = new Thickness(2200, 0, 0, 50), To = new Thickness(4200, 0, 0, 50), Duration = TimeSpan.FromMilliseconds(500), AccelerationRatio = 0.4 }; DoubleAnimation blendin = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromMilliseconds(300) }; switch (mainframekey) { case 1: //setting if (direction == 1) { SettingFrame.BeginAnimation(Frame.MarginProperty, moveinleft); } else if (direction == 2) { SettingFrame.BeginAnimation(Frame.MarginProperty, moveinright); } SettingFrame.BeginAnimation(Frame.OpacityProperty, blendin); break; case 2: //navigation if (direction == 1) { NavigationFrame.BeginAnimation(Frame.MarginProperty, moveinleft); } else if (direction == 2) { NavigationFrame.BeginAnimation(Frame.MarginProperty, moveinright); } NavigationFrame.BeginAnimation(Frame.OpacityProperty, blendin); break; case 3: //drive if (direction == 1) { DriveFrame.BeginAnimation(Frame.MarginProperty, moveinleft); } else if (direction == 2) { DriveFrame.BeginAnimation(Frame.MarginProperty, moveinright); } DriveFrame.BeginAnimation(Frame.OpacityProperty, blendin); break; case 4: //fitness if (direction == 1) { FitnessFrame.BeginAnimation(Frame.MarginProperty, moveinleft); } else if (direction == 2) { FitnessFrame.BeginAnimation(Frame.MarginProperty, moveinright); } FitnessFrame.BeginAnimation(Frame.OpacityProperty, blendin); break; default: Debug.Print("no case called"); break; } }
private void StartUp() { NavigationFrame.Navigate(new Start()); }
public MainPage() { this.InitializeComponent(); NavigationFrame.Navigate(typeof(AccessibilityDemoPage)); }
public void GoBack(string frameName) { var navigationFrame = NavigationFrame.GetNavigationFrame(frameName); navigationFrame.GoBack(); }
private void Settings_Button_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new Settings()); }
/// <summary> /// Navigates to Custom time input menu /// </summary> private void CustomTime_Button_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new CustomTime()); }
private void NavigateNotes(object sender, TappedRoutedEventArgs e) { NavigationFrame.Navigate(typeof(Notes)); }
/// <summary> /// navigates to presets menu /// </summary> private void Presets_Button_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new Presets()); }
public void changemainframeright(int mainframekey) // int direction (1 or 2) 1 is right 2 is left { var righttransfrommain = new ThicknessAnimation() { From = new Thickness(4000, 0, 0, 0), To = new Thickness(2000, 0, 0, 0), Duration = TimeSpan.FromMilliseconds(500) }; var righttranstomain = new ThicknessAnimation() { From = new Thickness(6000, 0, 0, 0), To = new Thickness(4000, 0, 0, 0), Duration = TimeSpan.FromMilliseconds(500) }; var rightopacityfrommain = new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromMilliseconds(500) }; var rightopacitytomain = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromMilliseconds(500) }; // mainframekey: 1 is settingscreen, 2 is navigation, 3 is drivescreen, 4 is fitnessscreen //right -> nach links gewischt switch (mainframekey) { case 1: //von setting nach navigation SettingFrame.BeginAnimation(Frame.MarginProperty, righttransfrommain); NavigationFrame.BeginAnimation(Frame.MarginProperty, righttranstomain); SettingFrame.BeginAnimation(Frame.OpacityProperty, rightopacityfrommain); NavigationFrame.BeginAnimation(Frame.OpacityProperty, rightopacitytomain); break; case 2: //von navigation nach drive NavigationFrame.BeginAnimation(Frame.MarginProperty, righttransfrommain); DriveFrame.BeginAnimation(Frame.MarginProperty, righttranstomain); NavigationFrame.BeginAnimation(Frame.OpacityProperty, rightopacityfrommain); DriveFrame.BeginAnimation(Frame.OpacityProperty, rightopacitytomain); break; case 3: // von drive nach fitness DriveFrame.BeginAnimation(Frame.MarginProperty, righttransfrommain); FitnessFrame.BeginAnimation(Frame.MarginProperty, righttranstomain); DriveFrame.BeginAnimation(Frame.OpacityProperty, rightopacityfrommain); FitnessFrame.BeginAnimation(Frame.OpacityProperty, rightopacitytomain); break; case 4: // von fitness nach setting FitnessFrame.BeginAnimation(Frame.MarginProperty, righttransfrommain); SettingFrame.BeginAnimation(Frame.MarginProperty, righttranstomain); FitnessFrame.BeginAnimation(Frame.OpacityProperty, rightopacityfrommain); SettingFrame.BeginAnimation(Frame.OpacityProperty, rightopacitytomain); break; } }
private void MBtnExpenses_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new ExpensesPage()); // Open Expenses page in dock panel }
public void changemainframeleft(int mainframekey) { Debug.Print("changemainframeleft called"); var lefttransfrommain = new ThicknessAnimation() { From = new Thickness(4000, 0, 0, 0), To = new Thickness(6000, 0, 0, 0), Duration = TimeSpan.FromMilliseconds(500), }; var lefttranstomain = new ThicknessAnimation() { From = new Thickness(2000, 0, 0, 0), To = new Thickness(4000, 0, 0, 0), Duration = TimeSpan.FromMilliseconds(500) }; var leftopacityfrommain = new DoubleAnimation() { From = 1, To = 0, Duration = TimeSpan.FromMilliseconds(500) }; var leftopacitytomain = new DoubleAnimation() { From = 0, To = 1, Duration = TimeSpan.FromMilliseconds(500) }; Debug.Print("Animations built"); // mainframekey: 1 is settingscreen, 2 is navigation, 3 is drivescreen, 4 is fitnessscreen switch (mainframekey) // gibt an welcher screen angezeigt wird { case 0: Debug.Print("case 0 called"); break; case 1: // von setting nach fitness SettingFrame.BeginAnimation(Frame.MarginProperty, lefttransfrommain); FitnessFrame.BeginAnimation(Frame.MarginProperty, lefttranstomain); SettingFrame.BeginAnimation(Frame.OpacityProperty, leftopacityfrommain); FitnessFrame.BeginAnimation(Frame.OpacityProperty, leftopacitytomain); Debug.Print("Case 1"); break; case 2: // von navigation nach setting NavigationFrame.BeginAnimation(Frame.MarginProperty, lefttransfrommain); SettingFrame.BeginAnimation(Frame.MarginProperty, lefttranstomain); NavigationFrame.BeginAnimation(Frame.OpacityProperty, leftopacityfrommain); SettingFrame.BeginAnimation(Frame.OpacityProperty, leftopacitytomain); Debug.Print("Case 2"); break; //case 3: // von drive nach navigation DriveFrame.BeginAnimation(Frame.MarginProperty, lefttransfrommain); NavigationFrame.BeginAnimation(Frame.MarginProperty, lefttranstomain); DriveFrame.BeginAnimation(Frame.OpacityProperty, leftopacityfrommain); NavigationFrame.BeginAnimation(Frame.OpacityProperty, leftopacitytomain); Debug.Print("Case 3"); break; case 4: // von fitness nach drive FitnessFrame.BeginAnimation(Frame.MarginProperty, lefttransfrommain); DriveFrame.BeginAnimation(Frame.MarginProperty, lefttranstomain); FitnessFrame.BeginAnimation(Frame.OpacityProperty, leftopacityfrommain); DriveFrame.BeginAnimation(Frame.OpacityProperty, leftopacitytomain); Debug.Print("Case 4"); break; default: Debug.Print("no case called"); break; } }
private void MBtnSettings_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new SettingsPage()); // Open Settings page in dock panel }
public MainWindow() { InitializeComponent(); NavigationFrame.Focus(); }
public MainWindow() { InitializeComponent(); NavigationFrame.Navigate(new LoginPage()); }
private void NavigationFrame_Navigated(object sender, NavigationEventArgs e) { NavigationFrame.Navigate(typeof(SettingsPage)); }
public Form1() { Log.Logger = new LoggerConfiguration() .WriteTo.Console() .WriteTo.File($"{AppDomain.CurrentDomain.BaseDirectory}\\log\\log-.txt", rollingInterval: RollingInterval.Day, outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}") .CreateLogger(); //宣告Serilog初始化 MySqlSetting = InitialMethod.MySqlLoad(); ButtonSetting = InitialMethod.InitialButtonLoad(); InitializeComponent(); NavigationFrame = new NavigationFrame() { Dock = DockStyle.Fill }; NavigationFrame.Parent = DisPlaypanelControl; ButtonMethod = new ButtonMethod() { Form1 = this, navigationFrame = NavigationFrame }; ButtonMethod.AccordionLoad(accordionControl1, ButtonSetting); #region Ewatch平台 Ewatch_MySqlMethod = new Ewatch_MySqlMethod(MySqlSetting); Ewatch_MySqlComponent = new Ewatch_MySqlComponent(Ewatch_MySqlMethod); Ewatch_MySqlComponent.MyWorkState = true; Ewatch_Field4Component.Add(Ewatch_MySqlComponent); Ewatch_AlarmComponent = new Ewatch_AlarmComponent(Ewatch_MySqlMethod); Ewatch_AlarmComponent.MyWorkState = true; Ewatch_Field4Component.Add(Ewatch_AlarmComponent); EwatchConnectionUserControl ewatchConnectionUserControl = new EwatchConnectionUserControl(Ewatch_MySqlComponent) { Dock = DockStyle.Fill }; NavigationFrame.AddPage(ewatchConnectionUserControl); Ewatch_Field4UserControl.Add(ewatchConnectionUserControl); CaseUserControl caseUserControl = new CaseUserControl(Ewatch_MySqlMethod) { Form1 = this, Dock = DockStyle.Fill }; NavigationFrame.AddPage(caseUserControl); Ewatch_Field4UserControl.Add(caseUserControl); AiSettingUserControl aiSettingUserControl = new AiSettingUserControl(Ewatch_MySqlMethod) { Form1 = this, Dock = DockStyle.Fill }; NavigationFrame.AddPage(aiSettingUserControl); Ewatch_Field4UserControl.Add(aiSettingUserControl); AiConfigUserControl aiConfigUserControl = new AiConfigUserControl(Ewatch_MySqlMethod) { Form1 = this, Dock = DockStyle.Fill }; NavigationFrame.AddPage(aiConfigUserControl); Ewatch_Field4UserControl.Add(aiConfigUserControl); ElectricSettingUserControl electricSettingUserControl = new ElectricSettingUserControl(Ewatch_MySqlMethod) { Form1 = this, Dock = DockStyle.Fill }; NavigationFrame.AddPage(electricSettingUserControl); Ewatch_Field4UserControl.Add(electricSettingUserControl); StateSettingUserControl stateSettingUserControl = new StateSettingUserControl(Ewatch_MySqlMethod) { Form1 = this, Dock = DockStyle.Fill }; NavigationFrame.AddPage(stateSettingUserControl); Ewatch_Field4UserControl.Add(stateSettingUserControl); #endregion #region ChungHsin平台 ChungHsin_MySqlMethod = new ChungHsin_MySqlMethod(MySqlSetting); ChungHsin_MySqlComponent = new ChungHsin_MySqlComponent(ChungHsin_MySqlMethod); ChungHsin_MySqlComponent.MyWorkState = true; ChungHsin_Field4Component.Add(ChungHsin_MySqlComponent); ChumgHsinConnectionUserControl chumgHsinConnectionUserControl = new ChumgHsinConnectionUserControl(ChungHsin_MySqlComponent) { Dock = DockStyle.Fill }; NavigationFrame.AddPage(chumgHsinConnectionUserControl); ChungHsin_Field4UserControl.Add(chumgHsinConnectionUserControl); DeviceConfigUserControl deviceConfigUserControl = new DeviceConfigUserControl(ChungHsin_MySqlMethod) { Dock = DockStyle.Fill }; NavigationFrame.AddPage(deviceConfigUserControl); ChungHsin_Field4UserControl.Add(deviceConfigUserControl); CH_CaseSettingUserControl cH_CaseSettingUserControl = new CH_CaseSettingUserControl(ChungHsin_MySqlMethod) { Dock = DockStyle.Fill }; NavigationFrame.AddPage(cH_CaseSettingUserControl); ChungHsin_Field4UserControl.Add(cH_CaseSettingUserControl); ReceiveSettingUserControl receiveSettingUserControl = new ReceiveSettingUserControl(ChungHsin_MySqlMethod) { Dock = DockStyle.Fill }; NavigationFrame.AddPage(receiveSettingUserControl); ChungHsin_Field4UserControl.Add(receiveSettingUserControl); #endregion timer1.Interval = 1000; timer1.Enabled = true; }
public Shell() { this.InitializeComponent(); ViewModel = DataContext as ShellViewModel; NavigationFrame.Navigate(typeof(HomePage)); }
private void SearchButton_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new SearchPage()); }
/// <summary> /// Menu Navigation to traverse the navigation bar and open the corresponding page in the dock panel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> #region Menu Navigation private void MBtnOverview_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new OverviewPage()); // Open Overview page in dock panel }
public Navigation() { this.InitializeComponent(); NavigationFrame.Navigate(typeof(Pomodoro)); }
private void MBtnCurrentMonth_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new CurrentMonthPage()); // Open Current Month page in dock panel }
public override void NavigateView(NavigationFrame frameView) { _emailSetup.User = txtUser.Text; _emailSetup.Password = txtPwd.Text; WizardData = _emailSetup; }
private void MBtnCalendar_Click(object sender, RoutedEventArgs e) { NavigationFrame.Navigate(new CalendarPage()); // Open Calendar page in dock panel }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { this.LoadResources(); if (e.PrelaunchActivated) { await this.OnPrelaunchActivation(); } if (Assemblies.IsDebugging) { this.EnableFrameRateCounter = true; } var rootFrame = Window.Current.Content as NavigationFrame; if (rootFrame == null) { var contentControl = new ContentControl(); contentControl.ContentTemplateSelector = new CauldronTemplateSelector(); contentControl.VerticalContentAlignment = VerticalAlignment.Stretch; contentControl.HorizontalContentAlignment = HorizontalAlignment.Stretch; Window.Current.Content = contentControl; contentControl.Content = this; Window.Current.Activate(); await this.OnPreload(); } // Do not repeat app initialization when the Window already has content, just ensure that // the window is active if (rootFrame == null) { Window.Current.VisibilityChanged -= this.Current_VisibilityChanged; Window.Current.VisibilityChanged += this.Current_VisibilityChanged; // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new NavigationFrame(); rootFrame.ContentTemplateSelector = new CauldronTemplateSelector(); // Place the frame in the current Window Window.Current.Content = rootFrame; rootFrame.Navigated += this.RootFrame_Navigated; } if (rootFrame.DataContext == null) { rootFrame.DataContext = this; } if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { await this.OnLoadStateAsync(e); await rootFrame.Reload(); } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, configuring // the new page by passing required information as a navigation parameter await this.OnStartup(e); } // Ensure the current window is active Window.Current.Activate(); }
private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { if (args.IsSettingsSelected) { DoSettings(); } else { switch (currentPage) { case 0: NewHub.Stop(); break; case 1: HomePage.Stop(); break; case 2: MainPage.Stop(); break; case 3: TelemetryPage.Stop(); break; case 4: ControlDeviceTelemetryPage.Stop(); break; case 5: break; case 6: break; case 7: break; } var eventargs = (NavigationViewSelectionChangedEventArgs)args; if (int.TryParse((string)((Control)eventargs.SelectedItem).Tag, out int newPage)) { if ((new List <int>() { 1, 2, 3, 4, 5, 6, 7 }).Contains(newPage)) //,8}).Contains(newPage)) { currentPage = newPage; switch (currentPage) { case 1: NavigationFrame.Navigate(typeof(Pages.HomePage), false); break; case 2: NavigationFrame.Navigate(typeof(Pages.MainPage), null); break; case 3: NavigationFrame.Navigate(typeof(Pages.TelemetryPage), null); break; case 4: NavigationFrame.Navigate(typeof(Pages.ControlDeviceTelemetryPage), null); break; //case 8: // NavigationFrame.Navigate(typeof(Pages.ProxyPage), null); // break; case 5: NavigationFrame.Navigate(typeof(Pages.DeployToDevice), null); break; case 6: NavigationFrame.Navigate(typeof(Pages.LinksPage), null); break; case 7: NavigationFrame.Navigate(typeof(Pages.AboutPage), true); break; } } } } }