Skip to content

Commit

Permalink
Merge branch 'unoplatform:master' into DevTKSSdocs(CTK8)
Browse files Browse the repository at this point in the history
  • Loading branch information
DevTKSS authored Jan 18, 2025
2 parents ba9bf48 + 4c8b326 commit 88301e2
Show file tree
Hide file tree
Showing 340 changed files with 6,435 additions and 2,609 deletions.
37 changes: 37 additions & 0 deletions .globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,40 @@ dotnet_diagnostic.IDE0055.severity = warning # Will be promoted as an error by T

# IDE0051: Remove unused private member
dotnet_diagnostic.IDE0051.severity = warning

# MSTEST0004: Public types should be test classes
# dotnet_diagnostic.MSTEST0004.severity = warning

# MSTEST0007: Use test attributes only on test methods
dotnet_diagnostic.MSTEST0007.severity = warning

# MSTEST0016: Test class should have test method
# Enabled only as an IDE suggestion for now. Violations can be addressed later
dotnet_diagnostic.MSTEST0016.severity = suggestion

# MSTEST0017: Assertion arguments should be passed in the correct order
dotnet_diagnostic.MSTEST0017.severity = warning

# MSTEST0023: Do not negate boolean assertions
dotnet_diagnostic.MSTEST0023.severity = warning

# MSTEST0025: Use 'Assert.Fail' instead of an always-failing assert
dotnet_diagnostic.MSTEST0025.severity = warning

# MSTEST0026: Avoid conditional access in assertions
dotnet_diagnostic.MSTEST0026.severity = suggestion

# MSTEST0029: Public method should be test method
dotnet_diagnostic.MSTEST0029.severity = warning

# MSTEST0030: Type containing [TestMethod] should be marked with [TestClass]
dotnet_diagnostic.MSTEST0030.severity = warning

# MSTEST0031: System.ComponentModel.DescriptionAttribute has no effect on test methods
dotnet_diagnostic.MSTEST0031.severity = warning

# MSTEST0032: Review or remove the assertion as its condition is known to be always true
dotnet_diagnostic.MSTEST0032.severity = warning

# MSTEST0037: Use proper 'Assert' methods
dotnet_diagnostic.MSTEST0037.severity = warning
1 change: 1 addition & 0 deletions build/cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"devs",
"dbus",
"Dismissable",
"dmgbuild",
"Docfx",
"ellipsize",
"Entra",
Expand Down
50 changes: 15 additions & 35 deletions build/ci/.azure-devops-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,10 @@ jobs:
UWP:
UNO_UWP_BUILD: true
XAML_FLAVOR_BUILD: UWP
ADDITIONAL_FLAGS: ''

WinUI:
UNO_UWP_BUILD: false
XAML_FLAVOR_BUILD: WinUI
ADDITIONAL_FLAGS: ''

# Keep for future previews
# Preview:
# ADDITIONAL_FLAGS: '/p:LangVersion=preview /p:MicrosoftNetCompilerVersionOverride=3.8.0-3.final'

#CSharp9:
# ADDITIONAL_FLAGS: '/p:LangVersion=9.0'

variables:
CombinedConfiguration: Release|Any CPU
Expand Down Expand Up @@ -77,10 +68,9 @@ jobs:
cleanDestinationFolder: false
overwriteExistingFiles: true

- task: MSBuild@1
inputs:
solution: src/Uno.UI-UnitTests-only.slnf
msbuildArguments: /r /v:m /p:CheckExclusions=True /p:Configuration=Release /nodeReuse:true /detailedsummary /m $(ADDITIONAL_FLAGS) /bl:$(build.artifactstagingdirectory)\unit-tests-build-$(XAML_FLAVOR_BUILD).binlog
- pwsh: |
dotnet build src/Uno.UI-UnitTests-only.slnf -c Release -bl:$(build.artifactstagingdirectory)\unit-tests-build-$(XAML_FLAVOR_BUILD).binlog
displayName: Build unit tests solution filter
- task: PublishBuildArtifacts@1
condition: always()
Expand All @@ -90,27 +80,17 @@ jobs:
ArtifactName: NugetPackages-Artifacts
ArtifactType: Container

- task: VisualStudioTestPlatformInstaller@1
inputs:
versionSelector: specificVersion
testPlatformVersion: 17.6.0
- pwsh: |
dotnet test src/Uno.UI-UnitTests-only.slnf -c Release --no-build -- --report-trx --results-directory $(Build.SourcesDirectory)/artifacts/TestResults
displayName: Run unit tests
- task: VSTest@2
- task: PublishTestResults@2
displayName: Publish TRX Test Results
inputs:
testAssemblyVer2: |
**\*test*.dll
!**\obj\**
!**\*Wasm.Test*.dll
!**\*UITests.dll
!**\*.RuntimeTests.dll
!**\Uno.UI.Tests.ViewLibraryProps.dll
!**\Uno.UI.Tests.ViewLibrary.dll
!**\testhost*.*
!**\Microsoft*.dll
vsTestVersion: toolsInstaller
testRunTitle: $(Agent.JobName)
testSelector: testAssemblies
batchingBasedOnAgentsOption: customBatchSize
rerunFailedTests: 'true'
customBatchSizeValue: 200 # test count / 10 (https://developercommunity.visualstudio.com/content/problem/891803/vstestconsoleadapter-fails-with-outofmemory.html?childToView=896206#comment-896206)
testResultsFormat: 'VSTest'
testResultsFiles: '*.trx'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults'
testRunTitle: 'Unit Tests $(XAML_FLAVOR_BUILD)'
mergeTestResults: true
continueOnError: true
condition: always()
10 changes: 6 additions & 4 deletions doc/articles/features/working-with-themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public class MainPage : Page

private void OnThemeChanged(ThemeListener sender)
{
bool isDarkMode = sender.CurrentTheme == ApplicationTheme.Dark;
var theme = SystemThemeHelper.IsRootInDarkMode(this.XamlRoot) ? ElementTheme.Light : ElementTheme.Dark;

SystemThemeHelper.SetApplicationTheme(darkMode: isDarkMode);
SystemThemeHelper.SetApplicationTheme(this.XamlRoot, theme);
}
}
```
Expand All @@ -94,12 +94,14 @@ public class SettingsPage : Page

private void OnLoaded(object sender, RoutedEventArgs e)
{
this.DarkModeToggle.IsOn = SystemThemeHelper.IsDarkModeEnabled;
this.DarkModeToggle.IsOn = SystemThemeHelper.IsRootInDarkMode(this.XamlRoot);
}

private void OnDarkModeToggleToggled(object sender, RoutedEventArgs e)
{
SystemThemeHelper.SetApplicationTheme(darkMode: this.DarkModeToggle.IsOn);
var theme = DarkModeToggle.IsOn ? ElementTheme.Light : ElementTheme.Dark;

SystemThemeHelper.SetApplicationTheme(this.XamlRoot, theme);
}
}
```
Expand Down
11 changes: 7 additions & 4 deletions doc/articles/features/working-with-xaml-hot-reload.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ The Uno Platform **Hot Reload** feature provides a way to modify the XAML and C#

## Features

- Supported in **Visual Studio 2022** (Windows), **VS Code** (Linux, macOS, Windows, CodeSpaces, and GitPod) and Rider (Linux, macOS, Windows)
- Supported in **Visual Studio 2022** (Windows), **VS Code** (Linux, macOS, Windows, CodeSpaces, and GitPod) and **Rider** (Linux, macOS, Windows)
- XAML and [C# Markup](xref:Uno.Extensions.Markup.Overview) Hot Reload for **iOS, Catalyst, Android, WebAssembly, and Skia (X11, Windows, macOS and FrameBuffer)**
- All **[C# of Hot Reload](https://learn.microsoft.com/visualstudio/debugger/hot-reload)** in both Visual Studio and VS Code. See [supported code changes](https://learn.microsoft.com/visualstudio/debugger/supported-code-changes-csharp).
- **Simulator and physical devices** support
- Hot Reload **Indicator** visuals for an enhanced development experience on Uno Platform targets
- **Hot Reload Indicator** visuals for an enhanced development experience on Uno Platform targets (not currently supported on WinAppSDK target)
- What can be Hot Reloaded:
- **XAML files** in the **main project** and **referenced projects libraries**
- **C# Markup controls**
- **Bindings**
- Full **x:Bind expressions**
- **x:Bind expressions**
- **App.xaml** and **referenced resource dictionaries**
- **DataTemplates**
- **Styles**
Expand Down Expand Up @@ -297,7 +297,10 @@ Mobile targets are currently using a limited version of XAML Hot Reload and do n

## Hot Reload Indicator

Hot Reload displays a visual indicator to help you further monitor changes while developing. It displays new information every time Hot Reload is triggered. The indicator is enabled by default within the `UseStudio()` method which is located in the root `App.xaml.cs` file. This displays an overlay which hosts the visual indicator. If you wish to disable it, you simply have to provide the following boolean: `EnableHotReload(disableIndicator: true)`, removing the overlay from the view.
> [!NOTE]
> The Hot Reload indicator is currently not supported for the WinAppSDK target
Hot Reload displays a visual indicator to help you further monitor changes while developing. It displays new information every time Hot Reload is triggered. The indicator is enabled by default within the `UseStudio()` method which is located in the root `App.xaml.cs` file. This displays an overlay that hosts the visual indicator. If you wish to disable it, you simply have to provide the following boolean: `UseStudio(showHotReloadIndicator: false)`, removing the overlay from the view.

<p align="center">
<img src="~/articles/Assets/features/hotreload/indicator.png" alt="A hot reload visual indicator" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ This tutorial will guide you through using Hot Design to create a simple counter
</p>

> [!NOTE]
> This tutorial is based on the [XAML + MVUX variant](xref:Uno.Workshop.Counter.XAML.MVUX) of the Counter app tutorial. It demonstrates how to create a simple cross-platform app using Uno Platform. Explore other tutorial variants [here](xref:Uno.Workshop.Counter).
> This tutorial is based on the [XAML + MVUX variant](xref:Uno.Workshop.Counter.XAML.MVUX) of the Counter app tutorial. It demonstrates how to create a simple cross-platform app using Uno Platform. If you prefer to use MVVM you can still complete this **Hot Design** tutorial by switching the MVUX code, with the MVVM code from the [XAML + MVVM variant](xref:Uno.Workshop.Counter.XAML.MVVM). Explore other tutorial variants [here](xref:Uno.Workshop.Counter).
>
> Additionally, as a general note, Hot Design can be used without selecting a specific architectural pattern, such as MVVM or MVUX, making it a versatile tool for various projects. For this particular tutorial, however, we will focus on using MVUX as an example.
>
> [!IMPORTANT]
> **Hot Design™** is currently in beta. Sign up to the [wait list](https://platform.uno/waitlist/) to get early access and be the first to try it out!
>
> [!IMPORTANT]
> Currently, **Hot Design** is not supported with C# Markup at this time and is only available with XAML.
>
> [!IMPORTANT]
> At the current stage of the **Hot Design™** beta, **only the Desktop platform is supported**. Other platforms are undergoing stabilization for Hot Design support and will be available in future updates.
Expand All @@ -32,10 +40,10 @@ For existing applications, take this opportunity to update to the [latest **Uno.

To start using **Hot Design**, ensure you are signed in with your Uno Platform account. Follow [these instructions](xref:Uno.GetStarted.Licensing) to register and sign in.

Once you're using the **latest stable 5.5 Uno.Sdk version or higher**, you can access **Hot Design** by clicking the **flame** icon in the diagnostics overlay that appears over your app.
Once you're using the **latest stable 5.5 Uno.Sdk version or higher**, you can access **Hot Design** by clicking the **flame** button in the diagnostics overlay that appears over your app.

<p align="center">
<img src="Assets/enter-hot-design-mode.png" alt="Hot Design flame icon to enter in design mode" />
<img src="Assets/enter-hot-design-mode.png" alt="Hot Design flame button to enter in design mode" />
</p>

## Creating the Counter Application
Expand Down Expand Up @@ -70,8 +78,17 @@ The template will create a solution with a single cross-platform project, named
- Select **Blank** in **Presets** selection
- Select the **Presentation** tab and choose **MVUX**
- Click **Create** to complete the wizard
- Copy the `dotnet new` command and run it from a terminal
This will create a new folder called **Counter** containing the new application.
- Copy the `dotnet new` command and run it from a terminal where you want your solution to be located.
- This will create a new folder called **Counter** containing the new application.
- Next, open the project using Visual Studio Code. In the terminal type the following:

```bash
code ./Counter
```

- Visual Studio Code might ask to restore the NuGet packages. Allow it to restore them if asked.
- Once the solution has been loaded, in the status bar at the bottom left of VS Code, `Counter.sln` is selected by default. Select `Counter.csproj` to load the project instead.
![Counter.csproj selection in Visual Studio Code](Assets/vscode-csproj-selection.png)

### [Command Line](#tab/cli)

Expand All @@ -90,7 +107,7 @@ This will create a new folder called **Counter** containing the new application.

## Assets

First, we need to add the image file to the application. Download this [SVG image](https://aka.platform.uno/counter-tutorial-svg-uno-logo) and add it to the **Assets** folder. Once added, rebuild the application to ensure the image is included in the application package.
First, we need to add the image file to the application. Download this [SVG image](https://aka.platform.uno/counter-tutorial-svg-uno-logo) (Open this [link](https://aka.platform.uno/counter-tutorial-svg-uno-logo), right-click on the SVG image and select "Save as") and add it to the **Assets** folder. Once added, rebuild the application to ensure the image is included in the application package.

> [!NOTE]
> If you're working in Visual Studio, select the newly added **logo.svg** file in the **Solution Explorer**, open the **Properties** window, and ensure the **Build Action** property is set to **`UnoImage`**. For other IDEs, no further action is required as the template automatically sets the **Build Action** to **`UnoImage`** for all files in the **Assets** folder.
Expand All @@ -103,6 +120,10 @@ Before you run the application, switch the target platform to **Desktop** (net8.

- [Visual Studio](xref:Uno.GettingStarted.CreateAnApp.VS2022#debug-the-app)
- [VS Code](xref:Uno.GettingStarted.CreateAnApp.VSCode#debug-the-app)
> [!IMPORTANT]
> In the status bar at the bottom left of VS Code, ensure `Counter.csproj` is selected (by default `Counter.sln` is selected).
>
> ![Counter.csproj selection in Visual Studio Code](Assets/vscode-csproj-selection.png)
- [Rider](xref:Uno.GettingStarted.CreateAnApp.Rider#debug-the-app)

> [!IMPORTANT]
Expand All @@ -122,13 +143,13 @@ If is not already previously done, to start using **Hot Design**, ensure you are

## Enter Hot Design Mode

To start editing the UI, enter **Hot Design** by clicking the **flame** icon in the diagnostics overlay that appears over your app (default position is in the top-left corner of the application window).
To start editing the UI, enter **Hot Design** by clicking the **flame** button in the diagnostics overlay that appears over your app (default position is in the top-left corner of the application window).

> [!NOTE]
> If you don't see the **Hot Design** flame icon, ensure that you are [signed in with your Uno Platform Account](xref:Uno.GetStarted.Licensing), enrolled in the current beta, and using the [latest stable 5.5 Uno.Sdk version or higher](https://www.nuget.org/packages/Uno.Sdk).
> If you don't see the **Hot Design** flame button, ensure that you are [signed in with your Uno Platform Account](xref:Uno.GetStarted.Licensing), enrolled in the current beta, and using the [latest stable 5.5 Uno.Sdk version or higher](https://www.nuget.org/packages/Uno.Sdk).
<p align="center">
<img src="Assets/enter-hot-design-mode.png" alt="Hot Design flame icon to enter design mode" />
<img src="Assets/enter-hot-design-mode.png" alt="Hot Design flame button to enter design mode" />
</p>

## Change the Layout
Expand Down
28 changes: 17 additions & 11 deletions doc/articles/studio/Hot Design/hot-design-getstarted-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ Use this guide to set up Hot Design and start creating and refining user interfa

## Set Up Your Environment for Hot Design

> [!IMPORTANT]
> **Hot Design™** is currently in beta. Sign up to the [wait list](https://platform.uno/waitlist/) to get early access and be the first to try it out!
>
> [!IMPORTANT]
> Currently, **Hot Design** is not supported with C# Markup at this time and is only available with XAML.
>
> [!IMPORTANT]
> At the current stage of the **Hot Design™** beta, **only the Desktop platform is supported**. Other platforms are undergoing stabilization for Hot Design support and will be available in future updates.
>
> For now, you can use the **Desktop** platform to create your UI with the runtime visual designer. Once you’re satisfied with your design, you can test the app on other platforms by launching it as you would normally.
>
> [!IMPORTANT]
> If you're new to developing with Uno Platform, make sure to set up your environment by [following our getting started guide](xref:Uno.GetStarted).
Expand All @@ -25,11 +36,6 @@ Once you're using the **latest stable 5.5 Uno.Sdk version or higher**, and provi
<img src="Assets/enter-hot-design-mode.png" alt="Hot Design flame icon to enter in design mode" />
</p>

> [!IMPORTANT]
> At the current stage of the **Hot Design™** beta, **only the Desktop platform is supported**. Other platforms are undergoing stabilization for Hot Design support and will be available in future updates.
>
> For now, you can use the **Desktop** platform to create your UI with the runtime visual designer. Once you’re satisfied with your design, you can test the app on other platforms by launching it as you would normally.
## Hot Design Core Tool Windows

Once in Hot Design, your running app becomes an interactive canvas.
Expand Down Expand Up @@ -85,7 +91,7 @@ Located at the top of the interactive canvas, the **Toolbar** streamlines your d

### Selecting elements

You can select controls on the app's current screen by simply clicking on them. A visual adorner will appear around the selected elements, clearly indicating their boundaries. The type, height, and width of the selected element are displayed below the adorner for easy reference.
You can select controls on the app's current screen by simply clicking on them. A visual adorner (in this case, a blue border) will appear around the selected elements, clearly indicating their boundaries. The type, height, and width of the selected element are displayed below the adorner for easy reference.

<p align="center">
<img src="Assets/canvas-select-single-item.png" alt="Selecting a single item on the main canvas" />
Expand Down Expand Up @@ -129,18 +135,18 @@ The **Properties** window displays the current values of a control's properties,

![Background property with autosuggest](Assets/properties-view-autosuggest-property.png)

For advanced options, clicking the **Advanced** button opens a flyout with three settings for each property: **Value**, **Binding**, or **Resource**.

![Three options for property setting and reset button](Assets/properties-view-button-flyout.png)

You can quickly identify the type of value set for a property by the icon displayed on the **Advanced** button. For example:
To the right of the property value is the **Advanced** button, which provides information on how the current property value is defined. For example:

- ![None](Assets/properties-view-advcd-button-none.png) indicates that nothing is set.
- ![XAML](Assets/properties-view-advcd-button-xaml.png) indicates a **Literal**/**XAML** value is set.
- ![Binding](Assets/properties-view-advcd-button-binding.png) indicates a **Binding** is set.
- ![Resource](Assets/properties-view-advcd-button-resource.png) indicates a **Resource** is set.
- ![Mixed Responsive](Assets/properties-view-advcd-button-mixed-responsive.png) indicates **Mixed Responsive** values is set using Responsive Extension.

Clicking the **Advanced** button opens a flyout with three settings for each property: **Value**, **Binding**, or **Resource**.

![Three options for property setting and reset button](Assets/properties-view-button-flyout.png)

> [!TIP]
> To quickly clear a property's value, click the **Reset** button. Cleared properties will behave as though they weren't specified in the original XAML file.
Expand Down
Loading

0 comments on commit 88301e2

Please sign in to comment.