private static void addOrUpdateScreenCap(xARMScreenCap screenCapToAdd, xARMScreenCap screenCapToReplace = null) { int screenCapIndex; // replace existing SC if (screenCapToReplace is xARMScreenCap) { // find SC to replace screenCapIndex = getScreenCapIndex(screenCapToReplace); // no SC to replace > find SC to update if (screenCapIndex == -1) { screenCapIndex = getScreenCapIndex(screenCapToAdd); } } else { screenCapIndex = getScreenCapIndex(screenCapToAdd); } if (screenCapIndex >= 0) // update (don't add duplicates) // values to keep { bool origEnabledState = AvailScreenCaps[screenCapIndex].Enabled; AvailScreenCaps[screenCapIndex] = screenCapToAdd; AvailScreenCaps[screenCapIndex].Enabled = origEnabledState; } else // add { AvailScreenCaps.Add(screenCapToAdd); } }
private static void addOrReplaceScreenCap(xARMScreenCap screenCapToAdd, xARMScreenCap screenCapToReplace) { int screenCapIndexToReplace = getScreenCapIndex(screenCapToReplace); int screenCapIndexToAdd = getScreenCapIndex(screenCapToAdd); if (screenCapIndexToReplace >= 0) // replace // values to keep { bool origEnabledState = AvailScreenCaps[screenCapIndexToReplace].Enabled; AvailScreenCaps[screenCapIndexToReplace] = screenCapToAdd; AvailScreenCaps[screenCapIndexToReplace].Enabled = origEnabledState; } else if (screenCapIndexToAdd >= 0) // update (don't add duplicates) // values to keep { bool origEnabledState = AvailScreenCaps[screenCapIndexToAdd].Enabled; AvailScreenCaps[screenCapIndexToAdd] = screenCapToAdd; AvailScreenCaps[screenCapIndexToAdd].Enabled = origEnabledState; } else // add { AvailScreenCaps.Add(screenCapToAdd); } }
private static void addOrUpdateScreenCap(xCBMScreenCap screenCapToAdd) { int screenCapIndex = getScreenCapIndex(screenCapToAdd); if (screenCapIndex >= 0) // update (don't add duplicates) // values to keep { bool origEnabledState = AvailScreenCaps[screenCapIndex].Enabled; AvailScreenCaps[screenCapIndex] = screenCapToAdd; AvailScreenCaps[screenCapIndex].Enabled = origEnabledState; } else // add { AvailScreenCaps.Add(screenCapToAdd); } }