Exemplo n.º 1
0
        private void AddThermalUnit(ThermalUnit thermalUnit)
        {
            this.test++;
            thermalUnit.test = this.test;
            thermalUnit.PreviewMouseLeftButtonDown += ThermalUnit_PreviewMouseLeftButtonDown;

            if (this.StackPanel1.Children.Count > 0)
            {
                this.StackPanel1.Children.Insert(this.insertIndex + 1, thermalUnit);
            }
            else
            {
                this.StackPanel1.Children.Add(thermalUnit);
            }
        }
Exemplo n.º 2
0
        private void AddThermalUnit(object sender, RoutedEventArgs e)
        {
            var newThermalUnit = new ThermalUnit();

            this.AddThermalUnit(newThermalUnit);

            if (this.StackPanel1.Children.Count > 1)
            {
                General.SetBinding(this.GetThermalUnit(this.insertIndex), newThermalUnit);
            }

            if (this.insertIndex < this.StackPanel1.Children.Count - 2)
            {
                General.SetBinding(newThermalUnit, this.GetThermalUnit(this.insertIndex + 2));
            }

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

            if (newThermalUnit == this.GetLastThermalUnit())
            {
                this.OnThermalChanged(ThermalChange.ChangeLastThermalUnit);
            }
        }