//设备迁移 private void Device_Move(object sender, RoutedEventArgs e) { if (moveGrid.Children != null) { moveGrid.Children.Clear(); } DeviceMove deviceMove = DeviceMigrationsFactory.DeviceMove; EquipmentClass _Eclass = new EquipmentClass(); //DataSet _RemoveSet = _Eclass.getWorkEquipment(); DataSet _RemoveSet = _Eclass.getMoveEquipment(); deviceMove.page.ShowPages(deviceMove.removeGrid, _RemoveSet, BaseRequest.PAGE_SIZE); moveGrid.Children.Add(deviceMove); deviceMove.SetValue(Grid.RowProperty, 0); deviceMove.SetValue(Grid.ColumnProperty, 0); }
private void Device_MouseMove(object sender, MouseEventArgs e) { if (is_drag) { int delta_x = e.X - previous_point.X; int delta_y = e.Y - previous_point.Y; device.Left += delta_x; device.Top += delta_y; if (DeviceMove != null) { DeviceMove.Invoke(new Point(device.Left, device.Top), device); } } }
//报修设备 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); } }