Beispiel #1
0
        /// <summary>
        /// Creates or updates a shortcut link at shortcutPath.
        /// </summary>
        /// <param name="shortcutPath"></param>
        /// <param name="operation"></param>
        /// <param name="options"></param>
        /// <returns>Whether the shortcut was created successfully.</returns>
        public Task <bool> WriteShortcutLinkAsync(string shortcutPath, ShortcutLinkOperation operation, ShortcutDetails options)
        {
            var taskCompletionSource = new TaskCompletionSource <bool>();

            BridgeConnector.Socket.On("shell-writeShortcutLinkCompleted", (success) =>
            {
                BridgeConnector.Socket.Off("shell-writeShortcutLinkCompleted");

                taskCompletionSource.SetResult((bool)success);
            });

            BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation.ToString(), JObject.FromObject(options, _jsonSerializer));

            return(taskCompletionSource.Task);
        }
Beispiel #2
0
 public async Task <bool> WriteShortcutLink(string shortcutPath, ShortcutLinkOperation options)
 {
     return(await Invoke <bool>("writeShortcutLink", shortcutPath, options));
 }
Beispiel #3
0
 /// <summary>
 /// Creates or updates a shortcut link at shortcutPath.
 /// </summary>
 /// <param name="shortcutPath">The path to the shortcut.</param>
 /// <param name="operation">Default is <see cref="ShortcutLinkOperation.Create"/></param>
 /// <param name="options">Structure of a shortcut.</param>
 /// <returns>Whether the shortcut was created successfully.</returns>
 public Task <bool> WriteShortcutLinkAsync(string shortcutPath, ShortcutLinkOperation operation, ShortcutDetails options)
 {
     return(BridgeConnector.OnResult <bool>("shell-writeShortcutLink", "shell-writeShortcutLinkCompleted", shortcutPath, operation.GetDescription(), options));
 }