Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        private void ControlPanelReading(ListBoxItemCustom item)
        {
            var rowIndex    = 0;
            var columnIndex = 0;

            if (item.Stats != null)
            {
                foreach (var buttonCollections in item.Stats)
                {
                    var groupBox = _presenter.GetContext()
                                   .Where(x => x.dockPanel.IdNumber == rowIndex)
                                   .Select(s => s.customButton);

                    foreach (Status button in buttonCollections)
                    {
                        SetBackgroundColor(columnIndex, groupBox, button);
                        columnIndex++;
                    }
                    columnIndex = 0;
                    rowIndex++;
                }
            }
            else
            {
                _presenter.ClearButtonsBackground();
            }
        }
Beispiel #2
0
 public void Write(ListBoxItemCustom item, bool reading)
 {
     if (ControlPanelEvent != null)
     {
         ControlPanelEvent(item, reading);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Event from ControlPanel
 /// </summary>
 /// <param name="item"></param>
 void ControlPanel_ControlPanelEvent(ListBoxItemCustom item, bool reading)
 {
     if (reading)
     {
         ControlPanelReading(item);
     }
     else
     {
         ControlPanelUpdate(item);
     }
 }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        private void ControlPanelUpdate(ListBoxItemCustom item)
        {
            //TODO - compare these two lists produce new one!
            List <List <Status> > permissions = new List <List <Status> >();

            var groupBoxes = _presenter.GetContext().Select(w => w.dockPanel).Distinct();

            foreach (var items in groupBoxes)
            {
                var buttons = _presenter.GetContext().Where(x => x.dockPanel == items).Select(s => s.customButton);
                permissions.Add(buttons.Select(x => x.Status).ToList());
            }

            _presenter.UpdateCardsPermissions(_presenter.GenerateFinalResult(permissions, item.Stats), item.cardId);
        }
Beispiel #5
0
        private void BindList()
        {
            foreach (var item in _cards)
            {
                ListBoxItemCustom control = new ListBoxItemCustom()
                {
                    ToolTip = string.Format(Properties.Resources.ListBoxItemCustomToolTip, item.StartTime, item.EndTime, item.Deleted),
                    Content = string.Format(Properties.Resources.cardIdTemplate, item.CardId),
                    cardId  = item.CardId,
                    Stats   = item.Permissions == null ? null : JsonConvert.DeserializeObject <List <List <Status> > >(item.Permissions)
                };
                CardsList.Items.Add(control);
            }

            _buffer = CardsList.Items.Cast <ListBoxItemCustom>().ToList();

            spin.Visibility = System.Windows.Visibility.Hidden;
        }