-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
304 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- Images from 3 folders | ||
- Demo: Collection for miniview | ||
- Settings: Include Image setting | ||
- Search | ||
- Language | ||
- Edit maps | ||
- Config editor | ||
- Records | ||
- Versioning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<UserControl x:Class="DeFRaG_Helper.UserControls.DemoCard" | ||
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:DeFRaG_Helper.UserControls" | ||
mc:Ignorable="d" | ||
d:DesignHeight="100" d:DesignWidth="1000" | ||
MouseEnter="UserControl_MouseEnter" | ||
MouseLeave="UserControl_MouseLeave" | ||
MouseDoubleClick="DemoCard_MouseDoubleClick"> | ||
<UserControl.Resources> | ||
<!-- Hover Style for Border --> | ||
<Style x:Key="HoverBorderStyle" TargetType="Border"> | ||
<Setter Property="Background" Value="#2c2c2c"/> | ||
<Style.Triggers> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<!-- Change to desired hover background color --> | ||
<Setter Property="Background" Value="#3e3e3e"/> | ||
</Trigger> | ||
</Style.Triggers> | ||
</Style> | ||
</UserControl.Resources> | ||
<Border CornerRadius="10" Background="#2c2c2c" Margin="10, 5, 10, 5" Style="{StaticResource HoverBorderStyle}" x:Name="MainBorder"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="*"/> | ||
</Grid.ColumnDefinitions> | ||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Name: " FontFamily="Segoe UI" FontSize="16" Foreground="White" VerticalAlignment="Bottom" Margin="10, 5, 0, 0"/> | ||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding PlayerName}" FontSize="16" Foreground="White" VerticalAlignment="Bottom" Margin="10, 5, 0, 0"/> | ||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Mapname: " FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 0, 0, 0"/> | ||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Mapname}" FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 0, 0, 0"/> | ||
<TextBlock Grid.Row="2" Grid.Column="0" Text="Physics: " FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 0, 0, 5"/> | ||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Physics}" FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 0, 0, 5"/> | ||
<TextBlock Grid.Row="0" Grid.Column="2" Text="Country: " FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 5, 0, 0"/> | ||
<TextBlock Grid.Row="0" Grid.Column="3" Text="{Binding PlayerCountry}" FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 5, 0, 0"/> | ||
<TextBlock Grid.Row="1" Grid.Column="2" Text="Type: " FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 0, 0, 0"/> | ||
<TextBlock Grid.Row="1" Grid.Column="3" Text="{Binding Type}" FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 0, 0, 0"/> | ||
<TextBlock Grid.Row="2" Grid.Column="2" Text="Time: " FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 0, 0, 5"/> | ||
<TextBlock Grid.Row="2" Grid.Column="3" Text="{Binding Time}" FontSize="12" Foreground="White" VerticalAlignment="Bottom" Margin="10, 0, 0, 5"/> | ||
</Grid> | ||
</Border> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
using DeFRaG_Helper.ViewModels; | ||
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 DeFRaG_Helper.UserControls | ||
{ | ||
/// <summary> | ||
/// Interaction logic for DemoCard.xaml | ||
/// </summary> | ||
public partial class DemoCard : UserControl | ||
{ | ||
public DemoCard() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
|
||
|
||
private async void DemoCard_MouseDoubleClick(object sender, MouseButtonEventArgs e) | ||
{ | ||
// Check if the actual item (not empty space) in the ListView was double-clicked | ||
var item = ((FrameworkElement)e.OriginalSource).DataContext as DemoItem; | ||
if (item != null) | ||
{ | ||
//we need the mapname of the actual demo | ||
var mapName = item.Mapname; | ||
//now we have to check if the map is installed. We check "IsInstalled" property of the map | ||
var viewModel = MapViewModel.GetInstanceAsync().Result; | ||
MessageHelper.Log($"Checking for Mapname: {mapName}"); | ||
var map = viewModel.Maps.FirstOrDefault(m => m.Mapname == (mapName + ".bsp")); | ||
if (map != null) | ||
{ | ||
if (map.IsInstalled == 0) | ||
{ | ||
await MapInstaller.InstallMap(map); | ||
MessageHelper.Log($"Map {map.Mapname} installed."); | ||
} | ||
//Prepare the progress handler to update the UI | ||
var progressHandler = new Progress<double>(value => | ||
{ | ||
App.Current.Dispatcher.Invoke(() => MainWindow.Instance.UpdateProgressBar(value)); | ||
}); | ||
//Prepare the link for the demo. It's contructed from http://95.31.6.66/~/api/get_file_list?uri=/demos/{mapName[0]}/{mapName}/" and the name of the demo | ||
var demoLink = $"http://95.31.6.66/demos/{mapName[0]}/{mapName}/{item.Name}"; | ||
|
||
//check if there is a demo folder. If not, create it | ||
if (!System.IO.Directory.Exists(AppConfig.GameDirectoryPath + "\\defrag\\demos")) | ||
{ | ||
System.IO.Directory.CreateDirectory(AppConfig.GameDirectoryPath + "\\defrag\\demos"); | ||
} | ||
//check if there is a demo folder for the map. If not, create it | ||
if (!System.IO.Directory.Exists(AppConfig.GameDirectoryPath + $"\\defrag\\demos\\{mapName}")) | ||
{ | ||
System.IO.Directory.CreateDirectory(AppConfig.GameDirectoryPath + $"\\defrag\\demos\\{mapName}"); | ||
} | ||
|
||
//Download the demo to the demo folder | ||
await Downloader.DownloadFileAsync(demoLink, AppConfig.GameDirectoryPath + $"\\defrag\\demos\\{mapName}\\{item.Name}", progressHandler); | ||
|
||
|
||
|
||
|
||
//System.Diagnostics.Process.Start(AppConfig.GameDirectoryPath + "\\oDFe.x64.exe", $"+demo {mapName}//{System.IO.Path.GetFilenameWithoutExtension(item.Name)}") ; | ||
System.Diagnostics.Process.Start(AppConfig.GameDirectoryPath + "\\oDFe.x64.exe", $"+demo {mapName}/{System.IO.Path.GetFileNameWithoutExtension(item.Name)}"); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
// Implement your double-click logic here | ||
// For example, navigate to a detail page or display a dialog | ||
///MessageBox.Show($"Double-clicked on item: {item.Name}"); | ||
|
||
|
||
} | ||
} | ||
private void UserControl_MouseEnter(object sender, MouseEventArgs e) | ||
{ | ||
// Change to a slightly lighter or darker background color on hover | ||
MainBorder.Background = new SolidColorBrush(Color.FromRgb(62, 62, 62)); // Example color | ||
} | ||
|
||
private void UserControl_MouseLeave(object sender, MouseEventArgs e) | ||
{ | ||
// Revert to the original background color | ||
MainBorder.Background = new SolidColorBrush(Color.FromRgb(45, 45, 45)); // Example color | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<UserControl x:Class="DeFRaG_Helper.UserControls.MiniView" | ||
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:DeFRaG_Helper.UserControls" | ||
mc:Ignorable="d" | ||
d:DesignHeight="120" d:DesignWidth="120"> | ||
<Border CornerRadius="10" Background="#222222"> | ||
<Grid> | ||
<Image Margin="5,5,5,45" Source="{Binding ImagePath}"/> | ||
<Border Margin="0,75,0,0" Background="#2c2c2c" CornerRadius="0,0,10,10"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<TextBlock Grid.Row="0" Text="{Binding Name}" FontSize="12" Foreground="White" HorizontalAlignment="Center" /> | ||
<TextBlock Grid.Row="1" Text="{Binding Mapname}" FontSize="10" Foreground="White" HorizontalAlignment="Center"/> | ||
</Grid> | ||
|
||
</Border> | ||
</Grid> | ||
</Border> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 DeFRaG_Helper.UserControls | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MiniView.xaml | ||
/// </summary> | ||
public partial class MiniView : UserControl | ||
{ | ||
public MiniView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
Oops, something went wrong.