Skip to content

Commit

Permalink
Bug LinkCopy
Browse files Browse the repository at this point in the history
  • Loading branch information
EndlessMISAKA committed May 27, 2020
1 parent abdd2cd commit 532cf6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
5 changes: 0 additions & 5 deletions AtelierMisaka/Global/GlobalCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ public class GlobalCommand
System.Diagnostics.Process.Start(GlobalData.VM_MA.SelectedDocument.Link);
});

public static ParamCommand<string> OpenBrowserCommand = new ParamCommand<string>((link) =>
{
System.Diagnostics.Process.Start(link);
});

public static CommonCommand LikePostCommand = new CommonCommand(async () =>
{
if (GlobalData.VM_MA.IsLiked_Document)
Expand Down
18 changes: 15 additions & 3 deletions AtelierMisaka/Views/Pop_Document.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down Expand Up @@ -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());
}
Expand All @@ -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);
}
}
}

0 comments on commit 532cf6c

Please sign in to comment.