コード例 #1
0
        //报修设备
        private void Device_Migrations(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            TreeViewItem assets = ((sender as TreeView).SelectedItem as TreeViewItem);

            if (moveGrid.Children != null)
            {
                moveGrid.Children.Clear();
            }
            string migrations = assets.Uid.ToString();

            if (migrations == null || "".Equals(migrations))
            {
                return;
            }
            if (migrations.Equals("repair"))
            {
                if (moveGrid.Children != null)
                {
                    moveGrid.Children.Clear();
                }
                Equipments equipments = DeviceMigrationsFactory.Equipments;
                moveGrid.Children.Add(equipments);
                equipments.SetValue(Grid.RowProperty, 0);
                equipments.SetValue(Grid.ColumnProperty, 0);
            }
            else if (migrations.Equals("incoming"))
            {
                if (moveGrid.Children != null)
                {
                    moveGrid.Children.Clear();
                }
                NewEquipment equipments = DeviceMigrationsFactory.NewEquipment;
                moveGrid.Children.Add(equipments);
                equipments.SetValue(Grid.RowProperty, 0);
                equipments.SetValue(Grid.ColumnProperty, 0);
            }
            else if (migrations.Equals("delivery"))
            {
                if (moveGrid.Children != null)
                {
                    moveGrid.Children.Clear();
                }
                EquipmentDelivery equipments = DeviceMigrationsFactory.EquipmentDelivery;
                moveGrid.Children.Add(equipments);
                equipments.SetValue(Grid.RowProperty, 0);
                equipments.SetValue(Grid.ColumnProperty, 0);
            }
            else if (migrations.Equals("incoming"))
            {
                if (moveGrid.Children != null)
                {
                    moveGrid.Children.Clear();
                }
                EquipmentDelivery equipments = DeviceMigrationsFactory.EquipmentDelivery;
                moveGrid.Children.Add(equipments);
                equipments.SetValue(Grid.RowProperty, 0);
                equipments.SetValue(Grid.ColumnProperty, 0);
            }
            else if (migrations.Equals("migrate"))
            {
                if (moveGrid.Children != null)
                {
                    moveGrid.Children.Clear();
                }
                DeviceMove equipments = DeviceMigrationsFactory.DeviceMove;
                moveGrid.Children.Add(equipments);
                equipments.SetValue(Grid.RowProperty, 0);
                equipments.SetValue(Grid.ColumnProperty, 0);
            }
            else if (migrations.Equals("scrap"))
            {
                if (moveGrid.Children != null)
                {
                    moveGrid.Children.Clear();
                }
                EquipmentScrapping equipments = DeviceMigrationsFactory.EquipmentScrapping;
                moveGrid.Children.Add(equipments);
                equipments.SetValue(Grid.RowProperty, 0);
                equipments.SetValue(Grid.ColumnProperty, 0);
            }
            else if (migrations.Equals("mains"))
            {
                if (moveGrid.Children != null)
                {
                    moveGrid.Children.Clear();
                }
                DevicePower equipments = DeviceMigrationsFactory.DevicePower;
                moveGrid.Children.Add(equipments);
                equipments.SetValue(Grid.RowProperty, 0);
                equipments.SetValue(Grid.ColumnProperty, 0);
            }
        }