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();
            }
        }
 /// <summary>
 /// Creates a new <see cref="ReactionPipelineStage"/> with the specified name and reaction to the specified inputs.
 /// </summary>
 /// <param name="name">The name of the new reaction.</param>
 /// <param name="reaction">The reaction delegate.</param>
 /// <param name="input1">Input number 1.</param>
 /// <param name="input2">Input number 2.</param>
 /// <param name="input3">Input number 3.</param>
 /// <param name="input4">Input number 4.</param>
 /// <param name="input5">Input number 5.</param>
 /// <param name="input6">Input number 6.</param>
 /// <param name="input7">Input number 7.</param>
 /// <param name="reactImmediately">Denotes if the reaction should fire immediately upon construction.</param>
 public ReactionPipelineStage(
     string name,
     Action <TInput1, TInput2, TInput3, TInput4, TInput5, TInput6, TInput7> reaction,
     IPipelineStage <TInput1> input1,
     IPipelineStage <TInput2> input2,
     IPipelineStage <TInput3> input3,
     IPipelineStage <TInput4> input4,
     IPipelineStage <TInput5> input5,
     IPipelineStage <TInput6> input6,
     IPipelineStage <TInput7> input7,
     bool reactImmediately)
 {
     Name     = name ?? throw new ArgumentNullException(nameof(name));
     Reaction = reaction ?? throw new ArgumentNullException(nameof(reaction));
     Input1   = input1 ?? throw new ArgumentNullException(nameof(input1));
     Input2   = input2 ?? throw new ArgumentNullException(nameof(input2));
     Input3   = input3 ?? throw new ArgumentNullException(nameof(input3));
     Input4   = input4 ?? throw new ArgumentNullException(nameof(input4));
     Input5   = input5 ?? throw new ArgumentNullException(nameof(input5));
     Input6   = input6 ?? throw new ArgumentNullException(nameof(input6));
     Input7   = input7 ?? throw new ArgumentNullException(nameof(input7));
     this.AddDependencies(input1, input2, input3, input4, input5, input6, input7);
     if (reactImmediately)
     {
         Reaction(Input1.GetValue(), Input2.GetValue(), Input3.GetValue(), Input4.GetValue(), Input5.GetValue(), Input6.GetValue(), Input7.GetValue());
     }
 }
Пример #3
0
 /// <summary>
 /// Handles invalidation of the operation stage, and reacts as appropriate.
 /// </summary>
 /// <param name="invalidator">The invalidator.</param>
 public void OnInvalidate(IPipelineInvalidator invalidator)
 {
     invalidator.InvalidateAllDependentStages(this);
     Reaction(Input1.GetValue(), Input2.GetValue(), Input3.GetValue(), Input4.GetValue(), Input5.GetValue(), Input6.GetValue(), Input7.GetValue(), Input8.GetValue());
 }