private void CreateBLEPage()
 {
     try {
         if (BLE_Full.Instances == 0)
         {
             this.cleanUpPage(this.blePage, typeof(BLE_Full));
             this.blePage = new BLE_Full(this.parent);
             this.blePage.Show();
         }
     }
     catch (Exception) {}
 }
        private void cleanUpPage(object sender, Type _type)
        {
            lock (this) {
                try {
                    if (sender != null)
                    {
                        ((Window)sender).Close();

                        if (_type == typeof(BTRun))
                        {
                            this.btPage.CloseRequest -= this.btCloseRequest;
                            this.btPage = null;
                        }
                        else if (_type == typeof(WifiRun))
                        {
                            this.wifiPage.CloseRequest -= this.wifiCloseRequest;
                            this.wifiPage = null;
                        }
                        else if (_type == typeof(SerialRun))
                        {
                            this.serialPage.CloseRequest -= this.serialCloseRequest;
                            this.serialPage = null;
                        }
                        else if (_type == typeof(EthernetRun))
                        {
                            this.ethernetPage.CloseRequest -= this.ethernetCloseRequest;
                            this.ethernetPage = null;
                        }
                        else if (_type == typeof(BLE_Full))
                        {
                            this.blePage.Close();
                            this.blePage = null;
                        }
                    }
                }
                catch (Exception) {
                }
            }
        }