Modification Titre tournois
Modification WPF (Ctrl +C) + Selection
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<ListView Grid.Row ="1" Margin="2" ItemsSource="{Binding Path=Reservation}">
|
||||
<ListView Grid.Row ="1" Margin="2" ItemsSource="{Binding Path=Reservation}" TextSearch.TextPath="Name">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace LaDOSE.DesktopApp.ViewModels
|
||||
var findUser2 = FindUser(SelectedWpEvent.Id, SelectedGame,true);
|
||||
|
||||
findUser.ForEach((e) => this.Players.AddUI(e,()=>NotifyOfPropertyChange(() => this.CanGenerate)));
|
||||
findUser2.ForEach((e) => this.PlayersOptions.AddUI(e));
|
||||
findUser2.ForEach((e) => this.PlayersOptions.AddUI(e,null));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Id}" />
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" />
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Date}" />
|
||||
<TextBlock Margin="5,0,0,0" Text="{Binding Date, StringFormat=dd/MM/yyyy}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
@@ -46,11 +46,12 @@
|
||||
<ColumnDefinition Width="2*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListView Grid.Column="0" ItemsSource="{Binding ElementName=EventsList,Path=SelectedItem.WpBookings}"
|
||||
x:Name="BookingList" IsTextSearchEnabled="True" TextSearch.TextPath="WpUserDto.Name" Margin="2">
|
||||
x:Name="BookingList" IsTextSearchEnabled="True" TextSearch.TextPath="WpUser.Name" Margin="2" KeyUp="Copy">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal" >
|
||||
<TextBlock Text="{Binding WpUser.Name}" />
|
||||
<TextBlock Text="{Binding WpUser.Name}">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
|
||||
@@ -3,15 +3,19 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using LaDOSE.DTO;
|
||||
using Clipboard = System.Windows.Clipboard;
|
||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
using ListViewItem = System.Windows.Controls.ListViewItem;
|
||||
using UserControl = System.Windows.Controls.UserControl;
|
||||
|
||||
namespace LaDOSE.DesktopApp.Views
|
||||
{
|
||||
@@ -27,5 +31,21 @@ namespace LaDOSE.DesktopApp.Views
|
||||
}
|
||||
|
||||
|
||||
private void Copy(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (sender != BookingList) return;
|
||||
|
||||
if (e.Key == Key.C && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
|
||||
CopySelectedValuesToClipboard();
|
||||
}
|
||||
|
||||
private void CopySelectedValuesToClipboard()
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
foreach (WPBookingDTO item in BookingList.SelectedItems)
|
||||
builder.AppendLine(item.WpUser.Name);
|
||||
|
||||
Clipboard.SetText(builder.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +93,12 @@ namespace LaDOSE.Business.Service
|
||||
{
|
||||
|
||||
var currentEvent = currentWpEvent.FirstOrDefault();
|
||||
var eventDate = currentEvent.Date?.ToString("MM/dd/yy");
|
||||
var eventDate = currentEvent.Date?.ToString("dd/MM/yy");
|
||||
|
||||
var remove = currentEvent.Date?.ToString("Mdyy");
|
||||
var url = $"{remove}{selectedGame.Id}";
|
||||
var name = $"[{eventDate}]Ranking {currentEvent.Name} {selectedGame.Name}";
|
||||
var selectedEvent = FormatCurrentEventName(currentEvent.Name);
|
||||
var name = $"[{eventDate}] LaDOSE.Net - {selectedEvent} - {selectedGame.Name}";
|
||||
var tournament = _challongeProvider.CreateTournament(name, url).Result;
|
||||
|
||||
|
||||
@@ -146,5 +147,26 @@ namespace LaDOSE.Business.Service
|
||||
|
||||
return "error while creating challonge";
|
||||
}
|
||||
|
||||
private string FormatCurrentEventName(string currentEventName)
|
||||
{
|
||||
|
||||
|
||||
if (currentEventName.Contains("-"))
|
||||
{
|
||||
var strings = currentEventName.Split('-');
|
||||
var s = strings[strings.Length-1];
|
||||
DateTime test;
|
||||
if (DateTime.TryParse(s, out test))
|
||||
{
|
||||
var formatCurrentEventName = currentEventName.Replace(s, "");
|
||||
formatCurrentEventName= formatCurrentEventName.Replace(" -", "");
|
||||
return formatCurrentEventName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return currentEventName;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user