private void Connect_PC_Click(object sender, RoutedEventArgs e) { int num = Equipment.pcs.Count + 1; txt_name.Text = "PC" + num; txt_ip.Text = "192.168.0." + ip_num; added_type = "PC"; if (add_grid.ActualHeight == 0) { ServicesAnimation.up_and_show(grid_connect_Switch, 110, 10, Canvas.BottomProperty, Duration); ServicesAnimation.up_and_show(grid_connect_Router, 60, 10, Canvas.BottomProperty, Duration); ServicesAnimation.opacity(grid_connect_Switch, 1.0, 0.0, Duration); ServicesAnimation.opacity(grid_connect_Router, 1.0, 0.0, Duration); ServicesAnimation.show_add_grid(add_grid); } else { ServicesAnimation.hide_add_grid(add_grid); ServicesAnimation.up_and_show(grid_connect_Switch, 10, 110, Canvas.BottomProperty, Duration, 300); ServicesAnimation.up_and_show(grid_connect_Router, 10, 60, Canvas.BottomProperty, Duration, 300); ServicesAnimation.opacity(grid_connect_Switch, 0.5, 1.0, Duration, 300); ServicesAnimation.opacity(grid_connect_Router, 0.5, 1.0, Duration, 300); } }
private void Connect_Router_Click(object sender, RoutedEventArgs e) { int num = Equipment.routers.Count + 1; txt_name.Text = "Router" + num; txt_ip.Text = "192.168.0." + ip_num; added_type = "Router"; if (add_grid.ActualHeight == 0) { ServicesAnimation.up_and_show(grid_connect_Router, Convert.ToInt32(Canvas.GetBottom(grid_connect_Router)), 160, Canvas.BottomProperty, Duration); if (selected_object != null) { if (selected_object is Switch) { ServicesAnimation.up_and_show(grid_connect_PC, 160, 10, Canvas.BottomProperty, Duration); ServicesAnimation.opacity(grid_connect_PC, 1.0, 0.0, Duration); } ServicesAnimation.up_and_show(grid_connect_Switch, 110, 10, Canvas.BottomProperty, Duration); ServicesAnimation.opacity(grid_connect_Switch, 1.0, 0.0, Duration); } ServicesAnimation.show_add_grid(add_grid); } else { ServicesAnimation.hide_add_grid(add_grid); if (selected_object == null) { connect_Router.Visibility = Visibility.Visible; ServicesAnimation.up_and_show(grid_connect_Router, Convert.ToInt32(Canvas.GetBottom(grid_connect_Router)), 60, Canvas.BottomProperty, Duration, 300); } else { if (selected_object is Router) { connect_Router.Visibility = Visibility.Visible; connect_Switch.Visibility = Visibility.Visible; ServicesAnimation.up_and_show(grid_connect_Switch, 10, 110, Canvas.BottomProperty, Duration, 300); ServicesAnimation.up_and_show(grid_connect_Router, Convert.ToInt32(Canvas.GetBottom(grid_connect_Router)), 60, Canvas.BottomProperty, Duration, 300); ServicesAnimation.opacity(grid_connect_Switch, 0.5, 1.0, Duration, 300); } if (selected_object is Switch) { connect_PC.Visibility = Visibility.Visible; connect_Router.Visibility = Visibility.Visible; connect_Switch.Visibility = Visibility.Visible; ServicesAnimation.up_and_show(grid_connect_PC, 10, 160, Canvas.BottomProperty, Duration, 300); ServicesAnimation.up_and_show(grid_connect_Switch, 10, 110, Canvas.BottomProperty, Duration, 300); ServicesAnimation.up_and_show(grid_connect_Router, Convert.ToInt32(Canvas.GetBottom(grid_connect_Router)), 60, Canvas.BottomProperty, Duration, 300); ServicesAnimation.opacity(grid_connect_PC, 0.5, 1.0, Duration, 300); ServicesAnimation.opacity(grid_connect_Switch, 0.5, 1.0, Duration, 300); ServicesAnimation.opacity(grid_connect_Router, 0.5, 1.0, Duration, 300); } } } }
public void hide_btn_connect() { if (add_grid.ActualHeight > 0) { ServicesAnimation.hide_add_grid(add_grid); if (selected_object == null) { connect_Router.Visibility = Visibility.Visible; ServicesAnimation.up_and_show(grid_connect_Router, Convert.ToInt32(Canvas.GetBottom(grid_connect_Router)), 10, Canvas.BottomProperty, Duration, 400); ServicesAnimation.opacity(grid_connect_Router, 1.0, 0.0, Duration, 400); } else { if (selected_object is Router) { connect_Router.Visibility = Visibility.Visible; connect_Switch.Visibility = Visibility.Visible; ServicesAnimation.up_and_show(grid_connect_Switch, Convert.ToInt32(Canvas.GetBottom(grid_connect_Switch)), 10, Canvas.BottomProperty, Duration, 400); ServicesAnimation.up_and_show(grid_connect_Router, Convert.ToInt32(Canvas.GetBottom(grid_connect_Router)), 10, Canvas.BottomProperty, Duration, 400); ServicesAnimation.opacity(grid_connect_Switch, 1.0, 0.0, Duration, 400); ServicesAnimation.opacity(grid_connect_Router, 1.0, 0.0, Duration, 400); } if (selected_object is Switch) { connect_PC.Visibility = Visibility.Visible; connect_Router.Visibility = Visibility.Visible; connect_Switch.Visibility = Visibility.Visible; ServicesAnimation.up_and_show(grid_connect_PC, Convert.ToInt32(Canvas.GetBottom(grid_connect_PC)), 10, Canvas.BottomProperty, Duration, 400); ServicesAnimation.up_and_show(grid_connect_Switch, Convert.ToInt32(Canvas.GetBottom(grid_connect_Switch)), 10, Canvas.BottomProperty, Duration, 400); ServicesAnimation.up_and_show(grid_connect_Router, Convert.ToInt32(Canvas.GetBottom(grid_connect_Router)), 10, Canvas.BottomProperty, Duration, 400); ServicesAnimation.opacity(grid_connect_PC, 1.0, 0.0, Duration, 400); ServicesAnimation.opacity(grid_connect_Switch, 1.0, 0.0, Duration, 400); ServicesAnimation.opacity(grid_connect_Router, 1.0, 0.0, Duration, 400); } } } else { ServicesAnimation.up_and_show(grid_connect_PC, Convert.ToInt32(Canvas.GetBottom(grid_connect_PC)), 10, Canvas.BottomProperty, Duration); ServicesAnimation.up_and_show(grid_connect_Switch, Convert.ToInt32(Canvas.GetBottom(grid_connect_Switch)), 10, Canvas.BottomProperty, Duration); ServicesAnimation.up_and_show(grid_connect_Router, Convert.ToInt32(Canvas.GetBottom(grid_connect_Router)), 10, Canvas.BottomProperty, Duration); ServicesAnimation.opacity(grid_connect_PC, 1.0, 0.0, Duration); ServicesAnimation.opacity(grid_connect_Switch, 1.0, 0.0, Duration); ServicesAnimation.opacity(grid_connect_Router, 1.0, 0.0, Duration); } }