winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

MSStore.h (1754B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include "Manifest.h"
      5 #include <AppInstallerProgress.h>
      6 
      7 #include <winrt/Windows.Foundation.Collections.h>
      8 #include <winrt/Windows.ApplicationModel.Store.Preview.InstallControl.h>
      9 
     10 #include <string>
     11 
     12 namespace AppInstaller::MSStore
     13 {
     14     using namespace std::string_view_literals;
     15     static constexpr std::wstring_view s_AppInstallerProductId = L"9NBLGGH4NNS1"sv;
     16 
     17     enum class MSStoreOperationType
     18     {
     19         Install,
     20         Update,
     21         Repair,
     22     };
     23 
     24     struct MSStoreOperation
     25     {
     26         MSStoreOperation(MSStoreOperationType type, const std::wstring& productId, Manifest::ScopeEnum scope, bool isSilentMode, bool force) :
     27             m_type(type), m_productId(productId), m_scope(scope), m_isSilentMode(isSilentMode), m_force(force)
     28         {
     29         }
     30 
     31         MSStoreOperation(const MSStoreOperation&) = delete;
     32         MSStoreOperation& operator=(const MSStoreOperation&) = delete;
     33 
     34         MSStoreOperation(MSStoreOperation&&) = delete;
     35         MSStoreOperation& operator=(MSStoreOperation&&) = delete;
     36 
     37         HRESULT StartAndWaitForOperation(IProgressCallback& progress);
     38 
     39     private:
     40         HRESULT InstallPackage(IProgressCallback& progress);
     41         HRESULT UpdatePackage(IProgressCallback& progress);
     42         HRESULT WaitForOperation(winrt::Windows::Foundation::Collections::IVectorView<winrt::Windows::ApplicationModel::Store::Preview::InstallControl::AppInstallItem>& installItems, IProgressCallback& progress);
     43 
     44         MSStoreOperationType m_type;
     45         std::wstring m_productId;
     46         Manifest::ScopeEnum m_scope;
     47         bool m_isSilentMode;
     48         bool m_force;
     49     };
     50 }