forked from weedeej/ValorantCC
-
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
8 changed files
with
308 additions
and
28 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,63 @@ | ||
<Window x:Class="ValorantCC.ProfilesWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:ValorantCC" | ||
mc:Ignorable="d" | ||
Title="ProfilesWindow" Height="Auto" Width="Auto" ResizeMode="NoResize" SizeToContent="WidthAndHeight"> | ||
<Border Background="#232429" Height="450" Width="350"> | ||
<StackPanel Name="Container" HorizontalAlignment="Center" Margin="0,5"> | ||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> | ||
<TextBox Name="SearchCode" MinWidth="165" MaxWidth="165" Background="#FF393B44" Margin="0,0,5,0" Foreground="White"/> | ||
<Button Name="btnSearchCode" Content="Search Code" MinWidth="85" Background="#FF393B44" Foreground="White" Click="btnSearchCode_Click"/> | ||
</StackPanel> | ||
<StackPanel Name="ShareablesContainer" HorizontalAlignment="Center"> | ||
<Border Background="#FF393B44" MinHeight="95" MaxHeight="95" MinWidth="330" MaxWidth="330" Margin="0,5"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="2.5*"/> | ||
<RowDefinition Height="1*"/> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="1*"/> | ||
<ColumnDefinition Width="1*"/> | ||
<ColumnDefinition Width="1*"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Image Source="../Resources/CrosshairBG5.png" Grid.ColumnSpan="3" Grid.Row="0" Stretch="Fill" Margin="2,0,2,2"/> | ||
<Label Grid.Column="2" Grid.Row="0" Content="Deeej's Profile" Foreground="White" VerticalAlignment="Bottom" HorizontalAlignment="Right"/> | ||
|
||
<Rectangle Fill="#FF404661" Height="auto" Grid.Row="1" Grid.ColumnSpan="3"/> | ||
<Button Style="{DynamicResource RoundButton}" Margin="5,0" Grid.Row="1" Grid.Column="0" Content="Share" FontWeight="Bold" FontSize="12"/> | ||
<Button Style="{DynamicResource RoundButton}" Margin="5,0" Grid.Row="1" Grid.Column="1" Content="Details" FontWeight="Bold" FontSize="12"/> | ||
<Button Style="{DynamicResource RoundButton}" Margin="5,0" Grid.Row="1" Grid.Column="2" Content="Apply" FontWeight="Bold" FontSize="12"/> | ||
</Grid> | ||
</Border> | ||
<Border Background="#FF393B44" MinHeight="95" MaxHeight="95" MinWidth="330" MaxWidth="330" Margin="0,5"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="2.5*"/> | ||
<RowDefinition Height="1*"/> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="1*"/> | ||
<ColumnDefinition Width="1*"/> | ||
<ColumnDefinition Width="1*"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Image Source="../Resources/CrosshairBG1.png" Grid.ColumnSpan="3" Grid.Row="0" Stretch="Fill" Margin="2,0,2,2"/> | ||
<Label Grid.Column="2" Grid.Row="0" Content="Haruki's Profile" Foreground="White" VerticalAlignment="Bottom" HorizontalAlignment="Right"/> | ||
|
||
<Rectangle Fill="#FF404661" Height="auto" Grid.Row="1" Grid.ColumnSpan="3"/> | ||
<Button Style="{DynamicResource RoundButton}" Margin="5,0" Grid.Row="1" Grid.Column="0" Content="Share" FontWeight="Bold" FontSize="12"/> | ||
<Button Style="{DynamicResource RoundButton}" Margin="5,0" Grid.Row="1" Grid.Column="1" Content="Details" FontWeight="Bold" FontSize="12"/> | ||
<Button Style="{DynamicResource RoundButton}" Margin="5,0" Grid.Row="1" Grid.Column="2" Content="Apply" FontWeight="Bold" FontSize="12"/> | ||
</Grid> | ||
</Border> | ||
<Border Background="#FF393B44" MinHeight="95" MaxHeight="95" MinWidth="330" MaxWidth="330" Margin="0,5"/> | ||
<Border Background="#FF393B44" MinHeight="95" MaxHeight="95" MinWidth="330" MaxWidth="330" Margin="0,5"/> | ||
</StackPanel> | ||
</StackPanel> | ||
</Border> | ||
</Window> |
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,88 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
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.Shapes; | ||
using Newtonsoft.Json; | ||
namespace ValorantCC | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ProfilesWindow.xaml | ||
/// </summary> | ||
|
||
public struct PublicProfile | ||
{ | ||
public String owner { get; set; } | ||
public CrosshairProfile settings { get; set; } | ||
} | ||
|
||
public partial class ProfilesWindow : Window | ||
{ | ||
public CrosshairProfile selected; | ||
private static API ValCCApi; | ||
private static MainWindow main; | ||
private static List<PublicProfile> PublicProfiles = new List<PublicProfile>(); | ||
public ProfilesWindow(CrosshairProfile current, API ValCCAPI) | ||
{ | ||
InitializeComponent(); | ||
main = (MainWindow) Application.Current.MainWindow; | ||
ValCCApi = ValCCAPI; | ||
InitialFetch(); | ||
RenderProfiles(); | ||
} | ||
|
||
/// <summary> | ||
/// Returns the searched sharecode or the list of shareables depending if sharecode is provided or not. | ||
/// </summary> | ||
/// <param name="sharecode">Nullable. Searched Code</param> | ||
private static void InitialFetch(String sharecode = null) | ||
{ | ||
List<ShareableProfile> Shareables; | ||
if (sharecode != null) | ||
{ | ||
ValCCApi.Action = 3; | ||
Shareables = ValCCApi.Fetch(sharecode).data; | ||
} | ||
else Shareables = ValCCApi.Fetch().data; | ||
|
||
|
||
for (int i = 0; i < Shareables.Count; i++) | ||
{ | ||
ShareableProfile currentShareable = Shareables[i]; | ||
CrosshairProfile profile; | ||
try | ||
{ | ||
profile = JsonConvert.DeserializeObject<CrosshairProfile>(currentShareable.settings); | ||
} | ||
catch | ||
{ | ||
continue; | ||
} | ||
PublicProfiles.Add(new PublicProfile() { owner = currentShareable.displayName, settings = profile }); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Render the PublicProfiles var into frontend. | ||
/// </summary> | ||
private static void RenderProfiles() | ||
{ | ||
|
||
} | ||
private void btnSearchCode_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (SearchCode.Text == null || SearchCode.Text == "") return; | ||
InitialFetch(SearchCode.Text); | ||
RenderProfiles(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.