1 | using System;
|
---|
2 | using HeuristicLab.Clients.Hive.CloudManager.Azure;
|
---|
3 | using HeuristicLab.Clients.Hive.CloudManager.Model;
|
---|
4 | using HeuristicLab.Common;
|
---|
5 | using HeuristicLab.Core;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Clients.Hive.CloudManager {
|
---|
8 | [Item("CloudManagerClient", "Hive Cloud Manager Client.")]
|
---|
9 | public sealed class CloudManagerClient : IContent {
|
---|
10 | private static CloudManagerClient instance;
|
---|
11 | public static CloudManagerClient Instance {
|
---|
12 | get {
|
---|
13 | if (instance == null) instance = new CloudManagerClient();
|
---|
14 | return instance;
|
---|
15 | }
|
---|
16 | }
|
---|
17 |
|
---|
18 | private CloudManagerClient() { }
|
---|
19 |
|
---|
20 | #region Properties
|
---|
21 | private IItemList<Subscription> subscriptions;
|
---|
22 | public IItemList<Subscription> Subscriptions {
|
---|
23 | get { return subscriptions; }
|
---|
24 | set {
|
---|
25 | if (value != subscriptions) {
|
---|
26 | subscriptions = value;
|
---|
27 | //fire event OnSubscriptionsChagned
|
---|
28 | }
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
32 | private IAzureProvider azureProvider;
|
---|
33 | public IAzureProvider AzureProvider {
|
---|
34 | get { return azureProvider; }
|
---|
35 | set { azureProvider = value; }
|
---|
36 | }
|
---|
37 |
|
---|
38 | #endregion
|
---|
39 |
|
---|
40 | #region Events
|
---|
41 |
|
---|
42 | public event EventHandler Refreshing;
|
---|
43 | private void OnRefreshing() {
|
---|
44 | EventHandler handler = Refreshing;
|
---|
45 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
46 | }
|
---|
47 | public event EventHandler Refreshed;
|
---|
48 | private void OnRefreshed() {
|
---|
49 | var handler = Refreshed;
|
---|
50 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
51 | }
|
---|
52 |
|
---|
53 | #endregion
|
---|
54 |
|
---|
55 | #region Refresh
|
---|
56 |
|
---|
57 | public void Refresh() {
|
---|
58 | OnRefreshing();
|
---|
59 |
|
---|
60 | try {
|
---|
61 |
|
---|
62 | }
|
---|
63 | catch {
|
---|
64 | throw;
|
---|
65 | }
|
---|
66 | finally {
|
---|
67 | OnRefreshed();
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | #endregion
|
---|
72 |
|
---|
73 |
|
---|
74 | }
|
---|
75 | }
|
---|