Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MsBox.Avalonia/MsBox.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<AvaloniaResource Include="Assets\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.11" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.3.0" />
<PackageReference Include="Avalonia" Version="11.3.12" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.4.1" />
<PackageReference Include="DialogHost.Avalonia" Version="0.10.4" />
<PackageReference Include="Markdown.Avalonia.Tight" Version="11.0.2" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ Have fun!
- <a href="https://www.wishforge.games/?ref=svgrepo.com" target="_blank">Wishforge.games</a> in CC Attribution License
- <a href="https://github.com/yamatsum/nonicons?ref=svgrepo.com" target="_blank">Yamatsum</a> in MIT License
- <a href="https://github.com/32pixelsCo/zest-icons/blob/master/packages/zest-free/LICENSE.md?ref=svgrepo.com" target="_blank">Zest</a> in MIT License
- <a href="https://github.com/neuicons/neu?ref=svgrepo.com" target="_blank">Neuicons</a> in MIT License via
- <a href="https://dazzleui.gumroad.com/l/dazzleiconsfree?ref=svgrepo.com" target="_blank">Dazzle Ui</a> in CC Attribution License
30 changes: 30 additions & 0 deletions ZXBSInstaller.Log/ServiceLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1152,5 +1152,35 @@ private static void SetZXBSConfig()

#endregion


public static bool RunZXBasicStudio()
{
try
{
var fileName = Path.Combine(GeneralConfig.BasePath, "zxbs", "ZXBasicStudio.exe");
if (!File.Exists(fileName))
{
fileName = Path.Combine(GeneralConfig.BasePath, "zxbs", "ZXBasicStudio");
}
if (!File.Exists(fileName))
{
ServiceLayer.ShowMessage("ZX Basic Studio executable not found. Please check the installation.");
return false;
}
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = fileName,
};
using Process process = new Process { StartInfo = psi };
process.Start();
return true;
}
catch (Exception ex)
{
ServiceLayer.ShowMessage("Error launching ZX Basic Studio. Please check the installation.");
return false;
}
}

}
}
16 changes: 0 additions & 16 deletions ZXBSInstaller.Log/ZXBSInstaller.Log.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,4 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<None Remove="InstallerResources\zxbs.png" />
</ItemGroup>

<ItemGroup>
<Content Include="InstallerResources\zxbasic.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="InstallerResources\zxbsinstaller.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="InstallerResources\zxbs.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
7 changes: 7 additions & 0 deletions ZXBSInstaller/Assets/install.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions ZXBSInstaller/Assets/play.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions ZXBSInstaller/Assets/refresh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 25 additions & 2 deletions ZXBSInstaller/Controls/MainControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
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:svg="using:Avalonia.Svg.Skia"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="600"
x:Class="ZXBSInstaller.Controls.MainControl">
<Grid Grid.ColumnDefinitions="*,1,250" Grid.RowDefinitions="Auto,1,*,1,Auto">
Expand Down Expand Up @@ -36,10 +37,32 @@
<CheckBox x:Name="chkSetZXBSOptions" Grid.Row="3" Margin="0,4,0,0" Content="Update ZX Basic Studio Options"/>
</Grid>
</Grid>
<Grid Grid.Column="2" Grid.Row="4" Margin="8" HorizontalAlignment="Right" VerticalAlignment="Bottom">
<Button x:Name="btnInstall" Click="btnInstall_Click">Install selected components</Button>

<Grid Grid.Column="2" Grid.Row="4" Grid.RowDefinitions="*,Auto" Margin="8" HorizontalAlignment="Right">
<StackPanel Orientation="Vertical" HorizontalAlignment="Right">
<Button x:Name="btnPlayZXBS" Width="200" Click="btnPlayZXBS_Click">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<svg:Svg Path="/Assets/play.svg" Width="20" Margin="0,0,4,0"></svg:Svg>
<TextBlock Text="Run ZX Basic Studio"/>
</StackPanel>
</Button>
<Button x:Name="btnRefresh" Width="200" Margin="0,4,0,0" Click="btnRefresh_Click">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<svg:Svg Path="/Assets/refresh.svg" Width="20" Margin="0,0,4,0"></svg:Svg>
<TextBlock Text="Refrsh"/>
</StackPanel>
</Button>
</StackPanel>

<Button x:Name="btnInstall" Grid.Row="1" Width="200" Click="btnInstall_Click">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<svg:Svg Path="/Assets/install.svg" Width="20" Margin="0,0,4,0"></svg:Svg>
<TextBlock Text="Install components"/>
</StackPanel>
</Button>
</Grid>


<!-- Progress Status -->
<Grid x:Name="pnlStatus" Grid.ColumnSpan="3" Grid.RowSpan="5" Margin="0" IsVisible="False">
<Grid Background="Black" Opacity="0.8"></Grid>
Expand Down
68 changes: 65 additions & 3 deletions ZXBSInstaller/Controls/MainControl.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Threading;
using Avalonia.VisualTree;
using MsBox.Avalonia;
Expand All @@ -22,7 +24,7 @@ namespace ZXBSInstaller.Controls;
public partial class MainControl : UserControl
{
private List<ToolItemControl> toolItemControls = new List<ToolItemControl>();

private static Brush Yellow = new SolidColorBrush(Colors.Yellow);

public MainControl()
{
Expand Down Expand Up @@ -103,7 +105,7 @@ private void GetExternalTools()
WindowStartupLocation = WindowStartupLocation.CenterOwner
});
box.ShowAsPopupAsync(this);

}
else
{
Expand Down Expand Up @@ -152,6 +154,7 @@ private void UpdateSummary()
{
pnlSummary.Children.Clear();
bool allUpToDate = true;
// Check for recommended updates/installs
foreach (var tool in toolItemControls)
{
if (tool.IsSelected)
Expand All @@ -177,6 +180,48 @@ private void UpdateSummary()
tb.Text = "All tools are up to date.";
pnlSummary.Children.Add(tb);
}

// Separator
{
var separator = new Separator()
{
Margin = new Thickness(0, 10, 0, 10)
};
pnlSummary.Children.Add(separator);
}

// Show tools tree
{
pnlSummary.Children.Add(new TextBlock()
{
Text = "Base path:",
Foreground = Yellow
});
pnlSummary.Children.Add(new TextBlock()
{
Text = ServiceLayer.GeneralConfig.BasePath,
Margin = new Thickness(10, 4, 0, 0)
});
}
foreach (var tool in toolItemControls)
{
var tb = new TextBlock();
tb.TextWrapping = Avalonia.Media.TextWrapping.Wrap;
if (tool.ExternalTool.InstalledVersion != null)
{
pnlSummary.Children.Add(new TextBlock()
{
Text = tool.ExternalTool.Name + ":",
Margin = new Thickness(0, 8, 0, 0),
Foreground = Yellow
});
pnlSummary.Children.Add(new TextBlock()
{
Text = System.IO.Path.Combine(ServiceLayer.GeneralConfig.BasePath, tool.ExternalTool.Id),
Margin = new Thickness(10, 4, 0, 0)
});
}
}
});
}

Expand Down Expand Up @@ -289,7 +334,7 @@ private void ShowVersions(string id)
pnlVersions.Children.Add(btn);
}

var versionControlHeader = new VersionControl(null, null,Command_Received);
var versionControlHeader = new VersionControl(null, null, Command_Received);
pnlVersions.Children.Add(versionControlHeader);
foreach (var version in tool.Versions)
{
Expand Down Expand Up @@ -324,4 +369,21 @@ private void Versions_Close(object? sender, RoutedEventArgs e)
mainVersions.IsVisible = false;
});
}

private void btnPlayZXBS_Click(object? sender, RoutedEventArgs e)
{
if (ServiceLayer.RunZXBasicStudio())
{
if (App.Current?.ApplicationLifetime
is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.Shutdown();
}
}
}

private void btnRefresh_Click(object? sender, RoutedEventArgs e)
{
new Thread(GetExternalTools).Start();
}
}
2 changes: 1 addition & 1 deletion ZXBSInstaller/Controls/ToolItemControl.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ToolItemControl(ExternalTool tool, Action<string, string> callBackCommand
ExternalTool = tool;
Command = callBackCommand;

UITools.ShowImage($"InstallerResources/{ExternalTool.Id}.png", imgIcon);
UITools.ShowImage($"{ExternalTool.Id}.png", imgIcon);
txtName.Text = tool.Name;
txtDescription.Text = tool.Description;
txtPath.Text = "Path: " + tool.LocalPath;
Expand Down
7 changes: 5 additions & 2 deletions ZXBSInstaller/UITools.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using System;
using System.Collections.Generic;
using System.IO;
Expand All @@ -15,8 +16,10 @@ public static void ShowImage(string fileName, Image imgControl)
{
try
{
using var stream = File.OpenRead(fileName);
imgControl.Source = new Bitmap(stream);
var uri= new Uri($"avares://ZXBSInstaller/Assets/{fileName}");
var asset=AssetLoader.Open(uri);
var bitmap=new Bitmap(asset);
imgControl.Source = bitmap;
}
catch (Exception ex)
{
Expand Down
30 changes: 24 additions & 6 deletions ZXBSInstaller/ZXBSInstaller.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,43 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<ApplicationIcon>zxbs.ico</ApplicationIcon>
<Version>0.0.1.6</Version>
<Version>0.0.1.7</Version>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\install.svg" />
<None Remove="Assets\play.svg" />
<None Remove="Assets\refresh.svg" />
</ItemGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\install.svg" />
<AvaloniaResource Include="Assets\play.svg" />
<AvaloniaResource Include="Assets\refresh.svg" />
<AvaloniaResource Include="zxbs.ico" />
</ItemGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\zxbasic.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</AvaloniaResource>
<AvaloniaResource Include="Assets\zxbs.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</AvaloniaResource>
<AvaloniaResource Include="Assets\zxbsinstaller.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</AvaloniaResource>
<Content Include="zxbs.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.11" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.11" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.11" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.11" />
<PackageReference Include="Avalonia" Version="11.3.12" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.12" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.12" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.12" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.11">
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.12">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>
<PackageReference Include="Svg.Controls.Skia.Avalonia" Version="11.3.9.2" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions ZXBStudio/ZXBasicStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -563,13 +563,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.11" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.3.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.11" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.11" />
<PackageReference Include="Avalonia" Version="11.3.12" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.4.1" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.12" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.12" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.11" />
<PackageReference Include="Avalonia.Themes.Simple" Version="11.3.11" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.12" />
<PackageReference Include="Avalonia.Themes.Simple" Version="11.3.12" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
Expand Down
2 changes: 1 addition & 1 deletion ZXBasicStudioTest/ZXBasicStudioTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PackageReference Include="coverlet.collector" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down