コード例 #1
0
        private void ImageRadioButton_Checked(object sender, RoutedEventArgs e)
        {
            ImageRadioButton irb  = sender as ImageRadioButton;
            string           name = (irb.Source as BitmapImage).UriSource.OriginalString;

            SelectImage(name);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
ファイル: ConfigForm.cs プロジェクト: nda111/PptToPdf-Ver-2.0
        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);
            }
        }
コード例 #4
0
        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;
                    }
                }
            }
        }
コード例 #5
0
ファイル: BasePageViewModel.cs プロジェクト: naisev/WeMusic
        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);
            });
        }