using System; using System.Windows.Input; using RGBController2.Commands; using RGBController2.Boards; using RGBController2.ViewModels.LightingModes; namespace RGBController2.ViewModels.Tabs { /// /// An abstract class of a tab. /// public abstract class Tab : BaseViewModel, ITab { /// /// An enum of the different types of tabs there can be. /// Currently this is used for getting the typ0e of the tab for saving the config file. /// public enum tabType { Unknown, Arduino, CUE, Chroma } /// /// The type of this tab. /// public tabType TabType = tabType.Unknown; /// /// The currently selected lighting mode view model of the tab. /// private BaseViewModel _selectedLightingMode; public BaseViewModel SelectedLightingMode { get { return _selectedLightingMode; } set { _selectedLightingMode = value; } } /// /// The name used for the tab header. /// public string Name { get; set; } /// /// The command used to close the tab. /// public ICommand CloseCommand { get; } /// /// The event handler to handel closing the tab. /// public event EventHandler CloseRequested; /// /// The connection status string used by the UI. /// private string _conntectionStatus; public string ConnectionStatus { get { return _conntectionStatus; } set { _conntectionStatus = value; } } /// /// THE RGB device that the tab will communicated with. /// public IBoard _device; /// /// An enum of the different types of tabs there can be. /// Currently this is used for getting the typ0e of the tab for saving the config file. /// protected enum LightingModes { StaticMode = 0, AnimationMode, QuakeMode } /// /// The selected lighting mode. /// This corresponds the the selected item from the drop down box. /// private LightingModes _lightingMode; public int LightingMode { get { return (int)_lightingMode; } set { if (_lightingMode != (LightingModes)value) { _lightingMode = (LightingModes)value; switch (_lightingMode) { case LightingModes.AnimationMode: SelectedLightingMode = new AnimationViewModel(); break; case LightingModes.StaticMode: SelectedLightingMode = new StaticViewModel(_device); break; //case LightingModes.QuakeMode: // SelectedLightingMode = new Q(); // break; } OnPropertyChanged(nameof(SelectedLightingMode)); } } } /// /// Binded to the enabled value of the SlectLightingMode combo box /// private bool _enableSelectLightingMode = false; public bool EnableSelectLightingMode { get { return _enableSelectLightingMode; } set { _enableSelectLightingMode = value; } } /// /// Creates a tab and sets up the close command. /// public Tab() { CloseCommand = new ActionCommand(p => CloseRequested?.Invoke(this, EventArgs.Empty)); } } }