Where are all my methods of NavigationService and NavigationContext? - silverlight-4.0

I can't see my Navigate method or for that matter any method of NavigationService and NavigationContext of System.Windows.Navigation. The intellisense doesn't show up. I can see only two method named Equals and ReferenceEquals. This looks very funny. What did i do wrong?

Is intellisense broken in general, or is it just not working for Navigation framework?
Will your code compile with the Navigation code in it?

Related

Cypress spy method on page component

What I'm trying to do here is simple : I have and filter method called "search()" that is called on different action on my page.
I'd like to "spy" this method and then check if it was called with : cy.get('method').should('be.called')
But really, I don't understand how to reach the method, that is written in one of my component as vue method and spy on it. I've read the docs, but still can't understand how to do this.
Thanks in advance.
This did the trick for me:
mount(Component, opts)
cy.spy(Component.methods, 'method').as('method')
cy.get('#method').should('have.been.calledOnce')

ReactNavigation on navigation back via the back arrow, imported components are not remounted/re-imported (I think)

The situation. I have an a custom alert component in a shared components file. I have my different screens in their respective files, and they all import the custom alert. On navigation away from one screen to another, and then I navigate back via reactnavigation's back arrow, the alert is not remounted, and so its invocation throws an error. How should I take care of this?
I figured out a hack; so long it works for now and maintains the development momentum. So, prior to any function call that will eventually invoke the custom imported alert, I call setState, and update a dummy value, e.g. this.setState({sth:'sth'}). This seems to in turn, reload the component's relation to its imported stuff, and just like that the error is no more.

Differences between this.props.navigation.dispatch vs this.props.navigation.navigate?

I see a lot of folks in the react-navigation issues section using this.props.navigation.dispatch to programmatically navigate. Is there any specific reason or use case to use that over this.props.navigation.navigate?
It seems like you can pass more options to the dispatch function? Is there anything else? Can you use dispatch without explicitly tying react-navigation into your apps redux store? Right now I have an app that has redux, but I dont explicitly configure my redux setup to know about react-navigation (and would prefer to keep it that way if I can).
From github 👇🏻:
This is the code of navigate function which reuses navigation.dispatch.. And remember:
Code Don't Lie
Then, navigation.navigate(...args) is an alias of navigation.dispatch(NavigationActions.navigate(...args))
From the React Navigation docs The Navigation Prop chapter (https://reactnavigation.org/docs/navigators/navigation-prop#dispatch-Send-an-action-to-the-router):
...The other navigation functions use dispatch behind the scenes...
Also parameters for NavigationActions.navigate and this.props.navigation.navigate are the same. There should be no difference which one you use. In my opinion, this.props.navigation.navigate is shorter and more readable.

Error checking as navigating though UI

I have a number of objects which are used repeatedly as navigating though the pages of web application. I check each page for an error dialog as I navigate. As I repeatedly use these tests, if I do encounter an error, each test case which uses the navigation functions will fail. I don't want to maintain two sets of navigation functions so I am wondering if anyone knows of a good approach to take?
Thanks
You should not do assertions in your navigation classes. As much as I understand from you question, you have at the moment something similar to:
class Navigation{
public void navigateToSomePlace(){
navigate();
assertTrue(isInExpectedPlace());
}
}
But you should remove the validation from that method and implement it as a separate method which you can call when you need it. If you want better explanation, show some code.
Edit, how I would implement it:
class Navigation{
public void navigateToSomePlace(){
navigate();
}
public void validateIsInSomePlace(){
assertTrue(isInExpectedPlace());
}
}
So basically, when you are doing the navigation test you would call both of them, but if you only use it for navigating, you would only call the navigate()

Search usages of Subclass's method

I have parent class Parent with method getToken(). And I have its child class - ChildA and ChildB, which don't override method getToken().
How I can search usages of method getToken() which used by instance of class ChildA?
Sorry for my English. Thanks!
As I spent half an hour to find the exact solution through all complicated and outdated documentations and examples, I just put the full answer using SSR here (Intellij 15.0.5):
Open SSR dialog (Edit > Find > Search Structurally...) and input template in screenshot, then click on "Edit variables..." to see the second dialog and edit the "Expression type (regexp)" as shown:
and if you want to include subclasses of ChildA too, just check the box "Apply constraint within type hierarchy" bellow the expression type:
You can add getToken() to ChildA, perform the search only for this method, then delete it. Another way is to use Structural Search and Replace.
Intellij asks about this if you use Ctrl+Alt+Shift+F7 for the search. First you have to explicitly override the method in the subclass/subinterface though, as CrazyCoder suggested.