Modification Smash
Ajout Ecran Layout XSB
This commit is contained in:
@@ -127,11 +127,15 @@
|
||||
</Compile>
|
||||
<Compile Include="Utils\WpEventDeserialize.cs" />
|
||||
<Compile Include="Utils\WpfUtil.cs" />
|
||||
<Compile Include="ViewModels\EventPlayerViewModel.cs" />
|
||||
<Compile Include="ViewModels\ShellViewModel.cs" />
|
||||
<Compile Include="ViewModels\GameViewModel.cs" />
|
||||
<Compile Include="ViewModels\TournamentResultViewModel.cs" />
|
||||
<Compile Include="ViewModels\WebNavigationViewModel.cs" />
|
||||
<Compile Include="ViewModels\WordPressViewModel.cs" />
|
||||
<Compile Include="Views\EventPlayerView.xaml.cs">
|
||||
<DependentUpon>EventPlayerView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\WebNavigationView.xaml.cs">
|
||||
<DependentUpon>WebNavigationView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -159,6 +163,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\EventPlayerView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\WebNavigationView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
107
LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/EventPlayerViewModel.cs
Normal file
107
LaDOSE.Src/LaDOSE.DesktopApp/ViewModels/EventPlayerViewModel.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Caliburn.Micro;
|
||||
using LaDOSE.DesktopApp.Utils;
|
||||
using LaDOSE.DTO;
|
||||
using LaDOSE.REST;
|
||||
using Microsoft.Win32;
|
||||
using RestSharp.Serialization.Json;
|
||||
|
||||
namespace LaDOSE.DesktopApp.ViewModels
|
||||
{
|
||||
public class EventPlayerViewModel : Screen
|
||||
{
|
||||
public override string DisplayName => "EventPlayers";
|
||||
|
||||
|
||||
public class KiouzeFile
|
||||
{
|
||||
public String player { get; set; }
|
||||
public String character { get; set; }
|
||||
}
|
||||
|
||||
public ObservableCollection<KiouzeFile> Data { get; set; }
|
||||
|
||||
private List<string> _playersList;
|
||||
private List<string> _charList;
|
||||
private string _chars { get; set; }
|
||||
public string Slug { get; set; }
|
||||
|
||||
private RestService RestService { get; set; }
|
||||
public EventPlayerViewModel(RestService restService)
|
||||
{
|
||||
this.RestService = restService;
|
||||
Data = new ObservableCollection<KiouzeFile>();
|
||||
this.Slug = "tag-team-tuesdays-umvc3-team-tournament-2";
|
||||
this.Chars = "akuma;blanka;boxer;cammy;chunli;claw;deejay;dhalsim;dictator;feilong;guile;honda;ken;ryu;sagat;thawk;zangief";
|
||||
|
||||
}
|
||||
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
|
||||
base.OnInitialize();
|
||||
}
|
||||
|
||||
public void GetPlayers()
|
||||
{
|
||||
WpfUtil.Await(() =>
|
||||
{
|
||||
|
||||
var resultsDto = this.RestService.GetPlayers(this.Slug);
|
||||
Players = resultsDto;
|
||||
Players.ForEach(p=> Data.AddUI(new KiouzeFile(){player = p}));
|
||||
});
|
||||
}
|
||||
|
||||
public void Export()
|
||||
{
|
||||
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
if (saveFileDialog.ShowDialog() == true)
|
||||
{
|
||||
JsonSerializer p = new JsonDeserializer();
|
||||
var json = p.Serialize(Data.ToList());
|
||||
File.WriteAllText(saveFileDialog.FileName, json);
|
||||
}
|
||||
}
|
||||
public List<String> Players
|
||||
{
|
||||
get => _playersList;
|
||||
set
|
||||
{
|
||||
_playersList = value;
|
||||
NotifyOfPropertyChange(() => this.Players);
|
||||
}
|
||||
}
|
||||
public List<String> CharList
|
||||
{
|
||||
get => _charList;
|
||||
set
|
||||
{
|
||||
_charList = value;
|
||||
NotifyOfPropertyChange(() => this.CharList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String Chars
|
||||
{
|
||||
get => _chars;
|
||||
set
|
||||
{
|
||||
_chars = value;
|
||||
_charList = _chars.Split(';').ToList();
|
||||
NotifyOfPropertyChange(()=>this.Players);
|
||||
NotifyOfPropertyChange(()=>this.CharList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -68,5 +68,9 @@ namespace LaDOSE.DesktopApp.ViewModels
|
||||
{
|
||||
ActivateItem(new TournamentResultViewModel(IoC.Get<RestService>()));
|
||||
}
|
||||
public void EventPlayers()
|
||||
{
|
||||
ActivateItem(new EventPlayerViewModel(IoC.Get<RestService>()));
|
||||
}
|
||||
}
|
||||
}
|
||||
53
LaDOSE.Src/LaDOSE.DesktopApp/Views/EventPlayerView.xaml
Normal file
53
LaDOSE.Src/LaDOSE.DesktopApp/Views/EventPlayerView.xaml
Normal file
@@ -0,0 +1,53 @@
|
||||
<UserControl x:Class="LaDOSE.DesktopApp.Views.EventPlayerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:LaDOSE.DesktopApp.Views"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:behaviors="clr-namespace:LaDOSE.DesktopApp.Behaviors"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
x:Name ="EventPlayer">
|
||||
<Grid Row="4" Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<TextBox Width="200" Text="{Binding Slug}"></TextBox>
|
||||
<Button x:Name="GetPlayers">Load Games</Button>
|
||||
</StackPanel>
|
||||
<DockPanel Grid.Row="1" >
|
||||
<Label> Char : </Label>
|
||||
<TextBox Text="{Binding Chars}"></TextBox>
|
||||
</DockPanel>
|
||||
|
||||
<ListView Grid.Row="2" ItemsSource="{Binding Data}" x:Name="GamesListView">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Column="0" Content="{Binding player}" ></Label>
|
||||
<ComboBox Grid.Column="1" Text="{Binding character}" ItemsSource="{Binding DataContext.CharList, RelativeSource={RelativeSource AncestorType=UserControl}}"></ComboBox>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
|
||||
</ListView>
|
||||
<Button Grid.Row="3" Grid.ColumnSpan="2" x:Name="Export">Export</Button>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
LaDOSE.Src/LaDOSE.DesktopApp/Views/EventPlayerView.xaml.cs
Normal file
28
LaDOSE.Src/LaDOSE.DesktopApp/Views/EventPlayerView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
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.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace LaDOSE.DesktopApp.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ShellView.xaml
|
||||
/// </summary>
|
||||
public partial class EventPlayerView : UserControl
|
||||
{
|
||||
public EventPlayerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,14 @@
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_EventPlayers">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<cal:ActionMessage MethodName="EventPlayers">
|
||||
</cal:ActionMessage>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Close" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
Reference in New Issue
Block a user