Skip to content

Commit

Permalink
Merge pull request #793 from lepoco/development
Browse files Browse the repository at this point in the history
Update main branch from development, bump version to 3.0.0-preview.8
  • Loading branch information
pomianowski committed Oct 22, 2023
2 parents bb3933b + 763174b commit a58feed
Show file tree
Hide file tree
Showing 172 changed files with 2,592 additions and 1,477 deletions.
2 changes: 1 addition & 1 deletion .csharpierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"printWidth": 130,
"printWidth": 110,
"useTabs": false,
"tabWidth": 4,
"preprocessorSymbolSets": [
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Version>3.0.0-preview.7</Version>
<Version>3.0.0-preview.8</Version>
<LangVersion>11.0</LangVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>
Expand Down
6 changes: 5 additions & 1 deletion docs/codesnippet/Rtf/RtfDocumentProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ public FileModel Load(FileAndType file, ImmutableDictionary<string, object> meta
#region Save
public SaveResult Save(FileModel model)
{
return new SaveResult { DocumentType = "Conceptual", FileWithoutExtension = Path.ChangeExtension(model.File, null), };
return new SaveResult
{
DocumentType = "Conceptual",
FileWithoutExtension = Path.ChangeExtension(model.File, null),
};
}
#endregion

Expand Down
3 changes: 2 additions & 1 deletion src/Wpf.Ui.Demo.Mvvm/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public partial class App
/// </summary>
/// <typeparam name="T">Type of the service to get.</typeparam>
/// <returns>Instance of the service or <see langword="null"/>.</returns>
public static T? GetService<T>() where T : class
public static T? GetService<T>()
where T : class
{
return _host.Services.GetService(typeof(T)) as T;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Wpf.Ui.Demo.Mvvm/Services/ApplicationHostService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ private async Task HandleActivationAsync()

if (!Application.Current.Windows.OfType<MainWindow>().Any())
{
_navigationWindow = (_serviceProvider.GetService(typeof(INavigationWindow)) as INavigationWindow)!;
_navigationWindow = (
_serviceProvider.GetService(typeof(INavigationWindow)) as INavigationWindow
)!;
_navigationWindow!.ShowWindow();

_navigationWindow.Navigate(typeof(Views.Pages.DashboardPage));
Expand Down
3 changes: 2 additions & 1 deletion src/Wpf.Ui.Demo.Mvvm/Services/PageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public PageService(IServiceProvider serviceProvider)
}

/// <inheritdoc />
public T? GetPage<T>() where T : class
public T? GetPage<T>()
where T : class
{
if (!typeof(FrameworkElement).IsAssignableFrom(typeof(T)))
throw new InvalidOperationException("The page should be a WPF control.");
Expand Down
7 changes: 6 additions & 1 deletion src/Wpf.Ui.Demo.Mvvm/ViewModels/DataViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ private void InitializeViewModel()
new DataColor
{
Color = new SolidColorBrush(
Color.FromArgb((byte)200, (byte)random.Next(0, 250), (byte)random.Next(0, 250), (byte)random.Next(0, 250))
Color.FromArgb(
(byte)200,
(byte)random.Next(0, 250),
(byte)random.Next(0, 250),
(byte)random.Next(0, 250)
)
)
}
);
Expand Down
8 changes: 6 additions & 2 deletions src/Wpf.Ui.Demo.Mvvm/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ public partial class SettingsViewModel : ObservableObject, INavigationAware
private string _appVersion = String.Empty;

[ObservableProperty]
private Wpf.Ui.Appearance.ApplicationTheme _currentApplicationTheme = Wpf.Ui.Appearance.ApplicationTheme.Unknown;
private Wpf.Ui.Appearance.ApplicationTheme _currentApplicationTheme = Wpf.Ui
.Appearance
.ApplicationTheme
.Unknown;

public void OnNavigatedTo()
{
Expand All @@ -35,7 +38,8 @@ private void InitializeViewModel()

private string GetAssemblyVersion()
{
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? String.Empty;
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString()
?? String.Empty;
}

[RelayCommand]
Expand Down
6 changes: 5 additions & 1 deletion src/Wpf.Ui.Demo.Mvvm/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ public partial class MainWindow : INavigationWindow
{
public ViewModels.MainWindowViewModel ViewModel { get; }

public MainWindow(ViewModels.MainWindowViewModel viewModel, IPageService pageService, INavigationService navigationService)
public MainWindow(
ViewModels.MainWindowViewModel viewModel,
IPageService pageService,
INavigationService navigationService
)
{
ViewModel = viewModel;
DataContext = this;
Expand Down
4 changes: 2 additions & 2 deletions src/Wpf.Ui.Demo.Mvvm/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="https://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="https://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
Expand Down
5 changes: 4 additions & 1 deletion src/Wpf.Ui.Demo.Simple/Views/Pages/DashboardPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public DashboardPage()

private void OnBaseButtonClick(object sender, RoutedEventArgs e)
{
CounterTextBlock.SetCurrentValue(System.Windows.Controls.TextBlock.TextProperty, (++_counter).ToString());
CounterTextBlock.SetCurrentValue(
System.Windows.Controls.TextBlock.TextProperty,
(++_counter).ToString()
);
}
}
7 changes: 6 additions & 1 deletion src/Wpf.Ui.Demo.Simple/Views/Pages/DataPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ private void InitializeData()
new DataColor
{
Color = new SolidColorBrush(
Color.FromArgb((byte)200, (byte)random.Next(0, 250), (byte)random.Next(0, 250), (byte)random.Next(0, 250))
Color.FromArgb(
(byte)200,
(byte)random.Next(0, 250),
(byte)random.Next(0, 250),
(byte)random.Next(0, 250)
)
)
}
);
Expand Down
3 changes: 2 additions & 1 deletion src/Wpf.Ui.Demo.Simple/Views/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private void OnDarkThemeRadioButtonChecked(object sender, RoutedEventArgs e)

private string GetAssemblyVersion()
{
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? String.Empty;
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString()
?? String.Empty;
}
}
4 changes: 2 additions & 2 deletions src/Wpf.Ui.Demo.Simple/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="https://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="https://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
Expand Down
4 changes: 2 additions & 2 deletions src/Wpf.Ui.Extension.Template.Blank/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="https://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="https://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
Expand Down
4 changes: 2 additions & 2 deletions src/Wpf.Ui.Extension.Template.Compact/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="https://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="https://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
Expand Down
4 changes: 2 additions & 2 deletions src/Wpf.Ui.Extension.Template.Fluent/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="https://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="https://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
Expand Down
10 changes: 8 additions & 2 deletions src/Wpf.Ui.FontMapper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ async Task FetchFontContents(FontSource source, string version)
await httpClient.GetFromJsonAsync<Dictionary<string, long>>(source.SourcePath)
?? throw new Exception("Unable to obtain JSON data");

sourceJsonContent = sourceJsonContent.OrderBy(x => x.Value).ToDictionary(k => FormatIconName(k.Key), v => v.Value);
sourceJsonContent = sourceJsonContent
.OrderBy(x => x.Value)
.ToDictionary(k => FormatIconName(k.Key), v => v.Value);

source.SetContents(sourceJsonContent);
source.UpdateVersion(version);
Expand Down Expand Up @@ -144,7 +146,11 @@ async Task WriteToFile(FontSource singleFont, string fileRootDirectory)
_ = enumMapStringBuilder.AppendLine($" {singleIcon.Key} = 0x{singleIcon.Value:X},");
}

_ = enumMapStringBuilder.AppendLine("}").AppendLine(String.Empty).AppendLine("#pragma warning restore CS1591").Append("\r\n");
_ = enumMapStringBuilder
.AppendLine("}")
.AppendLine(String.Empty)
.AppendLine("#pragma warning restore CS1591")
.Append("\r\n");

var fileInfo = new FileInfo(destinationPath);

Expand Down
2 changes: 2 additions & 0 deletions src/Wpf.Ui.Gallery/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
</ResourceDictionary.MergedDictionaries>

<helpers:EnumToBooleanConverter x:Key="EnumToBooleanConverter" />
<helpers:ThemeToIndexConverter x:Key="ThemeToIndexConverter" />
<helpers:PaneDisplayModeToIndexConverter x:Key="PaneDisplayModeToIndexConverter" />

</ResourceDictionary>
</Application.Resources>
Expand Down
3 changes: 2 additions & 1 deletion src/Wpf.Ui.Gallery/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public partial class App
/// </summary>
/// <typeparam name="T">Type of the service to get.</typeparam>
/// <returns>Instance of the service or <see langword="null"/>.</returns>
public static T GetRequiredService<T>() where T : class
public static T GetRequiredService<T>()
where T : class
{
return _host.Services.GetRequiredService<T>();
}
Expand Down
7 changes: 5 additions & 2 deletions src/Wpf.Ui.Gallery/Controllers/MonacoController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ public async Task SetThemeAsync(ApplicationTheme appApplicationTheme)

public async Task SetLanguageAsync(MonacoLanguage monacoLanguage)
{
var languageId = monacoLanguage == MonacoLanguage.ObjectiveC ? "objective-c" : monacoLanguage.ToString().ToLower();
var languageId =
monacoLanguage == MonacoLanguage.ObjectiveC ? "objective-c" : monacoLanguage.ToString().ToLower();

await _webView.ExecuteScriptAsync("monaco.editor.setModelLanguage(" + EditorObject + $".getModel(), \"{languageId}\");");
await _webView.ExecuteScriptAsync(
"monaco.editor.setModelLanguage(" + EditorObject + $".getModel(), \"{languageId}\");"
);
}

public async Task SetContentAsync(string contents)
Expand Down
10 changes: 8 additions & 2 deletions src/Wpf.Ui.Gallery/Controls/ControlExample.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public class ControlExample : Control
nameof(XamlCodeSource),
typeof(Uri),
typeof(ControlExample),
new PropertyMetadata(null, static (o, args) => ((ControlExample)o).OnXamlCodeSourceChanged((Uri)args.NewValue))
new PropertyMetadata(
null,
static (o, args) => ((ControlExample)o).OnXamlCodeSourceChanged((Uri)args.NewValue)
)
);

public static readonly DependencyProperty CsharpCodeProperty = DependencyProperty.Register(
Expand All @@ -49,7 +52,10 @@ public class ControlExample : Control
nameof(CsharpCodeSource),
typeof(Uri),
typeof(ControlExample),
new PropertyMetadata(null, static (o, args) => ((ControlExample)o).OnCsharpCodeSourceChanged((Uri)args.NewValue))
new PropertyMetadata(
null,
static (o, args) => ((ControlExample)o).OnCsharpCodeSourceChanged((Uri)args.NewValue)
)
);

public string? HeaderText
Expand Down
24 changes: 15 additions & 9 deletions src/Wpf.Ui.Gallery/Controls/PageControlDocumentation.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class PageControlDocumentation : Control

public static void SetShow(FrameworkElement target, bool show) => target.SetValue(ShowProperty, show);

public static Type? GetDocumentationType(FrameworkElement target) => (Type?)target.GetValue(DocumentationTypeProperty);
public static Type? GetDocumentationType(FrameworkElement target) =>
(Type?)target.GetValue(DocumentationTypeProperty);

public static void SetDocumentationType(FrameworkElement target, Type type) =>
target.SetValue(DocumentationTypeProperty, type);
Expand All @@ -40,12 +41,13 @@ public class PageControlDocumentation : Control
new FrameworkPropertyMetadata(null)
);

public static readonly DependencyProperty IsDocumentationLinkVisibleProperty = DependencyProperty.Register(
nameof(IsDocumentationLinkVisible),
typeof(Visibility),
typeof(PageControlDocumentation),
new FrameworkPropertyMetadata(Visibility.Collapsed)
);
public static readonly DependencyProperty IsDocumentationLinkVisibleProperty =
DependencyProperty.Register(
nameof(IsDocumentationLinkVisible),
typeof(Visibility),
typeof(PageControlDocumentation),
new FrameworkPropertyMetadata(Visibility.Collapsed)
);

public static readonly DependencyProperty TemplateButtonCommandProperty = DependencyProperty.Register(
nameof(TemplateButtonCommand),
Expand Down Expand Up @@ -73,7 +75,10 @@ public PageControlDocumentation()
Loaded += static (sender, _) => ((PageControlDocumentation)sender).OnLoaded();
Unloaded += static (sender, _) => ((PageControlDocumentation)sender).OnUnloaded();

SetValue(TemplateButtonCommandProperty, new CommunityToolkit.Mvvm.Input.RelayCommand<string>(OnClick));
SetValue(
TemplateButtonCommandProperty,
new CommunityToolkit.Mvvm.Input.RelayCommand<string>(OnClick)
);
}

private FrameworkElement? _page;
Expand Down Expand Up @@ -127,7 +132,8 @@ private void OnClick(string? param)

string navigationUrl = param switch
{
"doc" when GetDocumentationType(_page) is { } documentationType => CreateUrlForDocumentation(documentationType),
"doc" when GetDocumentationType(_page) is { } documentationType
=> CreateUrlForDocumentation(documentationType),
"xaml" => CreateUrlForGithub(_page.GetType(), ".xaml"),
"c#" => CreateUrlForGithub(_page.GetType(), ".xaml.cs"),
_ => String.Empty
Expand Down
3 changes: 2 additions & 1 deletion src/Wpf.Ui.Gallery/Controls/TermsOfUseContentDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace Wpf.Ui.Gallery.Controls;

public partial class TermsOfUseContentDialog : ContentDialog
{
public TermsOfUseContentDialog(ContentPresenter contentPresenter) : base(contentPresenter)
public TermsOfUseContentDialog(ContentPresenter contentPresenter)
: base(contentPresenter)
{
InitializeComponent();
}
Expand Down
3 changes: 2 additions & 1 deletion src/Wpf.Ui.Gallery/Controls/TypographyControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class TypographyControl : Control
typeof(TypographyControl),
new PropertyMetadata(
FontTypography.Body,
static (o, args) => ((TypographyControl)o).OnExampleFontTypographyChanged((FontTypography)args.NewValue)
static (o, args) =>
((TypographyControl)o).OnExampleFontTypographyChanged((FontTypography)args.NewValue)
)
);

Expand Down
6 changes: 5 additions & 1 deletion src/Wpf.Ui.Gallery/ControlsLookup/ControlPages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ static class ControlPages

public static IEnumerable<GalleryPage> All()
{
foreach (var type in GalleryAssembly.Asssembly.GetTypes().Where(t => t.IsDefined(typeof(GalleryPageAttribute))))
foreach (
var type in GalleryAssembly.Asssembly
.GetTypes()
.Where(t => t.IsDefined(typeof(GalleryPageAttribute)))
)
{
var galleryPageAttribute = type.GetCustomAttributes<GalleryPageAttribute>().FirstOrDefault();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ internal static class ServiceCollectionExtensions
{
IEnumerable<Type> types = assembly
.GetTypes()
.Where(x => x.IsClass && x.Namespace!.StartsWith(namespaceName, StringComparison.InvariantCultureIgnoreCase));
.Where(
x =>
x.IsClass
&& x.Namespace!.StartsWith(namespaceName, StringComparison.InvariantCultureIgnoreCase)
);

foreach (Type? type in types)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Gallery/Helpers/EnumToBooleanConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Wpf.Ui.Gallery.Helpers;

internal class EnumToBooleanConverter : IValueConverter
internal sealed class EnumToBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Gallery/Helpers/NameToPageTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Wpf.Ui.Gallery.Helpers;

internal class NameToPageTypeConverter
internal sealed class NameToPageTypeConverter
{
private static readonly Type[] PageTypes = Assembly
.GetExecutingAssembly()
Expand Down
Loading

0 comments on commit a58feed

Please sign in to comment.