Skip to content

Commit

Permalink
feat(demo): add copy player steamid in scoreboard context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver committed Jul 13, 2022
1 parent 2d72473 commit abaa896
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Manager/Resources/ContextMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<MenuItem Header="{x:Static properties:Resources.ShowPlayerDemos}"
Command="{Binding DemoDetails.ShowPlayerDemosCommand, Source={StaticResource Locator}}"
CommandParameter="{Binding DemoDetails.SelectedPlayer, Source={StaticResource Locator}}" />
<MenuItem Header="{x:Static properties:Resources.CopySteamID}"
Command="{Binding DemoDetails.CopyPlayerSteamIdCommand, Source={StaticResource Locator}}"
CommandParameter="{Binding DemoDetails.SelectedPlayer.SteamId, Source={StaticResource Locator}}" />
</ContextMenu>

<ContextMenu x:Key="WhitelistRowContextMenu">
Expand Down
8 changes: 8 additions & 0 deletions Manager/ViewModel/Demos/DemoDetailsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ public ICollectionView PlayersTeam2Collection

#region Commands

public RelayCommand<string> CopyPlayerSteamIdCommand { get; }

public RelayCommand WindowLoaded
{
get
Expand Down Expand Up @@ -961,6 +963,7 @@ public DemoDetailsViewModel(
_cacheService = cacheService;
_excelService = excelService;
_roundService = roundService;
CopyPlayerSteamIdCommand = new RelayCommand<string>(CopyPlayerSteamId);

Sources = Source.Sources;

Expand Down Expand Up @@ -1133,5 +1136,10 @@ private void HandleAnalyzeProgress(string demoId, float value)
Messenger.Default.Send(msg);
}));
}

private void CopyPlayerSteamId(string steamId)
{
System.Windows.Clipboard.SetText(steamId);
}
}
}

0 comments on commit abaa896

Please sign in to comment.