summaryrefslogtreecommitdiffstats
path: root/win/C#/Functions/UpdateCheckInformation.cs
blob: c157f8a68a8e8fa2b9277e59a3fe3bead0e5961a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Threading;

namespace Handbrake.Functions
{
    /// <summary>
    /// Provides information about an update check.
    /// </summary>
    public struct UpdateCheckInformation
    {
        public bool NewVersionAvailable { get; set; }
        public bool ErrorOccured { get { return Error != null; } }

        /// <summary>
        /// Gets information about the new build, if any. This will be null if there is no new verison.
        /// </summary>
        public AppcastReader BuildInformation { get; set; }

        /// <summary>
        /// Gets the error that occurred, if any. This will be null if no error occured.
        /// </summary>
        public Exception Error { get; set; }
    }

    /// <summary>
    /// Used in EndUpdateCheck() for update checking and the IAsyncResult design pattern.
    /// </summary>
    public class UpdateCheckResult : IAsyncResult
    {
        public UpdateCheckResult(object asyncState, UpdateCheckInformation info)
        {
            AsyncState = asyncState;
            Result = info;
        }

        /// <summary>
        /// Gets whether the check was executed in debug mode.
        /// </summary>
        public object AsyncState { get; private set; }

        /// <summary>
        /// Gets the result of the update check.
        /// </summary>
        public UpdateCheckInformation Result { get; private set; }

        public WaitHandle AsyncWaitHandle { get { throw new NotImplementedException(); } }
        public bool CompletedSynchronously { get { throw new NotImplementedException(); } }
        public bool IsCompleted { get { throw new NotImplementedException(); } }
    }
}