I have a situation where I am calling function/method in cascading style. See following example for illustration and question. I wish I knew some technical word for this situation. It would be easier for people understand what I am talking about.
public static class test
{
private void button1_Click(object sender, RoutedEventArgs e)
{
if (Login("johndoe","password"))
{
if(checkForSomething("johndoe"))
{
DoOpenDashboard();
// Now it opens dashboard, it has several buttons.
// Each button does several different things
// On this example I am just giving you two level of hierarchy
// but in my actual program, there are 7 levels.
}
}
}
public static bool Login(string userid, string password)
{
//valid user
return true;
}
public static bool checkForSomething(string userid)
{
return true;
}
How do I avoid process to go back to previous calling method/function if child method runs sucessfully?
For example login method is calling checkForSomething("johndoe")
. If checkForSomething("johndoe")
is passed then it will open Dashboard window by calling DoOpenDashboard. At this point my process should should not go back to checkforsoemthing, and then login. I hope it makes sense.