Merge branch 'development' into VisualScripting

This commit is contained in:
Robert committed 2021-08-31 15:15:41 +02:00
commit dc9661353c
14 files changed
+175 -75

No files matched your search

+10 -18
View File
@@ -62,7 +62,7 @@
VerticalAlignment="Bottom"
Margin="0 0 0 32">
<StackPanel>
<materialDesign:Card Width="840" Margin="8 16" Height="Auto">
<materialDesign:Card Width="852" Margin="8" Height="Auto">
<Grid VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -86,23 +86,15 @@
</TextBlock>
</StackPanel>
<Border Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="0" BorderThickness="0 1 0 0" BorderBrush="{DynamicResource MaterialDesignDivider}" Padding="8">
<DockPanel>
<Button Style="{DynamicResource MaterialDesignFlatButton}"
DockPanel.Dock="Right"
Command="{s:Action OpenUrl}"
CommandParameter="https://wiki.artemis-rgb.com/en/guides/user/plugins">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="OpenInBrowser" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Get more plugins</TextBlock>
</StackPanel>
</Button>
<TextBlock Foreground="{DynamicResource MaterialDesignBodyLight}"
TextWrapping="Wrap"
Margin="16"
VerticalAlignment="Center">
Want more plugins? You can find them on our wiki.
</TextBlock>
</DockPanel>
<Button Style="{DynamicResource MaterialDesignFlatButton}"
HorizontalAlignment="Right"
Command="{s:Action OpenUrl}"
CommandParameter="https://wiki.artemis-rgb.com/en/guides/user/plugins">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="OpenInBrowser" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Get more plugins</TextBlock>
</StackPanel>
</Button>
</Border>
</Grid>
</materialDesign:Card>
@@ -3,7 +3,6 @@ using System.Globalization;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Artemis.UI.Shared.Services;
using Castle.Core.Internal;
using FluentValidation;
using Stylet;
@@ -70,7 +69,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Dialogs
if (parts.Length == 1)
return TimeSpan.FromSeconds(double.Parse(parts[0]));
// Only milliseconds provided with a leading .
if (parts[0].IsNullOrEmpty())
if (string.IsNullOrEmpty(parts[0]))
{
// Add trailing zeros so 2.5 becomes 2.500, can't seem to make double.Parse do that
while (parts[0].Length < 3) parts[0] += "0";
+13
View File
@@ -61,6 +61,19 @@
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch"
IsTabStop="False" />
<Border Grid.Row="1" Visibility="{Binding SidebarViewModel.ActivatingProfile, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay, Delay=2000}">
<Border.Background>
<SolidColorBrush Color="{Binding Path=Color, Source={StaticResource MaterialDesignToolBarBackground}}" Opacity="0.5"></SolidColorBrush>
</Border.Background>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}" Value="0" IsIndeterminate="True" Width="50" Height="50" Margin="20"/>
<TextBlock TextAlignment="Center" Style="{StaticResource MaterialDesignHeadline5TextBlock}">
Activating profile...
</TextBlock>
</StackPanel>
</Border>
<materialDesign:Snackbar Grid.Row="0"
Grid.RowSpan="2"
x:Name="MainSnackbar"
@@ -96,7 +96,7 @@
Grid.Column="1"
Style="{StaticResource MaterialDesignBody1TextBlock}"
Padding="0">
Robert 'Spoinky' Beekman
Robert Beekman
</TextBlock>
<TextBlock Grid.Column="1"
Grid.Row="1"
@@ -111,7 +111,7 @@
Style="{StaticResource MaterialDesignIconForegroundButton}"
ToolTip="View GitHub profile"
Command="{s:Action OpenUrl}"
CommandParameter="https://github.com/SpoinkyNL/">
CommandParameter="https://github.com/RobertWasTaken/">
<materialDesign:PackIcon Kind="Github" Width="20" Height="20" />
</Button>
</StackPanel>
@@ -18,6 +18,7 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ArtemisSidebar.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
</ResourceDictionary>
</UserControl.Resources>
<materialDesign:DialogHost IsTabStop="False" Focusable="False" Identifier="SidebarDialog" DialogTheme="Inherit" DialogMargin="14">
@@ -74,7 +75,8 @@
Margin="0 2"
ItemContainerStyle="{StaticResource SidebarListBoxItem}"
ItemsSource="{Binding SidebarScreens}"
SelectedItem="{Binding SelectedSidebarScreen}">
SelectedItem="{Binding SelectedSidebarScreen}"
IsEnabled="{Binding ActivatingProfile, Converter={StaticResource InverseBooleanConverter}}">
<ListBox.ItemTemplate>
<DataTemplate>
<ContentControl s:View.Model="{Binding}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" IsTabStop="False" />
@@ -105,7 +107,11 @@
dd:DragDrop.DropHandler="{Binding}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl s:View.Model="{Binding}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" IsTabStop="False" />
<ContentControl s:View.Model="{Binding}"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch"
IsTabStop="False"
IsEnabled="{Binding DataContext.ActivatingProfile, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Converter={StaticResource InverseBooleanConverter}}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
@@ -35,6 +35,7 @@ namespace Artemis.UI.Screens.Sidebar
private MainScreenViewModel _selectedScreen;
private readonly SidebarScreenViewModel<ProfileEditorViewModel> _profileEditor;
private readonly DefaultDropHandler _defaultDropHandler;
private bool _activatingProfile;
public SidebarViewModel(IKernel kernel,
IEventAggregator eventAggregator,
@@ -96,6 +97,12 @@ namespace Artemis.UI.Screens.Sidebar
}
}
public bool ActivatingProfile
{
get => _activatingProfile;
set => SetAndNotify(ref _activatingProfile, value);
}
private void ActivateScreenViewModel(SidebarScreenViewModel screenViewModel)
{
SelectedScreen = screenViewModel.CreateInstance(_kernel);
@@ -155,18 +162,34 @@ namespace Artemis.UI.Screens.Sidebar
if (_profileEditorService.SuspendEditing)
_profileEditorService.SuspendEditing = false;
_profileEditorService.ChangeSelectedProfileConfiguration(profileConfiguration);
if (profileConfiguration != null)
Task.Run(() =>
{
// Little workaround to clear the selected item in the menu, ugly but oh well
if (_selectedSidebarScreen != _profileEditor)
try
{
_selectedSidebarScreen = null;
NotifyOfPropertyChange(nameof(SelectedSidebarScreen));
ActivatingProfile = true;
_profileEditorService.ChangeSelectedProfileConfiguration(profileConfiguration);
}
finally
{
ActivatingProfile = false;
}
SelectedSidebarScreen = _profileEditor;
}
if (profileConfiguration == null)
return;
Execute.PostToUIThread(() =>
{
// Little workaround to clear the selected item in the menu, ugly but oh well
if (_selectedSidebarScreen != _profileEditor)
{
_selectedSidebarScreen = null;
NotifyOfPropertyChange(nameof(SelectedSidebarScreen));
}
SelectedSidebarScreen = _profileEditor;
});
});
}
#region Overrides of Screen
@@ -212,7 +235,7 @@ namespace Artemis.UI.Screens.Sidebar
Items[index].ProfileCategory.Order = index;
// Bit dumb but gets the job done
foreach (SidebarCategoryViewModel viewModel in Items)
foreach (SidebarCategoryViewModel viewModel in Items)
_profileService.SaveProfileCategory(viewModel.ProfileCategory);
}