Uno 开源项目教程

Uno 开源项目教程

UnoA next-gen solver for optimization with nonconvex objective and constraints. Reimplements filterSQP and IPOPT (barrier) in a modern and generic way, and unlocks a variety of novel methods. Competitive against filterSQP, IPOPT, SNOPT, MINOS and CONOPT.项目地址:https://gitcode.com/gh_mirrors/uno3/Uno

1. 项目的目录结构及介绍

Uno 项目的目录结构如下:

Uno/
├── README.md
├── Uno.sln
├── Uno.UI.sln
├── src/
│   ├── Uno.Core/
│   ├── Uno.Foundation/
│   ├── Uno.UI/
│   ├── Uno.Wasm.Bootstrap/
│   ├── Uno.Xaml/
│   └── ...
├── tests/
│   ├── Uno.Core.Tests/
│   ├── Uno.Foundation.Tests/
│   ├── Uno.UI.Tests/
│   └── ...
└── ...

目录结构介绍

  • README.md: 项目介绍和基本使用说明。
  • Uno.slnUno.UI.sln: 项目的解决方案文件,用于在 Visual Studio 中打开和管理项目。
  • src/: 包含项目的源代码。
    • Uno.Core/: 核心库。
    • Uno.Foundation/: 基础库。
    • Uno.UI/: UI 库。
    • Uno.Wasm.Bootstrap/: WebAssembly 启动库。
    • Uno.Xaml/: XAML 支持库。
  • tests/: 包含项目的测试代码。
    • Uno.Core.Tests/: 核心库的测试。
    • Uno.Foundation.Tests/: 基础库的测试。
    • Uno.UI.Tests/: UI 库的测试。

2. 项目的启动文件介绍

项目的启动文件主要位于 src/Uno.UI/ 目录下,其中 App.xamlApp.xaml.cs 是主要的启动文件。

App.xaml

<Application
    x:Class="Uno.UI.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Uno.UI">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

App.xaml.cs

namespace Uno.UI
{
    public partial class App : Application
    {
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;
        }

        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // 从之前的会话中恢复状态
                }

                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                Window.Current.Activate();
            }
        }

        void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
        }

        private void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();
            // 保存应用程序状态并停止任何后台活动
            deferral.Complete();
        }
    }
}

3. 项目的配置文件介绍

项目的配置文件主要位于 src/Uno.UI/ 目录下,其中 App.configUno.UI.csproj 是主要的配置文件。

App.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2

UnoA next-gen solver for optimization with nonconvex objective and constraints. Reimplements filterSQP and IPOPT (barrier) in a modern and generic way, and unlocks a variety of novel methods. Competitive against filterSQP, IPOPT, SNOPT, MINOS and CONOPT.项目地址:https://gitcode.com/gh_mirrors/uno3/Uno

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

孙泽忱

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值