Commit 7e4979d5 authored by Joachim Ehbrecht's avatar Joachim Ehbrecht
Browse files

Code synchronization

parent d4647421
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/ButtonStyles.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/ContextMenuStyle.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/LocalizedInputStyle.xaml" />
                <!--<ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/ScrollBarStyle.xaml"/>-->
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/SeparatorStyle.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/WindowStatusBarStyle.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/WindowTitleBarStyle.xaml" />
@@ -17,6 +16,7 @@
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/DiagramDesigner/DiagramDesignerStyles.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/EditorStyles.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/ToolTipStyle.xaml" />
                <ResourceDictionary Source="pack://application:,,,/Common.UI;component/Resources/ScrollBarStyle.xaml" />

                <ResourceDictionary Source="Resources/SKyBTButtonStyles.xaml"/>
                <ResourceDictionary Source="Resources/SKyBTCommonColors.xaml"/>
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ public partial class App : Application
        #region Simpel controls

        //this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/Theming/MainWindow.xaml", UriKind.Relative );
        this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/NavigationFrame/MainWindow.xaml", UriKind.Relative );
        //this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/NavigationFrame/MainWindow.xaml", UriKind.Relative );
        //this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/Windows/TitleBarMainWindow.xaml", UriKind.Relative );
        //this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/Windows/SplashScreenMainWindow.xaml", UriKind.Relative );
        //this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/Windows/LoginMainWindow.xaml", UriKind.Relative );
@@ -41,6 +41,7 @@ public partial class App : Application
        //this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/LocalizedInput/LocalizedIdentifierInputWindow.xaml", UriKind.Relative );
        //this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/Editors/RowBasedTextEditorMainWindow.xaml", UriKind.Relative );
        //this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/Editors/IntelliSenseEditorMainWindow.xaml", UriKind.Relative );
        this.StartupUri = new Uri( "/Common.UI.ViewTest;component/Views/ScrollBar/MarkerScrollBar_MainWindow.xaml", UriKind.Relative );

        #endregion Simple controls

+10 −1
Original line number Diff line number Diff line
using System;
using System.Threading.Tasks;

using Common.UI.Interfaces.Navigation;

@@ -8,6 +9,9 @@ namespace Common.UI.ViewTest.ViewModels.NavigationFrame;

public partial class UserControlViewModelBase : ObservableObject, INavigationAwareViewModel
{
    [ObservableProperty]
    private bool _isViewEnabled;

    [ObservableProperty]
    private string? _navigationText;

@@ -21,7 +25,12 @@ public partial class UserControlViewModelBase : ObservableObject, INavigationAwa
    /// </summary>
    /// <param name="fromViewModel"> The optional ViewModel instance from where navigation has been started. </param>
    /// <param name="data"> The optional data, which is passed to the navigated ViewModel. </param>
    public void Enter( object? fromViewModel, object? data = null ) {
    public Task Enter( object? fromViewModel, object? data = null ) {
        this.NavigationText = String.Concat( "From ViewModel = ", fromViewModel?.GetType().Name ?? String.Empty, "; Object data = ", data?.ToString() ?? String.Empty );
        return Task.CompletedTask;
    }

    partial void OnIsViewEnabledChanged( bool value ) {
        
    }
}
+36 −0
Original line number Diff line number Diff line
using System.Windows;
using System.Windows.Media;

using Common.UI.Interfaces.ScrollBar;

using CommunityToolkit.Mvvm.ComponentModel;

namespace Common.UI.ViewTest.ViewModels.ScrollBar;
public partial class ItemViewAdapter : ObservableObject, IScrollBarMarkerListBoxItem
{
    public string PlainText { get; set; }

    [ObservableProperty]
    private bool _hasMarker;

    [ObservableProperty]
    private SolidColorBrush _plainTextColor;

    public ItemViewAdapter( string plainText,
                            bool hasMarker ) {
        this.PlainText = plainText;
        this.HasMarker = hasMarker;
        this.PlainTextColor = (SolidColorBrush)Application.Current.Resources["MaterialDesign.Brush.Foreground"];
    }

    partial void OnHasMarkerChanged( bool value ) {
        if ( value )
        {
            this.PlainTextColor = (SolidColorBrush)Application.Current.Resources["MaterialDesignValidationErrorBrush"];
        }
        else
        {
            this.PlainTextColor = (SolidColorBrush)Application.Current.Resources["MaterialDesign.Brush.Foreground"];
        }
    }
}
+45 −0
Original line number Diff line number Diff line
using System;
using System.Collections.ObjectModel;

using Common.UI.Interfaces.ScrollBar;
using Common.UI.Models.ViewAdapter;

using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;

namespace Common.UI.ViewTest.ViewModels.ScrollBar;
public partial class MarkerScrollBar_MainWindowViewModel : ObservableObject
{
    [ObservableProperty]
    private ObservableCollection<IScrollBarMarkerListBoxItem> _items;

    [ObservableProperty]
    private ObservableCollection<IScrollBarMarkerListBoxItem> _itemsLate;

    public MarkerScrollBar_MainWindowViewModel() {
        this.Items = new( GetTestData( 500 ) );
    }

    [RelayCommand]
    public void AssignItems() {
        this.ItemsLate = new( GetTestData( 500 ) );
    }

    private ItemViewAdapter[] GetTestData( int count ) {
        Random random;
        unchecked
        {
            random = new Random( (int)DateTime.Now.Ticks );
        }
        ItemViewAdapter[] result = new ItemViewAdapter[count];
        for ( int i = 0; i < count; i++ )
            result[i] = new( $"Item {i}", false ); // random.NextDouble() < 0.1 );

        result[10].HasMarker = true;
        result[(int)( count / 2.0 )].HasMarker = true;
        result[(int)( 2.0 * count / 3.0 )].HasMarker = true;
        result[count - 10].HasMarker = true;

        return result;
    }
}
Loading