/// <summary>
        /// Navigates to specified uri.
        /// </summary>
        /// <param name="navigationSource">Source of navigation.</param>
        public void Navigate(Uri navigationSource)
        {
            this.CheckRootFrame();
            if (!isNavigatingNow)
            {
                var  page       = rootFame.Content as PhoneApplicationPage;
                bool wasUnfocus = false;
                if (page != null)
                {
                    wasUnfocus = page.Unfocus();
                }

                if (wasUnfocus)
                {
                    DispatcherTimer timer = new DispatcherTimer();
                    timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
                    timer.Tick    += this.OnTimerTick;
                    timer.Start();
                    this.navigateSource = navigationSource;
                }
                else
                {
                    rootFame.Navigate(navigationSource);
                }
            }
        }
        /// <summary>
        /// Mimics the WebAuthenticationBroker's AuthenticateAsync method.
        /// </summary>
        public static Task <WebAuthenticationResult> AuthenticateAsync(WebAuthenticationOptions options, Uri startUri, Uri endUri)
        {
            if (options != WebAuthenticationOptions.None)
            {
                throw new NotImplementedException("This method does not support authentication options other than 'None'.");
            }

            bool delegateToUI = false;
            PhoneApplicationFrame rootFrame = null;

            // Trying to do this in current thread. If not possible, try do to on UI thread.
            try
            {
                rootFrame = Application.Current.RootVisual as PhoneApplicationFrame;

                if (rootFrame == null)
                {
                    throw new InvalidOperationException();
                }
            }
            catch (InvalidOperationException)
            {
                delegateToUI = true;
            }

            WebAuthenticationBroker.StartUri = startUri;
            WebAuthenticationBroker.EndUri   = endUri;
            WebAuthenticationBroker.AuthenticationInProgress = true;

            // Navigate to the login page.
            if (!delegateToUI)
            {
                rootFrame.Navigate(new Uri("/Facebook.Client;component/loginpage.xaml", UriKind.Relative));
            }
            else
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    rootFrame = Application.Current.RootVisual as PhoneApplicationFrame;

                    if (rootFrame == null)
                    {
                        return;
                    }

                    rootFrame.Navigate(new Uri("/Facebook.Client;component/loginpage.xaml", UriKind.Relative));
                });
            }

            Task <WebAuthenticationResult> task = Task <WebAuthenticationResult> .Factory.StartNew(() =>
            {
                authenticateFinishedEvent.WaitOne();
                return(new WebAuthenticationResult(responseData, responseStatus, responseErrorDetail));
            });

            return(task);
        }
        /// <summary>
        /// Get the response of user details web service
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void userdetailswebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            LoginResponse objlgresponse = new LoginResponse();

            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objlgresponse = Utils.JsonHelper.Deserialize <LoginResponse>(response);

                    if (objlgresponse.status == 0)
                    {
                        App.PIN     = enterPinViewModel.Pin;
                        App.HashPIN = Utilities.GetSHA256(enterPinViewModel.Pin);
                        PhoneApplicationFrame frame = (PhoneApplicationFrame)Application.Current.RootVisual;
                        App.IsToombStoned = false;
                        App.IsApplicationInstancePreserved = false;

                        if ((!string.IsNullOrEmpty(App.TombStonedPageURL)) && (!string.IsNullOrWhiteSpace(App.TombStonedPageURL)))
                        {
                            frame.Navigate(new Uri(App.TombStonedPageURL, UriKind.Relative));
                        }
                        else if (!App.IsUserRegistered)
                        {
                            frame.Navigate(new Uri(PageURL.navigateToYourDetailsLoginURL, UriKind.Relative));
                        }
                        else if (App.IsPageHomePanorama)
                        {
                            frame.Navigate(new Uri(PageURL.navigateToHomePanoramaURL, UriKind.Relative));
                        }
                        else if (App.IsPageUpdateYourDetailsafterLogin)
                        {
                            frame.Navigate(new Uri(PageURL.navigateToYourDetailswithTCURL, UriKind.Relative));
                        }
                        App.NoofTriesLeft = 9;
                    }
                    else
                    {
                        enterPinViewModel.IsIncorrectPinPopupOpen = true;
                        enterPinViewModel.IncorrectPinMessage     = "Incorrect PIN entered please try again.\nYou have " + App.NoofTriesLeft + " tries left before your data is wiped.";
                        enterPinViewModel.HitVisibility           = false;
                        App.NoofTriesLeft     = App.NoofTriesLeft - 1;
                        enterPinViewModel.Pin = string.Empty;
                    }
                }
            }
            catch (Exception)
            {
                enterPinViewModel.IsIncorrectPinPopupOpen = true;
                enterPinViewModel.IncorrectPinMessage     = "Incorrect PIN entered please try again.\nYou have " + App.NoofTriesLeft + " tries left before your data is wiped.";
                enterPinViewModel.HitVisibility           = false;
                App.NoofTriesLeft     = App.NoofTriesLeft - 1;
                enterPinViewModel.Pin = string.Empty;
            }
        }
 public void NavigateTo(string pageUri)
 {
     if (EnsureMainFrame())
     {
         DispatcherHelper.UIDispatcher.BeginInvoke(() =>
         {
             _mainFrame.Navigate(new Uri(pageUri, UriKind.Relative));
         });
     }
 }
        /// <summary>
        /// method for binding selected surgen Name
        /// </summary>
        private void AddingToyourDetials()
        {
            App.IsSelectedSurgen      = true;
            App.IsDisableSearchsurgen = false;
            App.IsDisplaySelectedSurgenOnSearchBox = false;
            PhoneApplicationFrame frame = (PhoneApplicationFrame)Application.Current.RootVisual;
            bool success = false;

            if (Utilities.IsConnectedToNetwork())
            {
                if (App.IsNavigatedFromYourDetailsLogin)
                {
                    if (DisplaySelectedSurgen != App.SelectedSurgen)
                    {
                        App.SurgeonAddress = string.Empty;
                    }
                    App.SelectedSurgen = DisplaySelectedSurgen;

                    success = frame.Navigate(new Uri(PageURL.navigateToYourDetailsLoginURL, UriKind.Relative));
                    App.IsNavigatedFromYourDetailsLogin       = false;
                    App.IsNavigatedFromYourDetailsLoginwithTC = false;
                    App.IsNavigatedFromYourDetailsUpdate      = false;
                }
                else if (App.IsNavigatedFromYourDetailsLoginwithTC)
                {
                    if (DisplaySelectedSurgen != App.SurgeonSaved)
                    {
                        App.SurgeonAddress = string.Empty;
                    }
                    App.SurgeonSaved = DisplaySelectedSurgen;
                    success          = frame.Navigate(new Uri(PageURL.navigateToYourDetailswithTCURL, UriKind.Relative));
                    App.IsNavigatedFromYourDetailsLoginwithTC = false;
                    App.IsNavigatedFromYourDetailsLogin       = false;
                    App.IsNavigatedFromYourDetailsUpdate      = false;
                }
                else if (App.IsNavigatedFromYourDetailsUpdate)
                {
                    if (DisplaySelectedSurgen != App.SurgeonSaved)
                    {
                        App.SurgeonAddress = string.Empty;
                    }
                    App.SurgeonSaved = DisplaySelectedSurgen;

                    success = frame.Navigate(new Uri(PageURL.navigateToYourDetailsUpdateURL, UriKind.Relative));
                    App.IsNavigatedFromYourDetailsUpdate      = false;
                    App.IsNavigatedFromYourDetailsLoginwithTC = false;
                    App.IsNavigatedFromYourDetailsLogin       = false;
                }
            }
            else
            {
                IsInternetPopupOpen = true;
                HitVisibility       = false;
            }
        }
Beispiel #6
0
        /// <summary>
        /// Navigate to an url
        /// </summary>
        /// <param name="url"></param>
        public void Navigate <T>()
        {
            var type = typeof(T);
            //_frame=new PhoneApplicationFrame();
            var testvalue = (type.FullName.Substring(type.FullName.IndexOf('.')).Replace('.', '/')) + ".xaml";

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                _frame.Navigate(new Uri(testvalue, UriKind.Relative));
            });
        }
Beispiel #7
0
 public void NavigateTo(Uri pageUri, bool oneWay)
 {
     if (EnsureMainFrame())
     {
         _mainFrame.Dispatcher.BeginInvoke(delegate
         {
             _mainFrame.Navigate(pageUri);
             _mainFrame.RemoveBackEntry();
         });
     }
 }
Beispiel #8
0
 /// <summary>
 /// Affecte la propriété de view courante du ViewModel principal
 /// </summary>
 /// <param name="instanceToNavigate">
 /// Instance de la vue qui est devenue la vue courante
 /// </param>
 private void SetCurrentView(System.Uri instanceToNavigate)
 {
     try
     {
         _rootFrame.Navigate(instanceToNavigate);
     }
     catch (Exception e)
     {
         throw new FrameNavigationException();
     }
 }
        private void Episode_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            PodcastEpisodeModel   podcastEpisode   = this.DataContext as PodcastEpisodeModel;
            PhoneApplicationFrame applicationFrame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (podcastEpisode.EpisodePlayState == PodcastEpisodeModel.EpisodePlayStateEnum.Playing ||
                podcastEpisode.EpisodePlayState == PodcastEpisodeModel.EpisodePlayStateEnum.Paused ||
                podcastEpisode.EpisodePlayState == PodcastEpisodeModel.EpisodePlayStateEnum.Streaming)
            {
                applicationFrame.Navigate(new Uri("/Views/PodcastPlayerView.xaml", UriKind.Relative));
            }
            else
            {
                applicationFrame.Navigate(new Uri(string.Format("/Views/PodcastEpisodeDescriptionView.xaml?episodeId={0}", (this.DataContext as PodcastEpisodeModel).EpisodeId), UriKind.Relative));
            }
        }
Beispiel #10
0
        public void Show()
        {
            if (_frame == null)
            {
                // Hook up to necessary events and navigate
                _frame = Application.Current.RootVisual as PhoneApplicationFrame;
                _frameContentWhenOpened = _frame.Content;

                var frameContentWhenOpenedAsUiElement = _frameContentWhenOpened as UIElement;
                if (null != frameContentWhenOpenedAsUiElement)
                {
                    _savedNavigationInTransition = TransitionService.GetNavigationInTransition(frameContentWhenOpenedAsUiElement);
                    TransitionService.SetNavigationInTransition(frameContentWhenOpenedAsUiElement, null);
                    _savedNavigationOutTransition = TransitionService.GetNavigationOutTransition(frameContentWhenOpenedAsUiElement);
                    TransitionService.SetNavigationOutTransition(frameContentWhenOpenedAsUiElement, null);
                }

                _frame.Navigated += HandleFrameNavigated;

                if (_frame.GetType() == typeof(PhoneApplicationFrame))
                {
                    _frame.NavigationStopped += HandleFrameNavigationStoppedOrFailed;
                }

                _frame.NavigationFailed += HandleFrameNavigationStoppedOrFailed;

                _frame.Navigate(_pageUri);
            }
        }
Beispiel #11
0
        public void Execute(object parameter)
        {
            DataTransfer.cFilter.RemoveFilter(parameter as ITweetableFilter);
            PhoneApplicationFrame service = ((PhoneApplicationFrame)Application.Current.RootVisual);

            service.Navigate(Uris.Filters);
        }
        /// <summary>
        /// Mimics the WebAuthenticationBroker's AuthenticateAsync method.
        /// </summary>
        public static Task <WebAuthenticationResult> AuthenticateAsync(WebAuthenticationOptions options, Uri startUri, Uri endUri)
        {
            if (options != WebAuthenticationOptions.None)
            {
                throw new NotImplementedException("This method does not support authentication options other than 'None'.");
            }

            PhoneApplicationFrame rootFrame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (rootFrame == null)
            {
                throw new InvalidOperationException();
            }

            WebAuthenticationBroker.StartUri = startUri;
            WebAuthenticationBroker.EndUri   = endUri;
            WebAuthenticationBroker.AuthenticationInProgress = true;

            // Navigate to the login page.
            rootFrame.Navigate(new Uri("/Facebook.Client;component/loginpage.xaml", UriKind.Relative));

            Task <WebAuthenticationResult> task = Task <WebAuthenticationResult> .Factory.StartNew(() =>
            {
                authenticateFinishedEvent.WaitOne();
                return(new WebAuthenticationResult(responseData, responseStatus, responseErrorDetail));
            });

            return(task);
        }
        public void OpenPickerPage()
        {
            if (null == PickerPageUri)
            {
                throw new ArgumentException("PickerPageUri property must not be null.");
            }

            if (null == _frame)
            {
                _frame = Application.Current.RootVisual as PhoneApplicationFrame;
                if (null != _frame)
                {
                    _frameContentWhenOpened = _frame.Content;

                    // Save and clear host page transitions for the upcoming "popup" navigation
                    UIElement frameContentWhenOpenedAsUIElement = _frameContentWhenOpened as UIElement;
                    if (null != frameContentWhenOpenedAsUIElement)
                    {
                        _savedNavigationInTransition = TransitionService.GetNavigationInTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationInTransition(frameContentWhenOpenedAsUIElement, null);
                        _savedNavigationOutTransition = TransitionService.GetNavigationOutTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationOutTransition(frameContentWhenOpenedAsUIElement, null);
                    }

                    _frame.Navigated += OnFrameNavigated;
                    _frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
                    _frame.NavigationFailed += OnFrameNavigationStoppedOrFailed;

                    _frame.Navigate(PickerPageUri);

                }
            }
        }
Beispiel #14
0
        private void sub1(object sender, EventArgs e)
        {
            vc.Start(TimeSpan.FromMilliseconds(100));
            PhoneApplicationFrame root = Application.Current.RootVisual as PhoneApplicationFrame;

            root.Navigate(new Uri("/counsel.xaml", UriKind.Relative));
        }
Beispiel #15
0
        private static void NavigateTo(String URI)
        {
            Uri pathURI = new Uri(URI, UriKind.Relative);
            PhoneApplicationFrame ns = (Application.Current.RootVisual as PhoneApplicationFrame);

            ns.Navigate(pathURI);
        }
        public static bool Navigate(this PhoneApplicationFrame frame, string source, bool removeBackEntry, params KeyValuePair <string, string>[] parameters)
        {
            if (removeBackEntry)
            {
                if (parameters == null)
                {
                    parameters = new KeyValuePair <string, string> [1];
                }
                else
                {
                    Array.Resize(ref parameters, parameters.Length + 1);
                }

                parameters[parameters.Length - 1] = new KeyValuePair <string, string>(NavigationRemoveBackEntryParameterName, "true");
            }

            if (parameters != null)
            {
                if (source.Contains('?'))
                {
                    source += "&";
                }
                else
                {
                    source += "?";
                }

                source += string.Join("&", parameters.Select(p => Uri.EscapeDataString(p.Key) + "=" + Uri.EscapeDataString(p.Value)));
            }

            return(frame.Navigate(source));
        }
        private async Task <bool> TryShowPage(MvxViewModelRequest request)
        {
            var page = MvxPresenterHelpers.CreatePage <Page>(request);

            if (page == null)
            {
                return(false);
            }

            var viewModel = MvxPresenterHelpers.LoadViewModel(request);

            if (NavigationPage == null)
            {
                Xamarin.Forms.Forms.Init();
                NavigationPage = new NavigationPage(page);
                _rootFrame.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            }
            else
            {
                await NavigationPage.PushAsync(page);
            }

            page.BindingContext = viewModel;
            return(true);
        }
Beispiel #18
0
        // Do not add any additional code to this method
        private void InitializePhoneApplication()
        {
            if (phoneApplicationInitialized)
            {
                return;
            }

            // Create the frame but don't set it as RootVisual yet; this allows the splash
            // screen to remain active until the application is ready to render.
            RootFrame            = new TransitionFrame();
            RootFrame.Navigated += CompleteInitializePhoneApplication;

            // Handle navigation failures
            RootFrame.NavigationFailed += RootFrame_NavigationFailed;

            Messenger.Default.Register <Uri>(this, m => RootFrame.Navigate(m));
            Messenger.Default.Register <Action <Frame> >(this, action => action(RootFrame));
            RxApp.InUnitTestRunner();

            App.Current.Resources.Remove("CreateOption");
            App.Current.Resources.Add("CreateOption", BitmapCreateOptions.BackgroundCreation | BitmapCreateOptions.DelayCreation);

            // Ensure we don't initialize again
            phoneApplicationInitialized = true;
        }
Beispiel #19
0
        private void OpenPickerPage()
        {
            if (null == PickerPageUri)
            {
                throw new ArgumentException("PickerPageUri property must not be null.");
            }

            if (null == _frame)
            {
                // Hook up to necessary events and navigate
                _frame = Application.Current.RootVisual as PhoneApplicationFrame;
                if (null != _frame)
                {
                    _frameContentWhenOpened = _frame.Content;

                    // Save and clear host page transitions for the upcoming "popup" navigation
                    UIElement frameContentWhenOpenedAsUIElement = _frameContentWhenOpened as UIElement;
                    if (null != frameContentWhenOpenedAsUIElement)
                    {
                        _savedNavigationInTransition = TransitionService.GetNavigationInTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationInTransition(frameContentWhenOpenedAsUIElement, null);
                        _savedNavigationOutTransition = TransitionService.GetNavigationOutTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationOutTransition(frameContentWhenOpenedAsUIElement, null);
                    }

                    _frame.Navigated         += OnFrameNavigated;
                    _frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
                    _frame.NavigationFailed  += OnFrameNavigationStoppedOrFailed;

                    _frame.Navigate(PickerPageUri);
                }
            }
        }
        public bool RequestNavigate(MvxShowViewModelRequest request)
        {
            var requestTranslator = this.GetService <IMvxWindowsPhoneViewModelRequestTranslator>();
            var xamlUri           = requestTranslator.GetXamlUriFor(request);

            return(InvokeOrBeginInvoke(() => _rootFrame.Navigate(xamlUri)));
        }
Beispiel #21
0
        public static void Navigate(string uri, IDictionary <string, object> parameters)
        {
            PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (frame == null)
            {
                return;
            }

            string wellFormedUti = uri;

            if (!wellFormedUti.StartsWith("/"))
            {
                wellFormedUti = "/" + uri;
            }

            StringBuilder uriBuilder = new StringBuilder(wellFormedUti);

            if (parameters != null && parameters.Count > 0)
            {
                if (pageValues.ContainsKey(uri))
                {
                    pageValues.Remove(uri);
                }

                pageValues.Add(uri, parameters);
            }
            wellFormedUti = uriBuilder.ToString();


            // Before test
            Debug.WriteLine("----Before test-----------");
            foreach (var item in frame.BackStack)
            {
                Debug.WriteLine("Backstack : " + item.Source);
            }
            Debug.WriteLine("------End----------");

            // Clean back stack
            var backstack = frame.BackStack.ToList();

            if (backstack.Count >= 1)
            {
                // if previous equals destination, we unstack the previous
                if (backstack[0].Source.Equals(wellFormedUti))
                {
                    RemoveBackEntry();
                }
            }

            // Before test
            Debug.WriteLine("----After test-----------");
            foreach (var item in frame.BackStack)
            {
                Debug.WriteLine("Backstack : " + item.Source);
            }
            Debug.WriteLine("------End----------");

            frame.Navigate(new Uri(wellFormedUti, UriKind.RelativeOrAbsolute));
        }
Beispiel #22
0
            /**
             * @author Ciprian Filipas
             * @brief Function responsible with the open action for the picker page.
             */
            private void OpenPickerPage()
            {
                if (null == mFrame)
                {
                    // Hook up to necessary events and navigate
                    mFrame = Application.Current.RootVisual as PhoneApplicationFrame;
                    if (null != mFrame)
                    {
                        mFrameContentWhenOpened = mFrame.Content;

                        // Save and clear host page transitions for the upcoming "popup" navigation
                        UIElement frameContentWhenOpenedAsUIElement = mFrameContentWhenOpened as UIElement;
                        if (null != frameContentWhenOpenedAsUIElement)
                        {
                            mSavedNavigationInTransition = TransitionService.GetNavigationInTransition(frameContentWhenOpenedAsUIElement);
                            TransitionService.SetNavigationInTransition(frameContentWhenOpenedAsUIElement, null);
                            mSavedNavigationOutTransition = TransitionService.GetNavigationOutTransition(frameContentWhenOpenedAsUIElement);
                            TransitionService.SetNavigationOutTransition(frameContentWhenOpenedAsUIElement, null);
                        }

                        mFrame.Navigated         += OnFrameNavigated;
                        mFrame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
                        mFrame.NavigationFailed  += OnFrameNavigationStoppedOrFailed;

                        NumberPickerPageCustomUriString customString = new NumberPickerPageCustomUriString();
                        customString.Max = Max;
                        customString.Min = Min;

                        mFrame.Navigate(new Uri(customString.UriString, UriKind.RelativeOrAbsolute));
                    }
                }
            }
Beispiel #23
0
 public void NavigateTo(Uri pageUri)
 {
     if (EnsureMainFrame())
     {
         _mainFrame.Navigate(pageUri);
     }
 }
        public bool Navigate(string uri, IDictionary <string, string> parameters)
        {
            PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (frame == null)
            {
                return(false);
            }

            StringBuilder uriBuilder = new StringBuilder();

            uriBuilder.Append(uri);
            if (parameters != null && parameters.Count > 0)
            {
                uriBuilder.Append("?");
                bool prependAmp = false;
                foreach (KeyValuePair <string, string> parameterPair in parameters)
                {
                    if (prependAmp)
                    {
                        uriBuilder.Append("&");
                    }
                    uriBuilder.AppendFormat("{0}={1}", parameterPair.Key, parameterPair.Value);
                    prependAmp = true;
                }
            }

            uri = uriBuilder.ToString();
            return(frame.Navigate(new Uri(uri, UriKind.RelativeOrAbsolute)));
        }
        /// <summary>
        /// Opens the page to select the date or time value
        /// </summary>
        private void OpenPickerPage(DateTimePickerType type)
        {
            string pickerPageName = type == DateTimePickerType.Date ? "DatePickerPage.xaml" : "TimePickerPage.xaml";

            Uri pickerPageUri = new System.Uri("/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/" +
                                               pickerPageName + "?dummy=" + Guid.NewGuid().ToString(), UriKind.Relative);

            if (null == _frame)
            {
                // Hook up to necessary events and navigate
                _frame = Application.Current.RootVisual as PhoneApplicationFrame;
                if (null != _frame)
                {
                    _frameContentWhenOpened = _frame.Content;

                    // Save and clear host page transitions for the upcoming "popup" navigation
                    UIElement frameContentWhenOpenedAsUIElement = _frameContentWhenOpened as UIElement;
                    if (null != frameContentWhenOpenedAsUIElement)
                    {
                        _savedNavigationInTransition = TransitionService.GetNavigationInTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationInTransition(frameContentWhenOpenedAsUIElement, null);
                        _savedNavigationOutTransition = TransitionService.GetNavigationOutTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationOutTransition(frameContentWhenOpenedAsUIElement, null);
                    }

                    _frame.Navigated         += OnFrameNavigated;
                    _frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
                    _frame.NavigationFailed  += OnFrameNavigationStoppedOrFailed;

                    _frame.Navigate(pickerPageUri);
                }
            }
        }
Beispiel #26
0
        public async Task <TokenPair> Authorize(string clientId, string clientSecret, IEnumerable <string> scopes)
        {
            string uri = string.Format("/MobileOauth;component/LoginPage.xaml?authEndpoint={0}&clientId={1}&scope={2}",
                                       authEndpoint,
                                       clientId,
                                       string.Join(" ", scopes));

            SemaphoreSlim semaphore = new SemaphoreSlim(0, 1);

            Observable.FromEvent <NavigatingCancelEventHandler, NavigatingCancelEventArgs>(
                h => new NavigatingCancelEventHandler(h),
                h => this.frame.Navigating += h,
                h => this.frame.Navigating -= h)
            .SkipWhile(h => h.EventArgs.NavigationMode != NavigationMode.Back)
            .Take(1)
            .Subscribe(e => semaphore.Release());

            frame.Navigate(new Uri(uri, UriKind.Relative));

            await semaphore.WaitAsync();

            string authorizationCode = (string)PhoneApplicationService.Current.State["MobileOauth.AuthorizationCode"];

            return(await RequestAccessToken(authorizationCode, clientId, clientSecret));
        }
        /// <summary>
        /// Check the response for  resetpin webservice
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void resetpinswebservicecall_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
        {
            SendResetPinCodeResponse objresetpincoderesponse = new SendResetPinCodeResponse();

            try
            {
                if (e.Result != null)
                {
                    var response = e.Result.ToString();
                    objresetpincoderesponse = Utils.JsonHelper.Deserialize <SendResetPinCodeResponse>(response);
                    if (objresetpincoderesponse.status == 0)
                    {
                        enterPinViewModel.HitVisibility = true;
                        PhoneApplicationFrame frame = (PhoneApplicationFrame)Application.Current.RootVisual;
                        frame.Navigate(new Uri(PageURL.navigateToResetPinLoginURL, UriKind.Relative));
                    }
                    else
                    {
                        enterPinViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                        MessageBox.Show("Please Contact your pharmacy.");
                    }
                }
            }
            catch (Exception)
            {
                enterPinViewModel.ProgressBarVisibilty = Visibility.Collapsed;
                enterPinViewModel.HitVisibility        = true;
                MessageBox.Show("Sorry, Unable to process your request.");
            }
        }
        private void Episode_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            PodcastEpisodeModel   podcastEpisode   = this.DataContext as PodcastEpisodeModel;
            PhoneApplicationFrame applicationFrame = Application.Current.RootVisual as PhoneApplicationFrame;

            applicationFrame.Navigate(new Uri(string.Format("/Views/PodcastEpisodeDescriptionView.xaml?episodeId={0}", (this.DataContext as PodcastEpisodeModel).EpisodeId), UriKind.Relative));
        }
Beispiel #29
0
        public string getViewState_STATIC(string viewstate, string applicazione, string queryString)
        {
            string xmlString = "";

            if (viewstate == "ANNOUNCE_FINDCAR")

            {
                XDocument page = XDocument.Load(inputMessages.xmlOutputDIR + "/" + "template.social.viewstate.FINDCAR.xml");
                xmlString = page.ToString();
            }

            if (viewstate == "ANNOUNCE_FINDCAR_SELECTSLOT")
            {
                XDocument page = XDocument.Load(inputMessages.xmlOutputDIR + "/" + "template.social.viewstate.FINDCAR_selectSlot.xml");
                xmlString = page.ToString();
            }

            viewState_queryString = queryString;
            //App.GB.ViewState = viewstate;



            /* mancanza di rete */
            if (xmlString != "")
            {
                XDocument loaded = XDocument.Parse(xmlString);

                RemoveNamespace(loaded);


                var items = from x in loaded.Descendants("dati")
                            select new NewsItem
                {
                    pagina = x.Element("page").Value
                };

                foreach (var item in items)
                {
                    PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;

                    if (frame.CurrentSource != new Uri("/" + inputMessages.viewStateDir + "/" + inputMessages.tema + "/" + item.pagina + "?" + viewState_queryString, UriKind.Relative))
                    {
                        frame.Navigate(new Uri("/" + inputMessages.viewStateDir + "/" + inputMessages.tema + "/" + item.pagina + "?" + viewState_queryString, UriKind.Relative));
                    }
                }
            }
            else
            {
                PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;

                if (frame.CurrentSource != new Uri("/" + inputMessages.viewStateDir + "/" + inputMessages.tema + "/" + "nonetwork.xaml", UriKind.Relative))
                {
                    frame.Navigate(new Uri("/" + inputMessages.viewStateDir + "/" + inputMessages.tema + "/" + "nonetwork.xaml", UriKind.Relative));
                }
            }


            return("");
        }
Beispiel #30
0
        private void PodcastGroupTapped(object sender, System.Windows.Input.GestureEventArgs e)
        {
            BrowsePodcastsGroupModel group = (sender as StackPanel).DataContext as BrowsePodcastsGroupModel;

            PhoneApplicationFrame applicationFrame = Application.Current.RootVisual as PhoneApplicationFrame;

            applicationFrame.Navigate(new Uri(string.Format("/Views/PodcastListCategory.xaml?categoryName={0}", group.Name), UriKind.Relative));
        }
Beispiel #31
0
 private void ApplicationBar_OnClick(object sender, EventArgs e)
 {
     if (null != lstPictures.SelectedItem)
     {
         PhoneApplicationFrame root = Application.Current.RootVisual as PhoneApplicationFrame;
         root.Navigate(new Uri("/PictureView/" + (lstPictures.SelectedItem as Photo).Filename, UriKind.Relative));
     }
 }
Beispiel #32
0
        private void OpenPickerPage()
        {
            frame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (frame != null) {
                frame.Navigated += FrameNavigated;
                frame.Navigate(new Uri("/Flashcards;component/Views/ListPickerPage.xaml", UriKind.Relative));
            }
        }
 public void scan(string options)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         currentRootVisual = Application.Current.RootVisual as PhoneApplicationFrame;
         currentRootVisual.Navigated += OnFrameNavigated;
         currentRootVisual.Navigate(new Uri("/Plugins/com.phonegap.plugins.barcodescanner/Scan.xaml", UriKind.Relative));
     });
 }
        private void OpenPickerPage(DateTimePickerType type)
        {
            var page = type == DateTimePickerType.Date
                           ? "/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/DatePickerPage.xaml?dummy="
                           : "/Coding4Fun.Toolkit.Controls;component/ValuePicker/TimeSpanPicker/TimespanPickerPage.xaml?dummy=";

            page += Guid.NewGuid();

            var pickerPageUri = new Uri(page, UriKind.Relative);

            if (_frame != null) return;
            _frame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (_frame == null) return;

            _frameContentWhenOpened = _frame.Content;

            var uiElement = _frameContentWhenOpened as UIElement;
            if (null != uiElement)
            {
                _savedNavigationInTransition = TransitionService.GetNavigationInTransition(uiElement);
                TransitionService.SetNavigationInTransition(uiElement, null);
                _savedNavigationOutTransition = TransitionService.GetNavigationOutTransition(uiElement);
                TransitionService.SetNavigationOutTransition(uiElement, null);
            }

            if (type == DateTimePickerType.Date)
            {
                _frame.Navigated += OnDateFrameNavigated;
            }
            else
            {
                _frame.Navigated += OnTimeFrameNavigated;
            }
            _frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
            _frame.NavigationFailed += OnFrameNavigationStoppedOrFailed;

            _frame.Navigate(pickerPageUri);
        }
Beispiel #35
0
        /// <summary>
        /// Public method to scan
        /// </summary>
        public void scan(string options)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {

                if (null == _frame)
                {
                    // Hook up to necessary events and navigate
                    _frame = Application.Current.RootVisual as PhoneApplicationFrame;
                    if (null != _frame)
                    {
                        _frameContentWhenOpened = _frame.Content;

                        _frame.Navigated += OnFrameNavigated;
                        _frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
                        _frame.NavigationFailed += OnFrameNavigationStoppedOrFailed;

                        _frame.Navigate(new System.Uri("/Plugins/com.phonegap.plugins.barcodescanner/Scanner.xaml?dummy=" + Guid.NewGuid().ToString(), UriKind.Relative));
                    }
                }
            });
        }
        /// <summary>
        /// Opens the page to select the date or time value
        /// </summary>
        private void OpenPickerPage(DateTimePickerType type)
        {
            string pickerPageName = type == DateTimePickerType.Date ? "DatePickerPage.xaml" : "TimePickerPage.xaml";

            Uri pickerPageUri = new System.Uri("/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/" +
                pickerPageName + "?dummy=" + Guid.NewGuid().ToString(), UriKind.Relative);

            if (null == _frame)
            {
                // Hook up to necessary events and navigate
                _frame = Application.Current.RootVisual as PhoneApplicationFrame;
                if (null != _frame)
                {
                    _frameContentWhenOpened = _frame.Content;

                    // Save and clear host page transitions for the upcoming "popup" navigation
                    UIElement frameContentWhenOpenedAsUIElement = _frameContentWhenOpened as UIElement;
                    if (null != frameContentWhenOpenedAsUIElement)
                    {
                        _savedNavigationInTransition = TransitionService.GetNavigationInTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationInTransition(frameContentWhenOpenedAsUIElement, null);
                        _savedNavigationOutTransition = TransitionService.GetNavigationOutTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationOutTransition(frameContentWhenOpenedAsUIElement, null);
                    }

                    _frame.Navigated += OnFrameNavigated;
                    _frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
                    _frame.NavigationFailed += OnFrameNavigationStoppedOrFailed;

                    _frame.Navigate(pickerPageUri);
                }
            }
        }
Beispiel #37
0
        // Fügen Sie dieser Methode keinen zusätzlichen Code hinzu.
        private void InitializePhoneApplication()
        {
            if (phoneApplicationInitialized)
                return;

            // Erstellen Sie den Frame, aber legen Sie ihn noch nicht als RootVisual-Objekt fest; auf diese Weise
            // bleibt der Begrüßungsbildschirm aktiv, bis die Anwendung zum Rendern bereit ist.
            RootFrame = new PhoneApplicationFrame();
            RootFrame.Navigated += CompleteInitializePhoneApplication;

            // Handhabung von Navigationsfehlern
            RootFrame.NavigationFailed += RootFrame_NavigationFailed;

            // Stellen Sie sicher, dass keine erneute Initialisierung erfolgt.
            phoneApplicationInitialized = true;
            RootFrame.Navigate(new Uri("MainPage.xaml", UriKind.Relative));
        }
Beispiel #38
0
        // Do not add any additional code to this method
        private void InitializePhoneApplication()
        {
            if (phoneApplicationInitialized)
                return;

            // Create the frame but don't set it as RootVisual yet; this allows the splash
            // screen to remain active until the application is ready to render.
            RootFrame = new PhoneApplicationFrame();
            RootFrame.Navigated += CompleteInitializePhoneApplication;

            // Handle navigation failures
            RootFrame.NavigationFailed += RootFrame_NavigationFailed;

            // Ensure we don't initialize again
            phoneApplicationInitialized = true;
            configuracoes = new Configuracoes();
            Uri uri;
            if (LerXML())
            {
     /*           if (configuracoes.getCadastro("Cadastro").Equals("false"))
                {
                    RootFrame.Navigate(new Uri("/View/TelaCadastro.xaml", UriKind.RelativeOrAbsolute));
                }
                else
                {*/
                    RootFrame.Navigate(new Uri("/View/Perfil.xaml", UriKind.RelativeOrAbsolute));
   //             }
            }
            else
            {
                RootFrame.Navigate(new Uri("/View/CadastroUsuario.xaml", UriKind.RelativeOrAbsolute));
            }        
        }
        private static void OpenPickerPage()
        {
            if (null == m_frame)
            {
                m_frame = Application.Current.RootVisual as PhoneApplicationFrame;
                if (null != m_frame)
                {
                    m_frameContentWhenOpened = m_frame.Content;

                    m_frame.Navigated += OnFrameNavigated;
                    m_frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
                    m_frame.NavigationFailed += OnFrameNavigationStoppedOrFailed;

                    m_frame.Navigate(new Uri("/RhoRubyLib;component/views/RhoDateTimeDlg.xaml", UriKind.Relative));
                    RHODESAPP().m_transition = true;
                }
            }

        }
Beispiel #40
0
        // Do not add any additional code to this method
        private void InitializePhoneApplication()
        {
            if (phoneApplicationInitialized)
                return;

            // Create the frame but don't set it as RootVisual yet; this allows the splash
            // screen to remain active until the application is ready to render.
            RootFrame = new PhoneApplicationFrame();
            RootFrame.Navigated += CompleteInitializePhoneApplication;

            // Handle navigation failures
            RootFrame.NavigationFailed += RootFrame_NavigationFailed;

            // Handle reset requests for clearing the backstack
            RootFrame.Navigated += CheckForResetNavigation;

            // Ensure we don't initialize again
            phoneApplicationInitialized = true;

            if (settings.Contains("Token") && settings.Contains("TokenStatus"))
            {
                var token = settings["Token"];
                var tokenStatus = (TokenStatus)settings["TokenStatus"];

                if (token != null && tokenStatus == TokenStatus.VALID)
                {
                    RootFrame.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
                }
                else
                {
                    var text = "Please accept application request from \"Nordic-T WP8\"";
                    var caption = "Token not accepted";
                    RootFrame.Navigate(new Uri("/Login.xaml?text=" + text + "+caption=" + caption, UriKind.RelativeOrAbsolute));
                }
            }
            else
            {
                RootFrame.Navigate(new Uri("/Login.xaml", UriKind.RelativeOrAbsolute));
            }
        }
Beispiel #41
0
        // Do not add any additional code to this method
        private void InitializePhoneApplication()
        {
            if (phoneApplicationInitialized)
                return;

            // Create the frame but don't set it as RootVisual yet; this allows the splash
            // screen to remain active until the application is ready to render.
            RootFrame = new PhoneApplicationFrame();
            RootFrame.Navigated += CompleteInitializePhoneApplication;

            // Handle navigation failures
            RootFrame.NavigationFailed += RootFrame_NavigationFailed;

            // Handle reset requests for clearing the backstack
            RootFrame.Navigated += CheckForResetNavigation;

            // Handle contract activation such as a file open or save picker
            PhoneApplicationService.Current.ContractActivated += Application_ContractActivated;

            // Assign the custom URI mapper class to the application frame.
            RootFrame.UriMapper = new CustomMapping.CustomUriMapper();

            // Ensure we don't initialize again
            phoneApplicationInitialized = true;

            PhoneApplicationService.Current.ContractActivated += Application_ContractActivated;

            var appBar = App.Current.Resources["GlobalAppBar"] as ApplicationBar;
            ((ApplicationBarMenuItem)appBar.MenuItems[0]).Text = AppResources.AppBarHome;
            ((ApplicationBarMenuItem)appBar.MenuItems[1]).Text = AppResources.AppBarUpload;
            ((ApplicationBarMenuItem)appBar.MenuItems[2]).Text = AppResources.AppBarSettings;
            ((ApplicationBarMenuItem)appBar.MenuItems[3]).Text = AppResources.AppBarAbout;

            if (IsolatedStorageSettings.ApplicationSettings.Contains("tokensaved"))
            {
                if (GlobalVariables.IsolatedStorageUserInformations.Contains("tokensaved") && GlobalVariables.IsolatedStorageUserInformations.Contains("urlsaved"))
                {
                    string t = GlobalVariables.IsolatedStorageUserInformations["tokensaved"] as string;
                    string u = GlobalVariables.IsolatedStorageUserInformations["urlsaved"] as string;

                    RootFrame.Navigate(new Uri("/Pages/ListLibraryPage.xaml?token=" + t + "&url=" + u, UriKind.Relative));
                }
            }
            else
            {
                RootFrame.Navigate(new Uri("/Login.xaml", UriKind.RelativeOrAbsolute));
            }
        }
Beispiel #42
0
        // Do not add any additional code to this method
        private void InitializePhoneApplication()
        {
            if (phoneApplicationInitialized)
                return;

            // Create the frame but don't set it as RootVisual yet; this allows the splash
            // screen to remain active until the application is ready to render.
            RootFrame = new PhoneApplicationFrame();
            RootFrame.Navigated += CompleteInitializePhoneApplication;

            // Handle navigation failures
            RootFrame.NavigationFailed += RootFrame_NavigationFailed;

            // Handle reset requests for clearing the backstack
            RootFrame.Navigated += CheckForResetNavigation;

            // Handle contract activation such as a file open or save picker
            PhoneApplicationService.Current.ContractActivated += Application_ContractActivated;

            // Ensure we don't initialize again
            phoneApplicationInitialized = true;

            CopyDatabase();

            var builder = new ContainerBuilder();

            builder.RegisterModule(new OwModule());

            IContainer container = builder.Build();

            var locator = new AutofacServiceLocator(container);

            ServiceLocator.SetLocatorProvider(() => locator);

            var session = ServiceLocator.Current
                .GetInstance<Session>();

            session.LoadData();

            var chatManager = ServiceLocator.Current
                .GetInstance<ChatManager>();

            chatManager.Initialize();

            if (session.User != null)
            {
                RootFrame.Navigate(new Uri("/View/MainPage.xaml", UriKind.RelativeOrAbsolute));
            }
            else
            {
                RootFrame.Navigate(new Uri("/View/LoginPage.xaml", UriKind.RelativeOrAbsolute));
            }
        }
Beispiel #43
0
		public static void OpenPickerPage(DateTime selectedValue, DateTime? lowerBound, DateTime? upperBound, Action<DateTime> finished)
		{
			if (_frame != null) throw new InvalidOperationException("Picker page is already open.");

			DateTimePickerHelper.selectedValue = selectedValue.Date;
			DateTimePickerHelper.finished = finished;
			DateTimePickerHelper.lowerBound = lowerBound;
			DateTimePickerHelper.upperBound = upperBound;

			// Hook up to necessary events and navigate
			_frame = Application.Current.RootVisual as PhoneApplicationFrame;
			if (null == _frame) throw new InvalidOperationException("Cannot find PhoneApplicationFrame");

			_frameContentWhenOpened = _frame.Content;

			// Save and clear host page transitions for the upcoming "popup" navigation
			UIElement frameContentWhenOpenedAsUIElement = _frameContentWhenOpened as UIElement;
			if (null != frameContentWhenOpenedAsUIElement)
			{
				_savedNavigationInTransition = TransitionService.GetNavigationInTransition(frameContentWhenOpenedAsUIElement);
				TransitionService.SetNavigationInTransition(frameContentWhenOpenedAsUIElement, null);
				_savedNavigationOutTransition = TransitionService.GetNavigationOutTransition(frameContentWhenOpenedAsUIElement);
				TransitionService.SetNavigationOutTransition(frameContentWhenOpenedAsUIElement, null);
			}

			_frame.Navigated += OnFrameNavigated;
			_frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
			_frame.NavigationFailed += OnFrameNavigationStoppedOrFailed;

			_frame.Navigate(DefaultPickerPageUri);
		}
 private void OpenPage(Uri uri)
 {
     if (_frame == null) {
         _frame = Application.Current.RootVisual as PhoneApplicationFrame;
         if (_frame != null) {
             _frameContentWhenOpened = _frame.Content;
             _frame.Navigated += OnFrameNavigated;
             _frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
             _frame.NavigationFailed += OnFrameNavigationStoppedOrFailed;
             _frame.Navigate(uri);
         }
     }
 }
        private void OpenPickerPage()
        {
            if (null == PickerPageUri)
            {
                throw new ArgumentException("PickerPageUri");
            }

            if (null == _frame)
            {
                // Hook up to necessary events and navigate
                _frame = Application.Current.RootVisual as PhoneApplicationFrame;
                if (null != _frame)
                {
                    _frameContentWhenOpened = _frame.Content;

                    // Save and clear host page transitions for the upcoming "popup" navigation
                    UIElement frameContentWhenOpenedAsUIElement = _frameContentWhenOpened as UIElement;

                    if (null != frameContentWhenOpenedAsUIElement)
                    {
                        _savedNavigationInTransition = TransitionService.GetNavigationInTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationInTransition(frameContentWhenOpenedAsUIElement, null);
                        _savedNavigationOutTransition = TransitionService.GetNavigationOutTransition(frameContentWhenOpenedAsUIElement);
                        TransitionService.SetNavigationOutTransition(frameContentWhenOpenedAsUIElement, null);
                        
                    }

                    _frame.Navigated += new NavigatedEventHandler(HandleFrameNavigated);
                    _frame.NavigationStopped += new NavigationStoppedEventHandler(HandleFrameNavigationStoppedOrFailed);
                    _frame.NavigationFailed += new NavigationFailedEventHandler(HandleFrameNavigationStoppedOrFailed);

                    _hasPickerPageOpen = true;

                    _frame.Navigate(PickerPageUri);
                }
            }
        }
 private static void RootVisualNavigate(PhoneApplicationFrame frame, string uri)
 {
     frame.Navigate(new Uri(uri, UriKind.RelativeOrAbsolute));
 }