public MainPage()
        {
            this.InitializeComponent();

            bool isInternetConnected = NetworkInterface.GetIsNetworkAvailable();

            if (isInternetConnected == true)
            {
                conn = new SQLiteConnection(new SQLitePlatformWinRT(), path); //資料庫連接
                conn.CreateTable <Data>();                                    //建立資料表

                GpioController gpio = GpioController.GetDefault();
                Input0 = gpio.OpenPin(4);
                Input0.SetDriveMode(GpioPinDriveMode.Input);
                Input1 = gpio.OpenPin(5);
                Input1.SetDriveMode(GpioPinDriveMode.Input);
                Input2 = gpio.OpenPin(17);
                Input2.SetDriveMode(GpioPinDriveMode.Input);
                Input3 = gpio.OpenPin(18);
                Input3.SetDriveMode(GpioPinDriveMode.Input);
                Input4 = gpio.OpenPin(22);
                Input4.SetDriveMode(GpioPinDriveMode.Input);
                Input5 = gpio.OpenPin(23);
                Input5.SetDriveMode(GpioPinDriveMode.Input);
                Input6 = gpio.OpenPin(24);
                Input6.SetDriveMode(GpioPinDriveMode.Input);
                Input7 = gpio.OpenPin(25);
                Input7.SetDriveMode(GpioPinDriveMode.Input);

                timer = new DispatcherTimer
                {
                    Interval = TimeSpan.FromMilliseconds(400)
                };
                timer.Tick += Timer_Tick;
                timer.Start();



                bgwWorker.DoWork                    += new DoWorkEventHandler(bgwWorker_DoWork);
                bgwWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(bgwWorker_RunWorkerCompleted);
                bgwWorker.ProgressChanged           += new ProgressChangedEventHandler(bgwWorker_ProgressChanged);
                bgwWorker.WorkerReportsProgress      = true;
                bgwWorker.WorkerSupportsCancellation = true;
            }

            else
            {
                wifisettingAsync();
            }
        }