Пример #1
0
        private static void PerformAction()
        {
            switch (mMenu.MenuSelection)
            {
            case MenuSelection.PrintLabel:
                //Tell MUX what channel to write to...
                Debug.Print("Set Mux to Channel 0...");
                Mux.SetPort(MuxChannel.C0);
                Debug.Print("Write Default label to Serial Port...");
                mPrinterSerialPort.WriteString(Label.DefaultLabel);
                break;

            case MenuSelection.Job:
                mMenu.DataRecieved = RecievedData.ScannerJobAndSuffix;
                //Tell MUX what channel to listen on...
                Debug.Print("Set Mux to Channel 1...");
                Mux.SetPort(MuxChannel.C1);
                Debug.Print("Wait for Job Number from Scanner...");
                break;

            case MenuSelection.Operation:
                mMenu.DataRecieved = RecievedData.ScannerOperation;
                //Tell MUX what channel to listen on...
                Debug.Print("Set Mux to Channel 1...");
                Mux.SetPort(MuxChannel.C1);
                Debug.Print("Wait for Operation from Scanner...");
                break;

            case MenuSelection.ViewPieceWeight:
                mMenu.DataRecieved = RecievedData.None;
                Debug.Print("Set Menu to Adjust Piece Weight...");
                mMenu.MenuSelection = MenuSelection.AdjustPieceWeight;
                break;

            case MenuSelection.ViewNetWeightAdjustment:
                mMenu.DataRecieved = RecievedData.None;
                Debug.Print("Set Menu to Adjust Net Weight...");
                mMenu.MenuSelection = MenuSelection.AdjustNetWeight;
                break;

            case MenuSelection.ViewBackLightColor:
                mMenu.DataRecieved = RecievedData.None;
                Debug.Print("Set Menu to Adjust Background Color...");
                mMenu.MenuSelection = MenuSelection.ChangeBackLightColor;
                break;

            case MenuSelection.ViewNetworkInfo:
                mMenu.DataRecieved = RecievedData.None;
                Debug.Print("Set Menu to Display Network Info...");
                mMenu.MenuSelection = MenuSelection.DisplayNetworkInfo;
                Settings.RetrieveNetworkSettings(Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0]);
                break;

            case MenuSelection.Reboot:
                mMenu.MenuSelection = MenuSelection.Rebooting;
                mMenu.DisplayInformation(Settings);
                BlinkOnboardLED(3, 300);
                Debug.Print("Rebooting...");
                PowerState.RebootDevice(false);
                break;
            }
            mMenu.DisplayInformation(Settings);
        }