private void ImageRadioButton_Checked(object sender, RoutedEventArgs e) { ImageRadioButton irb = sender as ImageRadioButton; string name = (irb.Source as BitmapImage).UriSource.OriginalString; SelectImage(name); }
private void AddBtn_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog() { Filter = "PNG文件|*.png|BMP文件|*.bmp|JPG文件|*.jpg" }; if (openFileDialog.ShowDialog() == true) { string bgPath = AyuiConfig.AYUI_BackgroundImageDirectoryPath + "z自定义\\" + Path.GetFileName(openFileDialog.FileName); if (!Directory.Exists(Path.GetDirectoryName(bgPath))) { Directory.CreateDirectory(Path.GetDirectoryName(bgPath)); } //string thumbPath= Path.Combine(AyuiConfig.AYUI_BackgroundImageThumbDirectoryPath, Path.GetFileName(openFileDialog.FileName)); File.Copy(openFileDialog.FileName, bgPath); ImageRadioButton imageRadioButton = new ImageRadioButton() { Source = new BitmapImage(new Uri(bgPath)), GroupName = "images" }; imageRadioButton.Checked += ImageRadioButton_Checked; defPanel.Children.Insert(defPanel.Children.Count - 1, imageRadioButton); SelectImage(bgPath); } }
private void TapMenu_CheckedChanged(object sender, EventArgs e) { ImageRadioButton menu = sender as ImageRadioButton; Panel tab = tabDictionary[menu]; foreach (var panel in tabDictionary.Values) { panel.Visible = panel.Equals(tab); } }
private void SkinPage_Loaded(object sender, EventArgs e) { var files = Directory.EnumerateFiles(Environment.CurrentDirectory + "\\Contents\\bg\\bg", "*.*", SearchOption.AllDirectories); string nowPath = ConfigSetting.GetXmlValue("skinBg", "path"); foreach (string item in files) { if (Path.GetExtension(item) == ".png" || Path.GetExtension(item) == ".jpg" || System.IO.Path.GetExtension(item) == ".bmp") { ImageRadioButton imageRadioButton = new ImageRadioButton() { Source = new BitmapImage(new Uri(item)), GroupName = "images" }; imageRadioButton.Checked += ImageRadioButton_Checked; defPanel.Children.Insert(defPanel.Children.Count - 1, imageRadioButton); if (nowPath == item) { imageRadioButton.IsChecked = true; } } } }
public void RefreshPlatformList() { PlatformList = new StackPanel(); var infos = new PlatformInfoManager().GetList(); infos.ForEach(item => { ImageRadioButton btn = new ImageRadioButton(); btn.SetValue(ImageRadioButton.StyleProperty, Application.Current.Resources["MenuRadioButtom"]); btn.GroupName = "MenuItem"; btn.Content = item.Title; var menu = new ContextMenu(); var title = new TextBlock { Text = "删除歌单" }; title.MouseLeftButtonUp += ClickDeleteList; title.Tag = new TagInfo(1, item.Id); menu.Items.Add(title); btn.ContextMenu = menu; btn.Command = new DelegateCommand <object>(new Action <object>(ClickPlatformList)); btn.CommandParameter = item.Id; PlatformList.Children.Add(btn); }); }