diff --git a/ValorantCC/MainWindow.xaml b/ValorantCC/MainWindow.xaml index 789c5b0..384d219 100644 --- a/ValorantCC/MainWindow.xaml +++ b/ValorantCC/MainWindow.xaml @@ -231,11 +231,11 @@ - - - - - + + + + + diff --git a/ValorantCC/MainWindow.xaml.cs b/ValorantCC/MainWindow.xaml.cs index 135dd5a..8444139 100644 --- a/ValorantCC/MainWindow.xaml.cs +++ b/ValorantCC/MainWindow.xaml.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using Utilities; @@ -68,7 +69,7 @@ private async void btnSave_Click(object sender, RoutedEventArgs e) { if (!LoggedIn) { - MessageTxt.Text = "You are not logged in!"; + Utils.MessageText("You are not logged in!", Brushes.Red); return; } if (DataProcessor.ProfileListed) @@ -84,12 +85,11 @@ private async void btnSave_Click(object sender, RoutedEventArgs e) await DataProcessor.Construct(); profiles.Items.Refresh(); profiles.SelectedIndex = DataProcessor.CurrentProfile; - MessageTxt.Foreground = Brushes.Lime; - MessageTxt.Text = "Saved! Restart Valorant."; + Utils.MessageText("Saved! Restart Valorant.", Brushes.Lime); return; } - MessageTxt.Foreground = Brushes.Red; - MessageTxt.Text = "Failed. Consult developer."; + Utils.MessageText("Failed. Consult developer.", Brushes.Red); + return; } @@ -126,7 +126,7 @@ private async void btnReload_Click(object sender, RoutedEventArgs e) { if (!LoggedIn) { - MessageTxt.Text = "You are not logged in!"; + Utils.MessageText("You are not logged in!", Brushes.Red); return; } Utils.Log("Reload Clicked > Reconstructing Processor."); @@ -276,8 +276,7 @@ private void btnOpenLogs_Click(object sender, RoutedEventArgs e) Process p = new Process(); p.StartInfo = new ProcessStartInfo() { FileName = Path.GetDirectoryName(Utils.LoggingFile), UseShellExecute = true }; p.Start(); - MessageTxt.Foreground = Brushes.Lime; - MessageTxt.Text = "Log folder opened! Please include OLD files to your report if exists."; + Utils.MessageText("Log folder opened! Please include OLD files to your report if exists.", Brushes.Lime); } private void next_Click(object sender, RoutedEventArgs e) @@ -306,7 +305,7 @@ private void btnCommunityProfiles_Click(object sender, RoutedEventArgs e) { if (!LoggedIn) { - MessageTxt.Text = "You are not logged in!"; + Utils.MessageText("You are not logged in !", Brushes.Red); return; } try @@ -326,23 +325,31 @@ private void chkbxShareable_Click(object sender, RoutedEventArgs e) { if (!LoggedIn) { - MessageTxt.Text = "You are not logged in!"; + Utils.MessageText("You are not logged in !", Brushes.Red); ((CheckBox)sender).IsChecked = !((CheckBox)sender).IsChecked; return; } } - private void btnShare_Click(object sender, RoutedEventArgs e) + private async void btnShare_Click(object sender, RoutedEventArgs e) { if (!LoggedIn) { - MessageTxt.Text = "You are not logged in!"; + Utils.MessageText("You are not logged in !", Brushes.Red); return; } - MessageTxt.Text = "Your profile has been saved! Make sure you have the 'shareable' checkbox checked!"; + exitButton.Visibility = Visibility.Collapsed; + Utils.MessageText("Your profile is being saved...", Brushes.Yellow); + ValCCAPI.Shareable = (bool)chkbxShareable.IsChecked; ValCCAPI.profile = SelectedProfile; - _ = ValCCAPI.Set(); + SetCallResponse response = await ValCCAPI.Set(); + String sharecode = response.data.shareCode; + Clipboard.SetText(sharecode); + MessageWindow.Show($"Your sharecode is: \"{sharecode}\" and is copied.\nIf you want this profile accessible across the community,\nPlease be sure that you have the 'shareable' checkbox checked.", "Profile shared!"); + + Utils.MessageText("Your profile has been saved. It can now be browsed if \"shareable\" checkbox is checked before saving.", Brushes.Lime); + exitButton.Visibility = Visibility.Visible; } } } diff --git a/ValorantCC/SubWindow/MessageWindow.xaml b/ValorantCC/SubWindow/MessageWindow.xaml index 7fb1a76..a8305bf 100644 --- a/ValorantCC/SubWindow/MessageWindow.xaml +++ b/ValorantCC/SubWindow/MessageWindow.xaml @@ -5,11 +5,16 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ValorantCC.SubWindow" mc:Ignorable="d" - Title="MessageWindow" Width="350" Background="#FF232429" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" WindowStyle="None" WindowStartupLocation="CenterOwner" SizeToContent="Height" ResizeMode="NoResize" ShowInTaskbar="False"> - - - -