private void OnClicked(object o, EventArgs eventArgs) { var currentIndex = mScenes.IndexOf(mActiveScene); var index = currentIndex + 1; if (index > mScenes.Count - 1) { index = 0; } mActiveScene = mScenes[index]; mActiveScene.Apply(); }
public LightSceneSwitcher(IReadOnlyList <LightScene> scenes, ISwitch @switch) { mScenes = scenes.ToList(); mActiveScene = mScenes[0]; @switch.Clicked += OnClicked; }