ArchLeaders / ConfigFactory

Generic library for creating extensible config arrangements to be used with a UI builder
GNU Affero General Public License v3.0
6 stars 4 forks source link

Header and Description didn't show #13

Open zhusihan-python opened 1 day ago

zhusihan-python commented 1 day ago

Setting value loaded successfully, but the Header and Description didn't show image

I'm using ConfigFactory 0.4.2, Avalonia 11.2.0 on Windows 11 here is the code, I'm not sure if some settings are wrong

SlideSealTabView.axaml

<UserControl 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"
             xmlns:controls="clr-namespace:ConfigFactory.Avalonia;assembly=ConfigFactory.Avalonia"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="550"
             xmlns:suki="clr-namespace:SukiUI.Controls;assembly=SukiUI"
             x:Class="Hermes.Features.Bender.SlideSealTabView">
    <suki:GlassCard Margin="10"
                      HorizontalAlignment="Stretch">
        <controls:ConfigPage Name="ParamConfigPage">
            <controls:ConfigPage.Resources>
                <SolidColorBrush x:Key="SystemChromeHighColor" Color="{DynamicResource SukiAccentColor}" />
            </controls:ConfigPage.Resources>
            <controls:ConfigPage.Styles>
                <Style Selector="ToggleButton:checked">
                    <Setter Property="BorderBrush" Value="{DynamicResource SukiAccentColor}" />
                    <Setter Property="Background" Value="Black" />
                </Style>
                <Style Selector="ToggleButton:checked AccessText">
                    <Setter Property="Foreground" Value="{DynamicResource SukiAccentColor}" />
                </Style>
                <Style Selector="ToggleButton:pointerover AccessText">
                    <Setter Property="Foreground" Value="{DynamicResource SukiAccentColor75}" />
                </Style>
                <Style Selector="Grid#PART_FocusDelegate_2 TextBlock[FontWeight=SemiBold]">
                    <Setter Property="Foreground" Value="{DynamicResource SukiAccentColor}" />
                </Style>
            </controls:ConfigPage.Styles>
        </controls:ConfigPage>
    </suki:GlassCard>
</UserControl>

ConfigModel: SlideSealTabViewModel.cs

public partial class SlideSealTabViewModel: ParamBaseConfigModel<SlideSealTabViewModel>
{
    public SlideSealTabViewModel(ILogger logger,
        ISettingsRepository settingsRepository):
        base(logger, settingsRepository)
    {

    }
    #region General

    [ObservableProperty]
    [property: DropdownConfig(RuntimeItemsSourceMethodName = "Languages")]
    [property: Config(
        Header = "c_settings_header_language",
        Description = "c_settings_description_language",
        Category = "c_settings_category_general",
        Group = "c_settings_group_common")]
    private LanguageType _language = LanguageType.En;

    public static LanguageType[] Languages => EnumExtensions.GetValues<LanguageType>();

    [ObservableProperty]
    [property: NumericConfig(Minimum = 100, Maximum = 2000, Increment = 1)]
    [property: Config(
        Header = "c_settings_header_wait_delay_ms",
        Description = "c_settings_description_wait_delay_ms",
        Category = "c_settings_category_general",
        Group = "c_settings_group_common")]
    private int _waitDelayMilliseconds = 100;

    [ObservableProperty]
    [property: Config(
        Header = "Database server",
        Description = "c_settings_header_database_server",
        Category = "c_settings_category_general",
        Group = "c_settings_group_common")]
    private string _databaseServer = "10.12.204.48";

    [ObservableProperty]
    [property: Config(
        Header = "c_settings_header_update_manager_url",
        Description = "c_settings_header_update_manager_url",
        Category = "c_settings_category_general",
        Group = "c_settings_group_common")]
    private string _updateManagerUrl = @"10.12.204.48/hermes/download";

    [ObservableProperty]
    [property: DropdownConfig(RuntimeItemsSourceMethodName = "LineType")]
    [property: Config(
        Header = "c_settings_header_line_name",
        Description = "c_settings_header_line_name",
        Category = "c_settings_category_general",
        Group = "c_settings_group_station")]
    private LineType _line = LineType.Ag01;

    public static LineType[] LineTypes => EnumExtensions.GetValues<LineType>();

    [ObservableProperty]
    [property: DropdownConfig(RuntimeItemsSourceMethodName = "StationType")]
    [property: Config(
        Header = "c_settings_header_station",
        Description = "c_settings_header_station",
        Category = "c_settings_category_general",
        Group = "c_settings_group_station")]
    private StationType _station = StationType.SpiBottom;

    [ObservableProperty]
    [property: Config(
        Header = "c_settings_header_station_id",
        Description = "c_settings_header_station_id",
        Category = "c_settings_category_general",
        Group = "c_settings_group_station")]
    private string _stationId = "";

    public static StationType[] StationTypes => EnumExtensions.GetValues<StationType>();

    [ObservableProperty]
    [property: DropdownConfig(RuntimeItemsSourceMethodName = "MachineType")]
    [property: Config(
        Header = "c_settings_header_machine_type",
        Description = "c_settings_header_machine_type",
        Category = "c_settings_category_general",
        Group = "c_settings_group_station")]
    private MachineType _machine = MachineType.Spi;

    public static MachineType[] MachineTypes => EnumExtensions.GetValues<MachineType>();

    [ObservableProperty]
    [property: DropdownConfig(RuntimeItemsSourceMethodName = "LogfileTypes")]
    [property: Config(
        Header = "c_settings_header_logfile_type",
        Description = "c_settings_header_logfile_type",
        Category = "c_settings_category_general",
        Group = "c_settings_group_station")]
    private LogfileType _logfileType = LogfileType.TriDefault;

    public static LogfileType[] LogfileTypes => EnumExtensions.GetValues<LogfileType>();

    [ObservableProperty]
    [property: DropdownConfig(RuntimeItemsSourceMethodName = "FileExtensions")]
    [property: Config(
        Header = "c_settings_header_sfc_response_ext",
        Description = "c_settings_header_sfc_response_ext",
        Category = "c_settings_category_general",
        Group = "c_settings_group_station")]
    private FileExtension _sfcResponseExtension = FileExtension.Ret;

    [ObservableProperty]
    [property: DropdownConfig(RuntimeItemsSourceMethodName = "FileExtensions")]
    [property: Config(
        Header = "c_settings_header_input_file_ext",
        Description = "c_settings_header_input_file_ext",
        Category = "c_settings_category_general",
        Group = "c_settings_group_station")]
    private FileExtension _inputFileExtension = FileExtension.Ret;

    #endregion
}

view SlideSealTabView.cs

public partial class SlideSealTabView : UserControl
{
    public SlideSealTabView()
    {
        InitializeComponent();
        var serviceProvider = ((App)Application.Current).GetServiceProvider();
        var slideSealTabViewModel = serviceProvider.GetService<SlideSealTabViewModel>()!;
        if (ParamConfigPage.DataContext is ConfigPageModel model)
        {
            model.Append(slideSealTabViewModel);
        }
    }
}
ArchLeaders commented 1 day ago

Could you provide a minimal example to recreate this issue?

I can't tell from this what the issue might be. It's likely something conflicting with SukiUI but I could be wrong.

zhusihan-python commented 18 hours ago

thanks for the quick reply, i worked on extracting a minimal example, but kind of hard for me to make it compile successfully until now, i will continue this weekend