private void newCanvasSliceItem(object sender, RoutedEventArgs e) { if (displayID == 2) { if (currentSlice != "-1") { int n = 0; if(((DataView)grid.ItemsSource).Count>0) n = (int)((DataView)grid.ItemsSource)[((DataView)grid.ItemsSource).Count - 1].Row["sliceposition"] + 1; UICanvasItem uicanvasitem = new UICanvasItem(); uicanvasitem.setCanvasId(Int32.Parse(currentSlice), n); uicanvasitem.ShowDialog(); this.loadDataGrid(ITEMFILTER.CANVASSLICE, currentSlice); grid.ItemsSource = UIData.DefaultView; } else if (currentPeriod != "-1") { int n = 0; if (((DataView)grid.ItemsSource).Count > 0) n = (int)((DataView)grid.ItemsSource)[((DataView)grid.ItemsSource).Count - 1].Row["position"] + 1; UIPeriodItem uiperioditem = new UIPeriodItem(); uiperioditem.setPeriodId(Int32.Parse(currentPeriod), n); uiperioditem.ShowDialog(); this.loadDataGrid(ITEMFILTER.CANVASPERIOD, currentPeriod); grid.ItemsSource = UIData.DefaultView; } } }
private void GridRightBtnDown(object sender, MouseButtonEventArgs e) { if (grid.SelectedItem != null) { if (currentDisplay == ITEMFILTER.CATEGORY) { // MessageBox.Show("CATEGORY"); } else if (currentDisplay == ITEMFILTER.CANVASSLICE) { // MessageBox.Show("CANVASSLICE"); int selectedId = (int)((DataRowView)grid.SelectedItem)["id"]; int position = (int)((DataRowView)grid.SelectedItem)["sliceposition"]; SlotCanvasType type = (SlotCanvasType)((DataRowView)grid.SelectedItem)["type"]; String param1 = ((DataRowView)grid.SelectedItem)["param1"].ToString(); String param2 = ((DataRowView)grid.SelectedItem)["param2"].ToString(); String param3 = ((DataRowView)grid.SelectedItem)["param3"].ToString(); // MessageBox.Show(param1); UICanvasItem uicanvasitem = new UICanvasItem(); uicanvasitem.setModifValues(Int32.Parse(currentSlice), selectedId, position, type, param1, param2, param3); uicanvasitem.ShowDialog(); int selectedI = grid.SelectedIndex; this.loadDataGrid(ITEMFILTER.CANVASSLICE, currentSlice); grid.ItemsSource = UIData.DefaultView; grid.SelectedIndex = selectedI; } else if (currentDisplay == ITEMFILTER.CANVASPERIOD) { // MessageBox.Show("CANVASPERIOD"); } } }