diff --git a/AtelierMisaka/Global/GlobalCommand.cs b/AtelierMisaka/Global/GlobalCommand.cs index 3353c9b..e85704d 100644 --- a/AtelierMisaka/Global/GlobalCommand.cs +++ b/AtelierMisaka/Global/GlobalCommand.cs @@ -72,11 +72,6 @@ public class GlobalCommand System.Diagnostics.Process.Start(GlobalData.VM_MA.SelectedDocument.Link); }); - public static ParamCommand OpenBrowserCommand = new ParamCommand((link) => - { - System.Diagnostics.Process.Start(link); - }); - public static CommonCommand LikePostCommand = new CommonCommand(async () => { if (GlobalData.VM_MA.IsLiked_Document) diff --git a/AtelierMisaka/Views/Pop_Document.xaml.cs b/AtelierMisaka/Views/Pop_Document.xaml.cs index b5d51ff..df508cb 100644 --- a/AtelierMisaka/Views/Pop_Document.xaml.cs +++ b/AtelierMisaka/Views/Pop_Document.xaml.cs @@ -56,9 +56,9 @@ public void LoadData(BaseItem bi) } Hyperlink hl = new Hyperlink(new Run(link)) { - Command = GlobalCommand.OpenBrowserCommand, CommandParameter = link }; + hl.Click += Hl_Click; if (index != 0) { MainBody.Inlines.Add(new Run(dis.Substring(0, index))); @@ -101,9 +101,9 @@ public void LoadData(BaseItem bi) { Hyperlink hl = new Hyperlink(new Run(bi.FileNames[i])) { - Command = GlobalData.VM_DL.AddCommand, CommandParameter = new object[] { true, bi, i } }; + hl.Click += AddDownload; MainBody.Inlines.Add(hl); MainBody.Inlines.Add(new LineBreak()); } @@ -120,13 +120,25 @@ public void LoadData(BaseItem bi) { Hyperlink hl = new Hyperlink(new Run(bi.MediaNames[i])) { - Command = GlobalData.VM_DL.AddCommand, CommandParameter = new object[] { false, bi, i } }; + hl.Click += AddDownload; MainBody.Inlines.Add(hl); MainBody.Inlines.Add(new LineBreak()); } } } + + private void AddDownload(object sender, System.Windows.RoutedEventArgs e) + { + Hyperlink link = sender as Hyperlink; + GlobalData.VM_DL.AddCommand.Execute(link.CommandParameter); + } + + private void Hl_Click(object sender, System.Windows.RoutedEventArgs e) + { + Hyperlink link = sender as Hyperlink; + System.Diagnostics.Process.Start((string)link.CommandParameter); + } } }