TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
anupama b
NA
7
3.4k
Accessing the code in One If Condition from another condition
Feb 10 2012 7:36 AM
Hi,
I am trying to access the code in another if condition from another but unable to . could you please suggest an approach. Here is the code i am using
foreach (string arg in Environment.GetCommandLineArgs())
{
if (arg == "–Auto_BlueGrass")
{
for (int i = 0; i < 2; i++)
{
if (i==0)
{
mstrSwitch = "BluegrassCH";
AllocConsole();
Console.WriteLine("BlueGrass Chargeable Claims Job started in Auto mode - " + DateTime.Now + " ");
mblnAutomode = true;
goto AutoModePoint;
}
else if(i==1)
{
mstrSwitch = "BluegrassRP";
AllocConsole();
Console.WriteLine("BlueGrass Reporting Claims Job started in Auto mode - " + DateTime.Now + " ");
mblnAutomode = true;
goto AutoModePoint;
}
}
}
AutoModePoint: if (!IsUserAuthorized())
{
if (mblnAutomode)
{
Console.WriteLine("You do not have permissions to run this application. This application will now close." + " " + DateTime.Now);
Application.Current.Shutdown();
}
else
{
MessageBox.Show("You do not have permissions to run this application. This application will now close.", "No Access", MessageBoxButton.OK, MessageBoxImage.Stop);
Application.Current.Shutdown();
}
}
else
{
this.DataContext = this;
DefinePacificareStateCodes();
ReadApplicationSettings();
}
In the above code first i am using a for condition inside a if and foreach condition.
After execution the steps next to if(i==0) cond it has to goto the if (!IsUserAuthorized()) and execute those steps under that condition.
I tried using the goto statement but in that case it only executes if(i==0) condition but i also want if(i==1) condition to eexecute once the i is incremented in for loop which is not happening using goto statement could anyone please suggets an approach or any idea is appreciated
Aim : suppose i have a x job and x1 and x2 are sub jobs to it instead of executing x1 and x2 individually whenever i click on x first it has to complete x1 and then it should automatically start x2 and complete it.
if question is not understandable please let me know i will modify the question more ..
Reply
Answers (
1
)
when i click the button to show list of items on the button control in the form of listview or list model
How to show some indicator on the button when i can put the context menu in that button?