Adding 'Audio' tab.
Volume indicator of MDM16AA display now working.
Adding server side dependency on NAudio.
It was decided to have a server side dependency so that we could implement
new fields control such as:
* Volume indicator
* Mute indicator
* Spectrum visualizer
* Meter visualizer
* Fancy visualizer
2 using System.Collections.Generic;
4 using System.Threading.Tasks;
5 using System.Windows.Forms;
6 using System.Security.Principal;
7 using System.Diagnostics;
8 using System.Reflection;
10 namespace SharpDisplayManager
14 //WARNING: This is assuming we have a single instance of our program.
15 //That is what we want but we should enforce it somehow.
16 public static MainForm iMainForm;
18 /// The main entry point for the application.
25 if (!IsRunAsAdministrator())
27 var processInfo = new ProcessStartInfo(Assembly.GetExecutingAssembly().CodeBase);
29 // The following properties run the new process as administrator
30 processInfo.UseShellExecute = true;
31 processInfo.Verb = "runas";
33 // Start the new process
36 Process.Start(processInfo);
40 // The user did not allow the application to run as administrator
41 MessageBox.Show("Sorry, this application must be run as Administrator.");
44 // Shut down the current process
47 //Application.Current.Shutdown();
51 Application.ApplicationExit += new EventHandler(OnApplicationExit);
53 Application.EnableVisualStyles();
54 Application.SetCompatibleTextRenderingDefault(false);
55 iMainForm = new MainForm();
56 Application.Run(iMainForm);
61 static private bool IsRunAsAdministrator()
63 var wi = WindowsIdentity.GetCurrent();
64 var wp = new WindowsPrincipal(wi);
66 return wp.IsInRole(WindowsBuiltInRole.Administrator);
70 /// Occurs after form closing.
72 /// <param name="sender"></param>
73 /// <param name="e"></param>
74 static private void OnApplicationExit(object sender, EventArgs e)