@@ -1031,6 +1031,113 @@ public static void UnsetAutoRestart()
10311031 }
10321032 }
10331033
1034+ /// <summary>
1035+ /// Sets the default application for the app control.
1036+ /// </summary>
1037+ /// <remarks>
1038+ /// This method sets the specified application as the default handler
1039+ /// for the given app control's operation, MIME type, and URI combination.
1040+ /// This method is only available for platform level signed applications.
1041+ /// </remarks>
1042+ /// <param name="appControl">The AppControl.</param>
1043+ /// <param name="applicationId">The application ID to set as default.</param>
1044+ /// <exception cref="ArgumentNullException">Thrown when the argument is null.</exception>
1045+ /// <exception cref="ArgumentException">Thrown when the argument is invalid.</exception>
1046+ /// <exception cref="Exceptions.PermissionDeniedException">Thrown when the permission is denied.</exception>
1047+ /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
1048+ /// <since_tizen> 14 </since_tizen>
1049+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
1050+ public static void SetDefaultApplication ( AppControl appControl , string applicationId )
1051+ {
1052+ if ( appControl == null )
1053+ {
1054+ throw new ArgumentNullException ( nameof ( appControl ) ) ;
1055+ }
1056+
1057+ if ( string . IsNullOrEmpty ( applicationId ) )
1058+ {
1059+ throw new ArgumentNullException ( nameof ( applicationId ) ) ;
1060+ }
1061+
1062+ Interop . AppControl . ErrorCode err =
1063+ Interop . AppControl . SetDefaultApplication ( appControl . _handle , applicationId ) ;
1064+ if ( err != Interop . AppControl . ErrorCode . None )
1065+ {
1066+ switch ( err )
1067+ {
1068+ case Interop . AppControl . ErrorCode . InvalidParameter :
1069+ throw new ArgumentException ( "Invalid arguments" ) ;
1070+ case Interop . AppControl . ErrorCode . PermissionDenied :
1071+ throw new Exceptions . PermissionDeniedException ( "Permission denied" ) ;
1072+ case Interop . AppControl . ErrorCode . OutOfMemory :
1073+ throw new Exceptions . OutOfMemoryException ( "Out of memory" ) ;
1074+ default :
1075+ throw new InvalidOperationException ( "err = " + err ) ;
1076+ }
1077+ }
1078+ }
1079+
1080+ /// <summary>
1081+ /// Unsets the default application.
1082+ /// </summary>
1083+ /// <remarks>
1084+ /// This method removes the default application setting for the specified application ID.
1085+ /// This method is only available for platform level signed applications.
1086+ /// </remarks>
1087+ /// <param name="applicationId">The application ID to unset as default.</param>
1088+ /// <exception cref="ArgumentNullException">Thrown when the argument is null.</exception>
1089+ /// <exception cref="ArgumentException">Thrown when the argument is invalid.</exception>
1090+ /// <exception cref="Exceptions.PermissionDeniedException">Thrown when the permission is denied.</exception>
1091+ /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
1092+ /// <since_tizen> 14 </since_tizen>
1093+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
1094+ public static void UnsetDefaultApplication ( string applicationId )
1095+ {
1096+ if ( string . IsNullOrEmpty ( applicationId ) )
1097+ {
1098+ throw new ArgumentNullException ( nameof ( applicationId ) ) ;
1099+ }
1100+
1101+ Interop . AppControl . ErrorCode err = Interop . AppControl . UnsetDefaultApplication ( applicationId ) ;
1102+ if ( err != Interop . AppControl . ErrorCode . None )
1103+ {
1104+ switch ( err )
1105+ {
1106+ case Interop . AppControl . ErrorCode . InvalidParameter :
1107+ throw new ArgumentException ( "Invalid arguments" ) ;
1108+ case Interop . AppControl . ErrorCode . PermissionDenied :
1109+ throw new Exceptions . PermissionDeniedException ( "Permission denied" ) ;
1110+ default :
1111+ throw new InvalidOperationException ( "err = " + err ) ;
1112+ }
1113+ }
1114+ }
1115+
1116+ /// <summary>
1117+ /// Exports the app control data as a bundle.
1118+ /// </summary>
1119+ /// <remarks>
1120+ /// This method exports the internal data of the app control as a Bundle object.
1121+ /// The exported bundle contains all the information of the app control, including
1122+ /// the operation, URI, MIME type, extra data, and internal AUL data.
1123+ /// This method is only available for platform level signed applications.
1124+ /// </remarks>
1125+ /// <returns>The exported Bundle object.</returns>
1126+ /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
1127+ /// <since_tizen> 14 </since_tizen>
1128+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
1129+ public Bundle ExportAsBundle ( )
1130+ {
1131+ Interop . AppControl . ErrorCode err = Interop . AppControl . ExportAsBundle ( _handle , out IntPtr bundleHandle ) ;
1132+ if ( err != Interop . AppControl . ErrorCode . None )
1133+ {
1134+ throw new InvalidOperationException ( "Failed to export app control as bundle. err = " + err ) ;
1135+ }
1136+
1137+ SafeBundleHandle safeBundleHandle = new SafeBundleHandle ( bundleHandle , true ) ;
1138+ return new Bundle ( safeBundleHandle ) ;
1139+ }
1140+
10341141 /// <summary>
10351142 /// Gets all default applications.
10361143 /// </summary>
0 commit comments