Exemple #1
0
        /// <summary>
        /// Signals the desktop application that a long-running operation such
        /// as cluster setup is starting.
        /// </summary>
        /// <param name="summary">A brief summary of the operation.</param>
        /// <returns>The tracking <see cref="Task"/>.</returns>
        /// <remarks>
        /// <note>
        /// This method will fail silently if the desktop application does
        /// not respond.
        /// </note>
        /// </remarks>
        public async Task StartOperationAsync(string summary)
        {
            var operation = new RemoteOperation()
            {
                Summary   = summary,
                ProcessId = Process.GetCurrentProcess().Id
            };

            try
            {
                await client.PostAsync(NoRetryPolicy.Instance, "start-operation", operation);
            }
            catch
            {
                // Intentionally ignoring this.
            }
        }
Exemple #2
0
        /// <summary>
        /// Signals the desktop application the a long-running operation has
        /// completed.
        /// </summary>
        /// <param name="completedToast">
        /// Optionally specifies text to be displayed as toast by the
        /// desktop application.
        /// </param>
        /// <param name="failed">Optionally indicates that the operation failed.</param>
        /// <returns>The tracking <see cref="Task"/>.</returns>
        /// <remarks>
        /// <note>
        /// This method will fail silently if the desktop application does
        /// not respond.
        /// </note>
        /// </remarks>
        public async Task EndOperationAsync(string completedToast = null, bool failed = false)
        {
            var operation = new RemoteOperation()
            {
                ProcessId      = Process.GetCurrentProcess().Id,
                CompletedToast = completedToast,
                Failed         = failed
            };

            try
            {
                await client.PostAsync(NoRetryPolicy.Instance, "end-operation", operation);
            }
            catch
            {
                // Intentionally ignoring this.
            }
        }