private void saveSelectComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { TextBlock selectedItem = saveSelectComboBox.SelectedItem as TextBlock; if (selectedItem == null) { return; } SaveInfo save = selectedItem.Tag as SaveInfo; string sinfo = string.Format("{0} ", save.ToString()); SaveDetailInfo.Text = sinfo; }
public void Show(bool isSave) { this.IsSave = isSave; if (isSave) { okButton.Content = "保存"; suggestInfo.Text = "请选择或输入要保存的存档"; } else { okButton.Content = "读取"; suggestInfo.Text = "请选择或输入要读取的存档"; } List <SaveInfo> savefilelist = RuntimeData.Instance.GetSaveList(); listPanel.Children.Clear(); foreach (var s in savefilelist) { string filepath = s.Name; SaveInfo info = s; TextBlock saveFile = new TextBlock() { Text = filepath, Foreground = new SolidColorBrush(Colors.White), FontSize = 22 }; saveFile.MouseEnter += (ss, e) => { saveFile.Foreground = new SolidColorBrush(Colors.Yellow); }; saveFile.MouseLeave += (ss, e) => { saveFile.Foreground = new SolidColorBrush(Colors.White); }; saveFile.MouseLeftButtonUp += (ss, e) => { fileText.Text = filepath; saveDetail.Text = info.ToString(); }; listPanel.Children.Add(saveFile); } this.Visibility = System.Windows.Visibility.Visible; }