Skip to content

Commit

Permalink
fix window issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Dec 6, 2023
1 parent 8b75f7e commit d4ab197
Show file tree
Hide file tree
Showing 25 changed files with 122 additions and 86 deletions.
2 changes: 1 addition & 1 deletion build/props/Avalonia.Browser.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Browser" Version="11.1.999-cibuild0042398-beta" />
<PackageReference Include="Avalonia.Browser" Version="11.0.6" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/props/Avalonia.Controls.ColorPicker.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="11.1.999-cibuild0042398-beta" />
<PackageReference Include="Avalonia.Controls.ColorPicker" Version="11.0.6" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/props/Avalonia.Controls.DataGrid.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.1.999-cibuild0042398-beta" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.6" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/props/Avalonia.Desktop.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="11.1.999-cibuild0042398-beta" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.6" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/props/Avalonia.Diagnostics.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Diagnostics" Version="11.1.999-cibuild0042398-beta" Condition="'$(Configuration)' == 'Debug'" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.6" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/props/Avalonia.Fonts.Inter.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.999-cibuild0042398-beta" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.6" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/props/Avalonia.Themes.Simple.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Themes.Simple" Version="11.1.999-cibuild0042398-beta" />
<PackageReference Include="Avalonia.Themes.Simple" Version="11.0.6" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/props/Avalonia.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.1.999-cibuild0042398-beta" />
<PackageReference Include="Avalonia" Version="11.0.6" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/props/Base.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Version>0.12.4.0</Version>
<Version>0.12.5.0</Version>
<Authors>Hendrik Mennen</Authors>
<Company>Protop Solutions UG</Company>
<Description>The FPGA Programming Revolution</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,25 @@ public ApplicationCommandService(IWindowService windowService)

private void OpenManager(ILogical logical, string startTab)
{
if (_lastManagerWindow?.IsAttachedToVisualTree() ?? false)
Dispatcher.UIThread.Post(() =>
{
var manager = _lastManagerWindow.DataContext as CommandManagerViewModel;
if (manager == null) throw new NullReferenceException(nameof(manager));
manager.SelectedTab = manager.Tabs.First(t => t.Title == startTab);
}
else
{
var manager = ContainerLocator.Container.Resolve<CommandManagerViewModel>((typeof(ILogical), logical));
manager.SelectedTab = manager.Tabs.First(t => t.Title == startTab);
_lastManagerWindow = new CommandManagerView()
if (_lastManagerWindow?.IsAttachedToVisualTree() ?? false)
{
DataContext = manager
};
_windowService.Show(_lastManagerWindow, logical as Window);
}
var manager = _lastManagerWindow.DataContext as CommandManagerViewModel;
if (manager == null) throw new NullReferenceException(nameof(manager));
manager.SelectedTab = manager.Tabs.First(t => t.Title == startTab);
}
else
{
var manager = ContainerLocator.Container.Resolve<CommandManagerViewModel>((typeof(ILogical), logical));
manager.SelectedTab = manager.Tabs.First(t => t.Title == startTab);
_lastManagerWindow = new CommandManagerView()
{
DataContext = manager
};
_windowService.Show(_lastManagerWindow, logical as Window);
}
});
}

public void RegisterCommand(IApplicationCommand command)
Expand Down
15 changes: 10 additions & 5 deletions src/OneWare.ApplicationCommands/Views/CommandManagerView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
PrefWidth="500" SizeToContent="Height"
ShowTitle="False" Title="Application Commands"
Name="CommandManagerViewView"
SystemDecorations="None"
Focusable="False"
SystemDecorations="BorderOnly"
ExtendClientAreaToDecorationsHint="False"
CanResize="False"
WindowStartupLocation="CenterOwner"
CloseOnDeactivated="True">
CloseOnDeactivated="False">
<Interaction.Behaviors>
<behaviours:CommandOnKeyPressedBehaviour TriggerKey="Escape" HandledEventsToo="True"
Command="{Binding Close}"
Expand Down Expand Up @@ -48,8 +49,12 @@
SelectedItem="{Binding SelectedItem}"
IsVisible="{Binding VisibleItems.Count}"
AutoScrollToSelectedItem="True"
Name="ItemList"
CornerRadius="{x:Static helpers:PlatformHelper.WindowsCornerRadiusBottom}">
Name="ItemList">
<ListBox.Styles>
<Style Selector="ListBox ScrollContentPresenter">
<Setter Property="CornerRadius" Value="{x:Static helpers:PlatformHelper.WindowsCornerRadiusBottom}"/>
</Style>
</ListBox.Styles>
<ListBox.ItemTemplate>
<DataTemplate x:DataType="models1:IApplicationCommand">
<DockPanel VerticalAlignment="Center" Margin="3 0">
Expand Down
1 change: 1 addition & 0 deletions src/OneWare.Core/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</SimpleTheme.Resources>
</SimpleTheme>
<DockSimpleTheme/>

<StyleInclude Source="avares://AvaloniaEdit/Themes/Simple/AvaloniaEdit.xaml" />
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Simple.xaml" />
<StyleInclude Source="avares://NodeEditorAvalonia/Themes/NodeEditorTheme.axaml" />
Expand Down
1 change: 0 additions & 1 deletion src/OneWare.Core/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using OneWare.ApplicationCommands;
using OneWare.ApplicationCommands.Models;
using OneWare.ApplicationCommands.Services;
using OneWare.Core.Helpers;
using OneWare.Core.ModuleLogic;
using OneWare.Core.Services;
using OneWare.Core.ViewModels.DockViews;
Expand Down
4 changes: 4 additions & 0 deletions src/OneWare.Core/OneWare.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
<ProjectReference Include="..\OneWare.Settings\OneWare.Settings.csproj" />
<ProjectReference Include="..\OneWare.SDK\OneWare.SDK.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Helpers\" />
</ItemGroup>

</Project>

Expand Down
1 change: 1 addition & 0 deletions src/OneWare.Core/Services/DockService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using OneWare.Core.Dock;
using OneWare.Core.ViewModels.DockViews;
using OneWare.Core.Views.Windows;
using OneWare.SDK.Controls;
using Prism.Ioc;
using OneWare.SDK.Enums;
using OneWare.SDK.Models;
Expand Down
28 changes: 0 additions & 28 deletions src/OneWare.Core/Services/WindowService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,32 +199,4 @@ public void ShowNotificationWithButton(string title, string message, string butt

ContainerLocator.Container.Resolve<MainWindow>().NotificationManager.Show(model);
}

public Window CreateHost(FlexibleWindow flexible)
{
var host = new AdvancedWindow();

host.Bind(AdvancedWindow.ShowTitleProperty, flexible.GetObservable(FlexibleWindow.ShowTitleProperty));
host.Bind(AdvancedWindow.CustomIconProperty, flexible.GetObservable(FlexibleWindow.CustomIconProperty));
host.Bind(AdvancedWindow.TitleBarContentProperty, flexible.GetObservable(FlexibleWindow.TitleBarContentProperty));
host.Bind(AdvancedWindow.BottomContentProperty, flexible.GetObservable(FlexibleWindow.BottomContentProperty));

host.Bind(Window.WindowStartupLocationProperty, flexible.GetObservable(FlexibleWindow.WindowStartupLocationProperty));
host.Bind(Window.IconProperty, flexible.GetObservable(FlexibleWindow.IconProperty));
host.Bind(Window.TitleProperty, flexible.GetObservable(FlexibleWindow.TitleProperty));
host.Bind(Window.SizeToContentProperty, flexible.GetObservable(FlexibleWindow.SizeToContentProperty));
host.Bind(Window.SystemDecorationsProperty, flexible.GetObservable(FlexibleWindow.SystemDecorationsProperty));
host.Bind(Window.ExtendClientAreaToDecorationsHintProperty, flexible.GetObservable(FlexibleWindow.ExtendClientAreaToDecorationsHintProperty));

//host.Bind(TopLevel.TransparencyLevelHintProperty, flexible.GetObservable(FlexibleWindow.TransparencyLevelHintProperty));
host.Bind(TemplatedControl.BackgroundProperty,
flexible.GetObservable(FlexibleWindow.WindowBackgroundProperty).Where(x => x is not null));

host.Height = flexible.PrefHeight;
host.Width = flexible.PrefWidth;

host.Content = flexible;

return host;
}
}
13 changes: 13 additions & 0 deletions src/OneWare.Core/Styles/Accents/Base.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@
Color="{StaticResource ThemeControlHighlightHighColor}" />
<SolidColorBrush x:Key="ThemeForegroundBrush" Color="{StaticResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="HighlightBrush" Color="{DynamicResource ThemeAccentColor}" />
<SolidColorBrush x:Key="HighlightBrush2" Color="{DynamicResource ThemeAccentColor}" />

<SolidColorBrush x:Key="CaptionButtonForeground" Color="{StaticResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="CaptionButtonBackground" Color="{StaticResource ThemeBorderLowColor}" />
<SolidColorBrush x:Key="CaptionButtonBorderBrush" Color="{StaticResource ThemeBorderLowColor}" />

<SolidColorBrush x:Key="ThemeEditorBrush" Color="{StaticResource ThemeEditorColor}" />

<SolidColorBrush x:Key="IconColor" Opacity="1" Color="#FFFFFF" />
Expand Down Expand Up @@ -199,6 +205,13 @@
Color="{StaticResource ThemeControlHighlightHighColor}" />
<SolidColorBrush x:Key="ThemeForegroundBrush" Color="{StaticResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="HighlightBrush" Color="{DynamicResource ThemeAccentColor}" Opacity="0.7" />
<SolidColorBrush x:Key="HighlightBrush2" Color="{DynamicResource ThemeAccentColor}" />

<!-- BaseResources for CaptionButtons.xaml -->
<SolidColorBrush x:Key="CaptionButtonForeground" Color="{StaticResource ThemeForegroundColor}" />
<SolidColorBrush x:Key="CaptionButtonBackground" Color="{StaticResource ThemeBorderLowColor}" />
<SolidColorBrush x:Key="CaptionButtonBorderBrush" Color="{StaticResource ThemeBorderLowColor}" />

<SolidColorBrush x:Key="ThemeEditorBrush" Color="{StaticResource ThemeEditorColor}" />

<SolidColorBrush x:Key="IconColor" Opacity="1" Color="#424040" />
Expand Down
13 changes: 6 additions & 7 deletions src/OneWare.Core/Styles/AdvancedWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
xmlns:layout="clr-namespace:Avalonia.Layout;assembly=Avalonia.Base"
xmlns:shared="clr-namespace:OneWare.SDK;assembly=OneWare.SDK"
xmlns:converters="clr-namespace:OneWare.SDK.Converters;assembly=OneWare.SDK"
xmlns:windows="clr-namespace:OneWare.Core.Views.Windows"
xmlns:helpers="clr-namespace:OneWare.SDK.Helpers;assembly=OneWare.SDK">
xmlns:helpers="clr-namespace:OneWare.SDK.Helpers;assembly=OneWare.SDK"
xmlns:controls="clr-namespace:OneWare.SDK.Controls;assembly=OneWare.SDK">

<Style Selector="windows|AdvancedWindow">
<Style Selector="controls|AdvancedWindow">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True"/>
<Setter Property="ExtendClientAreaTitleBarHeightHint" Value="30"/>
<Setter Property="Padding" Value="{TemplateBinding Padding}"/>
<Setter Property="CornerRadius" Value="{x:Static helpers:PlatformHelper.WindowsCornerRadius}"/>
Expand Down Expand Up @@ -50,8 +49,8 @@
<Image Source="{TemplateBinding CustomIcon}" Height="16" Width="16" VerticalAlignment="Center">
<Image.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="$parent[windows:AdvancedWindow].HorizontalAlignmentTitle" Converter="{x:Static converters:SharedConverters.ComparisonConverter}" ConverterParameter="{x:Static layout:HorizontalAlignment.Left}"/>
<Binding Path="$parent[windows:AdvancedWindow].CustomIcon" Converter="{x:Static ObjectConverters.IsNotNull}"/>
<Binding Path="$parent[controls:AdvancedWindow].HorizontalAlignmentTitle" Converter="{x:Static converters:SharedConverters.ComparisonConverter}" ConverterParameter="{x:Static layout:HorizontalAlignment.Left}"/>
<Binding Path="$parent[controls:AdvancedWindow].CustomIcon" Converter="{x:Static ObjectConverters.IsNotNull}"/>
</MultiBinding>
</Image.IsVisible>
</Image>
Expand All @@ -67,7 +66,7 @@
</Setter>
</Style>

<Style Selector="windows|AdvancedWindow.PlatformWindows">
<Style Selector="controls|AdvancedWindow.PlatformWindows">
<Setter Property="TransparencyLevelHint" Value="AcrylicBlur"/>
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrushOp}"/>
</Style>
Expand Down
20 changes: 10 additions & 10 deletions src/OneWare.Core/Views/Windows/MainWindow.axaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<windows:AdvancedWindow xmlns="https://github.com/avaloniaui"
<sdkControls:AdvancedWindow xmlns="https://github.com/avaloniaui"
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"
Expand All @@ -16,16 +16,16 @@
WindowStartupLocation="CenterScreen"
Background="{DynamicResource ThemeBackgroundBrush}"
xmlns:helpers="clr-namespace:OneWare.SDK.Helpers;assembly=OneWare.SDK"
xmlns:controls1="clr-namespace:OneWare.Core.ViewModels.Controls"
xmlns:coreControls="clr-namespace:OneWare.Core.ViewModels.Controls"
xmlns:converters="clr-namespace:OneWare.SDK.Converters;assembly=OneWare.SDK"
xmlns:windows="clr-namespace:OneWare.Core.Views.Windows"
xmlns:viewmodels="clr-namespace:OneWare.Core.ViewModels.Windows"
xmlns:controls2="clr-namespace:OneWare.SDK.Controls;assembly=OneWare.SDK"
xmlns:sdkControls="clr-namespace:OneWare.SDK.Controls;assembly=OneWare.SDK"
xmlns:enums="clr-namespace:OneWare.SDK.Enums;assembly=OneWare.SDK"
x:DataType="viewmodels:MainWindowViewModel">

<Window.DataTemplates>
<DataTemplate DataType="controls1:CustomNotificationViewModel">
<DataTemplate DataType="coreControls:CustomNotificationViewModel">
<controls:CustomNotificationView />
</DataTemplate>
</Window.DataTemplates>
Expand Down Expand Up @@ -85,7 +85,7 @@
<DockControl Name="DockControl" Grid.Row="1" Layout="{Binding DockService.Layout}" UseLayoutRounding="False" />
</Grid>

<windows:AdvancedWindow.TitleBarContent>
<sdkControls:AdvancedWindow.TitleBarContent>
<StackPanel Orientation="Horizontal" Spacing="5">
<Image IsHitTestVisible="False" Source="{Binding Paths.AppIconPath, Converter={x:Static converters:SharedConverters.PathToBitmapConverter}}" Height="20" Width="20"
IsVisible="{Binding $parent[Window].IsExtendedIntoWindowDecorations}" />
Expand All @@ -98,14 +98,14 @@
</Menu.Styles>
</Menu>
</StackPanel>
</windows:AdvancedWindow.TitleBarContent>
</sdkControls:AdvancedWindow.TitleBarContent>

<windows:AdvancedWindow.BottomContent>
<sdkControls:AdvancedWindow.BottomContent>
<Border Padding="2" CornerRadius="{x:Static helpers:PlatformHelper.WindowsCornerRadiusBottom}"
Background="{DynamicResource ThemeAccentBrush}">
<DockPanel Height="20" HorizontalAlignment="Stretch" LastChildFill="False">
<!--Left elements-->
<controls2:Spinner CustomIcon="{DynamicResource SpinnerWhite}" Height="15" Margin="3, 0, 0, 0"
<sdkControls:Spinner CustomIcon="{DynamicResource SpinnerWhite}" Height="15" Margin="3, 0, 0, 0"
IsVisible="{Binding ApplicationStateService.ActiveProcess.State, Converter={x:Static converters:SharedConverters.ComparisonConverter}, ConverterParameter={x:Static enums:AppState.Loading}}" />

<TextBlock VerticalAlignment="Center" Margin="5, 0, 3, 0" Text="{Binding ApplicationStateService.ActiveProcess.StatusMessage}" Foreground="White" />
Expand Down Expand Up @@ -179,5 +179,5 @@
</StackPanel>
</DockPanel>
</Border>
</windows:AdvancedWindow.BottomContent>
</windows:AdvancedWindow>
</sdkControls:AdvancedWindow.BottomContent>
</sdkControls:AdvancedWindow>
1 change: 1 addition & 0 deletions src/OneWare.Core/Views/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using DynamicData.Binding;
using OneWare.Core.ViewModels.Windows;
using OneWare.Core.Extensions;
using OneWare.SDK.Controls;
using OneWare.SDK.Models;
using OneWare.SDK.ViewModels;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
using Dock.Avalonia.Controls;
using Dock.Model.Controls;
using Dock.Model.Mvvm.Controls;
using OneWare.Core.Helpers;
using OneWare.SDK;
using OneWare.SDK.Helpers;
using OneWare.SDK.Services;
using OneWare.SDK.ViewModels;

namespace OneWare.Core.Views.Windows;
namespace OneWare.SDK.Controls;

public class AdvancedHostWindow : HostWindow
{
Expand Down
Loading

0 comments on commit d4ab197

Please sign in to comment.