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
77 changes: 76 additions & 1 deletion src/UniGetUI/Controls/PackageItemContainer.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using Microsoft.UI.Xaml.Automation;
using Microsoft.UI.Xaml.Automation.Peers;
using Microsoft.UI.Xaml.Automation.Provider;
using Microsoft.UI.Xaml.Controls;
using UniGetUI.PackageEngine.Interfaces;
using UniGetUI.PackageEngine.PackageClasses;
Expand All @@ -7,6 +10,78 @@ namespace UniGetUI.Interface.Widgets
public partial class PackageItemContainer : ItemContainer
{
public IPackage? Package { get; set; }
public PackageWrapper Wrapper { get; set; } = null!;

private PackageWrapper _wrapper = null!;
public PackageWrapper Wrapper
{
get => _wrapper;
set
{
if (_wrapper != null)
{
_wrapper.PropertyChanged -= Wrapper_PropertyChanged;
}
_wrapper = value;
if (_wrapper != null)
{
_wrapper.PropertyChanged += Wrapper_PropertyChanged;
}
}
}

private void Wrapper_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(PackageWrapper.IsChecked))
{
var peer = FrameworkElementAutomationPeer.FromElement(this) as PackageItemContainerAutomationPeer;
if (peer != null)
{
ToggleState oldState = !Wrapper.IsChecked ? ToggleState.On : ToggleState.Off;
ToggleState newState = Wrapper.IsChecked ? ToggleState.On : ToggleState.Off;
peer.RaiseToggleStatePropertyChanged(oldState, newState);
}
}
}

protected override AutomationPeer OnCreateAutomationPeer()
{
return new PackageItemContainerAutomationPeer(this);
}
}

public partial class PackageItemContainerAutomationPeer : FrameworkElementAutomationPeer, IToggleProvider
{
private readonly PackageItemContainer _owner;

public PackageItemContainerAutomationPeer(PackageItemContainer owner) : base(owner)
{
_owner = owner;
}

protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.CheckBox;
}

protected override object GetPatternCore(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.Toggle)
{
return this;
}
return base.GetPatternCore(patternInterface);
}

public ToggleState ToggleState => (_owner.Wrapper != null && _owner.Wrapper.IsChecked) ? ToggleState.On : ToggleState.Off;

public void Toggle()
{
_owner.Wrapper?.IsChecked = !_owner.Wrapper.IsChecked;
}

public void RaiseToggleStatePropertyChanged(ToggleState oldValue, ToggleState newValue)
{
RaisePropertyChangedEvent(TogglePatternIdentifiers.ToggleStateProperty, oldValue, newValue);
}
}
}
3 changes: 3 additions & 0 deletions src/UniGetUI/Controls/PackageWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ public bool IsChecked
{
Package.IsChecked = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsChecked)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CheckedStatus)));
_page.UpdatePackageCount();
}
}

public string CheckedStatus => IsChecked ? CoreTools.Translate("Checked") : CoreTools.Translate("Unchecked");

public bool IconWasLoaded;
public bool AlternateIdIconVisible;
public bool ShowCustomPackageIcon;
Expand Down
3 changes: 2 additions & 1 deletion src/UniGetUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
PaneToggleRequested="TitleBar_PaneToggleRequested"
SizeChanged="TitleBar_SizeChanged"
Visibility="Collapsed"
IsTabStop="False"
>
<!--TitleBar.IconSource>
<ImageIconSource ImageSource="ms-appx:///Assets/Images/icon.png" />
Expand Down Expand Up @@ -97,7 +98,7 @@
/>
</StackPanel>
<Frame Name="MainContentFrame" Grid.Row="2">
<Grid Background="{StaticResource ProgressBarBorderThemeBrush}" Visibility="Visible">
<Grid Background="{StaticResource ProgressBarBorderThemeBrush}" Visibility="Visible" AutomationProperties.Name="Loading UniGetUI">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
Expand Down
2 changes: 2 additions & 0 deletions src/UniGetUI/Pages/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@

<controls:GridSplitter
x:Name="OperationSplitter"
AutomationProperties.Name="Operation list resizer"
Grid.Row="1"
Grid.Column="0"
Height="12"
Expand All @@ -398,6 +399,7 @@
</Grid.ColumnDefinitions>
<HyperlinkButton
Name="ExpandCollapseOpList"
AutomationProperties.Name="Expand or collapse operation list"
Grid.Column="1"
Height="12"
Padding="12,0,12,0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void RefreshMinimumAgeLayout()
: new CornerRadius(8);
}

private UIElement BuildReleaseDateCompatTable()
private static UIElement BuildReleaseDateCompatTable()
{
string yesStr = CoreTools.Translate("Yes");
string noStr = CoreTools.Translate("No");
Expand Down
1 change: 1 addition & 0 deletions src/UniGetUI/Pages/SettingsPages/SettingsBasePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
</Grid.ColumnDefinitions>
<Button
Name="BackButton"
AutomationProperties.Name="Back"
Width="36"
Height="36"
Padding="6"
Expand Down
33 changes: 29 additions & 4 deletions src/UniGetUI/Pages/SoftwarePages/AbstractPackagesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
Grid.Column="0"
VerticalAlignment="Center"
IsChecked="{x:Bind IsChecked, Mode=TwoWay}"
IsTabStop="False"
AutomationProperties.AccessibilityView="Raw"
/>

<!-- Regular or package icon -->
Expand Down Expand Up @@ -285,6 +287,8 @@
HorizontalAlignment="Left"
VerticalAlignment="Top"
IsChecked="{x:Bind IsChecked, Mode=TwoWay}"
IsTabStop="False"
AutomationProperties.AccessibilityView="Raw"
/>

<Button
Expand Down Expand Up @@ -418,6 +422,8 @@
HorizontalAlignment="Left"
VerticalAlignment="Top"
IsChecked="{x:Bind IsChecked, Mode=TwoWay}"
IsTabStop="False"
AutomationProperties.AccessibilityView="Raw"
/>
<Button
Grid.Row="0"
Expand Down Expand Up @@ -591,24 +597,26 @@
VerticalAlignment="Center"
Orientation="Horizontal"
Spacing="4"
AutomationProperties.Name="View modes"
AutomationProperties.LocalizedControlType="grouping"
>
<widgets:TranslatedTextBlock VerticalAlignment="Center" Text="View mode:" />
<Toolkit:Segmented
x:Name="ViewModeSelector"
SelectionChanged="ViewModeSelector_SelectionChanged"
SelectionMode="Single"
>
<Toolkit:SegmentedItem x:Name="Selector_List">
<Toolkit:SegmentedItem x:Name="Selector_List" AutomationProperties.Name="List view">
<Toolkit:SegmentedItem.Icon>
<FontIcon Glyph="&#xE8FD;" />
</Toolkit:SegmentedItem.Icon>
</Toolkit:SegmentedItem>
<Toolkit:SegmentedItem x:Name="Selector_Grid">
<Toolkit:SegmentedItem x:Name="Selector_Grid" AutomationProperties.Name="Grid view">
<Toolkit:SegmentedItem.Icon>
<FontIcon Glyph="&#xF168;" />
</Toolkit:SegmentedItem.Icon>
</Toolkit:SegmentedItem>
<Toolkit:SegmentedItem x:Name="Selector_Icons">
<Toolkit:SegmentedItem x:Name="Selector_Icons" AutomationProperties.Name="Icons view">
<Toolkit:SegmentedItem.Icon>
<FontIcon Glyph="&#xF0E2;" />
</Toolkit:SegmentedItem.Icon>
Expand Down Expand Up @@ -641,6 +649,7 @@
<StackPanel x:Name="ToggleFiltersButtonWidth" Margin="0,0,13,0" Orientation="Horizontal">
<ToggleButton
x:Name="ToggleFiltersButton"
AutomationProperties.Name="Toggle filters panel"
Grid.Column="0"
Height="36"
Margin="1,4"
Expand Down Expand Up @@ -688,6 +697,7 @@
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button
x:Name="MainToolbarButton"
AutomationProperties.Name="{x:Bind MainToolbarButtonText.Text, Mode=OneWay}"
Height="36"
Margin="0,0,1,0"
x:FieldModifier="protected"
Expand All @@ -711,6 +721,7 @@
</Button>
<Button
x:Name="MainToolbarButtonDropdown"
AutomationProperties.Name="More actions"
Width="30"
Height="36"
Padding="4"
Expand All @@ -728,6 +739,8 @@
HorizontalAlignment="Left"
x:FieldModifier="protected"
DefaultLabelPosition="Right"
IsDynamicOverflowEnabled="False"
OverflowButtonVisibility="Collapsed"
/>
</Grid>
</Grid>
Expand All @@ -747,6 +760,7 @@
PaneClosing="FilteringPanel_PaneClosing"
PanePlacement="Left"
SizeChanged="FilteringPanel_SizeChanged"
IsTabStop="False"
>
<SplitView.Pane>
<ScrollViewer
Expand All @@ -759,6 +773,7 @@
CornerRadius="0,8,8,0"
HorizontalScrollMode="Disabled"
SizeChanged="SidepanelWidth_SizeChanged"
IsTabStop="False"
>
<Grid Name="SidePanelGrid" RowSpacing="8">
<Grid.RowDefinitions>
Expand Down Expand Up @@ -887,7 +902,7 @@
</StackPanel>
</Expander.Header>
<Expander.Content>
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Spacing="0">
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical" Spacing="0" AutomationProperties.Name="Filter options" AutomationProperties.LocalizedControlType="grouping">
<CheckBox
x:Name="InstantSearchCheckbox"
x:FieldModifier="protected"
Expand Down Expand Up @@ -959,6 +974,7 @@
>
<RadioButton
x:Name="QueryNameRadio"
AutomationProperties.Name="Package Name"
Height="30"
Margin="0,-2,0,-2"
x:FieldModifier="protected"
Expand All @@ -969,6 +985,7 @@
</RadioButton>
<RadioButton
x:Name="QueryIdRadio"
AutomationProperties.Name="Package ID"
Height="30"
Margin="0,-2,0,-2"
x:FieldModifier="protected"
Expand All @@ -979,6 +996,7 @@
</RadioButton>
<RadioButton
x:Name="QueryBothRadio"
AutomationProperties.Name="Both"
Height="30"
Margin="0,-2,0,-2"
x:FieldModifier="protected"
Expand All @@ -990,6 +1008,7 @@
</RadioButton>
<RadioButton
x:Name="QueryExactMatch"
AutomationProperties.Name="Exact match"
Height="30"
Margin="0,-2,0,-2"
x:FieldModifier="protected"
Expand All @@ -1000,6 +1019,7 @@
</RadioButton>
<RadioButton
x:Name="QuerySimilarResultsRadio"
AutomationProperties.Name="Show similar packages"
Height="30"
Margin="0,-2,0,-2"
x:FieldModifier="protected"
Expand Down Expand Up @@ -1070,9 +1090,12 @@
HorizontalAlignment="Stretch"
BorderThickness="0"
CornerRadius="4,0,0,4"
IsTabStop="False"
AutomationProperties.AccessibilityView="Raw"
>
<CheckBox
Name="SelectAllCheckBox"
AutomationProperties.Name="Select all packages"
Margin="12,4,4,4"
Checked="SelectAllCheckBox_ValueChanged"
Unchecked="SelectAllCheckBox_ValueChanged"
Expand Down Expand Up @@ -1210,6 +1233,8 @@
Binding="{x:Bind FilteringPanel.OpenPaneLength, Mode=TwoWay}"
CornerRadius="2"
Visibility="{x:Bind FilteringPanel.IsPaneOpen, Mode=OneWay}"
IsTabStop="False"
AutomationProperties.AccessibilityView="Raw"
>
<Toolkit:PropertySizer.RenderTransform>
<TranslateTransform X="0" />
Expand Down
12 changes: 10 additions & 2 deletions src/UniGetUI/Services/UserAvatar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public UserAvatar()
{
VerticalContentAlignment = VerticalAlignment.Center;
HorizontalContentAlignment = HorizontalAlignment.Center;
Microsoft.UI.Xaml.Automation.AutomationProperties.SetName(this, CoreTools.Translate("User profile"));
ToolTipService.SetToolTip(this, CoreTools.Translate("User profile"));
_ = RefreshStatus();
GitHubAuthService.AuthStatusChanged += GitHubAuthService_AuthStatusChanged;
}
Expand Down Expand Up @@ -166,7 +168,7 @@ private PointButton GenerateLoginControl()
Content = stackPanel,
};

return new PointButton
var btn = new PointButton
{
Margin = new Thickness(0),
Padding = new Thickness(4),
Expand All @@ -176,6 +178,9 @@ private PointButton GenerateLoginControl()
Content = personPicture,
Flyout = flyout,
};
Microsoft.UI.Xaml.Automation.AutomationProperties.SetName(btn, CoreTools.Translate("User profile"));
ToolTipService.SetToolTip(btn, CoreTools.Translate("User profile"));
return btn;
}

private async Task<PointButton> GenerateLogoutControl()
Expand Down Expand Up @@ -289,7 +294,7 @@ private async Task<PointButton> GenerateLogoutControl()
Content = stackPanel,
};

return new PointButton
var btn = new PointButton
{
Margin = new Thickness(0),
Padding = new Thickness(4),
Expand All @@ -299,6 +304,9 @@ private async Task<PointButton> GenerateLogoutControl()
Content = personPicture,
Flyout = flyout,
};
Microsoft.UI.Xaml.Automation.AutomationProperties.SetName(btn, CoreTools.Translate("User profile"));
ToolTipService.SetToolTip(btn, CoreTools.Translate("User profile"));
return btn;
}
}
}
Loading