Skip to content

Commit

Permalink
Merge pull request CosmosOS#2153 from CosmosOS/installeruinew
Browse files Browse the repository at this point in the history
Improve UI and speed of builder
  • Loading branch information
valentinbreiz authored Mar 8, 2022
2 parents aa7b582 + b6e1c2f commit 6510f61
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 88 deletions.
7 changes: 3 additions & 4 deletions source/Cosmos.Build.Builder/App.xaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Application x:Class="Cosmos.Build.Builder.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="http://schemas.modernwpf.com/2019">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemeResources />
<ui:XamlControlsResources />
<ResourceDictionary Source="pack://application:,,,/WPFUI;component/Styles/Theme/Dark.xaml" />
<ResourceDictionary Source="pack://application:,,,/WPFUI;component/Styles/WPFUI.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override string GetArguments()
throw new InvalidOperationException("ProjectFilePath is null!");
}

var args = $"\"{ProjectFilePath}\" /nologo /maxcpucount /nodeReuse:False /verbosity:minimal /t:\"{String.Join(";", Targets)}\"";
var args = $"\"{ProjectFilePath}\" /nologo /maxcpucount /m /nodeReuse:False /verbosity:minimal /t:\"{String.Join(";", Targets)}\"";

if (Properties != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;

namespace Cosmos.Build.Builder.BuildTasks
{
Expand Down Expand Up @@ -92,6 +94,8 @@ private static async Task ReadOutputAsync(StreamReader reader, ILogger logger)
{
while (true)
{
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background,
new Action(delegate { }));
var line = await reader.ReadLineAsync().ConfigureAwait(false);

if (line == null)
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.Build.Builder/BuildTasks/RestoreTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class RestoreTask : MSBuildTargetBuildTaskBase
public override IEnumerable<string> Targets { get { yield return RestoreTaskName; } }

protected override IReadOnlyDictionary<string, string> Properties => _properties;
private readonly Dictionary<string, string> _properties;
private readonly Dictionary<string, string> _properties = new Dictionary<string, string>();

public RestoreTask(
IMSBuildService msBuildService,
Expand Down
5 changes: 2 additions & 3 deletions source/Cosmos.Build.Builder/Cosmos.Build.Builder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.16.30"/>
<PackageReference Include="ModernWpfUI" Version="0.9.4" />
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.16.30" />
<PackageReference Include="NuGet.Common" />
<PackageReference Include="NuGet.Configuration" />
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.6.0" />
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.0.1" />
<PackageReference Include="WPF-UI" Version="1.2.2-prerelease151" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,9 @@
SizeToContent="WidthAndHeight"
Title="Cosmos Kit Builder"
WindowStartupLocation="CenterOwner"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True">
xmlns:wpfui="clr-namespace:WPFUI.Controls;assembly=WPFUI">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

<Style TargetType="Button" BasedOn="{ui:StaticResource DefaultButtonStyle}">
<Setter Property="Margin" Value="4" />
<Setter Property="MinWidth" Value="48" />
<Setter Property="Padding" Value="8,3" />
</Style>
</Window.Resources>

<Grid Margin="8"
Expand Down
139 changes: 74 additions & 65 deletions source/Cosmos.Build.Builder/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,100 +3,109 @@
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:wpfui="clr-namespace:WPFUI.Controls;assembly=WPFUI"
mc:Ignorable="d"
Icon="/Cosmos.Build.Builder;component/Resources/Cosmos.ico"
MinHeight="480"
MinWidth="800"
Title="Cosmos Kit Builder"
WindowStartupLocation="CenterScreen"
WindowState="{Binding WindowState}"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True">
WindowState="{Binding WindowState}"
Style="{StaticResource UiWindow}">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</Window.Resources>

<DockPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>

<Grid DockPanel.Dock="Bottom" Height="46">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<wpfui:TitleBar Grid.Row="0" ApplicationNavigation="True" Icon="/Cosmos.Build.Builder;component/Resources/Cosmos.ico" Title="Cosmos Builder"/>

<Button Grid.Column="0"
<DockPanel Grid.Row="1">

<Grid DockPanel.Dock="Bottom" Height="46">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Button Grid.Column="0"
Command="{Binding CopyCommand}"
Content="Copy log" Grid.ColumnSpan="2" Width="96" Height="46" />
Content="Copy log" Width="96" Height="46"
Padding="10,10,10,10"/>

<CheckBox Grid.Column="2"
<CheckBox Grid.Column="2"
IsChecked="{Binding CloseWhenCompleted}"
Content="Close when finished" Height="39" Margin="0,0,20,7" />
</Grid>
</Grid>

<Rectangle DockPanel.Dock="Top"
<Rectangle DockPanel.Dock="Top"
Height="5" />
<TextBlock DockPanel.Dock="Top"
<TextBlock DockPanel.Dock="Top"
FontSize="26"
FontWeight="Medium"
Text="{Binding CurrentSection.Name, StringFormat=' Build status: {0}', FallbackValue=' Starting build...'}" />
<ItemsControl DockPanel.Dock="Top"
<ItemsControl DockPanel.Dock="Top"
Background="Black"
BorderBrush="DarkGray"
BorderThickness="0.5"
FontSize="16"
Foreground="Green"
Margin="0,4"
ItemsSource="{Binding TailItems}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="DarkGray"
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="DarkGray"
BorderThickness="0.5"
Padding="4,0">
<TextBlock Text="{Binding}" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock Text="{Binding}" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

<Rectangle DockPanel.Dock="Top"
<Rectangle DockPanel.Dock="Top"
Height="5"
/>
<ScrollViewer HorizontalScrollBarVisibility="Auto"
<ScrollViewer HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto" VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="0,5,0,0">
<ItemsControl ItemsSource="{Binding Sections}" HorizontalAlignment="Stretch">
<ItemsControl.ItemTemplate>
<DataTemplate>
<HeaderedContentControl>
<HeaderedContentControl.Header>
<ToggleButton x:Name="sectionToggleButton"
<ItemsControl ItemsSource="{Binding Sections}" HorizontalAlignment="Stretch">
<ItemsControl.ItemTemplate>
<DataTemplate>
<HeaderedContentControl>
<HeaderedContentControl.Header>
<ToggleButton x:Name="sectionToggleButton"
FontSize="18"
FontWeight="Bold"
HorizontalContentAlignment="Left"
Content="{Binding Name}"
HorizontalAlignment="Stretch"
>
<ToggleButton.Style>
<Style TargetType="ToggleButton" BasedOn="{ui:StaticResource DefaultToggleButtonStyle}">
<Setter Property="Foreground" Value="Green" />
<ToggleButton.Style>
<Style TargetType="ToggleButton" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Foreground" Value="Green" />


<Style.Triggers>
<DataTrigger Binding="{Binding HasLoggedErrors}" Value="True">
<Setter Property="Foreground" Value="White" />
<Setter Property="IsChecked" Value="True" />
<Setter Property= "Background" Value="DarkRed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasLoggedErrors}" Value="True">
<Setter Property="Foreground" Value="White" />
<Setter Property="IsChecked" Value="True" />
<Setter Property= "Background" Value="DarkRed"/>

<!--Override the background color with Red-->
<Setter Property="Template">
<Setter.Value >
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="border"
<!--Override the background color with Red-->
<Setter Property="Template">
<Setter.Value >
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="border"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="True">
<ContentPresenter x:Name="contentPresenter"
<ContentPresenter x:Name="contentPresenter"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
Expand All @@ -106,24 +115,24 @@
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
</HeaderedContentControl.Header>
<TextBlock Visibility="{Binding IsChecked, ElementName=sectionToggleButton, Converter={StaticResource BooleanToVisibilityConverter}}"
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
</HeaderedContentControl.Header>
<TextBlock Visibility="{Binding IsChecked, ElementName=sectionToggleButton, Converter={StaticResource BooleanToVisibilityConverter}}"
Text="{Binding Log}" />
</HeaderedContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

</DockPanel>
</HeaderedContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

</DockPanel>
</Grid>
</Window>
4 changes: 1 addition & 3 deletions source/Cosmos.Build.Builder/Views/MessageBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
ShowInTaskbar="False"
SizeToContent="WidthAndHeight"
Title="Cosmos Kit Builder"
WindowStartupLocation="CenterOwner"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True">
WindowStartupLocation="CenterOwner">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
ResizeMode="NoResize"
SizeToContent="WidthAndHeight"
Title="Choose Visual Studio Instance"
WindowStartupLocation="CenterOwner"
ui:WindowHelper.UseModernWindowStyle="True">
WindowStartupLocation="CenterOwner">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

<Style TargetType="Button" BasedOn="{ui:StaticResource DefaultButtonStyle}">
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Margin" Value="4" />
<Setter Property="MinWidth" Value="48" />
<Setter Property="Padding" Value="8,3" />
Expand Down

0 comments on commit 6510f61

Please sign in to comment.