public MainWindow()
        {
            InitializeComponent();

            this.Top    = Properties.Settings.Default.Top;
            this.Left   = Properties.Settings.Default.Left;
            this.Height = Properties.Settings.Default.Height;
            this.Width  = Properties.Settings.Default.Width;
            // Very quick and dirty - but it does the job
            if (Properties.Settings.Default.Maximized)
            {
                WindowState = WindowState.Maximized;
            }

            FileInfo exeFile = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);

            configFile = String.Format("{0}\\config.xml", exeFile.DirectoryName);
            if (!File.Exists(configFile))
            {
                LPConfig newConfig = new LPConfig();
                for (int i = 0; i < 15; i++)
                {
                    var Page = new LPPage(i);
                    Page.Initialize();
                    newConfig.Pages.Add(Page);
                }
                newConfig.Save(configFile);
            }

            Launchpad = new LaunchpadInterface();


            Launchpad.OnLaunchpadKeyPressed    += Launchpad_OnLaunchpadKeyPressed;
            Launchpad.OnLaunchpadTopKeyPressed += Launchpad_OnLaunchpadTopKeyPressed;
            Launchpad.OnLaunchpadCCKeyPressed  += Launchpad_OnLaunchpadCCKeyPressed;


            ((App)Application.Current).Config = LPConfig.Load(configFile);
            Config = ((App)Application.Current).Config;

            Initialize();
            SelectedPage = Config.Pages.FirstOrDefault();

            Launchpad.clearAllLEDs();
            BuildLight();
            BuildButtons();
            SelectPage(0);
        }
 public ConfigDialog(LPConfig config) : this()
 {
     Config = config;
     Initialize();
 }