Current code:
bool preparingScheme = false;
Attribute SetAttribute (Attribute attribute, [CallerMemberName] string callerMemberName = null)
{
if (!Application._initialized && !preparingScheme)
return attribute;
if (preparingScheme)
return attribute;
preparingScheme = true;
switch (caller) {
case "TopLevel":
switch (callerMemberName) {
case "Normal":
HotNormal = Application.Driver.MakeAttribute (HotNormal.Foreground, attribute.Background);
break;
case "Focus":
HotFocus = Application.Driver.MakeAttribute (HotFocus.Foreground, attribute.Background);
break;
....
}
preparingScheme = false;
return attribute;
}
Shouldn't preparingCode be a lock?
While I'm here, the logic in the switch statement has always confused me. I do not understand the intent! It seems arbitrary to be making style decisions in code like this. Can anyone explain clearly?
Current code:
Shouldn't
preparingCodebe a lock?While I'm here, the logic in the switch statement has always confused me. I do not understand the intent! It seems arbitrary to be making style decisions in code like this. Can anyone explain clearly?