Esempio n. 1
0
        private void SetBindingNext(ThermalCell thermalCell)
        {
            var thermalCellIndex = this.StackPanel1.Children.IndexOf(thermalCell);

            if (thermalCellIndex != this.StackPanel1.Children.Count - 1)
            {
                General.SetBinding(thermalCell, this.GetThermalCell(thermalCellIndex + 1));
            }
        }
Esempio n. 2
0
        private void SetBindingPrevious(ThermalCell thermalCell)
        {
            var thermalCellIndex = this.StackPanel1.Children.IndexOf(thermalCell);

            if (thermalCellIndex != 0)
            {
                var previousThermalCell = this.GetThermalCell(thermalCellIndex - 1);
                General.SetBinding(previousThermalCell, thermalCell);
            }
        }
Esempio n. 3
0
        private void AddThermalCell(object sender, RoutedEventArgs e)
        {
            var newThermalCell = new ThermalCell {
                Margin = new Thickness(-1, 0, 0, 0)
            };

            if (this.StackPanel1.Children.Count == 0)
            {
                newThermalCell.SetValue(MarginProperty, new Thickness());
            }

            newThermalCell.ThermalChanged += ThermalChanged;

            newThermalCell.MouseLeftButtonDown += ThermalCellSelected;

            if (this.StackPanel1.Children.Count > 0)
            {
                this.StackPanel1.Children.Insert(this.selectedIndex + 1, newThermalCell);
            }

            else
            {
                this.StackPanel1.Children.Add(newThermalCell);
            }

            if (this.StackPanel1.Children.Count > 1)
            {
                General.SetBinding(this.GetThermalCell(this.selectedIndex), newThermalCell);
            }

            if (this.selectedIndex < this.StackPanel1.Children.Count - 2)
            {
                General.SetBinding(newThermalCell, this.GetThermalCell(this.selectedIndex + 2));
            }

            this.selectedIndex = this.StackPanel1.Children.Count - 1;

            this.ResetSelection();
        }