private void goodsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ReadCountStage stage = this.stageListBox.SelectedItem as ReadCountStage; ReadCountItem goodsItem = this.goodsListBox.SelectedItem as ReadCountItem; this.removeGoodsButton.IsEnabled = stage != null && goodsItem != null; }
private ReadCountItem CreateReadCountItem(string goodsImage, int maxCount) { Random rand = new Random(Environment.TickCount); ReadCountItem item = new ReadCountItem(goodsImage, rand.Next(maxCount + 1), maxCount, true); item.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(item_PropertyChanged); return(item); }
private void stageListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ReadCountStage stage = this.stageListBox.SelectedItem as ReadCountStage; ReadCountItem goodsItem = this.goodsListBox.SelectedItem as ReadCountItem; //this.backgroundImageButton.IsEnabled = stage != null; //this.addGoodsButton.IsEnabled = stage != null; //this.removeGoodsButton.IsEnabled = stage != null && goodsItem != null; this.stageInfoPanel.DataContext = stage; }
private void speechRecognizer_SpeechRecognized(object sender, RecognizeCompletedEventArgs e) { ReadCountItem item = this.readCountResultListBox.SelectedItem as ReadCountItem; if (item == null || e.Result == null) { return; } int count = 0; int.TryParse(e.Result.Text, out count); item.Result = count; }
private void removeGoodsItemButton_Click(object sender, RoutedEventArgs e) { ReadCountStage stage = this.stageListBox.SelectedItem as ReadCountStage; if (stage == null) { return; } ReadCountItem item = this.goodsListBox.SelectedItem as ReadCountItem; if (item != null) { stage.Items.Remove(item); } }
private void addToCurrentStageButton_Click(object sender, RoutedEventArgs e) { ReadCountStage stage = this.stageListBox.SelectedItem as ReadCountStage; if (stage == null) { return; } ImageItem imageItem = this.goodsImageListBox.SelectedItem as ImageItem; if (imageItem != null) { ReadCountItem item = new ReadCountItem(imageItem.File, 0, 9, true); stage.Items.Add(item); } }
private void readCountResultListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox lb = sender as ListBox; ReadCountItem readCountItem = lb.SelectedItem as ReadCountItem; if (readCountItem == null) { return; } ListBoxItem item = lb.ItemContainerGenerator.ContainerFromItem(readCountItem) as ListBoxItem; FocusItem(item, "numberTextBox"); NumberOnlyTextBox textBox = GC_UIHelper.FindChild <NumberOnlyTextBox>(item, "numberTextBox"); if (textBox != null) { textBox.SelectAll(); } }