-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainForm.cs
79 lines (66 loc) · 2.14 KB
/
MainForm.cs
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PermissionViewer.Entities;
using PermissionViewer.Services;
using PermissionViewer.Controls;
namespace PermissionViewer
{
/// <summary>
/// The main form used by the PermissionViewer application
/// </summary>
public partial class MainForm : Form
{
/// <summary>
/// Creates a new MainForm object
/// </summary>
public MainForm()
{
InitializeComponent();
}
/// <summary>
/// Event handler for the ConnectionChanged event of the
/// ConnectionArea control
/// </summary>
private void connectionArea_ConnectionChanged(object sender, ConnectionChangedEventArgs e)
{
applicationSelector.Connection = e.NewConnection;
permissionDisplay.Connection = e.NewConnection;
permissionDisplay.CurrentApplication = null;
applicationSelectionGroupBox.Visible = (e.NewConnection != null);
permissionDisplayGroupBox.Visible = (e.NewConnection != null);
SetVersionInfo();
}
/// <summary>
/// Event handler for the SelectedApplicationChanged event of
/// the ApplicationSelector control
/// </summary>
private void applicationSelector_SelectedApplicationChanged(object sender, SelectedApplicationChangedEventArgs e)
{
var application = applicationSelector.SelectedApplication;
permissionDisplay.CurrentApplication = application;
permissionDisplayGroupBox.Visible = (application != null);
}
/// <summary>
/// Loads version information from the EvolutionConnection and
/// reports it in the StatusBar at the bottom of the form
/// </summary>
protected void SetVersionInfo()
{
string product, platformVersion, webservicesVersion;
var connection = connectionArea1.Connection;
if (connection == null)
product = platformVersion = webservicesVersion = "UNKNOWN";
else
{
product = connection.Product;
platformVersion = connection.PlatformVersion.ToString();
webservicesVersion = connection.WebservicesVersion.ToString();
}
productLabel.Text = "Product: " + product;
versionLabel.Text = "Platform: " + platformVersion;
webservicesLabel.Text = "Webservices: " + webservicesVersion;
}
}
}