Re: Radnen's Sphere Studio v1.1.7.0
Reply #517 –
On a minor sidenote re: the Weifen Luo controls, I think this is the most awesome piece of code I've ever written:
bool autoHide = Core.Settings.AutoHidePanes.Contains(name);
DockState state = plugin.DockHint == DockHint.Float ? DockState.Float
: plugin.DockHint == DockHint.Left ? (autoHide ? DockState.DockLeftAutoHide : DockState.DockLeft)
: plugin.DockHint == DockHint.Right ? (autoHide ? DockState.DockRightAutoHide : DockState.DockRight)
: plugin.DockHint == DockHint.Top ? (autoHide ? DockState.DockTopAutoHide : DockState.DockTop)
: plugin.DockHint == DockHint.Bottom ? (autoHide ? DockState.DockBottomAutoHide : DockState.DockBottom)
: DockState.Float; // stacked and nested ternary = awesome
Funny thing is, I used to avoid ternary conditionals like the plague, thinking they made the code harder to read. But had the above been written as a traditional if/else tower... *shudder* (I still would have found a way to make it as compact as possible though
) Nowadays I use them all over the place.