mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
UI - Fixed various rename dialogs cancelling instead of submitting when pressing enter
Submission wizard - Allow window to scroll when setting up layer adaption hints Local web API - Added status endpoint to determine whether webserver is running
This commit is contained in:
parent
d96581f11c
commit
8d5640aba3
@ -45,4 +45,5 @@
|
|||||||
<StyleInclude Source="/Styles/NumberBox.axaml" />
|
<StyleInclude Source="/Styles/NumberBox.axaml" />
|
||||||
<StyleInclude Source="/Styles/TreeView.axaml" />
|
<StyleInclude Source="/Styles/TreeView.axaml" />
|
||||||
<StyleInclude Source="/Styles/Plugins.axaml" />
|
<StyleInclude Source="/Styles/Plugins.axaml" />
|
||||||
|
<StyleInclude Source="/Styles/ScrollViewer.axaml" />
|
||||||
</Styles>
|
</Styles>
|
||||||
15
src/Artemis.UI.Shared/Styles/ScrollViewer.axaml
Normal file
15
src/Artemis.UI.Shared/Styles/ScrollViewer.axaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<Style xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<Design.PreviewWith>
|
||||||
|
<Border Padding="20">
|
||||||
|
<ScrollViewer Classes="with-padding" Height="100">
|
||||||
|
<Rectangle Fill="Blue" Width="50" Height="200"></Rectangle>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
</Design.PreviewWith>
|
||||||
|
|
||||||
|
<!-- Add Styles Here -->
|
||||||
|
<Style Selector="ScrollViewer.with-padding /template/ ScrollContentPresenter#PART_ContentPresenter">
|
||||||
|
<Setter Property="Grid.ColumnSpan" Value="1"></Setter>
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
@ -20,6 +20,12 @@ public class RemoteController : WebApiController
|
|||||||
_mainWindowService = mainWindowService;
|
_mainWindowService = mainWindowService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route(HttpVerbs.Any, "/status")]
|
||||||
|
public void GetStatus()
|
||||||
|
{
|
||||||
|
HttpContext.Response.StatusCode = 200;
|
||||||
|
}
|
||||||
|
|
||||||
[Route(HttpVerbs.Post, "/remote/bring-to-foreground")]
|
[Route(HttpVerbs.Post, "/remote/bring-to-foreground")]
|
||||||
public void PostBringToForeground()
|
public void PostBringToForeground()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,9 +7,6 @@
|
|||||||
x:Class="Artemis.UI.Screens.ProfileEditor.ProfileTree.ContentDialogs.ProfileElementRenameView"
|
x:Class="Artemis.UI.Screens.ProfileEditor.ProfileTree.ContentDialogs.ProfileElementRenameView"
|
||||||
x:DataType="contentDialogs:ProfileElementRenameViewModel">
|
x:DataType="contentDialogs:ProfileElementRenameViewModel">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel.KeyBindings>
|
|
||||||
<KeyBinding Gesture="Enter" Command="{CompiledBinding Enter}" />
|
|
||||||
</StackPanel.KeyBindings>
|
|
||||||
<TextBox Name="NameTextBox" Text="{CompiledBinding ProfileElementName}" Watermark="Profile element name" />
|
<TextBox Name="NameTextBox" Text="{CompiledBinding ProfileElementName}" Watermark="Profile element name" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@ -22,7 +22,6 @@ public class ProfileElementRenameViewModel : ContentDialogViewModelBase
|
|||||||
_profileElementName = profileElement.Name;
|
_profileElementName = profileElement.Name;
|
||||||
|
|
||||||
Confirm = ReactiveCommand.Create(ExecuteConfirm, ValidationContext.Valid);
|
Confirm = ReactiveCommand.Create(ExecuteConfirm, ValidationContext.Valid);
|
||||||
Enter = ReactiveCommand.Create(() => ContentDialog?.Hide(ContentDialogResult.Primary), Confirm.CanExecute);
|
|
||||||
this.ValidationRule(vm => vm.ProfileElementName, name => !string.IsNullOrWhiteSpace(name), "You must specify a valid name");
|
this.ValidationRule(vm => vm.ProfileElementName, name => !string.IsNullOrWhiteSpace(name), "You must specify a valid name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +32,6 @@ public class ProfileElementRenameViewModel : ContentDialogViewModelBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> Enter { get; }
|
|
||||||
public ReactiveCommand<Unit, Unit> Confirm { get; }
|
public ReactiveCommand<Unit, Unit> Confirm { get; }
|
||||||
|
|
||||||
private void ExecuteConfirm()
|
private void ExecuteConfirm()
|
||||||
|
|||||||
@ -7,9 +7,6 @@
|
|||||||
x:Class="Artemis.UI.Screens.ProfileEditor.Properties.Tree.ContentDialogs.LayerEffectRenameView"
|
x:Class="Artemis.UI.Screens.ProfileEditor.Properties.Tree.ContentDialogs.LayerEffectRenameView"
|
||||||
x:DataType="contentDialogs:LayerEffectRenameViewModel">
|
x:DataType="contentDialogs:LayerEffectRenameViewModel">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel.KeyBindings>
|
|
||||||
<KeyBinding Gesture="Enter" Command="{CompiledBinding Enter}" />
|
|
||||||
</StackPanel.KeyBindings>
|
|
||||||
<TextBox Name="NameTextBox" Text="{CompiledBinding LayerEffectName}" Watermark="Layer effect name" />
|
<TextBox Name="NameTextBox" Text="{CompiledBinding LayerEffectName}" Watermark="Layer effect name" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -22,7 +22,6 @@ public class LayerEffectRenameViewModel : ContentDialogViewModelBase
|
|||||||
_layerEffectName = layerEffect.Name;
|
_layerEffectName = layerEffect.Name;
|
||||||
|
|
||||||
Confirm = ReactiveCommand.Create(ExecuteConfirm, ValidationContext.Valid);
|
Confirm = ReactiveCommand.Create(ExecuteConfirm, ValidationContext.Valid);
|
||||||
Enter = ReactiveCommand.Create(() => ContentDialog?.Hide(ContentDialogResult.Primary), Confirm.CanExecute);
|
|
||||||
this.ValidationRule(vm => vm.LayerEffectName, categoryName => !string.IsNullOrWhiteSpace(categoryName), "You must specify a valid name");
|
this.ValidationRule(vm => vm.LayerEffectName, categoryName => !string.IsNullOrWhiteSpace(categoryName), "You must specify a valid name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +32,6 @@ public class LayerEffectRenameViewModel : ContentDialogViewModelBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> Confirm { get; }
|
public ReactiveCommand<Unit, Unit> Confirm { get; }
|
||||||
public ReactiveCommand<Unit, Unit> Enter { get; }
|
|
||||||
|
|
||||||
private void ExecuteConfirm()
|
private void ExecuteConfirm()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,9 +7,6 @@
|
|||||||
x:Class="Artemis.UI.Screens.Sidebar.SidebarCategoryEditView"
|
x:Class="Artemis.UI.Screens.Sidebar.SidebarCategoryEditView"
|
||||||
x:DataType="sidebar:SidebarCategoryEditViewModel">
|
x:DataType="sidebar:SidebarCategoryEditViewModel">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel.KeyBindings>
|
<TextBox Name="NameTextBox" Text="{CompiledBinding CategoryName}" Watermark="Category name"/>
|
||||||
<KeyBinding Gesture="Enter" Command="{CompiledBinding Enter}" />
|
|
||||||
</StackPanel.KeyBindings>
|
|
||||||
<TextBox Text="{CompiledBinding CategoryName}" Watermark="Category name"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,6 +1,7 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
using Artemis.UI.Shared.Extensions;
|
using Artemis.UI.Shared.Extensions;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Avalonia.ReactiveUI;
|
using Avalonia.ReactiveUI;
|
||||||
|
using Avalonia.Threading;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
|
||||||
namespace Artemis.UI.Screens.Sidebar;
|
namespace Artemis.UI.Screens.Sidebar;
|
||||||
@ -10,7 +11,18 @@ public partial class SidebarCategoryEditView : ReactiveUserControl<SidebarCatego
|
|||||||
public SidebarCategoryEditView()
|
public SidebarCategoryEditView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.WhenActivated(_ => this.ClearAllDataValidationErrors());
|
this.WhenActivated(_ =>
|
||||||
|
{
|
||||||
|
this.ClearAllDataValidationErrors();
|
||||||
|
Dispatcher.UIThread.Post(DelayedAutoFocus);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void DelayedAutoFocus()
|
||||||
|
{
|
||||||
|
// Don't ask
|
||||||
|
await Task.Delay(200);
|
||||||
|
NameTextBox.SelectAll();
|
||||||
|
NameTextBox.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -24,7 +24,6 @@ public class SidebarCategoryEditViewModel : ContentDialogViewModelBase
|
|||||||
_categoryName = _category.Name;
|
_categoryName = _category.Name;
|
||||||
|
|
||||||
Confirm = ReactiveCommand.Create(ExecuteConfirm, ValidationContext.Valid);
|
Confirm = ReactiveCommand.Create(ExecuteConfirm, ValidationContext.Valid);
|
||||||
Enter = ReactiveCommand.Create(() => ContentDialog?.Hide(ContentDialogResult.Primary), Confirm.CanExecute);
|
|
||||||
this.ValidationRule(vm => vm.CategoryName, categoryName => !string.IsNullOrWhiteSpace(categoryName?.Trim()), "You must specify a valid name");
|
this.ValidationRule(vm => vm.CategoryName, categoryName => !string.IsNullOrWhiteSpace(categoryName?.Trim()), "You must specify a valid name");
|
||||||
this.ValidationRule(vm => vm.CategoryName, categoryName => profileService.ProfileCategories.All(c => c.Name != categoryName?.Trim()), "You must specify a unique name");
|
this.ValidationRule(vm => vm.CategoryName, categoryName => profileService.ProfileCategories.All(c => c.Name != categoryName?.Trim()), "You must specify a unique name");
|
||||||
}
|
}
|
||||||
@ -36,7 +35,6 @@ public class SidebarCategoryEditViewModel : ContentDialogViewModelBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> Confirm { get; }
|
public ReactiveCommand<Unit, Unit> Confirm { get; }
|
||||||
public ReactiveCommand<Unit, Unit> Enter { get; }
|
|
||||||
|
|
||||||
private void ExecuteConfirm()
|
private void ExecuteConfirm()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,37 +31,46 @@
|
|||||||
Learn more about adaption hints
|
Learn more about adaption hints
|
||||||
</controls:HyperlinkButton>
|
</controls:HyperlinkButton>
|
||||||
|
|
||||||
<ItemsRepeater ItemsSource="{CompiledBinding Layers}" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="0 10 0 0">
|
<ScrollViewer Grid.Row="2"
|
||||||
<ItemsRepeater.ItemTemplate>
|
Grid.Column="0"
|
||||||
<DataTemplate DataType="profile:ProfileAdaptionHintsLayerViewModel">
|
Grid.ColumnSpan="2"
|
||||||
<StackPanel>
|
Margin="0 10 0 0"
|
||||||
<Border Classes="card-separator" />
|
Classes="with-padding"
|
||||||
<Grid ColumnDefinitions="Auto,*,Auto" RowDefinitions="*,*">
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
<avalonia:MaterialIcon Grid.Column="0"
|
VerticalScrollBarVisibility="Auto"
|
||||||
Grid.Row="0"
|
VerticalAlignment="Top">
|
||||||
Grid.RowSpan="2"
|
<ItemsRepeater ItemsSource="{CompiledBinding Layers}">
|
||||||
Width="25"
|
<ItemsRepeater.ItemTemplate>
|
||||||
Height="25"
|
<DataTemplate DataType="profile:ProfileAdaptionHintsLayerViewModel">
|
||||||
Margin="5 0 10 0"
|
<StackPanel>
|
||||||
Kind="{CompiledBinding Layer.LayerBrush.Descriptor.Icon, FallbackValue=QuestionMark}" />
|
<Border Classes="card-separator" />
|
||||||
<TextBlock Grid.Column="1" Grid.Row="0" Text="{CompiledBinding Layer.Name}" />
|
<Grid ColumnDefinitions="Auto,*,Auto" RowDefinitions="*,*">
|
||||||
<TextBlock Grid.Column="1"
|
<avalonia:MaterialIcon Grid.Column="0"
|
||||||
Grid.Row="1"
|
Grid.Row="0"
|
||||||
VerticalAlignment="Top"
|
Grid.RowSpan="2"
|
||||||
Classes="subtitle"
|
Width="25"
|
||||||
Classes.danger="{CompiledBinding !AdaptionHintCount}"
|
Height="25"
|
||||||
Text="{CompiledBinding AdaptionHintText}">
|
Margin="5 0 10 0"
|
||||||
</TextBlock>
|
Kind="{CompiledBinding Layer.LayerBrush.Descriptor.Icon, FallbackValue=QuestionMark}" />
|
||||||
<Button Grid.Column="2"
|
<TextBlock Grid.Column="1" Grid.Row="0" Text="{CompiledBinding Layer.Name}" />
|
||||||
Grid.Row="0"
|
<TextBlock Grid.Column="1"
|
||||||
Grid.RowSpan="2"
|
Grid.Row="1"
|
||||||
Command="{Binding EditAdaptionHints}">
|
VerticalAlignment="Top"
|
||||||
Edit hints
|
Classes="subtitle"
|
||||||
</Button>
|
Classes.danger="{CompiledBinding !AdaptionHintCount}"
|
||||||
</Grid>
|
Text="{CompiledBinding AdaptionHintText}">
|
||||||
</StackPanel>
|
</TextBlock>
|
||||||
</DataTemplate>
|
<Button Grid.Column="2"
|
||||||
</ItemsRepeater.ItemTemplate>
|
Grid.Row="0"
|
||||||
</ItemsRepeater>
|
Grid.RowSpan="2"
|
||||||
|
Command="{Binding EditAdaptionHints}">
|
||||||
|
Edit hints
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsRepeater.ItemTemplate>
|
||||||
|
</ItemsRepeater>
|
||||||
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
Loading…
x
Reference in New Issue
Block a user