Esempio n. 1
0
        private void EditorLostFocus(object sender, RoutedEventArgs e)
        {
            PhidgetLEDBoard board = Interface as PhidgetLEDBoard;

            for (int i = 0; i < 64; i++)
            {
                board.SetLedPower(i, 0);
            }
        }
Esempio n. 2
0
 public LedGroupViewModel(PhidgetLEDBoard board, LEDGroup group)
 {
     _board = board;
     _group = group;
     for(int i=0; i < 64; i++)
     {
         _leds.Add(new LedViewModel(board, group, i));
     }
 }
Esempio n. 3
0
 public LedGroupViewModel(PhidgetLEDBoard board, LEDGroup group)
 {
     _board = board;
     _group = group;
     for (int i = 0; i < 64; i++)
     {
         _leds.Add(new LedViewModel(board, group, i));
     }
 }
Esempio n. 4
0
        public LedGroupsViewModel(PhidgetLEDBoard board)
        {
            _board = board;
            foreach (LEDGroup group in _board.LedGroups)
            {
                Add(new LedGroupViewModel(_board, group));
            }

            _board.LedGroups.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(LedGroups_CollectionChanged);
        }
Esempio n. 5
0
        private void RemoveLedGroup(object sender, RoutedEventArgs e)
        {
            PhidgetLEDBoard   board = Interface as PhidgetLEDBoard;
            LedGroupViewModel model = LedGroupListBox.SelectedItem as LedGroupViewModel;

            if (model != null && board.LedGroups.Contains(model.Group))
            {
                ConfigManager.UndoManager.AddUndoItem(new RemoveLedGroupUndoEvent(board.LedGroups, model.Group, board.LedGroups.IndexOf(model.Group)));
                board.LedGroups.Remove(model.Group);
            }
        }
Esempio n. 6
0
        private void LEDClicked(object sender, RoutedEventArgs e)
        {
            PhidgetLEDBoard   board = Interface as PhidgetLEDBoard;
            LedGroupViewModel model = LedGroupListBox.SelectedItem as LedGroupViewModel;

            if (model != null)
            {
                model.Group.Level = model.Group.DefaultLevel;
            }
            SetLeds();
        }
Esempio n. 7
0
        private void DefaultLevelChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            PhidgetLEDBoard   board = Interface as PhidgetLEDBoard;
            LedGroupViewModel model = LedGroupListBox.SelectedItem as LedGroupViewModel;

            if (model != null)
            {
                model.Group.Level = model.Group.DefaultLevel;
                SetLeds();
            }
        }
Esempio n. 8
0
        public LEDGroup(PhidgetLEDBoard parentBoard, string name)
        {
            _name = name;
            _togglePowerAction = new HeliosAction(parentBoard, name, "Power", "Toggle", "Toggles the power to this led group.  Current brightness setting will be retained.");
            _togglePowerAction.Context = this;

            _setPowerAction = new HeliosAction(parentBoard, name, "Power", "Set", "Sets whether this led group is powered on or not. Current brightness setting will be retained.", "True if the leds should be turned on, false if the leds should be turned off.", BindingValueUnits.Boolean);
            _setPowerAction.Context = this;

            _setBrightnessAction = new HeliosAction(parentBoard, name, "Brightness", "Set", "Sets the brightness of the leds in this group.", "0 = off regardless of power, 100 = full brightness", BindingValueUnits.Numeric);
            _setBrightnessAction.Context = this;
        }
Esempio n. 9
0
        public LEDGroup(PhidgetLEDBoard parentBoard, string name)
        {
            _name = name;
            _togglePowerAction         = new HeliosAction(parentBoard, name, "Power", "Toggle", "Toggles the power to this led group.  Current brightness setting will be retained.");
            _togglePowerAction.Context = this;

            _setPowerAction         = new HeliosAction(parentBoard, name, "Power", "Set", "Sets whether this led group is powered on or not. Current brightness setting will be retained.", "True if the leds should be turned on, false if the leds should be turned off.", BindingValueUnits.Boolean);
            _setPowerAction.Context = this;

            _setBrightnessAction         = new HeliosAction(parentBoard, name, "Brightness", "Set", "Sets the brightness of the leds in this group.", "0 = off regardless of power, 100 = full brightness", BindingValueUnits.Numeric);
            _setBrightnessAction.Context = this;
        }
Esempio n. 10
0
        public override void Closed()
        {
            base.Closed();
            PhidgetLEDBoard board = Interface as PhidgetLEDBoard;

            if (board != null)
            {
                foreach (LEDGroup group in board.LedGroups)
                {
                    board.SetGroupPower(group, false);
                }
                board.Detach();
            }
        }
Esempio n. 11
0
        private void EditorGotFocus(object sender, RoutedEventArgs e)
        {
            PhidgetLEDBoard   board = Interface as PhidgetLEDBoard;
            LedGroupViewModel model = LedGroupListBox.SelectedItem as LedGroupViewModel;

            foreach (LEDGroup group in board.LedGroups)
            {
                board.SetGroupPower(group, false);
            }
            if (model != null)
            {
                model.Group.Level = model.Group.DefaultLevel;
            }
            SetLeds();
        }
Esempio n. 12
0
        private void SetLeds()
        {
            PhidgetLEDBoard   board = Interface as PhidgetLEDBoard;
            LedGroupViewModel model = LedGroupListBox.SelectedItem as LedGroupViewModel;

            for (int i = 0; i < 64; i++)
            {
                int level = 0;
                if (model != null && model.Group.Leds.Contains(i))
                {
                    level = model.Group.DefaultLevel;
                }
                board.SetLedPower(i, level);
            }
        }
Esempio n. 13
0
        protected override void OnInterfaceChanged(HeliosInterface oldInterface, HeliosInterface newInterface)
        {
            PhidgetLEDBoard oldBoard = oldInterface as PhidgetLEDBoard;

            if (oldBoard != null)
            {
                oldBoard.Detach();
            }

            PhidgetLEDBoard newBoard = newInterface as PhidgetLEDBoard;

            if (newBoard != null)
            {
                newBoard.Attach();
            }

            GroupsViewModel = new LedGroupsViewModel(newInterface as PhidgetLEDBoard);
        }
Esempio n. 14
0
        private void AddLedGroup(object sender, RoutedEventArgs e)
        {
            PhidgetLEDBoard board = Interface as PhidgetLEDBoard;

            int    i    = 0;
            string name = "Led Group " + i++;

            while (board.LedGroups.ContainsKey(name))
            {
                name = "Led Group " + i++;
            }

            LEDGroup group = new LEDGroup(board, name);

            board.LedGroups.Add(group);

            LedGroupListBox.SelectedItem = GroupsViewModel.Last();

            ConfigManager.UndoManager.AddUndoItem(new AddLedGroupUndoEvent(board.LedGroups, group));
        }
Esempio n. 15
0
 public LedViewModel(PhidgetLEDBoard board, LEDGroup group, int led)
 {
     _board = board;
     _group = group;
     _led   = led;
 }
Esempio n. 16
0
 public LedViewModel(PhidgetLEDBoard board, LEDGroup group, int led)
 {
     _board = board;
     _group = group;
     _led = led;
 }