SaturnDemo.Saturn.IsSaturnOpen C# (CSharp) Method

IsSaturnOpen() public method

public IsSaturnOpen ( ) : bool
return bool
        public bool IsSaturnOpen()
        {
            return !myStage.IsDisposed;
        }

Usage Example

Beispiel #1
0
        private void timerUpdateGUI_Tick(object sender, EventArgs e)
        {
            timerUpdateGUI.Enabled = false; // we don't want timer to start this thread twice

            swGUI.Reset(); // some timers to keep track of how long gui updates are taking.
            swGUI.Start();

            // update this timer's refresh rate from text box
            int newInterval = Convert.ToInt16(Convert.ToDouble(txtSaturnRefreshMs.Text));
            if (newInterval > 10000 || newInterval < 1) newInterval = 100;
            timerUpdateGUI.Interval = newInterval;

            // Tell the Tag Handler what's on the GUI
            SetHandleTagSettings();

            // Update Text Boxes
            txtBoxTags.Text = tagTextBoxContent;
            txtDebugMessages.Text = debugTextBoxContent;

            // Update Saturn checkbox
            if (!saturn.IsSaturnOpen())
            {
                chkSaturn.Checked = false;
            }

            // Update MIDI checkbox
            if (!midi.IsMidiConfigOpen())
            {
                chkMIDI.Checked = false;
            }

            // Update Bink Bonk checkbox
            if (!binkBonk.isBinkBonkOpen())
            {
                chkBinkBonk.Checked = false;
            }

            //  ***** this is the heart of it ******   //
            // Update the relevant sensor gui sections:


            if (readerMgr.IsInventoryRunning())
            {
                // Sensor Processing

                UpdateAccelerometerGUI();
                UpdateTemperatureGUI();
                UpdateSOCGUI();
            }

            // Update tag statistics - this does the grid view
            ArrayList newTags = handleTags.GetNewTags();
            if (newTags.Count > 0)
                ProcessTagStats();

            // Check if Read is enabled and reader is connected. If so, enable read on the Reader.
            if (!chkReadDisabled.Checked && readerMgr.IsConnected())
            {
                if (chkReadAll.Checked)
                {
                    readerMgr.RestartRead(new ReaderManager.ReadCmdSettings("0000", "0000000000000000", 1, 0));
                }
                else if (chkReadSelected.Checked)
                {
                    // Refresh which tag we are performing Read command on
                    // via the selected tag in the grid view.
                    string selectedTag = stats.GetSelectedTagID();
                    string mask = "";
                    if (selectedTag != null)
                    {
                        mask = mask.PadRight(selectedTag.Length * 4, '1');
                        readerMgr.RestartRead(new ReaderManager.ReadCmdSettings(selectedTag, mask, 1, 0));
                    }
                    else
                    {
                        readerMgr.StopRead();
                    }
                }
            }
            else if (readerMgr.IsConnected())
                readerMgr.StopRead();

            // Update time info
            swGUI.Stop();
            long picosecPerTick = (1000L * 1000L * 1000L * 1000L) / Stopwatch.Frequency;
            long microsecGUIrate = swGUI.ElapsedTicks * picosecPerTick / (1000L * 1000L * 1000L);
            //long microsecHandlerrate = swHandler.ElapsedTicks * picosecPerTick / (1000L * 1000L * 1000L);

            if (microsecGUIrate > peakGuiTime) peakGuiTime = microsecGUIrate;
            //if (microsecHandlerrate > peakHandlerTime) peakHandlerTime = microsecHandlerrate;

            lblGUITime.Text = "GUI Time: " + peakGuiTime.ToString() + " ms";
            //lblHandlerTime.Text = "Handler Time: " + peakHandlerTime.ToString() + " ms";

            //Application.DoEvents();  // removing this cut the gui handler down from 55ms to 20ms peak time
            //                             with Saturn open, and with no effect on gui responsiveness!
            timerUpdateGUI.Enabled = true; // re-enable this timer.
        }