Inheritance: ContentControl, IFrame, INavigate
示例#1
0
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();          
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }

                Window.Current.Content = rootFrame;
            }
            if (rootFrame.Content == null)
            {
                if (!rootFrame.Navigate(typeof(GroupedItemsPage), "AllGroups"))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            Window.Current.Activate();

            this.InitSettings();
        }
        /// <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)
        {
            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();

                if (args.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
                if (!rootFrame.Navigate(typeof(MainView), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
示例#3
0
        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;
        }
示例#4
0
        /// <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)
        {
            var 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();

                if (args.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

                var setup = new Setup(rootFrame);
                setup.Initialize();

                var start = Mvx.Resolve<IMvxAppStart>();
                start.Start();
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
示例#5
0
文件: App.xaml.cs 项目: xlune/XTween
        /// <summary>
        /// アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます。他のエントリ ポイントは、
        /// アプリケーションが特定のファイルを開くために呼び出されたときに
        /// 検索結果やその他の情報を表示するために使用されます。
        /// </summary>
        /// <param name="args">起動要求とプロセスの詳細を表示します。</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // ウィンドウに既にコンテンツが表示されている場合は、アプリケーションの初期化を繰り返さずに、
            // ウィンドウがアクティブであることだけを確認してください
            if (rootFrame == null)
            {
                // ナビゲーション コンテキストとして動作するフレームを作成し、最初のページに移動します
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 以前中断したアプリケーションから状態を読み込みます。
                }

                // フレームを現在のウィンドウに配置します
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // ナビゲーション スタックが復元されていない場合、最初のページに移動します。
                // このとき、必要な情報をナビゲーション パラメーターとして渡して、新しいページを
                // 構成します
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // 現在のウィンドウがアクティブであることを確認します
            Window.Current.Activate();
        }
示例#6
0
        /// <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)
        {
            if (!String.IsNullOrWhiteSpace(e.Arguments) &&
                e.Arguments.Contains("RunningAsUITests"))
            {
                RunningAsUITests = true;
                Controls.App.PreloadTestCasesIssuesList = false;
            }
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                //   DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.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 Windows.UI.Xaml.Controls.Frame();
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                Forms.SetFlags("Shell_UWP_Experimental");

                Forms.Init(e);
                //FormsMaps.Init (Controls.App.Config["UWPMapsAuthKey"]);

                // 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);
            }

            //// Uncomment to test overriding the status bar color
            //if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            //{
            //	var statusBar = StatusBar.GetForCurrentView();
            //	if (statusBar != null)
            //	{
            //		statusBar.BackgroundOpacity = 1;
            //		statusBar.BackgroundColor = Colors.Black;
            //		statusBar.ForegroundColor = Colors.White;
            //	}
            //}

            // Ensure the current window is active
            Window.Current.Activate();
        }
示例#7
0
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Container.Register<Toodeloo.WinRT.Infrastructure.Execution.IDispatcher>(new Toodeloo.WinRT.Infrastructure.Execution.Dispatcher(Window.Current.Dispatcher));
            var viewModelLocator = Resources["ViewModelLocator"] as ViewModelLocator;
            viewModelLocator.Initialize();

            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                    ApplicationService.Resume();

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                    throw new Exception("Failed to create initial page");

            SharingService.Initialize();
            SearchService.Initialize();
            Window.Current.Activate();
        }
示例#8
0
        public static double GetWindowHeight()
        {
            Windows.UI.Xaml.Controls.Frame rootFrame = Windows.UI.Xaml.Window.Current.Content as Windows.UI.Xaml.Controls.Frame;
            double height = rootFrame.ActualHeight;

            return(height);
        }
示例#9
0
        //获取屏幕宽度
        public static double GetWindowsWidth()
        {
            Windows.UI.Xaml.Controls.Frame rootFrame = Windows.UI.Xaml.Window.Current.Content as Windows.UI.Xaml.Controls.Frame;
            double Width = rootFrame.ActualWidth;

            return(Width);
        }
示例#10
0
        /// <summary>
        /// 在應用程式由使用者正常啟動時叫用。其他進入點
        /// 將在啟動應用程式以開啟特定檔案時使用,以顯示
        /// 搜尋結果等。
        /// </summary>
        /// <param name="args">關於啟動要求和處理序的詳細資料。</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // 當視窗已經有內容時,不重複應用程式初始化,
            // 只確定視窗是作用中
            if (rootFrame == null)
            {
                // 建立框架做為巡覽內容,並巡覽至第一頁
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 從之前暫停的應用程式載入狀態
                }

                // 將框架放在目前視窗中
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // 在巡覽堆疊未還原時,巡覽至第一頁,
                // 設定新的頁面,方式是透過傳遞必要資訊做為巡覽
                // 參數
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // 確定目前視窗是作用中
            Window.Current.Activate();
        }
示例#11
0
        /// <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)
        {
            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();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            EnsureSampleAppApplication(rootFrame);
            if (rootFrame.Content == null) SampleAppApplication.Instance.ContinueToSampleItemList();

            // Ensure the current window is active
            Window.Current.Activate();
        }
示例#12
0
 public MascotaPage()
 {
     this.InitializeComponent();
     rootFrame = Window.Current.Content as Frame;
     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
     SystemNavigationManager.GetForCurrentView().BackRequested += MascotaPage_BackRequested;
 }
示例#13
0
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                }

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            if (args.Arguments != string.Empty)
            {
                LoadFromPinned(args.Arguments);
            }

            Window.Current.Activate();
        }
        public MainPage(Frame frame)
        {
            this.InitializeComponent();
            this.MySplitView.Content = frame;
            title = new Title();
            loggedIn = new Title();
            DataContext = title;

            rdLogin.DataContext = loggedIn;

            loggedIn.Value = Parse.ParseUser.CurrentUser == null ? "Login" : "Profile";


            DispatcherTimer dt = new DispatcherTimer();
            dt.Interval = TimeSpan.FromSeconds(1);
           
            d = DateTime.Parse("2/27/2016 13:00:00 GMT");
            dt.Tick += Dt_Tick;
            txtCountDown.Loaded += (s, e) => { dt.Start(); };
            

            MySplitView.PaneClosed += (s, e) => { bgPane.Width = 48; };
            root = this;
            rootFrame = MySplitView.Content as Frame;
        }
        public ExtendedSplash(SplashScreen splashscreen, bool loadState)
        {
            InitializeComponent();

            // Listen for window resize events to reposition the extended _splash screen image accordingly.
            // This is important to ensure that the extended _splash screen is formatted properly in response to snapping, unsnapping, rotation, etc...
            Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize);

            _splash = splashscreen;

            if (_splash != null)
            {
                // Register an event handler to be executed when the _splash screen has been Dismissed.
                _splash.Dismissed += DismissedEventHandler;

                // Retrieve the window coordinates of the _splash screen image.
                SplashImageRect = _splash.ImageLocation;
                PositionImage();

                // Optional: Add a progress ring to your _splash screen to show users that content is loading
                PositionRing();
            }

            // Create a Frame to act as the navigation context
            RootFrame = new Frame();

            // Restore the saved session state if necessary
            Task.Run(async () => await RestoreStateAsync(loadState));
        }
        /// <summary>
        /// Sets the ContinuationArgs for this instance. Should be called by the main activation
        /// handling code in App.xaml.cs.
        /// </summary>
        /// <param name="args">
        /// The activation args.
        /// </param>
        /// <param name="rootFrame">
        /// The frame control that contains the current page.
        /// </param>
        internal void Continue(IContinuationActivatedEventArgs args, Frame rootFrame)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            if (_continuationActivatedEventArgs != null && !_handled)
            {
                throw new InvalidOperationException("Can't set args more than once");
            }

            _continuationActivatedEventArgs = args;
            _handled = false;
            _id = Guid.NewGuid();

            if (rootFrame == null)
            {
                return;
            }

            switch (args.Kind)
            {
                case ActivationKind.WebAuthenticationBrokerContinuation:
                    var webPage = rootFrame.Content as IWebAuthenticationContinuable;
                    if (webPage != null)
                    {
                        webPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs);
                    }
                    break;
            }
        }
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {

            Messenger.Default.Register<GoToPageMessage>(this, NavigateToPage);

            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 (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();
        }
示例#18
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }

            Window.Current.Activate();
        }
        public ShellSectionRenderer()
        {
            Xamarin.Forms.Shell.VerifyShellUWPFlagEnabled(nameof(ShellSectionRenderer));
            MenuItemTemplate    = (Windows.UI.Xaml.DataTemplate)Windows.UI.Xaml.Application.Current.Resources["ShellSectionMenuItemTemplate"];
            IsBackButtonVisible = Microsoft.UI.Xaml.Controls.NavigationViewBackButtonVisible.Collapsed;
            IsSettingsVisible   = false;
            AlwaysShowHeader    = false;
            PaneDisplayMode     = Microsoft.UI.Xaml.Controls.NavigationViewPaneDisplayMode.Top;
            ItemInvoked        += OnMenuItemInvoked;

            AutoSuggestBox = new Windows.UI.Xaml.Controls.AutoSuggestBox()
            {
                Width = 300
            };
            AutoSuggestBox.TextChanged      += OnSearchBoxTextChanged;
            AutoSuggestBox.QuerySubmitted   += OnSearchBoxQuerySubmitted;
            AutoSuggestBox.SuggestionChosen += OnSearchBoxSuggestionChosen;

            Frame             = new Windows.UI.Xaml.Controls.Frame();
            Content           = Frame;
            this.SizeChanged += OnShellSectionRendererSizeChanged;
            Resources["NavigationViewTopPaneBackground"]            = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultBackgroundColor);
            Resources["TopNavigationViewItemForeground"]            = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["TopNavigationViewItemForegroundSelected"]    = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
            Resources["NavigationViewSelectionIndicatorForeground"] = new Windows.UI.Xaml.Media.SolidColorBrush(ShellRenderer.DefaultForegroundColor);
        }
        /// <summary>
        /// 在应用程序由最终用户正常启动时进行调用。
        /// 当启动应用程序以执行打开特定的文件或显示搜索结果等操作时
        /// 将使用其他入口点。
        /// </summary>
        /// <param name="args">有关启动请求和过程的详细信息。</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 从之前挂起的应用程序加载状态
                }

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // 当未还原导航堆栈时,导航到第一页,
                // 并通过将所需信息作为导航参数传入来配置
                // 参数
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // 确保当前窗口处于活动状态
            Window.Current.Activate();
        }
示例#21
0
        /// <summary>
        /// Occurs when the application is launched.
        /// </summary>
        /// <param name="args"></param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            base.OnLaunched(args);

            var frame = Window.Current.Content as Frame;

            if (frame == null) {
                frame = new Frame();

                frame.Navigated += OnFrameNavigated;
                frame.NavigationFailed += OnFrameNavigationFailed;

                Window.Current.Content = frame;

                // listen for backbutton requests
                SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
                UpdateBackButtonVisibility();
            }

            if (frame.Content == null) {
                // navigate to the master page providing the navigation structure
                frame.Navigate(typeof(MasterNavigationPage), this.NavigationStructure);
            }
            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();

                rootFrame.NavigationFailed += OnNavigationFailed;

                // Add background to our Frame for navigation transitions
                rootFrame.Background = (Brush)Application.Current.Resources["ApplicationPageBackgroundThemeBrush"];

                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();
        }
示例#23
0
        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)));
                }
            }
        }
示例#24
0
        /// <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)
        {
            Windows.UI.Xaml.Controls.Frame rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.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 Windows.UI.Xaml.Controls.Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                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();
            }
        }
        /// <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="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#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();

                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
                Xamarin.Forms.Forms.Init(e);
                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)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += this.RootFrame_FirstNavigated;

                // 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(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
示例#26
0
        /// <summary>
        /// Wird aufgerufen, wenn die Anwendung durch den Endbenutzer normal gestartet wird. Weitere Einstiegspunkte
        /// werden verwendet, wenn die Anwendung zum Öffnen einer bestimmten Datei, zum Anzeigen
        /// von Suchergebnissen usw. gestartet wird.
        /// </summary>
        /// <param name="e">Details über Startanforderung und -prozess.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // App-Initialisierung nicht wiederholen, wenn das Fenster bereits Inhalte enthält.
            // Nur sicherstellen, dass das Fenster aktiv ist.
            if (rootFrame == null)
            {
                // Frame erstellen, der als Navigationskontext fungiert und zum Parameter der ersten Seite navigieren
                rootFrame = new Frame();

                // TODO: diesen Wert auf eine Cachegröße ändern, die für Ihre Anwendung geeignet ist
                rootFrame.CacheSize = 1;

                // Standardsprache festlegen
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Zustand von zuvor angehaltener Anwendung laden
                }

                // Den Frame im aktuellen Fenster platzieren
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Entfernt die Drehkreuznavigation für den Start.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += this.RootFrame_FirstNavigated;

                // Wenn der Navigationsstapel nicht wiederhergestellt wird, zur ersten Seite navigieren
                // und die neue Seite konfigurieren, indem die erforderlichen Informationen als Navigationsparameter
                // übergeben werden
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Sicherstellen, dass das aktuelle Fenster aktiv ist
            Window.Current.Activate();
        }
示例#27
0
        /// <summary>
        /// 최종 사용자가 응용 프로그램을 정상적으로 시작할 때 호출됩니다. 다른 진입점은
        /// 특정 파일을 열거나, 검색 결과를 표시하는 등 응용 프로그램을 시작할 때
        /// 사용됩니다.
        /// </summary>
        /// <param name="args">시작 요청 및 프로세스에 대한 정보입니다.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // 창에 콘텐츠가 이미 있는 경우 앱 초기화를 반복하지 말고,
            // 창이 활성화되어 있는지 확인하십시오.
            if (rootFrame == null)
            {
                // 탐색 컨텍스트로 사용할 프레임을 만들고 첫 페이지로 이동합니다.
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 이전에 일시 중지된 응용 프로그램에서 상태를 로드합니다.
                }

                // 현재 창에 프레임 넣기
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // 탐색 스택이 복원되지 않으면 첫 번째 페이지로 돌아가고
                // 필요한 정보를 탐색 매개 변수로 전달하여 새 페이지를
                // 구성합니다.
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // 현재 창이 활성 창인지 확인
            Window.Current.Activate();
        }
示例#28
0
        /// <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!");
        }
示例#29
0
        /// <summary>
        /// Invoqué lorsque l'application est lancée normalement par l'utilisateur final.  D'autres points d'entrée
        /// sont utilisés lorsque l'application est lancée pour ouvrir un fichier spécifique, pour afficher
        /// des résultats de recherche, etc.
        /// </summary>
        /// <param name="e">Détails concernant la requête et le processus de lancement.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            #if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
            #endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Ne répétez pas l'initialisation de l'application lorsque la fenêtre comporte déjà du contenu,
            // assurez-vous juste que la fenêtre est active
            if (rootFrame == null)
            {
                // Créez un Frame utilisable comme contexte de navigation et naviguez jusqu'à la première page
                rootFrame = new Frame();

                // TODO: modifier cette valeur à une taille de cache qui contient à votre application
                rootFrame.CacheSize = 1;

                // Définir la page par défaut
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: chargez l'état de l'application précédemment suspendue
                }

                // Placez le frame dans la fenêtre active
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Supprime la navigation tourniquet pour le démarrage.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += this.RootFrame_FirstNavigated;

                // Quand la pile de navigation n'est pas restaurée, accédez à la première page,
                // puis configurez la nouvelle page en transmettant les informations requises en tant que
                // paramètre
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Vérifiez que la fenêtre actuelle est active
            Window.Current.Activate();
        }
示例#30
0
        /// <summary>
        /// Wird aufgerufen, wenn die Anwendung durch den Endbenutzer normal gestartet wird. Weitere Einstiegspunkte
        /// werden verwendet, wenn die Anwendung zum Öffnen einer bestimmten Datei, zum Anzeigen
        /// von Suchergebnissen usw. gestartet wird.
        /// </summary>
        /// <param name="args">Details über Startanforderung und -prozess.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // App-Initialisierung nicht wiederholen, wenn das Fenster bereits Inhalte enthält.
            // Nur sicherstellen, dass das Fenster aktiv ist.
            if (rootFrame == null)
            {
                // Einen Rahmen erstellen, der als Navigationskontext fungiert und zum Parameter der ersten Seite navigieren
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Zustand von zuvor angehaltener Anwendung laden
                }

                // Den Rahmen im aktuellen Fenster platzieren
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Wenn der Navigationsstapel nicht wiederhergestellt wird, zur ersten Seite navigieren
                // und die neue Seite konfigurieren, indem die erforderlichen Informationen als Navigationsparameter
                // übergeben werden
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Sicherstellen, dass das aktuelle Fenster aktiv ist
            Window.Current.Activate();
        }
示例#31
0
文件: App.xaml.cs 项目: brisilda/blog
        /// <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();
        }
示例#32
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user. 
        /// </summary>
        /// <param name="args">A <see cref="LaunchActivatedEventArgs"/> containing details about the launch request and 
        /// the process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            var rootFrame = Window.Current.Content as Frame;
            if (rootFrame == null)
            {
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            Window.Current.Activate();
        }
示例#33
0
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            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();
                //Associate the frame with a SuspensionManager key                                
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                // 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
                if (!rootFrame.Navigate(typeof(EventsPage), "AllGroups"))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();            
        }
示例#34
0
        /// <summary>
        /// Richiamato quando l'applicazione viene avviata normalmente dall'utente. All'avvio dell'applicazione
        /// verranno usati altri punti di ingresso per aprire un file specifico.
        /// </summary>
        /// <param name="e">Dettagli sulla richiesta e sul processo di avvio.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Non ripetere l'inizializzazione dell'applicazione se la finestra già dispone di contenuto,
            // assicurarsi solo che la finestra sia attiva
            if (rootFrame == null)
            {
                // Creare un frame che agisca da contesto di navigazione e passare alla prima pagina
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: caricare lo stato dall'applicazione sospesa in precedenza
                }

                // Posizionare il frame nella finestra corrente
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Quando lo stack di esplorazione non viene ripristinato, passare alla prima pagina
                // e configurare la nuova pagina passando le informazioni richieste come parametro
                // parametro
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Assicurarsi che la finestra corrente sia attiva
            Window.Current.Activate();
        }
   //     private Windows.UI.Core.CoreDispatcher _dispatcher;

  /*      internal async Task ensureOnUIThread2(Action t)
        {
            if (_thread_id != Environment.CurrentManagedThreadId)
                await _dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => t.Invoke());
            else
            {
                t.Invoke();
            }
        } */

        internal Task<NKE_Window> createWindow(Dictionary<string, object> options)
        {

            var tcs = new TaskCompletionSource<NKE_Window>();

         //    _dispatcher = Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;


            Frame rootFrame = Window.Current.Content as Frame;
            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;
                Window.Current.Content = rootFrame;
            }

            globalEvents.once<NKE_Window>("NKE.WindowCreated." + this._id, (e, window) =>
            {
                //     this._window = window;
                tcs.TrySetResult(window);
            });

            if (rootFrame.Content == null)
            {
                rootFrame.Navigate(typeof(NKE_Window), this._id);
            }
            NKEventEmitter.global.emit<string>("NKE.WindowAdded", _id.ToString(), false);

            rootFrame.Unloaded += RootFrame_Unloaded;
            Window.Current.Activate();


            return tcs.Task;
        }
示例#36
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            #if DEBUG
              if (Debugger.IsAttached)
              {
            DebugSettings.EnableFrameRateCounter = true;
              }
            #endif

              Frame rootFrame = Window.Current.Content as Frame;
              if (rootFrame == null)
              {
            rootFrame = new Frame();
            rootFrame.NavigationFailed += OnNavigationFailed;

            if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
              //TODO: Load state from previously suspended application
            }

            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);
              }

              Window.Current.Activate();
        }
示例#37
0
        /// <summary>
        /// Se invoca cuando la aplicación la inicia normalmente el usuario final. Se usarán otros puntos
        /// de entrada cuando la aplicación se inicie para abrir un archivo específico, para mostrar
        /// resultados de la búsqueda, etc.
        /// </summary>
        /// <param name="e">Información detallada acerca de la solicitud y el proceso de inicio.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            #if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
            #endif

            Frame rootFrame = Window.Current.Content as Frame;

            // No repetir la inicialización de la aplicación si la ventana tiene contenido todavía,
            // solo asegurarse de que la ventana está activa.
            if (rootFrame == null)
            {
                // Crear un marco para que actúe como contexto de navegación y navegar a la primera página.
                rootFrame = new Frame();

                // TODO: Cambiar este valor a un tamaño de caché adecuado para la aplicación
                rootFrame.CacheSize = 1;

                // Establecer el idioma predeterminado
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Cargar el estado de la aplicación suspendida previamente
                }

                // Poner el marco en la ventana actual.
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Quita la navegación de transición en el inicio.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated += this.RootFrame_FirstNavigated;

                // Cuando no se restaura la pila de navegación, navegar a la primera página,
                // configurando la nueva página pasándole la información requerida como
                //parámetro de navegación
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Asegurarse de que la ventana actual está activa.
            Window.Current.Activate();
        }
示例#38
0
        /// <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="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Windows.UI.Xaml.Controls.Frame rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.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 Windows.UI.Xaml.Controls.Frame();

                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                Forms.Init(e);

                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)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += this.RootFrame_FirstNavigated;

                // 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(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
示例#39
0
        protected override void OnActivated(IActivatedEventArgs args)
        {
            if (args is ProtocolActivatedEventArgs)
            {
                ProtocolActivatedEventArgs pargs = (ProtocolActivatedEventArgs)args;
                bool success = false;

                if (pargs.PreviousExecutionState == ApplicationExecutionState.ClosedByUser ||
                    pargs.PreviousExecutionState == ApplicationExecutionState.NotRunning)
                {
                    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;

                        InitXamarin(args);

                        // 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);
                    }
                    // Ensure the current window is active
                    Window.Current.Activate();
                }

                try
                {
                    if (Scanner.IsAppURL(pargs.Uri.ToString()))
                    {
                        success = true;
                        QR2Web.App.StartScanFromWeb(pargs.Uri.ToString());
                    }
                }
                catch (Exception)
                {
                    success = false;
                }

                if (!success)
                {
                    QR2Web.App.StartScanFromWeb("");
                }
            }
            base.OnActivated(args);
        }
示例#40
0
 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 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)));
         }
     }
 }
示例#42
0
 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)));
         }
     }
 }
示例#43
0
 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)));
         }
     }
 }
示例#44
0
 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)));
         }
     }
 }
示例#45
0
        /// <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)
        {
//#if DEBUG
//            if (System.Diagnostics.Debugger.IsAttached)
//            {
//                this.DebugSettings.EnableFrameRateCounter = true;
//            }
//#endif
            Windows.UI.Xaml.Controls.Frame rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.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 Windows.UI.Xaml.Controls.Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                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

                    //Setup frame list, create manager.
                    //Navigate to NavPage
                    var frames = await generateFrames();

                    manager = new AppManager(frames);
                    manager.setMainFrame(rootFrame);
                    rootFrame.Navigate(typeof(NavPage), manager);
                }
                //Makes sure app opens in fullscreen mode
                ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
示例#46
0
        /// <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)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Windows.UI.Xaml.Controls.Frame rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.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 Windows.UI.Xaml.Controls.Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Rg.Plugins.Popup.Popup.Init();
                Xamarin.Forms.Forms.Init(e, Rg.Plugins.Popup.Popup.GetExtraAssemblies());
                List <Assembly> assembliesToInclude = new List <Assembly>();
                assembliesToInclude.Add(typeof(Xamarin.Forms.PancakeView.UWP.PancakeViewRenderer).GetTypeInfo().Assembly);
                Xamarin.Forms.Forms.Init(e, assembliesToInclude);
                DependencyService.Register <UWPToastManager>();
                DependencyService.Register <UWPSoundManager>();

                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();
        }
示例#47
0
        /// <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)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Windows.UI.Xaml.Controls.Frame rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.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 Windows.UI.Xaml.Controls.Frame();
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                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();

            Dealer dealer = new Dealer();
            dealer.Connect("tcp://localhost:33333");

            dealer.Send("Hello");
            string text = dealer.ReceiveString();
        }
        /// <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)
        {
            Windows.UI.Xaml.Controls.Frame rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.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 Windows.UI.Xaml.Controls.Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                /**
                 * As Per:
                 * https://forums.xamarin.com/discussion/146467/reference-to-type-assembly-claims-it-is-defined-in-system-runtime-but-it-could-not-be-found
                 *
                 * This project must have a min build of Windows 10 Fall Creators Update (10.0; Build 16299)
                 * otherwise
                 * Xamarin.Forms.Forms.Init(e);
                 * Will show the error 'Assembly' not found in System.Runtime
                 **/
                Xamarin.Forms.Forms.Init(e);

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                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();
            }
        }
示例#49
0
        /// <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)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.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 Windows.UI.Xaml.Controls.Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Xamarin.Forms.Forms.Init(e);

                DependencyService.Register <ToastNotificatorImplementation>();
                ToastNotificatorImplementation.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();
        }
        private void OnBackRequested(object sender, BackRequestedEventArgs e)
        {
            var currentPage = (BaseContentPage)this.Element;

            if (currentPage.BackButtonAction != null)
            {
                e.Handled = true;
                // Invoke the back button action
                currentPage.BackButtonAction.Invoke();
            }
            else
            {
                // Invoke the back button action
                UWPFrame rootFrame = Window.Current.Content as UWPFrame;
                if (rootFrame.CanGoBack)
                {
                    e.Handled = true;
                    rootFrame.GoBack();
                }
            }
        }
示例#51
0
        /// <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)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.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 Windows.UI.Xaml.Controls.Frame();
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                rootFrame.NavigationFailed += OnNavigationFailed;

                Forms.Init(e);
                FormsMaps.Init(Controls.App.Config["UWPMapsAuthKey"]);

                // 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();
        }
示例#52
0
        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)));
                }
            }
        }
示例#53
0
        public Lobby()
        {
            this.InitializeComponent();

            var roomManager = RoomManager.GetInstance();

            RoomListUI.ItemsSource = roomManager.RoomMembers;

            var mainPageViewModel = MainPageViewModel.GetInstance();

            ChatWindow.ItemsSource = mainPageViewModel.ChatMessages;
            DataContext            = mainPageViewModel;


            // This frame is hidden, meaning it is never shown.  It is simply used to load
            // each scenario page and then pluck out the input and output sections and
            // place them into the UserControls on the main page.
            HiddenFrame            = new Windows.UI.Xaml.Controls.Frame();
            HiddenFrame.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            //ContentRoot.Children.Add(HiddenFrame);

            LoadColumnView(typeof(FriendsList));
        }
示例#54
0
        public void UpdateTitleBarAndColor(bool bShowTitleBar)
        {
            Windows.UI.Color backgroundColor = ViewModelLocator.Settings.MenuBackgroundColor;
            Windows.UI.Color foregroundColor = ViewModelLocator.Settings.MenuForegroundColor;
            waitRingRectangle.Fill = new Windows.UI.Xaml.Media.SolidColorBrush(ViewModelLocator.Settings.BackgroundColor);
            bool darkTheme = !ViewModelLocator.Settings.LightTheme;

            if (coreTitleBar != null)
            {
                coreTitleBar.IsVisibleChanged     -= CoreTitleBar_IsVisibleChanged;
                coreTitleBar.LayoutMetricsChanged -= CoreTitleBar_LayoutMetricsChanged;
                coreTitleBar = null;
            }
            if (coreTitleBar == null)
            {
                coreTitleBar = Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar;
                coreTitleBar.IsVisibleChanged     += CoreTitleBar_IsVisibleChanged;
                coreTitleBar.LayoutMetricsChanged += CoreTitleBar_LayoutMetricsChanged;
            }
            coreTitleBar.ExtendViewIntoTitleBar = true;

            if (bShowTitleBar == true)
            {
                TitleBar.Background = new Windows.UI.Xaml.Media.SolidColorBrush(backgroundColor);
                MainTitleBarTextBlock.Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(foregroundColor);
                if (coreTitleBar.Height > 0)
                {
                    TitleBar.Height = coreTitleBar.Height;
                }
                Window.Current.SetTitleBar(MainTitleBar);
            }
            else
            {
                Window.Current.SetTitleBar(null);
            }

            hamburgerMenu.PaneBackground = new Windows.UI.Xaml.Media.SolidColorBrush(backgroundColor);
            Windows.UI.ViewManagement.ApplicationViewTitleBar formattableTitleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar;
            formattableTitleBar.ButtonForegroundColor         = foregroundColor;
            formattableTitleBar.ForegroundColor               = foregroundColor;
            formattableTitleBar.ButtonHoverForegroundColor    = foregroundColor;
            formattableTitleBar.ButtonInactiveForegroundColor = foregroundColor;
            formattableTitleBar.ButtonForegroundColor         = foregroundColor;

            if (bShowTitleBar == false)
            {
                formattableTitleBar.BackgroundColor               = Windows.UI.Colors.Transparent;
                formattableTitleBar.ButtonBackgroundColor         = Windows.UI.Colors.Transparent;
                formattableTitleBar.ButtonHoverBackgroundColor    = Windows.UI.Colors.Transparent;
                formattableTitleBar.ButtonInactiveBackgroundColor = Windows.UI.Colors.Transparent;
                // AppLogo.Opacity = 0.5;
                // MainTitleBar.Opacity = 0.5;
            }
            else
            {
                formattableTitleBar.BackgroundColor               = backgroundColor;
                formattableTitleBar.ButtonBackgroundColor         = backgroundColor;
                formattableTitleBar.ButtonHoverBackgroundColor    = backgroundColor;
                formattableTitleBar.ButtonInactiveBackgroundColor = backgroundColor;
                //  AppLogo.Opacity = 1;
                //  MainTitleBar.Opacity = 1;
            }

            if (darkTheme == true)
            {
                if (this.RequestedTheme != ElementTheme.Dark)
                {
                    this.RequestedTheme = ElementTheme.Dark;
                }
            }
            else
            {
                if (this.RequestedTheme != ElementTheme.Light)
                {
                    this.RequestedTheme = ElementTheme.Light;
                }
            }
            if (string.Equals(Information.SystemInformation.SystemFamily, "Windows.Xbox", StringComparison.OrdinalIgnoreCase))
            {
                this.Background = new Windows.UI.Xaml.Media.SolidColorBrush(this.ViewModelLocator.Settings.MenuBackgroundColor);
                Windows.UI.Xaml.Controls.Frame ui = this.Parent as Windows.UI.Xaml.Controls.Frame;
                if (ui != null)
                {
                    ui.Background = this.Background;
                }
            }
        }
 public MvxFormsWindowsSetup(XamlControls.Frame rootFrame, LaunchActivatedEventArgs e)
     : base(rootFrame)
 {
     _launchActivatedEventArgs = e;
 }
示例#56
0
//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)));
                }
            }
        }
示例#57
0
        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);
        }
示例#58
0
        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)));
                        }
                    }
                }
            }
        }
示例#59
0
 public Platform(Windows.UI.Xaml.Controls.Frame applicationFrame)
 {
 }
示例#60
0
 public Setup(XamlControls.Frame rootFrame, LaunchActivatedEventArgs e) : base(rootFrame, e)
 {
     _launchActivatedEventArgs = e;
 }