• 大小: 10.33MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-08-25
  • 语言: C/C++
  • 标签: 计算器  C++  Win10  

资源简介

最近微软开源了Win10上的计算器代码,并且此次微软抛弃了自己的亲儿子C#,改用C++,喜大普奔,VS2017可直接编译

资源截图

代码片段和文件信息

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Etw.Managed;
using Microsoft.OneCoreUap.Test.AppModel;
using MS.Internal.Mita.Foundation;
using MS.Internal.Mita.Foundation.Controls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Calculator.UIAutomationLibrary.Components;
using WEX.Logging.Interop;

namespace Calculator.UIAutomationLibrary
{
    /// 
    /// Class that can open and close the Calculator app.
    /// 

    public static class CalculatorAppLauncher
    {
        public const string CoreWindowClassName = “Windows.UI.Core.CoreWindow“;

        // This doesn‘t actually work right now because popup will disappear
        // Bug 13713223: ContentDialog/Popup does not show up in the UIA tree when Windows.Current.Content has an AutomationName set.
        // public static readonly UICondition TopLevelWindowUICondition = UICondition.CreateFromId(Constants.TopLevelWindowAutomationId);
        public static readonly UICondition CoreWindowUICondition = UICondition.CreateFromClassName(CoreWindowClassName)
            .AndWith(UICondition.CreateFromName(Constants.AppWindowName));

        /// 
        /// Launch the app
        /// 

        public static CalculatorAppLfm Launch()
        {
            Log.Comment(“Launching Calculator and waiting for first page load...“);

            // Need to set this for the MITALite Tap~ methods to work on high DPI screens.
            UAPApp.SetTestDPIAwareness();

            // We want to be able to see any element in the tree
            Context.RawContext.Activate();

            // Set default wait timeout.
            MS.Internal.Mita.Foundation.Waiters.Waiter.DefaultTimeout = TimeSpan.FromSeconds(30);

            // Enable Mita internal logging.
            MS.Internal.Mita.Foundation.Utilities.Log.OutImplementation = (s a) => { Log.Comment($“- [MitaLite] { string.Format(s a) }“); };
            
            using (EtwWaiter appLaunchWaiter = new EtwWaiter(Constants.CalculatorETWProviderGUID Constants.AppLaunchEndETWEventName))
            {
                var viewDescriptor = Navigationhelper.LaunchApplication(Constants.PackageAppUserModelId);
                appLaunchWaiter.Wait(TimeSpan.FromSeconds(30));

                Window calculatorWindow = new Window(UIobject.Root.Descendants.Find(CoreWindowUICondition));
                Debug.Assert(calculatorWindow.ClassName == CoreWindowClassName);

                // Move our window to the foreground.
                WindowHelper.SetAsForeground(calculatorWindow.GetTopLevelWindow());

                return new CalculatorAppLfm(new CalculatorAppPom(calculatorWindow) viewDescriptor);
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-03-16 04:21  calculator-master\
     文件         207  2019-03-16 04:21  calculator-master\.editorconfig
     文件        2492  2019-03-16 04:21  calculator-master\.gitattributes
     目录           0  2019-03-16 04:21  calculator-master\.github\
     目录           0  2019-03-16 04:21  calculator-master\.github\ISSUE_TEMPLATE\
     文件        1178  2019-03-16 04:21  calculator-master\.github\ISSUE_TEMPLATE\bug_report.md
     文件        1580  2019-03-16 04:21  calculator-master\.github\ISSUE_TEMPLATE\feature_request.md
     文件         336  2019-03-16 04:21  calculator-master\.github\pull_request_template.md
     文件        4963  2019-03-16 04:21  calculator-master\.gitignore
     文件         351  2019-03-16 04:21  calculator-master\CODE_OF_CONDUCT.md
     文件        5677  2019-03-16 04:21  calculator-master\CONTRIBUTING.md
     文件        1095  2019-03-16 04:21  calculator-master\LICENSE
     文件        1772  2019-03-16 04:21  calculator-master\NOTICE.txt
     文件        3806  2019-03-16 04:21  calculator-master\README.md
     目录           0  2019-03-16 04:21  calculator-master\Tools\
     目录           0  2019-03-16 04:21  calculator-master\Tools\PGO\
     文件         716  2019-03-16 04:21  calculator-master\Tools\PGO\Microsoft.WindowsCalculator.PGO.nuspec
     目录           0  2019-03-16 04:21  calculator-master\Tools\PGO\build\
     目录           0  2019-03-16 04:21  calculator-master\Tools\PGO\build\native\
     文件         244  2019-03-16 04:21  calculator-master\Tools\PGO\build\native\Microsoft.WindowsCalculator.PGO.props
     文件        2468  2019-03-16 04:21  calculator-master\Tools\PGO\build\native\Microsoft.WindowsCalculator.PGO.targets
     目录           0  2019-03-16 04:21  calculator-master\build\
     目录           0  2019-03-16 04:21  calculator-master\build\config\
     文件         392  2019-03-16 04:21  calculator-master\build\config\LocConfigPackageEs.xml
     文件         410  2019-03-16 04:21  calculator-master\build\config\SignConfig.xml
     目录           0  2019-03-16 04:21  calculator-master\build\config\TRexDefs\
     目录           0  2019-03-16 04:21  calculator-master\build\config\TRexDefs\amd64\
     文件        1369  2019-03-16 04:21  calculator-master\build\config\TRexDefs\amd64\performance.xml
     文件        1071  2019-03-16 04:21  calculator-master\build\config\TRexDefs\amd64\rs4_release.xml
     文件        1113  2019-03-16 04:21  calculator-master\build\config\TRexDefs\amd64\rs5_release.xml
     文件        2068  2019-03-16 04:21  calculator-master\build\config\TRexDefs\amd64\rs_apps_validate.xml
............此处省略874个文件信息

评论

共有 条评论