public StudentManagement(int userId, NavigationService navigationService)
        {
            //User Id and navigation service stored
            _userId = userId;
            _navigationService = navigationService;

            //Page Initialized
            InitializeComponent();

            //Students returned from database
            var studentList = _client.ReturnStudents();

            //Check to ensure students exist
            if (studentList != null)
            {
                //Population of students list
                foreach (var s in studentList)
                {
                    _studentCollectionList.Add(s);
                }
            }
            StudentList.ItemsSource = _studentCollectionList;
            //Default page information set
            Title.Text = "No selection made.";
            Forename.Text = "None";
            Surname.Text = "None";
            Email.Text = "None";
            Course.Text = "None";
            Year.Text = "None";
        }
        public StaffManagement(int userId, NavigationService navigationService)
        {
            //initialization of maintained data
            _userId = userId;
            _navigationService = navigationService;

            //Page rendered
            InitializeComponent();

            //Staff List returned from web service and added to listed display
            var staffList = _client.ReturnStaff();
            if (staffList != null)
            {
                foreach (var s in staffList)
                {
                    _staffCollectionList.Add(s);
                }
            }
            //Binding of  observable collection to page list
            StaffList.ItemsSource = _staffCollectionList;
            //Setting default display items
            Title.Text = "No selection made.";
            Forename.Text = "None";
            Surname.Text = "None";
            Email.Text = "None";
            Course.Text = "None";
        }
Esempio n. 3
0
 internal static ApplicationBarIconButton CreateButton(string text, string iconPath, NavigationService navigationService, string navigateTo)
 {
     ApplicationBarIconButton button = new ApplicationBarIconButton(new Uri(iconPath, UriKind.Relative));
     button.Text = text;
     button.Click += (sender, e) => { navigationService.Navigate(new Uri(navigateTo, UriKind.Relative)); };
     return button;
 }
Esempio n. 4
0
        public void AddPageToHistory(NavigationService nav)
        {
            int count = GetBackStackCount(nav);

            if (count > PageHistoryStack.Count + 1)
            {
                return;
            }

            if (count < PageHistoryStack.Count)
            {
                PageHistoryStack.RemoveAt(PageHistoryStack.Count - 1);
                LastPageName = null;
            }

            if (count > PageHistoryStack.Count)
            {
                PageHistoryStack.Add(
                    new PageEntry()
                    {
                        PageUrl = nav.CurrentSource.OriginalString
                    }
                    );
                LastPageName = null;
            }
        }
Esempio n. 5
0
 public static void ClearBackStack(NavigationService service)
 {
     while (service.BackStack.Any())
     {
         service.RemoveBackEntry();
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Registers the specified <see cref="PhoneApplicationFrame"/> instance.
        /// </summary>
        /// <param name="frame">The <see cref="PhoneApplicationFrame"/> instance.</param>
        public virtual void RegisterFrame(PhoneApplicationFrame frame)
        {
            lock (_frameLock)
            {
                if (_frame != null)
                {
                    _frame.Navigated    -= Frame_Navigated;
                    _frame.BackKeyPress -= Frame_BackKeyPress;
                }

                _frame = frame;

                if (_frame != null)
                {
                    _frame.Navigated    += Frame_Navigated;
                    _frame.BackKeyPress += Frame_BackKeyPress;

                    _navigationService = (_frame.Content as PhoneApplicationPage)?.NavigationService;
                }
                else
                {
                    _navigationService = null;
                }
            }
        }
		public void Navigate(Frame frame, FrameworkElement nextElement)
		{
			navigationService = frame.NavigationService;
			if (navigationService == null) { return; }

			srcElement = navigationService.Content as FrameworkElement;
			targetElement = nextElement;

			if (srcElement != null)
			{
				navigationService.Navigating += NavigationAnimator_Navigating;
			}

			if (transition == null)
			{
				var mask1 = new Rectangle()
				{
					Fill = new SolidColorBrush(Color.FromArgb(77, 8, 17, 48))
				};

				var mask2 = new Rectangle()
				{
					Fill = new SolidColorBrush(Color.FromArgb(77, 8, 17, 48))
				};

				transition = new ExampleTransition(mask1, mask2);
			}

			navigationService.Navigate(nextElement);
		}
 public ReplyCommand(string threadId, string subject, NavigationService service)
 {
     _threadId = threadId;
     _subject = subject;
     _navigationService = service;
     CanExecuteIt = true;
 }
        public override void Replay(NavigationService navigationService, NavigationMode mode)
        {
            ContentControl navigator = (ContentControl)navigationService.INavigatorHost;
            // Find a reference to the DocumentViewer hosted in the NavigationWindow
            // On initial history navigation in the browser, the window's layout may not have been 
            // done yet. ApplyTemplate() causes the viewer to be created.
            navigator.ApplyTemplate();
            DocumentApplicationDocumentViewer docViewer = navigator.Template.FindName(
                "PUIDocumentApplicationDocumentViewer", navigator)
                as DocumentApplicationDocumentViewer;
            Debug.Assert(docViewer != null, "PUIDocumentApplicationDocumentViewer not found.");
            if (docViewer != null)
            {
                // Set the new state on the DocumentViewer
                if (_state is DocumentApplicationState)
                {
                    docViewer.StoredDocumentApplicationState = (DocumentApplicationState)_state;
                }

                // Check that a Document exists.
                if (navigationService.Content != null)
                {
                    IDocumentPaginatorSource document = navigationService.Content as IDocumentPaginatorSource;

                    // If the document has already been paginated (could happen in the
                    // case of a fragment navigation), then set the DocumentViewer to the
                    // new state that was set.
                    if ((document != null) && (document.DocumentPaginator.IsPageCountValid))
                    {
                        docViewer.SetUIToStoredState();
                    }
                }
            }
        }
 //Window initailaized
 public CreateNewModule(int userId, NavigationService navigation)
 {
     //user Id and navigatino service maintained
     _userId = userId;
     _navigation = navigation;
     //Window opened
     InitializeComponent();
 }
Esempio n. 11
0
 private void Button1Click(object sender, RoutedEventArgs e)
 {
     if (_beginHost) return;
     e.Handled = true;
     _beginHost = true;
     _ns = NavigationService;
     Program.LClient.BeginHostGame(_game, textBox1.Text);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FrameNavigationServiceWrapper"/> class.
 /// </summary>
 /// <param name="dispatcher">The dispatcher.</param>
 /// <param name="frame">The frame.</param>
 public FrameNavigationServiceWrapper(Dispatcher dispatcher, Frame frame)
 {
     this.dispatcher = dispatcher;
     this.frame = frame;
     navigationService = this.frame.NavigationService;
     navigationService.Navigating += NavigationServiceNavigating;
     navigationService.Navigated += NavigationServiceNavigated;
 }
 //Window initailized
 public CreateNewCourse(int userId, NavigationService navigationService)
 {
     //user Id and navigatino service maintained
     _navigation = navigationService;
     _userId = userId;
     //Window initailized
     InitializeComponent();
 }
 //window initialized
 public CreateNewBuilding(int userId, NavigationService navigationService)
 {
     //user Id and navigatino service maintained
     _navigation = navigationService;
     _userId = userId;
     //window created
     InitializeComponent();
 }
 private void PageOptionsOnLoaded(object sender, RoutedEventArgs e)
 {
     navigation = NavigationService.GetNavigationService(this);
     ComboBox_NumberOfThrowings.SelectedIndex = preferences.NumberOfThrowings - 1;
     TextBox_HeadBonus.Text = preferences.HeadBonus.ToString();
     TextBox_TailCost.Text = preferences.TailCost.ToString();
     TextBox_DoubleHeadBonus.Text = preferences.DoubleHeadBonus.ToString();
 }
 private void NextPage_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (ErrorCount.EntityErrorCount == 0)
     {
         LocalTaskLayer.taskParams.InitTask();
         navigation = NavigationService.GetNavigationService(this);
         navigation.Navigate(new PageSolve(_baseLayer));
     }
 }
Esempio n. 17
0
        private void Frame_Navigated(object s, NavigationEventArgs e)
        {
            if (_navigationService == null)
            {
                _navigationService = (e.Content as PhoneApplicationPage)?.NavigationService;
            }

            RaiseNavigated(EventArgs.Empty);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NavigationTransitionSelector"/> class.
 /// </summary>
 /// <param name="navigationService">The navigation service.</param>
 /// <param name="transitionRegistry">The transition registry.</param>
 public NavigationTransitionSelector(NavigationService navigationService, NavigationTransitionRegistry transitionRegistry)
 {
     BackStack = new Stack<NavigationTransition>();
     ForwardStack = new Stack<NavigationTransition>();
     this.transitionRegistry = transitionRegistry;
     this.navigationService = navigationService;
     this.navigationService.Navigating += HandleContentNavigating;
     this.navigationService.Navigated += HandleContentNavigated;
 }
        private void NavigateToGraph()
        {
            View.PatientGraphView window = new View.PatientGraphView();
            ViewModel.PatientGraphViewModel vm = new PatientGraphViewModel(window);
            window.DataContext = vm;

            _ns = NavigationService.GetNavigationService(_linkedView);
            _ns.Navigate(window);
        }
        //Window created
        public EditStudent(int userId, int studentId, NavigationService navigationService)
        {
            //User Id for editing and navigatino service for redirect
            _userId = userId;
            _navigationService = navigationService;
            InitializeComponent();

            //titkles list created
            Titles.Add("Mr");
            Titles.Add("Mrs");
            Titles.Add("Miss");
            Titles.Add("Ms");
            Titles.Add("Dr");
            Title.ItemsSource = Titles;

            //Student details returned
            var student = _client.ReturnStudentDetail(studentId);
            if (student != null)
            {
                _student = student;
                //set information on page of selected student
                Title.SelectedItem = Titles.SingleOrDefault(x => x == _student.StudentTitle);
                Forename.Text = _student.StudentForename;
                Surname.Text = _student.StudentSurname;
                Email.Text = _student.StudentEmail;
                Year.Text = _student.Year.ToString("D");
            }
            //courses list returned
            var courses = _client.ReturnCourses();
            //validation message colour set
            ValidationMessage.Foreground = _alert;
            //course select list population
            if (courses != null)
            {
                //Courses select populated
                foreach (var c in courses)
                {
                    Courses.Add(c.CourseName);
                }
                //student selected course
                var selectedCourse = courses.SingleOrDefault(x => x.CourseId == _student.Course);
                Course.ItemsSource = Courses;
                if (selectedCourse != null)
                {   //setting slected course toreflect student
                    Course.Text = selectedCourse.CourseName;
                }

                return;
            }
            //defaults if student selceted isnt valid
            Title.SelectedItem = "No Selection";
            Forename.Text = "N/A";
            Surname.Text = "N/A";
            Email.Text = "N/A";
            Course.SelectedItem = "N/A";
        }
        public void Initialize()
        {
            _NavigationService = Model.NavigationService;

            // transit ModeSelectionScreen
            transitionTimer = new DispatcherTimer();
            transitionTimer.Interval = TimeSpan.FromMilliseconds(4000);
            transitionTimer.Tick += new EventHandler(Transition);
            transitionTimer.Start();
        }
Esempio n. 22
0
 public static void CleanPageStack(NavigationService srv)
 {
     while (true)
     {
         if (srv.CanGoBack)
             srv.RemoveBackEntry();
         else
             break;
     }
 }
Esempio n. 23
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     if (!beginHost)
     {
         e.Handled = true;
         beginHost = true;
         ns = NavigationService;
         Program.lobbyClient.BeginHostGame(EndHostGame, Game, textBox1.Text, textBox2.Text);
         Program.ClientWindow.HostJoinTab();
     }
 }
Esempio n. 24
0
 public MyOffersViewModel(System.Windows.Navigation.NavigationService navigationService, List <Oferta> oferty)
 {
     _navigationService = navigationService;
     ListaOfert         = oferty;
     Cofnij             = new RelayCommand(CofnijMethod);
     UsunOferte         = new RelayCommand(UsunMethod);
     foreach (var o in ListaOfert)
     {
         o.UsunOferte = UsunOferte;
     }
 }
Esempio n. 25
0
 protected override void OnNavigated(NavigationEventArgs e)
 {
     base.OnNavigated(e);
     if (e.Content is Page)
     {
         Page page = (Page)e.Content;
         if (page != null)
         {
             GlobalNavigator = page.NavigationService;
         }
     }
 }
Esempio n. 26
0
        //Window created
        public EditStaff(int userId, int staffId, NavigationService navigationService)
        {
            //User id and navigation service maintained
            _userId = userId;
            _navigationService = navigationService;

            InitializeComponent();
            //Titles selection setup
            Titles.Add("Mr");
            Titles.Add("Mrs");
            Titles.Add("Miss");
            Titles.Add("Ms");
            Titles.Add("Dr");
            Title.ItemsSource = Titles;
            //Staff member details returned
            var staff = _client.ReturnStaffDetail(staffId);
            if (staff != null)
            {
                _staff = staff;
                //staff details populated into available fields
                Title.SelectedItem = Titles.SingleOrDefault(x => x == _staff.StaffTitle);
                Forename.Text = _staff.StaffForename;
                Surname.Text = _staff.StaffSurname;
                Email.Text = _staff.StaffEmail;
            }
            //Validation message colour set
            ValidationMessage.Foreground = _alert;
            //Courses available returned
            var courses = _client.ReturnCourses();
            if (courses != null)
            {
                //Courses available populated into course select
                foreach (var c in courses)
                {
                    Courses.Add(c.CourseName);
                }
                //selected course set to equal that to staff members allocated course
                var selectedCourse = courses.SingleOrDefault(x => x.CourseId == _staff.Course);
                Course.ItemsSource = Courses;
                if (selectedCourse != null)
                {   //Select display item that equals course in course list
                    Course.Text = selectedCourse.CourseName;
                }

                return;
            }
            //Deafault page values if staff member selected isnt valid
            Title.SelectedItem = "No Selection";
            Forename.Text = "N/A";
            Surname.Text = "N/A";
            Email.Text = "N/A";
            Course.SelectedItem = "N/A";
        }
Esempio n. 27
0
        public static void ClearBackStackToPage(NavigationService service, string pageName)
        {
            while (service.CanGoBack)
            {
                if (service.BackStack.First().Source.OriginalString.Contains(pageName))
                {
                    service.RemoveBackEntry();
                    break;
                }
                service.RemoveBackEntry();
            }

        }
        public void initNavigation(NavigationService nas,Uri companyTarget,Uri ProductVideoTarget, Uri productImageSource=null )
        {
            companyNavigationUri = companyTarget;
            productVideoNavigationUri = ProductVideoTarget;

            navigationService = nas;
            if (productImageSource != null)
            {
                BitmapImage bImage = new BitmapImage(productImageSource);
                MessageBox.Show("" + bImage.PixelHeight);
                productImage.Source = bImage;
            }
        }
        public CourseModuleManagement(int userId, NavigationService navigation)
        {
            _pageRendered = false;
            _userId = userId;
            _navigation = navigation;

            InitializeComponent();

            //default course Id 0 does not exists in database
            _courseId = 0;

            //returning full list of courses and modules
            var courses = _client.ReturnCourses();
            var availableModules = _client.ReturnModules();

            //population of modules available for addition to course
            if (availableModules != null)
            {
                foreach (var m in availableModules)
                {
                    _availableModules.Add(m);
                }
            }
            AvailableModules.ItemsSource = _availableModules;
            SelectedModules.ItemsSource = _selectedModules;

            //Population of courses list seen on page
            if (courses != null)
            {
                _courseId = courses.First().CourseId;

                foreach (var c in courses)
                {
                    _courseList.Add(c.CourseName);
                }
                CourseList.ItemsSource = _courseList;
                CourseList.SelectedItem = _courseList.First();

                //Population of modules that appear in the selected courses modules
                var modules = _client.ReturnCourseModules(courses.First().CourseId);
                if (modules != null)
                {
                    foreach (var m in modules)
                    {
                        _selectedModules.Add(m);
                    }
                 }
                ModuleCount.Content = _selectedModules.Count();
                _pageRendered = true;
            }
        }
Esempio n. 30
0
        public void ActivateNavigationService(NavigationService navigationService, bool deactivateAfterNavigation)
        {
            Action<PageSwitchedAggregatedEvent> callback = null;

            callback = ae =>
                           {
                               try
                               {
                                   this._logService.Trace(string.Format("About to navigate to: {0}. Use navigate service operation : {1}", ae.NavigationServiceOperation, ae.UseNavigationServiceOperation));

                                   this._logService.Trace(string.Format("navigationService: {0}.", navigationService));

                                   if (!ae.UseNavigationServiceOperation)
                                   {
                                       navigationService.Navigate(ae.Uri);
                                   }
                                   else
                                   {
                                       switch (ae.NavigationServiceOperation)
                                       {
                                           case PageSwitchedAggregatedEvent.NavigationServiceOperations.GoBack:
                                               navigationService.GoBack();
                                               break;
                                           case PageSwitchedAggregatedEvent.NavigationServiceOperations.GoForward:
                                               navigationService.GoForward();
                                               break;
                                           case PageSwitchedAggregatedEvent.NavigationServiceOperations.StopLoading:
                                               navigationService.StopLoading();
                                               break;
                                           default:
                                               throw new ArgumentOutOfRangeException();
                                       }
                                   }
                                   this._logService.Trace(string.Format("Call to navigationServie issued. Deactivate after navigation : {0}", deactivateAfterNavigation));

                                   if (deactivateAfterNavigation)
                                   {
                                       // callback will not be modified, therefore : no need to make a copy to avoid accessing a modified closure.
                                       _eventAggregator.GetEvent<CompositePresentationEvent<PageSwitchedAggregatedEvent>>().Unsubscribe(callback);
                                   }
                               }
                               catch (InvalidOperationException e)
                               {
                                    _notificationService.Warning("Open syno is already navigating to a page. Please wait until the current navigation is over before switching to an other page.", "Just a second...");
                               }

                           };

            _eventAggregator.GetEvent<CompositePresentationEvent<PageSwitchedAggregatedEvent>>().Subscribe(callback, true);
        }
Esempio n. 31
0
 public void SetNavigationService(NavigationService ns)
 {
     if (null != _appSquareItems)
     {
         var temp = new ObservableCollection<AppSquareItem>();
         foreach (var item in _appSquareItems)
         {
             AppSquareItem asi = item;
             asi.SetNavigationService = ns;
             temp.Add(asi);
         }
         _appSquareItems = temp;
     }
 }
Esempio n. 32
0
        internal static NavigationEvent FromNavigationEventArgs(System.Windows.Navigation.NavigationService navigationService, NavigationEventArgs e)
        {
            var evnt = new NavigationEvent()
            {
                IsCancelable          = false,
                IsNavigationInitiator = e.IsNavigationInitiator,
                NavigationMode        = (AdysTech.FeatherLite.Navigation.NavigationMode)e.NavigationMode,
                FromUri           = navigationService.BackStack.Any() ? UriWithoutQUeryParam(navigationService.BackStack.FirstOrDefault().Source) : null,
                ToUri             = UriWithoutQUeryParam(e.Uri),
                NavigationContext = new NavigationContext(e.Uri)
            };

            return(evnt);
        }
Esempio n. 33
0
        public NavScroller()
        {
            DispatcherOperationCallback method = null;

            method = delegate(object unused)
            {
                _service = NavigationService.GetNavigationService(this);
                _service.Navigating += new NavigatingCancelEventHandler(OnNavigating);

                return null;
            };
            this.Dispatcher.BeginInvoke(DispatcherPriority.Send, method, null);

            ItemsSource = Commands;
        }
Esempio n. 34
0
        internal static NavigationEvent FromNavigatingCancelEventArgs(System.Windows.Navigation.NavigationService navigationService, NavigatingCancelEventArgs e)
        {
            var evnt = new NavigationEvent()
            {
                IsCancelable          = e.IsCancelable,
                IsNavigationInitiator = e.IsNavigationInitiator,
                FromUri           = UriWithoutQUeryParam(navigationService.CurrentSource),
                NavigationMode    = (AdysTech.FeatherLite.Navigation.NavigationMode)e.NavigationMode,
                Cancel            = e.Cancel,
                ToUri             = UriWithoutQUeryParam(e.Uri),
                NavigationContext = new NavigationContext(e.Uri)
            };

            return(evnt);
        }
        private void downloadSolvedBtn_Click(object sender, RoutedEventArgs e)
        {
            var element = GetTaskType();
            if (element != null)
            {
                var taskEx = new TaskViewForMainWindows
                    {
                        Name = element.ChildNodes[0].InnerText,
                        TaskUniq = element.ChildNodes[3].InnerText,
                        Window = element.ChildNodes[4].InnerText
                    };

                navigation = NavigationService.GetNavigationService(this);
                navigation.Navigate(new SolvedTasksPage(taskEx));
            }
        }
 private bool GetNavigationServiceFromPage(PhoneApplicationPage page)
 {
     return(page != null && (_navigationService = page.NavigationService) != null);
 }