/*
* This file is part of the libCEC(R) library.
*
- * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved.
* libCEC(R) is an original work, containing original code.
*
* libCEC(R) is a trademark of Pulse-Eight Limited.
using System.Collections.Generic;
using CecSharp;
using LibCECTray.settings;
+using System;
namespace LibCECTray.controller.applications
{
public CecButtonConfig(ApplicationController controller)
{
_controller = controller;
+
+ foreach (CecUserControlCode key in Enum.GetValues(typeof(CecUserControlCode)))
+ AddConfigItem(new CecButtonConfigItem(controller, (new CecKeypress { Keycode = key })));
+
+ Load();
+ }
+
+ private void AddConfigItem(CecButtonConfigItem item)
+ {
+ if (!HasItem(item) && item.Key.Keycode != CecUserControlCode.Unknown)
+ Add(item);
+ }
+
+ public bool HasItem(CecButtonConfigItem item)
+ {
+ foreach (var entry in this)
+ {
+ if (item.Key.Keycode == entry.Key.Keycode)
+ return true;
+ }
+ return false;
}
public void Load()