/// <summary> /// Setup the application and initialize the tests. /// </summary> /// <param name="args"> /// Details about the launch request and process. /// </param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just // ensure that the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } // Set the App Mode and configuration based on the arguments Harness.SetAutoConfig(args.Arguments); Frame rootFrame = new Frame(); if (Harness.Settings.ManualMode) { rootFrame.Navigate(typeof(MainPage)); } else { rootFrame.Navigate(typeof(TestPage)); } Window.Current.Content = rootFrame; Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Create a Frame to act navigation context and navigate to the first page var rootFrame = new Frame(); SimpleIoc.Default.Register<INavigationService>(() => new NavigationService(rootFrame)); if (!ApplicationData.Current.LocalSettings.Values.ContainsKey("SimBalanceBackgroundTask")) { //Register background worker var backgroundTaskManager = new BackgroundTaskBuilder { TaskEntryPoint = "MobileVikings.FrontEnd.BackgroundTasks.SimBalanceBackgroundTask", Name = "SimBalanceBackgroundTask" }; backgroundTaskManager.SetTrigger(new MaintenanceTrigger(15, false)); backgroundTaskManager.AddCondition(new SystemCondition(SystemConditionType.InternetAvailable)); var registration = backgroundTaskManager.Register(); ApplicationData.Current.LocalSettings.Values["SimBalanceBackgroundTask"] = true; } if (ApplicationData.Current.RoamingSettings.Values["AuthorizationInfo"] == null) { if (!rootFrame.Navigate(typeof(LoginView))) { throw new Exception("Failed to create initial page"); } } else { if (!rootFrame.Navigate(typeof(MainView))) { throw new Exception("Failed to create initial page"); } } // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); }
/// <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="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } Harness.SetAutoConfig(args.Arguments); if (Harness.Settings.ManualMode) { rootFrame.Navigate(typeof(MainPage)); } else { rootFrame.Navigate(typeof(TestPage)); } // Place the frame in the current Window Window.Current.Content = rootFrame; } 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 rootFrame.Navigate(typeof(MainPage), args.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Create a Frame to act navigation context and navigate to the first page var rootFrame = new Frame(); if (!rootFrame.Navigate(typeof(MainPage))) { throw new Exception("Failed to create initial page"); } // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); }
protected override void OnActivated(IActivatedEventArgs args) { base.OnActivated(args); if (args.Kind == ActivationKind.VoiceCommand) { var commandArgs = args as VoiceCommandActivatedEventArgs; SpeechRecognitionResult speechRecognitionResult = commandArgs.Result; var text = speechRecognitionResult.Text; var status = speechRecognitionResult.Status; var commandName = speechRecognitionResult.RulePath[0]; if(commandName == "command1") { }else if(commandName == "command2") { Frame rootFrame = new Frame(); Window.Current.Content = rootFrame; rootFrame.Navigate(typeof(SendPage),1); Window.Current.Activate(); } else if(commandName == "command3") { Frame rootFrame = new Frame(); Window.Current.Content = rootFrame; rootFrame.Navigate(typeof(SendPage),0); Window.Current.Activate(); } } }
private void search(object sender, RoutedEventArgs e) { Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; main_page.App.key = s.Text; if (localSettings.Containers.ContainsKey(s.Text)) { var rootFrame = new Frame(); if (!rootFrame.Navigate(typeof(BlankPage3))) { throw new Exception("Failed to create initial page"); } // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); } else { var rootFrame = new Frame(); if (!rootFrame.Navigate(typeof(BlankPage1))) { throw new Exception("Failed to create initial page"); } // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); } }
protected override async void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } // Create a Frame to act as the navigation context and associate it with a SuspensionManager key var rootFrame = new Frame(); SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { await SuspensionManager.RestoreAsync(); } if (rootFrame.Content == null) { if (!rootFrame.Navigate(typeof(HomeView), "AllGroups")) { throw new Exception("Failed to create initial page"); } } Window.Current.Content = rootFrame; Window.Current.Activate(); }
private void InitialiseRootFrame(Frame rootFrame) { var networkProfile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile(); if (networkProfile != null && networkProfile.GetNetworkConnectivityLevel() == Windows.Networking.Connectivity.NetworkConnectivityLevel.InternetAccess) { Window.Current.Content = new Pages.Shell(rootFrame); rootFrame.NavigationFailed += OnNavigationFailed; 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 rootFrame.Navigate(typeof(Pages.HomePage)); } } else { rootFrame.Content = new TextBlock() { Text = "No internet connectivity", FontSize = 22, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; Window.Current.Content = rootFrame; } }
private void BackMain_OnClick(object sender, RoutedEventArgs e) { var fr = new Frame(); fr.Navigate(typeof(MainPage)); Window.Current.Content = fr; Window.Current.Activate(); }
public async Task<int> ProjectAsync(Type viewType, DeviceInformation device = null) { int mainViewId = ApplicationView.GetForCurrentView().Id; int? secondViewId = null; var view = CoreApplication.CreateNewView(); await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { secondViewId = ApplicationView.GetForCurrentView().Id; var rootFrame = new Frame(); rootFrame.Navigate(viewType, null); Window.Current.Content = rootFrame; Window.Current.Activate(); }); if (secondViewId.HasValue) { if(device == null) await ProjectionManager.StartProjectingAsync(secondViewId.Value, mainViewId); else await ProjectionManager.StartProjectingAsync(secondViewId.Value, mainViewId, device); } return mainViewId; }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // Inject the platform specific services into the service repository. // Note - we do it here because the dispatcher is not created // before this point: ServiceRepository.FileService = new FileService(); ServiceRepository.GeoLocationService = new GeoLocationService(CoreWindow.GetForCurrentThread().Dispatcher); ServiceRepository.SettingsService = new SettingsService(); ServiceRepository.PageControlService = new PageControlService(); ServiceRepository.MessageBoxService = new MessageBoxService(); ServiceRepository.TileService = new TileService(); Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; rootFrame.Navigate(typeof(MainPage), args.Arguments); } else { MainPage mainPage = rootFrame.Content as MainPage; mainPage.NavigateToPageControlByArguments(args.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs args) { var rootFrame = new Frame(); // Do not repeat app initialization when the Window already has content, // just ensure that the window is active // Handles the live tile code //if (!string.IsNullOrEmpty(args.Arguments)) //{ // var cleanArgs = args.Arguments.Replace("SecondaryTilePage=", ""); // var tempArgs = cleanArgs.Split('|'); // if (!rootFrame.Navigate(typeof(SecondaryTilesPage), tempArgs)) // { // throw new Exception("Failed to create initial page"); // } //} 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 if (!rootFrame.Navigate(typeof(DashbaordPage), "AllGroups")) { throw new Exception("Failed to create initial page"); } } // Ensure the current window is active Window.Current.Content = rootFrame; Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected async override void OnLaunched(LaunchActivatedEventArgs args) { if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } var rootFrame = new Frame(); KarliCards.Gui.Common.SuspensionManager.RegisterFrame(rootFrame, "karliCardsFrame"); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { KarliCards.Gui.Common.SuspensionManager.KnownTypes.Add(typeof(GameViewModel)); await KarliCards.Gui.Common.SuspensionManager.RestoreAsync(); } if (rootFrame.Content == null) { if (!rootFrame.Navigate(typeof(MainPage))) { throw new Exception("Failed to create initial page"); } } Window.Current.Content = rootFrame; Window.Current.Activate(); }
protected override async void OnLaunched(LaunchActivatedEventArgs args) { if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } var rootFrame = new Frame(); SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { await SuspensionManager.RestoreAsync(); } if (rootFrame.Content == null) { if (!rootFrame.Navigate(typeof(GroupedItemsPage), "AllGroups")) { throw new Exception("Failed to create initial page"); } } Window.Current.Content = rootFrame; Window.Current.Activate(); }
private void button1_Click(object sender, RoutedEventArgs e) { if (textBox.Text.Length != 16) { textBlock1.Text = "Pogresan format broja licne karte"; return; } if (radioButton.IsChecked == true) { KontejnerskaKlasa.uplate.Add(new KLASE.Uplata(2m, DateTime.Now, "Satni")); } if (radioButton2.IsChecked == true) { KontejnerskaKlasa.uplate.Add(new KLASE.Uplata(10m, DateTime.Now, "Dnevni")); } if (radioButton3.IsChecked == true) { KontejnerskaKlasa.uplate.Add(new KLASE.Uplata(75m, DateTime.Now, "Mjesečni")); } if (radioButton1.IsChecked == true) { KontejnerskaKlasa.uplate.Add(new KLASE.Uplata(400m, DateTime.Now, "Godišnji")); } Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(MainPage))); } } }
void show() { var frame = new Frame(); frame.Navigate(typeof(MainPage)); Window.Current.Content = frame; Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // TODO: Create a data model appropriate for your problem domain to replace the sample data var sampleData = new SampleDataSource(); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Create a Frame to act navigation context and navigate to the first page, // configuring the new page by passing required information as a navigation // parameter var rootFrame = new Frame(); rootFrame.Navigate(typeof(Dashboard), sampleData); // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); // move to an appropriate place var liveTiles = new LiveTiles(); liveTiles.ShowAsLiveTile("Wash the car"); liveTiles.ShowAsLiveTile("Do the dishes"); liveTiles.ShowAsLiveTile("Show the app"); liveTiles.ShowAsLiveTile("Mow the lawn"); liveTiles.ShowAsBadge(6); liveTiles.ShowAsToast("Woot, a toast!"); }
/// <summary> /// Invoked when the application is activated. /// This is the entry point for Device Autoplay when a device is attached to the PC. /// Other activation kinds (such as search and protocol activation) may also be handled here. /// /// This code was adapted from the "Removable storage sample" on MSDN. /// </summary> /// <param name="args">Details about the activation request.</param> protected override void OnActivated(IActivatedEventArgs args) { if (args.Kind == ActivationKind.Device) { // Load the UI if (Window.Current.Content == null) { Frame rootFrame = new Frame(); rootFrame.Navigate(typeof(MainPage)); // Place the frame in the current Window Window.Current.Content = rootFrame; } // Ensure the current window is active or else the app will freeze at the splash screen Window.Current.Activate(); // Launched from Autoplay for device, notify the app what device launched this app DeviceActivatedEventArgs deviceArgs = (DeviceActivatedEventArgs)args; if (deviceArgs != null) { // The DeviceInformationId is the same id found in a DeviceInformation object, so it can potentially be used // with UsbDevice.FromIdAsync() // The deviceArgs->Verb is the verb that is provided in the appxmanifest for this specific device MainPage.Current.NotifyUser( "The app was launched by device id: " + deviceArgs.DeviceInformationId + "\nVerb: " + deviceArgs.Verb, NotifyType.StatusMessage); } } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Create a Frame to act navigation context and navigate to the first page var rootFrame = new Frame(); if (!rootFrame.Navigate(typeof(MainPage))) { throw new Exception("Failed to create initial page"); } /// <summary> /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents /// of memory still intact. /// </summary> /// <param name="sender">The source of the suspend request.</ // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); }
protected override void OnLaunched(LaunchActivatedEventArgs args) { var rootFrame = new Frame(); rootFrame.Navigate(typeof(DefaultPage)); Window.Current.Content = rootFrame; Window.Current.Activate(); }
protected override void OnShareTargetActivated(ShareTargetActivatedEventArgs args) { var rootFrame = new Frame(); rootFrame.Navigate(typeof(MainPage), args.ShareOperation); Window.Current.Content = rootFrame; Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Create a Frame to act navigation context and navigate to the first page var rootFrame = new Frame(); if (!rootFrame.Navigate(typeof(MainPage))) { throw new Exception("Failed to create initial page"); } // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate( new System.Uri(MobileService.ApplicationUri, "/api/notifications"), PeriodicUpdateRecurrence.HalfHour ); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs args) { // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // start up our runtime... await StreetFooRuntime.Start("Client"); var logonViewModel = ViewModelFactory.Current.GetHandler<ILogonPageViewModel>(new NullViewModelHost()); var targetPage = typeof(LogonPage); if (await logonViewModel.RestorePersistentLogonAsync()) targetPage = typeof(ReportsPage); // Create a Frame to act navigation context and navigate to the first page var rootFrame = new Frame(); if (!rootFrame.Navigate(targetPage)) { throw new Exception("Failed to create initial page"); } // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); }
public void Login(Authenticator authenticator) { _authenticator = authenticator; authenticator.Completed += AuthenticatorCompleted; System.Type pageType = authenticator.GetUI(); _rootFrame = Window.Current.Content as Frame; _rootFrame.Navigate(pageType, authenticator); if (!_hasHardwareButton && _authenticator.AllowCancel) { var navManager = SystemNavigationManager.GetForCurrentView(); navManager.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; navManager.BackRequested += CustomPlatformOAuthLoginPresenter_BackRequested; } return; authenticator.Completed += AuthenticatorCompleted; System.Type page_type = authenticator.GetUI(); Windows.UI.Xaml.Controls.Frame root_frame = null; root_frame = Windows.UI.Xaml.Window.Current.Content as Windows.UI.Xaml.Controls.Frame; root_frame.Navigate(page_type, authenticator); return; }
private void backButton_Tapped(object sender, TappedRoutedEventArgs e) { var fr = new Frame(); fr.Navigate(typeof(MainPage)); Window.Current.Content = fr; Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> async protected override void OnLaunched(LaunchActivatedEventArgs args) { if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { // Do an asynchronous restore await SuspensionManager.RestoreAsync(); } if (Window.Current.Content == null) { var rootFrame = new Frame(); rootFrame.Navigate(typeof(MainPage)); ((MainPage)rootFrame.Content).LaunchArgs = args; Window.Current.Content = rootFrame; } else { MainPage.Current.LaunchArgs = args; if (MainPage.Current.LaunchArgs != null) { if (!String.IsNullOrEmpty(MainPage.Current.LaunchArgs.Arguments)) { MainPage.Current.NavigateToLaunchedFromSecondaryTile(); } } } Window.Current.Activate(); }
private async void CreateView_Click(object sender, RoutedEventArgs e) { // Set up the secondary view, but don't show it yet ViewLifetimeControl viewControl = null; await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { // This object is used to keep track of the views and important // details about the contents of those views across threads // In your app, you would probably want to track information // like the open document or page inside that window viewControl = ViewLifetimeControl.CreateForCurrentView(); viewControl.Title = DEFAULT_TITLE; // Increment the ref count because we just created the view and we have a reference to it viewControl.StartViewInUse(); var frame = new Frame(); frame.Navigate(typeof(SecondaryViewPage), viewControl); Window.Current.Content = frame; // This is a change from 8.1: In order for the view to be displayed later it needs to be activated. Window.Current.Activate(); ApplicationView.GetForCurrentView().Title = viewControl.Title; }); // Be careful! This collection is bound to the current thread, // so make sure to update it only from this thread ((App)App.Current).SecondaryViews.Add(viewControl); }
protected override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = new Frame(); Window.Current.Content = rootFrame; rootFrame.Navigate(typeof(MainPage), e.Arguments); Window.Current.Activate(); }
/// <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 void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); // Set the default language rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; rootFrame.NavigationFailed += OnNavigationFailed; if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MasterDetailPage)); } // Place the frame in the current Window Window.Current.Content = rootFrame; } // Ensure the current window is active Window.Current.Activate(); }
/// <summary> /// Determines how best to support navigation back to the previous application state. /// </summary> public static void Activate(String queryText, ApplicationExecutionState previousExecutionState) { var previousContent = Window.Current.Content; var frame = previousContent as Frame; if (frame != null) { // If the app is already running and uses top-level frame navigation we can just // navigate to the search results frame.Navigate(typeof(SearchResultsPage), queryText); } else { // Otherwise bypass navigation and provide the tools needed to emulate the back stack // SearchResultsPage page = new SearchResultsPage(); // page._previousContent = previousContent; // page._previousExecutionState = previousExecutionState; // page.LoadState(queryText, null); /// Window.Current.Content = page; frame = new Frame(); Window.Current.Content = frame; SettingsPane.GetForCurrentView().CommandsRequested += (Application.Current as App).OnCommandsRequested; frame.Navigate(typeof(SearchResultsPage), queryText); } // Either way, active the window Window.Current.Activate(); }
public static async Task CreateNewWindow(int minWidth, int minHeight, string page) { var newCoreAppView = CoreApplication.CreateNewView(); var appView = ApplicationView.GetForCurrentView(); await newCoreAppView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Low, async () => { var window = Window.Current; var newAppView = ApplicationView.GetForCurrentView(); #if WINDOWS_UAP newAppView.SetPreferredMinSize(new Windows.Foundation.Size(minWidth, minHeight)); #endif var frame = new Frame(); window.Content = frame; if(page == "LoginFormPage") { frame.Navigate(typeof(LoginFormPage)); } window.Activate(); await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newAppView.Id, ViewSizePreference.UseMore, appView.Id, ViewSizePreference.Default); #if WINDOWS_UAP var success = newAppView.TryResizeView(new Windows.Foundation.Size(minWidth, minHeight)); #endif }); }
private void btnNext_Click(object sender, RoutedEventArgs e) { Frame frame = new Frame(); string[] para = { "aaa", "bbb" }; frame.Navigate(typeof(Sample1), para); Window.Current.Content = frame; }
private void button1_Click(object sender, RoutedEventArgs e) { Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(FormaUnosDezurnogRadnika))); } } }
private void button2_Click(object sender, RoutedEventArgs e) { Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(FormaGodisnjiIzvjestaj))); } } }
private void button_Click(object sender, RoutedEventArgs e) { Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(MainPage))); } } }
public static void TryShowNewWindow <TView>() { Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate(typeof(TView)); } } }
private void button_Click(object sender, RoutedEventArgs e) { //dodaj korisnika button Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(FormaUnosKorisnikavol2))); } } }
private static async Task <TTarget> FrameNavigate <TTarget>(TTarget targetViewModel, Type type, Windows.UI.Xaml.Controls.Frame frame) where TTarget : class, IViewModel { var parameter = new StageNavigationContext <TTarget>() { ViewModel = targetViewModel }; var t = new TaskCompletionSource <object>(); var dip = EventRouting.EventRouter.Instance .GetEventChannel <NavigationEventArgs>() .Where(e => object.ReferenceEquals(e.EventData.Parameter, parameter)) .Subscribe(e => { var page = e.Sender as MVVMPage; if (parameter.ViewModel != null) { page.ViewModel = parameter.ViewModel; } else { var solveV = page.GetDefaultViewModel(); if (solveV != null) { targetViewModel = parameter.ViewModel = (TTarget)solveV; } } if (targetViewModel == null) { targetViewModel = (TTarget)page.ViewModel; } parameter.ViewModel = targetViewModel; if (!t.Task.IsCompleted) { t.SetResult(null);; } }); frame.Navigate(type, parameter); await t.Task; dip.DisposeWith(targetViewModel); return(targetViewModel); }
private void button1_Click_1(object sender, RoutedEventArgs e) { decimal broj; bool jelDecimalni = decimal.TryParse(textBox5.Text, out broj); if (!jelDecimalni) { textBlock6.Text = "Neispravna cijena!"; return; } KontejnerskaKlasa.isplate.Add(new KLASE.Isplata(broj, datum.Date.DateTime, textBox1.Text)); Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(MainPage))); } } }
/// <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 async override void OnLaunched(LaunchActivatedEventArgs e) { InitNotificationsAsync(); // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (!(Window.Current.Content is Windows.UI.Xaml.Controls.Frame rootFrame)) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Windows.UI.Xaml.Controls.Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Xamarin.Forms.Forms.Init(e); //CarouselViewRenderer.Init(); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } 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 rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); await InitRemoteNotificationsAsync(); }
//event za klik na dugme dodaj private void button_Click(object sender, RoutedEventArgs e) { //validacija foreach (char slovo in textBox.Text) { if (!Char.IsLetter(slovo)) { textBlock10.Visibility = Visibility.Visible; textBlock10.Text = "Ime nije validno, unesite opet"; return; } } foreach (char slovo in textBox1.Text) { if (!Char.IsLetter(slovo)) { textBlock10.Visibility = Visibility.Visible; textBlock10.Text = "Prezime nije validno, unesite opet"; return; } } foreach (char broj in textBox2.Text) { if (!Char.IsDigit(broj)) { textBlock10.Visibility = Visibility.Visible; textBlock10.Text = "Broj telefona nije validan, unesite broj u formatu 0038xxxxxxxxx"; return; } } if (datumrodj.Date.Year < 1920 || datumrodj.Date.Year > 1997) { textBlock10.Text = "Niste unijeli dobro datum rođenja."; return; } if (textBox4.Text.Length != 14) { textBlock10.Text = "Pogresan format broja licne karte"; return; } foreach (Korisnik item in KontejnerskaKlasa.korisnici) { if (item.Username == textBox5.Text) { textBlock10.Text = "Username vec zauzet."; return; } } if (textBox5.Text.Length > 10) { textBlock10.Text = "Username ne moze biti duzi od 10 znakova"; return; } if (passwordBox.Password.Length > 16) { textBlock10.Text = "Password ne moze btii duzi od 16 znakoma"; return; } foreach (char slovo in textBox3.Text) { if (!Char.IsLetter(slovo)) { textBlock10.Visibility = Visibility.Visible; textBlock10.Text = "Adresa nije validna"; return; } } //ako prodju sve validacije //dodajemo korisnika u kontejnersku klasu KontejnerskaKlasa.korisnici.Add(new Korisnik(textBox.Text, textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, datumrodj.Date.DateTime, textBox8.Text, textBox7.Text, textBox5.Text, passwordBox.Password)); Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(FormaDezurniRadnik))); } } }
private static async Task <TTarget> FrameNavigate <TTarget>(TTarget targetViewModel, Type type, Windows.UI.Xaml.Controls.Frame frame) where TTarget : class, IViewModel { var parameter = new StageNavigationContext <TTarget>() { ViewModel = targetViewModel }; var t = new TaskCompletionSource <object>(); var dip = EventRouting.EventRouter.Instance .GetEventChannel <NavigationEventArgs>() .Where(e => object.ReferenceEquals(e.EventData.Parameter, parameter)) .Subscribe(e => { Page page = null; IView view = null; switch (e.Sender) { case MVVMPage mvvmPage: page = mvvmPage; view = mvvmPage; break; case PageViewDisguise disguise: page = disguise.AssocatedObject; view = disguise; break; default: break; } if (parameter.ViewModel != null) { view.ViewModel = parameter.ViewModel; } else { var solveV = view.GetDefaultViewModel(); if (solveV != null) { targetViewModel = parameter.ViewModel = (TTarget)solveV; } } if (targetViewModel == null) { targetViewModel = (TTarget)view.ViewModel; } view.ViewModel = parameter.ViewModel = targetViewModel; targetViewModel?.OnPageNavigatedTo(e.EventData); t.TrySetResult(null); }); frame.Navigate(type, parameter); await t.Task; dip.DisposeWith(targetViewModel); return(targetViewModel); }
private void button1_Click(object sender, RoutedEventArgs e) { if (checkBox.IsChecked == true) { textBlock2.Text = "Javite se vlasniku"; } //provjerava validnost podataka ako vlasnik nije zaboravio pasword if (checkBox.IsChecked != true && radioButton.IsChecked == true) { if (textBox.Text != "boss") { textBlock2.Text = "Pogresno korisnicko ime!!!"; } else if (passwordBox.Password != "1234") { textBlock2.Text = "Pogresan password!!!"; } else { //ako sve okej prodje, otvara se forma za vlasnika Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(FormaVlasnikIzvjestaji))); } } } } //provjerava validnost podataka ako se loguje korisnik i nije zaboravio pass //treba napraviti formu koja ce se prikazati korisniku if (checkBox.IsChecked != true && radioButton1.IsChecked == true) { bool nadjen = false; foreach (Korisnik korisnik in KontejnerskaKlasa.korisnici) { if (korisnik.Username == textBox.Text && korisnik.Password == passwordBox.Password) { nadjen = true; Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(FormaKorisnik))); } } } } //ako se ne nadje ni jedan korisnik sa usernameom i pw znaci da je pogrijesio if (!nadjen) { textBlock2.Text = "Pogresan username ili password!!!"; } } //Login za majstora if (checkBox.IsChecked != true && radioButton4.IsChecked == true) { bool nadjen = false; foreach (Majstor majstor in KontejnerskaKlasa.majstori) { if (majstor.Username == textBox.Text && majstor.Password == passwordBox.Password) { Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(FormaIzvjestajMajstora))); } } } } //ako se ne nadje ni jedan majstor sa usernameom i pw znaci da je pogrijesio if (!nadjen) { textBlock2.Text = "Pogresan username ili password!!!"; } } if (checkBox.IsChecked != true && radioButton2.IsChecked == true) { bool nadjen = false; foreach (DezurniRadnik radnik in KontejnerskaKlasa.dezurniRadnici) { if (radnik.Username == textBox.Text && radnik.Password == passwordBox.Password) { Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(FormaDezurniRadnik))); } } } } //ako se ne nadje ni jedan majstor sa usernameom i pw znaci da je pogrijesio if (!nadjen) { textBlock2.Text = "Pogresan username ili password!!!"; } } //Login za supervizora if (checkBox.IsChecked != true && radioButton3.IsChecked == true) { if (textBox.Text != "merima") { textBlock2.Text = "Pogresno korisnicko ime!!!"; } else if (passwordBox.Password != "1234") { textBlock2.Text = "Pogresan password!!!"; } else { //ako sve okej prodje, otvara se forma za supervizora Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate((typeof(FormaSupervizor))); } } } } }