Skip to content
Open
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
238 changes: 60 additions & 178 deletions UI/CameraCaptureUI/CameraCaptureUISample.sln

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions UI/CameraCaptureUI/CameraCaptureUISample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Application x:Class="CameraCaptureUISample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Load WinUI resources -->
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
</ResourceDictionary.MergedDictionaries>

<!-- Add resources here -->

</ResourceDictionary>
</Application.Resources>

</Application>
133 changes: 133 additions & 0 deletions UI/CameraCaptureUI/CameraCaptureUISample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
using System;
using Microsoft.Extensions.Logging;
using Uno.Resizetizer;

namespace CameraCaptureUISample;

public partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}

protected Window? MainWindow { get; private set; }

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
MainWindow = new Window();
#if DEBUG
MainWindow.UseStudio();
#endif


// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (MainWindow.Content is not Frame rootFrame)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();

// Place the frame in the current Window
MainWindow.Content = rootFrame;

rootFrame.NavigationFailed += OnNavigationFailed;
}

if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), args.Arguments);
}

MainWindow.SetWindowIcon();
// Ensure the current window is active
MainWindow.Activate();
}

/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new InvalidOperationException($"Failed to load {e.SourcePageType.FullName}: {e.Exception}");
}

/// <summary>
/// Configures global Uno Platform logging
/// </summary>
public static void InitializeLogging()
{
#if DEBUG
// Logging is disabled by default for release builds, as it incurs a significant
// initialization cost from Microsoft.Extensions.Logging setup. If startup performance
// is a concern for your application, keep this disabled. If you're running on the web or
// desktop targets, you can use URL or command line parameters to enable it.
//
// For more performance documentation: https://platform.uno/docs/articles/Uno-UI-Performance.html

var factory = LoggerFactory.Create(builder =>
{
#if __WASM__
builder.AddProvider(new global::Uno.Extensions.Logging.WebAssembly.WebAssemblyConsoleLoggerProvider());
#elif __IOS__
builder.AddProvider(new global::Uno.Extensions.Logging.OSLogLoggerProvider());

// Log to the Visual Studio Debug console
builder.AddConsole();
#else
builder.AddConsole();
#endif

// Exclude logs below this level
builder.SetMinimumLevel(LogLevel.Information);

// Default filters for Uno Platform namespaces
builder.AddFilter("Uno", LogLevel.Warning);
builder.AddFilter("Windows", LogLevel.Warning);
builder.AddFilter("Microsoft", LogLevel.Warning);

// Generic Xaml events
// builder.AddFilter("Microsoft.UI.Xaml", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.VisualStateGroup", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.StateTriggerBase", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.UIElement", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.FrameworkElement", LogLevel.Trace );

// Layouter specific messages
// builder.AddFilter("Microsoft.UI.Xaml.Controls", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.Controls.Layouter", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.Controls.Panel", LogLevel.Debug );

// builder.AddFilter("Windows.Storage", LogLevel.Debug );

// Binding related messages
// builder.AddFilter("Microsoft.UI.Xaml.Data", LogLevel.Debug );
// builder.AddFilter("Microsoft.UI.Xaml.Data", LogLevel.Debug );

// Binder memory references tracking
// builder.AddFilter("Uno.UI.DataBinding.BinderReferenceHolder", LogLevel.Debug );

// DevServer and HotReload related
// builder.AddFilter("Uno.UI.RemoteControl", LogLevel.Information);

// Debug JS interop
// builder.AddFilter("Uno.Foundation.WebAssemblyRuntime", LogLevel.Debug );
});

global::Uno.Extensions.LogExtensionPoint.AmbientLoggerFactory = factory;

#if HAS_UNO
global::Uno.UI.Adapter.Microsoft.Extensions.Logging.LoggingAdapter.Initialize();
#endif
#endif
}
}
42 changes: 42 additions & 0 deletions UI/CameraCaptureUI/CameraCaptureUISample/Assets/Icons/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions UI/CameraCaptureUI/CameraCaptureUISample/Assets/SharedAssets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Shared Assets

See documentation about assets here: https://github.com/unoplatform/uno/blob/master/doc/articles/features/working-with-assets.md

## Here is a cheat sheet

1. Add the image file to the `Assets` directory of a shared project.
2. Set the build action to `Content`.
3. (Recommended) Provide an asset for various scales/dpi

### Examples

```text
\Assets\Images\logo.scale-100.png
\Assets\Images\logo.scale-200.png
\Assets\Images\logo.scale-400.png

\Assets\Images\scale-100\logo.png
\Assets\Images\scale-200\logo.png
\Assets\Images\scale-400\logo.png
```

### Table of scales

| Scale | WinUI | iOS | Android |
|-------|:-----------:|:---------------:|:-------:|
| `100` | scale-100 | @1x | mdpi |
| `125` | scale-125 | N/A | N/A |
| `150` | scale-150 | N/A | hdpi |
| `200` | scale-200 | @2x | xhdpi |
| `300` | scale-300 | @3x | xxhdpi |
| `400` | scale-400 | N/A | xxxhdpi |
Loading
Loading