public void FlashDrive_DoubleClick(object sender, MouseButtonEventArgs e) { DataGridRow row = ItemsControl.ContainerFromElement((DataGrid)sender, e.OriginalSource as DependencyObject) as DataGridRow; if (row == null) { return; } FlashDrive rowPage = new FlashDrive((int)(((DataRowView)row.Item).Row["ID"])); this.NavigationService.Navigate(rowPage); }
private void MemberInventory_DoubleClick(object sender, RoutedEventArgs e) { DataGridRow row = ItemsControl.ContainerFromElement((DataGrid)sender, e.OriginalSource as DependencyObject) as DataGridRow; if (row == null) { return; } int res = 1; int id = (int)(((DataRowView)row.Item).Row["ID"]); using (SqlConnection conn = new SqlConnection(DB.getDB().getConnectionString())) using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandText = "isFlashDrive"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("ID", id); var returnParameter = cmd.Parameters.Add("@ReturnVal", SqlDbType.Int); returnParameter.Direction = ParameterDirection.ReturnValue; conn.Open(); cmd.ExecuteNonQuery(); res = (returnParameter.Value as Nullable <int>).GetValueOrDefault(2); } Page rowPage; if (res == 1) { rowPage = new FlashDrive(id); } else { rowPage = new Equipamento(id); } inventoryFlyout.IsOpen = false; FlyoutPage.NavigationService.Navigate(rowPage); }
public void InsertFlashDrive_Click(object sender, RoutedEventArgs e) { FlashDrive Page = new FlashDrive(-1); this.NavigationService.Navigate(Page); }