private void CreateEthernetPage()
 {
     try {
         if (EthernetRun.Instances == 0)
         {
             this.cleanUpPage(this.ethernetPage, typeof(EthernetRun));
             this.ethernetPage = new EthernetRun(this.parent);
             this.ethernetPage.CloseRequest += this.ethernetCloseRequest;
             this.ethernetPage.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) {
                }
            }
        }