/// <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 respond to voice commands, or 
        /// URI invoked. This also installs the voice commands into cortana.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
                if(Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride == string.Empty)
                    Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = Windows.Globalization.ApplicationLanguages.Languages[0];
                App.NavigationService = new NavigationService(rootFrame);

                rootFrame.NavigationFailed += OnNavigationFailed;

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

            if (rootFrame.Content == null)
            {
                // Determine if we're being activated normally, or with arguments from Cortana.
                if (string.IsNullOrEmpty(e.Arguments))
                {
                    // Launching normally.
                    rootFrame.Navigate(typeof(View.TripListView), "");
                }
                else
                {
                    // Launching with arguments. We assume, for now, that this is likely
                    // to be in the form of "destination=<location>" from activation via Cortana.
                    rootFrame.Navigate(typeof(View.TripDetails), e.Arguments);
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();

            try
            {
                // Install the main VCD. Since there's no simple way to test that the VCD has been imported, or that it's your most recent
                // version, it's not unreasonable to do this upon app load.
                StorageFile vcdStorageFile = await Package.Current.InstalledLocation.GetFileAsync(@"AdventureWorksCommands.xml");

                await Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.InstallCommandDefinitionsFromStorageFileAsync(vcdStorageFile);

               //Update phrase list.
               //ViewModel.ViewModelLocator locator = App.Current.Resources["ViewModelLocator"] as ViewModel.ViewModelLocator;
               // if (locator != null)
               // {
               //     await locator.TripViewModel.UpdateDestinationPhraseList();
               // }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Installing Voice Commands Failed: " + ex.ToString());
            }
        }
Exemple #2
0
 public HandlerPageViewModel(DiteService diteService, NavigationService navigationService, IComponentFactory factory, IMessengerService messengerService)
     :base(factory, messengerService)
 {
     this._diteService = diteService;
     _navigationService = navigationService;
     //_moduleFactory = moduleFactory;
 }
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // smooth merchant thumbnail image resizing
            new BitmapTransform().InterpolationMode = BitmapInterpolationMode.Cubic;

            Frame rootFrame = Window.Current.Content as Frame;

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

            if (rootFrame.Content == null)
            {
                var navigationService = new NavigationService(rootFrame);
                var loginPageViewModel = new LoginPageViewModel();
                var accountPageViewModel = new AccountPageViewModel();
                var schedulerService = new SchedulerService();

                var mondoAuthorizationClient = new MondoAuthorizationClient("YOUR_CLIENT_ID_HERE", "YOUR_CLIENT_SECRET_HERE", "https://production-api.gmon.io");

                var appController = new AppController(navigationService, mondoAuthorizationClient, loginPageViewModel, accountPageViewModel, schedulerService);

                appController.Start();
                rootFrame.Navigate(typeof (LoginPage), e.Arguments);
                rootFrame.DataContext = loginPageViewModel;
            }

            Window.Current.Activate();
        }
 /// <summary>
 /// Initializes a new <see cref="CreateTodoListItemViewModel"/> instance.
 /// </summary>
 /// <param name="navigationService">The navigation service, which is used to navigate between views.</param>
 /// <param name="applicationService">The application service, which can be used to manage the application lifecycle.</param>
 /// <param name="dialogService">The dialog service, which provides access to the various dialogs offered by Windows.</param>
 /// <param name="todoListItemsRepository">The todo list items repository, which can be used to manage the items on the todo list.</param>
 public CreateTodoListItemViewModel(NavigationService navigationService, ApplicationService applicationService, DialogService dialogService, TodoListItemsRepository todoListItemsRepository)
 {
     this.navigationService = navigationService;
     this.applicationService = applicationService;
     this.dialogService = dialogService;
     this.todoListItemsRepository = todoListItemsRepository;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="MainPageViewModel"/> class.
        /// </summary>
        /// <param name="messenger">
        /// The messenger.
        /// </param>
        /// <param name="navigationService">
        /// The navigation service.
        /// </param>
        public MainPageViewModel(IMessenger messenger, NavigationService navigationService)
            : base(messenger, navigationService)
        {
            this.InitializeMenu();

            this.ItemInvokedCommand = new RelayCommand<ListViewItem>(this.ItemInvoked);
        }
Exemple #6
0
        /// <summary>
        /// Вызывается при обычном запуске приложения пользователем.  Будут использоваться другие точки входа,
        /// например, если приложение запускается для открытия конкретного файла.
        /// </summary>
        /// <param name="e">Сведения о запросе и обработке запуска.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Не повторяйте инициализацию приложения, если в окне уже имеется содержимое,
            // только обеспечьте активность окна
            if (rootFrame == null)
            {
                // Создание фрейма, который станет контекстом навигации, и переход к первой странице
                rootFrame = new Frame();
                App.NavigationService = new NavigationService(rootFrame);

                rootFrame.NavigationFailed += OnNavigationFailed;

                // Размещение фрейма в текущем окне
                Window.Current.Content = rootFrame;
            }

            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
            }

            if (rootFrame.Content == null)
            {
                // Determine if we're being activated normally, or with arguments from Cortana.
                if (string.IsNullOrEmpty(e.Arguments))
                {
                    // Launching normally.
                    rootFrame.Navigate(typeof(View.MainPage), "");
                }
                else
                {
                    // Launching with arguments. We assume, for now, that this is likely
                    // to be in the form of "modelnumber=<number>" from activation via Cortana.
                    rootFrame.Navigate(typeof(View.SelectedModel), e.Arguments);
                }
            }

            // Обеспечение активности текущего окна
            Window.Current.Activate();

            // Установка словаря голосовых команд (VCD)
            try
            {
                var storageFile =
                await Windows.Storage.StorageFile
                .GetFileFromApplicationUriAsync(new Uri("ms-appx:///vcd.xml"));

                await Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager
                    .InstallCommandDefinitionsFromStorageFileAsync(storageFile);

                Debug.WriteLine("VCD installed");
            }
            catch
            {
                Debug.WriteLine("VCD installation failed");
            }
        }
        private void SetupNavigation()
        {
            var navigationService = new NavigationService();
            navigationService.Configure(ViewModelLocator.ResourcePageKey, new Uri("Views/ResourcesView.xaml", UriKind.Relative));
            navigationService.Configure(ViewModelLocator.StepsPageKey, new Uri("Views/StepsView.xaml", UriKind.Relative));

            SimpleIoc.Default.Register<IModernNavigationService>(() => navigationService);
        }
        public MPageViewModel(IMenusService menusService, NavigationService navigation)
        {
            this._menusService = menusService;
            IsOpen = false;
            Pjs = new Projects();
            Project pj1 = new Project();
            List<Project> list = new List<Project>();
            pj1.PCode = "行政绩效";
            pj1.PName = "行政绩效";
            pj1.PColor = "#b571cb";
            pj1.Image = @"Assets\行政绩效.png";
            list.Add(pj1);
            Project pj2 = new Project();
            pj2.PCode = "OA";
            pj2.PName = "办公自动化";
            pj2.PColor = "#b571cb";
            pj2.Image = @"Assets\OA.png";
            list.Add(pj2);
            Pjs.ProjectList = list;
            LoadMenus("行政绩效");
            MenuClickCommand = new RelayCommand<object>((e) =>
            {
                var parameter = e as Menu;
                if (parameter.MCode == "cszbjd")
                {
                    navigation.Navigate<Views.DeptPage>();
                }
                else if (parameter.MCode == "zbgs")
                {
                    navigation.Navigate<Views.PublishKpiPage>();
                }
                else if (parameter.MCode == "ldrc")
                {
                    navigation.Navigate<Views.OALDRCPage>();
                }
            });
            
            ButtonClickCommand = new RelayCommand<object>((e) =>
            {
                var p = e as Project;
                var ssxt = string.Empty;
                if (p == null)
                {
                    ssxt = "行政绩效";
                }
                else
                {
                    ssxt = p.PCode;
                }
                LoadMenus(ssxt);
                Ctl = new Controller();
                Ctl.IsOpen = !IsOpen;
                IsOpen = Ctl.IsOpen;

            });
            //ButtonClickCommand.Execute = new System.Action<object>(LoadMenus)

        }
		public void InitalizeNavigationService(Page rootPage)
		{			
			var navigationService = new NavigationService(rootPage);
			navigationService.Configure(NavigationService.RootPageKey, typeof(MainPage));
			navigationService.Configure("Tags", typeof(TagPage));
			navigationService.Configure("Settings", typeof(SettingsPage));

			SimpleIoc.Default.Register<INavigationService>(() => navigationService); ;
		}
 public ShellViewModel(NavigationService navigationService)
 {
     Menu = new ObservableCollection<MenuItem>
     {
         new MenuItem() {Glyph = "", Text = "My Team", NavigationDestination = typeof (MainPage)},
         new MenuItem() {Glyph = "", Text = "About Page", NavigationDestination = typeof (AboutPage)},
         new MenuItem() {Glyph = "", Text = "Third Page", NavigationDestination = null}
     };
 }
 public TimelineViewModel(
     DbService database,
     AppSettings settings,
     NavigationService navigationService)
 {
     this.database = database;
     this.settings = settings;
     this.navigationService = navigationService;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PageViewModel"/> class.
        /// </summary>
        /// <param name="messenger">
        /// The messenger.
        /// </param>
        /// <param name="navigationService">
        /// The navigation Service.
        /// </param>
        protected PageViewModel(IMessenger messenger, NavigationService navigationService)
        {
            if (messenger == null) throw new ArgumentNullException(nameof(messenger));
            if (navigationService == null) throw new ArgumentNullException(nameof(navigationService));

            this.Messenger = messenger;
            this.NavigationService = navigationService;

            this.NavigateBackCommand = new RelayCommand(() => this.NavigateBack(null));
        }
		protected override INavigationService CreateNavigationService()
		{
			var navigationService = new NavigationService();

			navigationService.Configure(Const.MOVIES_VIEW, typeof(MoviesView));
			navigationService.Configure(Const.MOVIESDATAIL_VIEW, typeof(MovieDetailView));


			return navigationService;
		}
 public MainPageViewModel(IDeptService deptService, NavigationService navigation)
 {
     this._deptService = deptService;
     LoadDepts();
     ItemClickCommand = new RelayCommand<object>((e) =>
     {
         var parameter = e as Dept;
         navigation.Navigate<Views.ProgressPage>(parameter.DepartmentID);
     });
 }
        public ExampleViewModel(NavigationService navigationService, MessagingService messagingService)
        {
            Message = "Example text 2";
            this.navigationService = navigationService;
            this.messagingService = messagingService;

            messagingService.Register();

            NavigateBackCommand = new RelayCommand(NavigateBackExecute);
        }
 private INavigationService CreateNavigationService(NavigationPage navigationPage)
 {
     var navigationService = new NavigationService(navigationPage);
     navigationService.Configure(ViewNames.Main, typeof(MainPage));
     navigationService.Configure(ViewNames.Place, typeof(PlacePage));
     navigationService.Configure(ViewNames.Pollen, typeof(PollenPage));
     navigationService.Configure(ViewNames.Settings, typeof(SettingsPage));
     navigationService.Configure(ViewNames.AddEditPlace, typeof(AddEditPlacePage));
     navigationService.Configure(ViewNames.About, typeof(AboutPage));
     return navigationService;
 }
Exemple #17
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            var navigationService = new NavigationService();
            WaveServices.RegisterService(navigationService);

            WaveServices.ScreenContextManager.SetDiagnosticsActive(true);

            navigationService.StartNavigation();
        }
		public NecromancerApp ()
		{
			InitializeComponent ();

			FileService = Resolver.Resolve<FileService> ();
			
			MainPage = new CustomNavigationPage (Resolver.Resolve<PageService> ().CreatePage<HomePage> ());

			Navigation = Resolver.Resolve<NavigationService> ();
			Navigation.SetNavigation (MainPage.Navigation);

		}
Exemple #19
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            BusinessLogic businessLogic = new BusinessLogic();

            MainWindow mainWindow = new MainWindow();
            mainWindow.Show();

            Navigation = new NavigationService(mainWindow.MyFrame);
            Navigation.Navigate<FirstPage>();
        }
Exemple #20
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 async void OnLaunched(LaunchActivatedEventArgs args)
        {
            bool isRestarting = false;
            //Do not repeat app initialization when already running, just ensure that window is active
            if(args.PreviousExecutionState == ApplicationExecutionState.Running)
            {
                Window.Current.Activate();
                return;
            }

            // Create a Frame to act as the navigation context and associate it with
            // a SuspensionManager key
            var rootFrame = new Frame();
            SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

            //SuspensionManager.KnownTypes.AddRange(new[]{typeof(PuzzleBoardViewModel), typeof(PuzzleViewModel), typeof(PuzzlesViewModel), typeof(PuzzleGroupViewModel),
            //    typeof(WordViewModel),typeof(CellViewModel) , typeof(CellEmptyViewModel),typeof(GameState),
            //    typeof(GameFinishedState),
            //    typeof(GameFinishedWithErrorsState),
            //    typeof(GameNotStartedState),
            //    typeof(GamePauseState)});

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated ||
                args.PreviousExecutionState == ApplicationExecutionState.ClosedByUser)
            {
                //Restore the saved session state only when appropriate
                await SuspensionManager.RestoreAsync();
                if (rootFrame.Content != null) isRestarting = true;
            }
            
            if (isRestarting)
            {
                App.NavigationService = new NavigationService(rootFrame);
                Window.Current.Content = rootFrame;
            }
            else
            {
                var gameDataService = SimpleIoc.Default.GetInstance<IGameDataService>();
                await gameDataService.GetGameDataAndStoreInLocalDb(Windows.Storage.ApplicationData.Current.LocalFolder.Path);

                //SplashScreen splashScreen = args.SplashScreen;
                //var extendedSplashScreen = new ExtendedSplashView(splashScreen, false);
                //splashScreen.Dismissed += splashScreen_Dismissed;
                App.NavigationService = new NavigationService(rootFrame);

                rootFrame.Navigate(typeof(PuzzlesView));
                Window.Current.Content = rootFrame;



            }
            Window.Current.Activate();
        }
 public LoginContext()
 {
     //_pageFactory = new PageFactoryBase();
     //Kernel.Bind(typeof(ILocatorTransformer<>)).To(typeof(SeleniumLocatorTransformer));
     //Kernel.Bind<IPageFactory>().To<PageFactoryBase>();
     //Kernel.Bind<IDriverDecorator>().To<SeleniumDriverDecorator>();
     //Kernel.Bind<IElement>().To<SeleniumElement>();
     //Kernel.Bind<IHow>().To<ProofOfConcept.Selenium.How>();
     //Kernel.Bind<NavigationService>().To<NavigationService>();
     //Kernel.Bind<IElementSearchConfiguration>().To<SeleniumElementFinder>();
     _pageFactory = DependencyManager.Kernel.Get<IPageFactory>();
     _navigationService = DependencyManager.Kernel.Get<NavigationService>();
 }
Exemple #22
0
        public void TestGetTaskListsCommand()
        {
            var data = new DataService();
            var navi = new NavigationService();
            var dialog = new DialogService();
            var vm = new TaskListsViewModel(data, navi, dialog);
            
            vm.GetTaskListsCommand.Execute(null);

            Assert.AreEqual(3, vm.TaskLists.Count);
            Assert.AreEqual("1", vm.SelectedTaskList.Id);
            Assert.AreEqual(10, vm.SelectedTaskList.Tasks.Count);
        }
Exemple #23
0
		public App ()
		{
			
			nav = new NavigationService ();
			nav.Configure (ViewModelLocator.EmployeeDetailPageKey, typeof(staffPage));
			nav.Configure (ViewModelLocator.EmployeeListPageKey, typeof(staffPage));

			SimpleIoc.Default.Register<IMyNavigationService> (()=> nav, true);
			var navPage = new NavigationPage (new loginPage ());
			navPage.Title ="staff";
			nav.Initialize (navPage);
			MainPage = navPage;
		}
Exemple #24
0
        public void Constructor_InjectedServiceLocator()
        {
            var serviceLocator = new ServiceLocator();
            var messageService = new MessageService();
            serviceLocator.RegisterInstance<IMessageService>(messageService);

            var navigationService = new NavigationService();
            serviceLocator.RegisterInstance<INavigationService>(navigationService);

            var viewModel = new TestViewModel(serviceLocator);
            Assert.AreEqual(messageService, viewModel.GetService<IMessageService>());
            Assert.IsTrue(ReferenceEquals(messageService, viewModel.GetService<IMessageService>()));
            Assert.AreEqual(navigationService, viewModel.GetService<INavigationService>());
            Assert.IsTrue(ReferenceEquals(navigationService, viewModel.GetService<INavigationService>()));
        }
        public override void Initialize()
        {
            CreatableTypes()
                .EndingWith("Service")
                .AsInterfaces()
                .RegisterAsLazySingleton();

            var navigationService =
                new NavigationService();

            Core.Services.Services.IoC.Register<INavigationService>(ioc =>
                navigationService);

            RegisterAppStart<ViewModels.PalestrantesViewModel>();
        }
        public DesignRequestListVm(IRepository<Request> requestRepository, IRepository<City> cityRepository, IEventAggregator eventAggregator, NavigationService navigationService)
        {
            _requestRepository = requestRepository;
            _cityRepository = cityRepository;
            _eventAggregator = eventAggregator;
            _navigationService = navigationService;

            Items = new ObservableCollection<RequestVm>(_requestRepository.GetAll().Select(x => new RequestVm(x)));

            _eventAggregator.GetEvent<ChangeAcceptedEvent<Hangar>>().Subscribe(_ =>

            {
                new ObservableCollection<RequestVm>(_requestRepository.GetAll().Select(x => new RequestVm(x)));
            });
        }
        public App()
        {
            var nav = new NavigationService();
            nav.Configure(Locator.FirstPage, typeof(FirstPage));
            nav.Configure(Locator.SecondPage, typeof(SecondPage));
            nav.Configure(Locator.ThirdPage, typeof(ThirdPage));
            SimpleIoc.Default.Register<INavigationService>(() => nav);

            var firstPage = new NavigationPage(new FirstPage());

            nav.Initialize(firstPage);

            //SimpleIoc.Default.Register<INavigationService>(() => nav);

            MainPage = firstPage;
        }
Exemple #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)
        {
            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();
            App.NavigationService = new NavigationService(rootFrame);

            rootFrame.Navigate(typeof(BlankPage));

            // Place the frame in the current Window and ensure that it is active
            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }
		public HeroesStateViewModel (NavigationService navigationService, GameStateService saveGameService)
		{
			_navigationService = navigationService;
			_saveGameService = saveGameService;
			MessagingCenter.Subscribe<SelectHeroViewModel,Hero>(this, "HeroSelected", (sender, hero) => {
				var fallenHero = Heroes.FirstOrDefault(x=>x.HasFallen);
				var insertIndex = 0;
				if(fallenHero != null)
				{
					insertIndex = Heroes.IndexOf(fallenHero);
					Heroes.Remove(fallenHero);
				}
				Heroes.Insert(insertIndex, hero);
				Heroes = new List<Hero>(Heroes);
				RaisePropertyChanged (() => Heroes);
			});
		}
        public App()
        {
            var navigationPage =
                new NavigationPage(
                    new View.PalestrantesPage()
                );
            // The root page of your application
            MainPage = navigationPage;

            var navigationService =
                new NavigationService(navigationPage);

            Core.Services.Services.IoC.Register<INavigationService>(ioc =>
                navigationService);

            navigationService.Register<PalestrantesViewModel, PalestrantesPage>();
            navigationService.Register<PalestranteViewModel, PalestrantePage>();
        }
Exemple #31
0
 //
 // Przycisk udostępnij
 //
 private void btnShareCitation_click(object sender, EventArgs e)
 {
     // Otwórz stronę udostępnienia
     NavigationService.Navigate(new Uri("/Pages/SharePage.xaml", UriKind.Relative));
 }
 private void Menu_Changes(object sender, EventArgs e)
 {
     NavigationService.Navigate(new ChangesPage());
 }
Exemple #33
0
 private void about_click(object sender, EventArgs e)
 {
     NavigationService.Navigate(new Uri("/Pages/about.xaml", UriKind.RelativeOrAbsolute));
 }
Exemple #34
0
 private void BackupClick(object sender, EventArgs e)
 {
     NavigationService.Navigate(new Uri("/Pages/backup.xaml", UriKind.RelativeOrAbsolute));
 }
Exemple #35
0
 private void ButtonNew_Click(object sender, RoutedEventArgs e)
 {
     NavigationService.Navigate <MasterDetailPage>();
 }
Exemple #36
0
 private void navigatePerformanceMeter(object sender, RoutedEventArgs e)
 {
     NavigationService.Navigate(new PerformanceTools.MainPerfomanceTool());
 }
Exemple #37
0
        private void CancelJournal_Click(object sender, RoutedEventArgs e)
        {
            PagePatient pp = new PagePatient(DbGet.GetPatient(patientId));

            NavigationService.Navigate(pp);
        }
 private void btnBack_Click(object sender, EventArgs e)
 {
     NavigationService.GoBack();
 }
Exemple #39
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     NavigationService.Navigate(new Uri("/AcqVoltageInt.xaml", UriKind.Relative));
 }
Exemple #40
0
        protected override void OnInitialized()
        {
            InitializeComponent();

            NavigationService.NavigateAsync("MainPage?title=Hello%20from%20Xamarin.Forms");
        }
 private void GoBack_OnTapped(object sender, TappedRoutedEventArgs e)
 {
     NavigationService.GoBack();
 }
 private void btnHome_Click(object sender, EventArgs e)
 {
     NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
 }
        protected override async void OnInitialized()
        {
            InitializeComponent();

            await NavigationService.NavigateAsync("NavigationPage/MainPage");
        }
Exemple #44
0
        private async void _Click(object sender, RoutedEventArgs e)
        {
            async void _Refresh()
            {
                uiRefreshButton.IsEnabled = false;
                var lst = await Task.Run(HostModule.Refresh);

                foreach (var inf in lst)
                {
                    int idx = _hosts.IndexOf(inf);
                    if (idx < 0)
                    {
                        _hosts.Add(inf);
                    }
                    else
                    {
                        _hosts[idx] = inf;
                    }
                }
                uiRefreshButton.IsEnabled = true;
            }

            var src = (Button)e.OriginalSource;

            if (src == uiBrowserButton)
            {
                uiBrowserButton.Visibility = Visibility.Collapsed;
                uiRefreshButton.Visibility =
                    uiListGrid.Visibility  = Visibility.Visible;
                _Refresh();
                return;
            }
            else if (src == uiRefreshButton)
            {
                _hosts.Clear();
                _Refresh();
                return;
            }
            else if (src == uiConnectButton)
            {
                uiConnectButton.IsEnabled = false;
                try
                {
                    var uid = int.Parse(uiIdBox.Text);
                    var pot = int.Parse(uiPortBox.Text);
                    var hos = uiHostBox.Text;

                    var add = IPAddress.TryParse(hos, out var hst);
                    if (add == false)
                    {
                        hst = Dns.GetHostEntry(hos).AddressList.First(r => r.AddressFamily == AddressFamily.InterNetwork);
                    }
                    var iep = new IPEndPoint(hst, pot);

                    // 放弃等待该方法返回的任务
                    var _ = await LinkModule.Start(uid, iep);

                    HostModule.Name = hos;
                    HostModule.Port = pot;

                    NavigationService.Navigate(new PageFrame());
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    Entrance.ShowError("连接失败", ex);
                }
                uiConnectButton.IsEnabled = true;
            }
        }
 private void buttonGoBack_Click(object sender, RoutedEventArgs e)
 {
     NavigationService.GoBack();
 }
 private void btnSearch_Click(object sender, EventArgs e)
 {
     NavigationService.Navigate(new Uri("/SearchActivity.xaml", UriKind.Relative));
 }
Exemple #47
0
 private void navigateTODO(object sender, RoutedEventArgs e)
 {
     NavigationService.Navigate(new ManagementTools.TODO.TodoPage(user));
 }
 public void StartCourse(Course course)
 {
     NavigationService.Navigate(typeof(TestsPage), course);
 }
Exemple #49
0
 /// <summary>
 /// Ons the initialized.
 /// </summary>
 protected override async void OnInitialized()
 {
     InitializeComponent();
     await NavigationService.NavigateAsync(Constants.LoginPage);
 }
 private void OnBack(object sender, MouseButtonEventArgs e)
 {
     NavigationService.GoBack();
 }
Exemple #51
0
 private void addClick(object sender, EventArgs e)
 {
     NavigationService.Navigate(new Uri("/Pages/addEditCar.xaml", UriKind.Relative));
 }
Exemple #52
0
 private void BackButton_Click(object sender, RoutedEventArgs e)
 {
     NavigationService.Navigate(Ppage);
 }
 private void lblNewOption_MouseUp(object sender, MouseButtonEventArgs e)
 {
     NavigationService.NavigateToWithoutHide(new ClientOptionsOptionxaml());
 }
 private void btnAllProducts_Click(object sender, RoutedEventArgs e)
 {
     NavigationService.NavigateToWithoutHide(new ClientOptionsProduct(selectedOptions.GUID));
 }
Exemple #55
0
 private void menuSettings_click(object sender, EventArgs e)
 {
     NavigationService.Navigate(new Uri("/Pages/Settings.xaml", UriKind.RelativeOrAbsolute));
 }
 private void btnUpdateOption_Click(object sender, RoutedEventArgs e)
 {
     NavigationService.NavigateToWithoutHide(new ClientOptionsOptionxaml(selectedOptions));
 }
Exemple #57
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            await NavigationService.NavigateAsync("/TravelMasterDetailPage/NavigationPage/HomePage");
        }
Exemple #58
0
 private void AddSkillsBtn_Click(object sender, RoutedEventArgs e)
 {
     NavigationService.Navigate(new AddSkillsPage());
 }
Exemple #59
0
 protected override async void OnInitialized()
 {
     InitializeComponent();
     IsInBackgrounded = false;
     await NavigationService.NavigateAsync("NavigationPage/StartPage");
 }
        private void onRegisterButtonClick(object sender, RoutedEventArgs e)
        {
            using (var session = NHibernateHelper.OpenSession())
            {
                BrushConverter converter = new BrushConverter();
                bool dataIsCorrect = true;
                if (user.Username == "Username")
                {
                    UsernameBox.BorderBrush = Brushes.Red;
                    UsernameError.Content = "Please enter a name";
                    UsernameError.Visibility = Visibility.Visible;
                    dataIsCorrect = false;
                }
                else if (db.usernameTaken(user.Username, session))
                {
                    UsernameBox.BorderBrush = Brushes.Red;
                    UsernameError.Content = "Name already taken";
                    UsernameError.Visibility = Visibility.Visible;
                    dataIsCorrect = false;
                }
                else
                {
                    UsernameError.Visibility = Visibility.Collapsed;
                    UsernameBox.BorderBrush = (SolidColorBrush)converter.ConvertFrom("#FFABADB3");
                }
                if (!IsValidEmailAddress(user.Email))
                {
                    EmailBox.BorderBrush = Brushes.Red;
                    EmailError.Visibility = Visibility.Visible;
                    dataIsCorrect = false;
                }
                else if (db.emailTaken(user.Email, session))
                {
                    EmailBox.BorderBrush = Brushes.Red;
                    EmailError.Content = "Email already taken";
                    EmailError.Visibility = Visibility.Visible;
                    dataIsCorrect = false;
                }
                else
                {
                    EmailError.Visibility = Visibility.Collapsed;
                    EmailBox.BorderBrush = (SolidColorBrush)converter.ConvertFrom("#FFABADB3");
                }
                if (PasswordBox.Password.Length < 8)
                {
                    dataIsCorrect = false;
                    if (PasswordBox.Password.Length == 0)
                    {
                        PasswordBox.BorderBrush = Brushes.Red;
                        PasswordError.Content = "Please choose a password";
                        PasswordError.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        PasswordBox.BorderBrush = Brushes.Red;
                        PasswordError.Content = "Password must be at least 8 characters long";
                        PasswordError.Visibility = Visibility.Visible;
                    }
                }
                else
                {
                    PasswordError.Visibility = Visibility.Collapsed;
                    PasswordBox.BorderBrush = (SolidColorBrush)converter.ConvertFrom("#FFABADB3");
                }
                if (PasswordBox.Password.Length < 8 || ConfirmBox.Password != PasswordBox.Password)
                {
                    dataIsCorrect = false;
                    if (ConfirmBox.Password.Length == 0)
                    {
                        ConfirmBox.BorderBrush = Brushes.Red;
                        ConfirmationError.Content = "Please confirm password";
                        ConfirmationError.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        ConfirmBox.BorderBrush = Brushes.Red;
                        ConfirmationError.Content = "Passwords don't match";
                        ConfirmationError.Visibility = Visibility.Visible;
                    }
                }
                else
                {
                    ConfirmationError.Visibility = Visibility.Collapsed;
                    ConfirmBox.BorderBrush = (SolidColorBrush)converter.ConvertFrom("#FFABADB3");
                }
                if (!dataIsCorrect)
                {
                    return;
                }
                user.Password = PasswordBox.Password;
                db.AddNewUser(user, session);
                NavigationService.GoBack();

            }
        }