Skip to content

Commit

Permalink
Merge pull request #9 from SeaDevTeam/v4.8
Browse files Browse the repository at this point in the history
4.8
  • Loading branch information
NoobNotFound authored Jul 15, 2022
2 parents d6c3407 + d54b0f6 commit d322e36
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 60 deletions.
2 changes: 1 addition & 1 deletion Package/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="SeaDevs.Launcher.UWP"
Publisher="CN=SeaDev Team"
Version="0.4.7.0" />
Version="0.4.8.0" />

<Properties>
<DisplayName>SD Launcher</DisplayName>
Expand Down
2 changes: 1 addition & 1 deletion Package/Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundlePlatforms>x64</AppxBundlePlatforms>
<AppxBundlePlatforms>x86|x64</AppxBundlePlatforms>
<AppInstallerUri>C:\</AppInstallerUri>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup>
Expand Down
17 changes: 17 additions & 0 deletions SDLauncher UWP/Dialogs/EncryptSettingsDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<ContentDialog
x:Class="SDLauncher_UWP.Dialogs.EncryptSettingsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SDLauncher_UWP.Dialogs"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Encript Settings"
PrimaryButtonText="Button1"
CornerRadius="5"
SecondaryButtonText="Button2"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
SecondaryButtonClick="ContentDialog_SecondaryButtonClick">
<Grid>
</Grid>
</ContentDialog>
35 changes: 35 additions & 0 deletions SDLauncher UWP/Dialogs/EncryptSettingsDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace SDLauncher_UWP.Dialogs
{
public sealed partial class EncryptSettingsDialog : ContentDialog
{
public EncryptSettingsDialog()
{
this.InitializeComponent();
}

private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
}

private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
}
}
}
11 changes: 8 additions & 3 deletions SDLauncher UWP/Dialogs/Login.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
IsStaggeringEnabled="True" />
</TransitionCollection>
</Grid.ChildrenTransitions>
<!--The New Account Grid-->
<!--#region New Account Grid-->
<Grid
Visibility="Collapsed"
x:Name="gridNew">
Expand Down Expand Up @@ -107,7 +107,9 @@
</Button>
</StackPanel>
</Grid>
<!--The Choose Account Grid-->
<!--#endregion-->

<!--#region Choose Account Grid-->
<Grid
Visibility="Collapsed"
Height="400"
Expand Down Expand Up @@ -333,7 +335,9 @@
FontWeight="SemiBold"
Text="Empty!" />
</Grid>
<!--The Account Settings Grid-->
<!--#endregion-->

<!--#region Account Settings Grid-->
<Grid
Height="345"
x:Name="gridSettingsOnline">
Expand Down Expand Up @@ -585,5 +589,6 @@
</Grid>
</Grid>
</Grid>
<!--#endregion-->
</Grid>
</ContentDialog>
8 changes: 2 additions & 6 deletions SDLauncher UWP/Dialogs/Login.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,10 @@ private void ContentDialog_Loaded(object sender, RoutedEventArgs e)

private void LoginFromCache(object sender, RoutedEventArgs e)
{
bool isSelectionMode = false;
bool isSelectionMode = true;
foreach (var item in vars.Accounts)
{
if (item.IsCheckboxVsible == Visibility.Visible)
{
isSelectionMode = true;
}
else
if (item.IsCheckboxVsible != Visibility.Visible)
{
isSelectionMode = false;
}
Expand Down
2 changes: 1 addition & 1 deletion SDLauncher UWP/Helpers/SDLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ public async Task<bool> LoadStore()
var result = await MessageBox.Show("Error", "Failed to load the data of the store, Retry", MessageBoxButtons.OkCancel);
if(result == MessageBoxResults.Ok)
{
TasksHelper.CompleteTask(taskID, false);
Status(Localized.Ready);
var s = await LoadStore();
TasksHelper.CompleteTask(taskID,true);
return s;
}
else
Expand Down
2 changes: 1 addition & 1 deletion SDLauncher UWP/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Identity
Name="9b2d8a86-7ce1-4016-bf2c-24e12b903639"
Publisher="CN=Sea Dev Team"
Version="0.4.5.0" />
Version="0.4.7.0" />

<mp:PhoneIdentity PhoneProductId="9b2d8a86-7ce1-4016-bf2c-24e12b903639" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
7 changes: 7 additions & 0 deletions SDLauncher UWP/SDLauncher UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
<Compile Include="Converters\ProcessToXmlConverter.cs" />
<Compile Include="Converters\StringToVisibility.cs" />
<Compile Include="DataTemplates\ServerTemplate.cs" />
<Compile Include="Dialogs\EncryptSettingsDialog.xaml.cs">
<DependentUpon>EncryptSettingsDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Dialogs\Login.xaml.cs">
<DependentUpon>Login.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -264,6 +267,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Dialogs\EncryptSettingsDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Dialogs\Login.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
6 changes: 5 additions & 1 deletion SDLauncher UWP/UserControls/TaskListView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ namespace SDLauncher_UWP.UserControls
{
public sealed partial class TaskListView : UserControl
{
public event EventHandler ErrorTaskRecieved = delegate { };
public ObservableCollection<Task> TasksCompleted { get;private set; }
public ObservableCollection<Task> CurrentTasks { get;private set; }
private int WholeTaskCount = 0;

public int UnwatchedErrorTasksCount { get; private set; } = 0;
public TaskListView()
{
this.InitializeComponent();
this.TasksCompleted = new ObservableCollection<Task>();
this.CurrentTasks = new ObservableCollection<Task>();
RefreshTasks();
}
public void ClearUnwatchedErrorTasks() => this.UnwatchedErrorTasksCount = 0;
public int AddTask(string name,int? ID = null)
{
if (ID == null)
Expand Down Expand Up @@ -64,6 +66,8 @@ public bool CompleteTask(int id,bool success)
itm.DateAdded = DateTime.Now;
if (!success)
{
this.UnwatchedErrorTasksCount++;
this.ErrorTaskRecieved(this, new EventArgs());
itm.BorderBrush = new SolidColorBrush(Colors.Red);
}
else
Expand Down
1 change: 1 addition & 0 deletions SDLauncher UWP/Views/BaseLauncherPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ private void navView_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sende
if(itm.Content.ToString() == "ChangeLogs")
{
navViewFrame.Content = LogsPage;
LogsPage.UpdateLogs();
}
else
{
Expand Down
11 changes: 7 additions & 4 deletions SDLauncher UWP/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,20 @@
<Grid.Resources>
<ResourceDictionary Source="/Resources/AcrylicButton.xaml"/>
</Grid.Resources>
<Button BorderThickness="0" Width="45" Background="Transparent" Height="45" FocusVisualPrimaryThickness="0" Padding="5" FocusVisualSecondaryThickness="0" CornerRadius="0,0,5,5" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,180,0">
<FontIcon Glyph="&#xe9d5;" FontSize="19"/>
<Button BorderThickness="0" Width="45" Background="Transparent" Height="45" x:Name="btnTasks" Click="btnTasks_Click" FocusVisualPrimaryThickness="0" Padding="0" FocusVisualSecondaryThickness="0" CornerRadius="0,0,5,5" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,180,0">
<Grid>
<FontIcon Glyph="&#xe9d5;" Margin="5" FontSize="19"/>
<winui:InfoBadge x:Name="infbdgErrorTasks" Visibility="Collapsed" Background="Red" VerticalAlignment="Top" HorizontalAlignment="Right" Value="1"/>
</Grid>
<Button.Flyout>
<Flyout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="Tasks" Style="{ThemeResource TitleTextBlockStyle}" FontWeight="SemiBold"/>
<NoobUI:TaskListView Grid.Row="1" x:Name="tasks"/>
<TextBlock Text="Tasks" Style="{ThemeResource TitleTextBlockStyle}" FontSize="20" FontWeight="SemiBold"/>
<NoobUI:TaskListView Grid.Row="1" ErrorTaskRecieved="tasks_ErrorTaskRecieved" x:Name="tasks"/>
</Grid>
</Flyout>
</Button.Flyout>
Expand Down
19 changes: 19 additions & 0 deletions SDLauncher UWP/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,24 @@ private void discordView_PaneClosed(SplitView sender, object args)
{
Canvas.SetZIndex(discordView, 1);
}

private void tasks_ErrorTaskRecieved(object sender, EventArgs e)
{
infbdgErrorTasks.Value = tasks.UnwatchedErrorTasksCount;
if(tasks.UnwatchedErrorTasksCount > 0)
{
infbdgErrorTasks.Visibility = Visibility.Visible;
}
else
{
infbdgErrorTasks.Visibility = Visibility.Collapsed;
}
}

private void btnTasks_Click(object sender, RoutedEventArgs e)
{
tasks.ClearUnwatchedErrorTasks();
tasks_ErrorTaskRecieved(null, null);
}
}
}
19 changes: 8 additions & 11 deletions SDLauncher UWP/Views/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@
</NoobUI:SettingsCard.Controls>
</NoobUI:SettingsCard>
<NoobUI:Expander Description="For Endermans" Icon="&#xec7a;" Margin="0,5,0,0" Title="JVM Argumentss">
<NoobUI:Expander.ControlsTransition>
<TransitionCollection>
<AddDeleteThemeTransition/>
</TransitionCollection>
</NoobUI:Expander.ControlsTransition>
<NoobUI:Expander.Controls>
<NoobUI:ArgumentsListView x:Name="args"/>
</NoobUI:Expander.Controls>
Expand Down Expand Up @@ -214,16 +209,18 @@
</Grid>
</NoobUI:Expander.Controls>
</NoobUI:Expander>
<NoobUI:Expander Margin="0,5,0,0" Title="Encrypt Settings" Icon="&#xe713;" Description="Do you really think this app is not secured ?">
<NoobUI:Expander Margin="0,5,0,0" Title="Hide settings.json" Icon="&#xe713;" Description="Do you really think this app is not secured ?">
<NoobUI:Expander.HeaderControls>
<ToggleSwitch Toggled="tglEncryptSettings_Toggled" x:Name="tglEncryptSettings" MinWidth="0"/>
</NoobUI:Expander.HeaderControls>
<NoobUI:Expander.Controls>
<StackPanel Margin="0,5,0,0" Orientation="Horizontal">
<Button x:Name="btnXML" Click="btnXML_Click" Margin="0,0,5,0" Content="Settings.json"/>
<Button x:Name="btnExportXML" Click="btnExportXML_Click" Margin="0,0,5,0" Content="Export json"/>
<Button x:Name="btnImportXML" Click="btnImportXML_Click" Content="Import json"/>
</StackPanel>
<ContentControl x:Name="pnlSettingsData" >
<StackPanel Margin="0,5,0,0" Orientation="Horizontal">
<Button x:Name="btnXML" Click="btnXML_Click" Margin="0,0,5,0" Content="Settings.json"/>
<Button x:Name="btnExportXML" Click="btnExportXML_Click" Margin="0,0,5,0" Content="Export json"/>
<Button x:Name="btnImportXML" Click="btnImportXML_Click" Content="Import json"/>
</StackPanel>
</ContentControl>
</NoobUI:Expander.Controls>
</NoobUI:Expander>
</StackPanel>
Expand Down
62 changes: 31 additions & 31 deletions SDLauncher UWP/Views/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
cmbxTheme.SelectedIndex = 2;
}
tglEncryptSettings.IsOn = bool.Parse(ApplicationData.Current.RoamingSettings.Values["IsInAppSettings"] as string);
btnXML.IsEnabled = !tglEncryptSettings.IsOn;
pnlSettingsData.IsEnabled = !tglEncryptSettings.IsOn;
cbAsset.IsChecked = vars.AssestsCheck;
chkbxFullScreen.IsChecked = vars.FullScreen;
tglAutoClose.IsOn = vars.AutoClose;
Expand Down Expand Up @@ -505,44 +505,44 @@ private void cmbxVerSelector_SelectionChanged(object sender, SelectionChangedEve

private async void btnExportXML_Click(object sender, RoutedEventArgs e)
{
if (await MessageBox.Show("Information", "A restart is required to load the settings correctly.\nContinue ?", MessageBoxButtons.YesNo) == MessageBoxResults.Yes)
{
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
savePicker.FileTypeChoices.Add("SDL Settings", new List<string>() { ".json" });
savePicker.SuggestedFileName = "New Document";
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
savePicker.FileTypeChoices.Add("SDL Settings", new List<string>() { ".json" });
savePicker.SuggestedFileName = "New Document";

StorageFile sfile = await savePicker.PickSaveFileAsync();
if (sfile != null)
{
await SettingsManager.SaveSettings(sfile);
}
StorageFile sfile = await savePicker.PickSaveFileAsync();
if (sfile != null)
{
await SettingsManager.SaveSettings(sfile);
}

}


private async void btnImportXML_Click(object sender, RoutedEventArgs e)
{
var picker = new FileOpenPicker();
picker.ViewMode = PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
picker.FileTypeFilter.Add(".xml");

StorageFile file = await picker.PickSingleFileAsync();
if (file != null)
if (await MessageBox.Show("Information", "A restart is required to load the settings correctly.\nContinue ?", MessageBoxButtons.YesNo) == MessageBoxResults.Yes)
{
if (tglEncryptSettings.IsOn)
{
var text = await FileIO.ReadTextAsync(file);
ApplicationData.Current.RoamingSettings.Values["InAppSettings"] = text;
}
else
var picker = new FileOpenPicker();
picker.ViewMode = PickerViewMode.Thumbnail;
picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
picker.FileTypeFilter.Add(".json");

StorageFile file = await picker.PickSingleFileAsync();
if (file != null)
{
await file.CopyAsync(ApplicationData.Current.RoamingFolder, "settings.json", NameCollisionOption.ReplaceExisting);
if (tglEncryptSettings.IsOn)
{
var text = await FileIO.ReadTextAsync(file);
ApplicationData.Current.RoamingSettings.Values["InAppSettings"] = text;
}
else
{
await file.CopyAsync(ApplicationData.Current.RoamingFolder, "settings.json", NameCollisionOption.ReplaceExisting);
}
await CoreApplication.RequestRestartAsync("");
}
await CoreApplication.RequestRestartAsync("");
}
}

private async void tglEncryptSettings_Toggled(object sender, RoutedEventArgs e)
{
if (tglEncryptSettings.IsOn)
Expand All @@ -554,11 +554,11 @@ private async void tglEncryptSettings_Toggled(object sender, RoutedEventArgs e)
}
catch { }
ApplicationData.Current.RoamingSettings.Values["IsInAppSettings"] = true.ToString();
btnXML.IsEnabled = false;
pnlSettingsData.IsEnabled = false;
}
else
{
btnXML.IsEnabled = true;
pnlSettingsData.IsEnabled = true;
ApplicationData.Current.RoamingSettings.Values["IsInAppSettings"] = false.ToString();
await SettingsManager.SaveSettings();
}
Expand Down

0 comments on commit d322e36

Please sign in to comment.