コード例 #1
0
 private void btnRestoreDefaults_Click(object sender, EventArgs e)
 {
     try
     {
         txtRFOn.Text  = "250";
         txtRFOff.Text = "50";
         using (ReadMgr.Session rsess = ReadMgr.GetSession())
         {
             ((SerialReader)rsess.Reader).CmdBootBootloader();
             properties = Utilities.GetProperties();
             ReadMgr.ForceDisconnect();
         }
         using (ReadMgr.Session rsess = ReadMgr.GetSession())
         {
             properties["tagencoding"] = rsess.Reader.ParamGet("/reader/gen2/tagEncoding").ToString();
             properties["gen2target"]  = rsess.Reader.ParamGet("/reader/gen2/target").ToString();
             properties["gen2session"] = rsess.Reader.ParamGet("/reader/gen2/session").ToString();
             properties["gen2q"]       = rsess.Reader.ParamGet("/reader/gen2/q").ToString();
             properties["rfontime"]    = "250";
             properties["rfofftime"]   = "50";
             AdvancedReaderSettings_Load(sender, e);
             isSettingsChanged = true;
         }
     }
     catch
     {
         System.Threading.Thread.Sleep(200);
         try
         {
             ReadMgr.ForceReconnect();
             btnRestoreDefaults_Click(sender, e);
         }
         catch (Exception ex)
         {
             logger.Error("In btnRestoreDefaults_Click: " + ex.ToString());
             MessageBox.Show(ex.Message);
         }
     }
 }
コード例 #2
0
ファイル: Info.cs プロジェクト: colombmo/itsi-gamification
        /// <summary>
        /// Form load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Info_Load(object sender, EventArgs e)
        {
            logger.Info("Info form loaded");
            try
            {
                Initialize2();
                logger.Debug("Initialize2 completed");
                InitializeHotkeys();
                logger.Debug("InitializeHotkeys completed");
                GpsMgr.Init();
                logger.Debug("GpsMgr.Init completed");

                try
                {
                    rsess = ReadMgr.GetSession();
                    logger.Debug("ReadMgr.GetSession completed");
                    ReadMgr.ReaderEvent += new ReadMgr.ReadMgrEventHandler(ReadMgr_ReaderEvent);
                    logger.Debug("ReadMgr.ReaderEvent subscribed to");
                }
                catch (Exception ex)
                {
                    logger.Error("In Info_Load ReadMgr: " + ex.ToString());
                    MessageBox.Show(ex.Message.ToString());
                    Application.Exit();
                    return;
                }

                System.Windows.Forms.Timer infoTimer = new System.Windows.Forms.Timer();
                infoTimer.Interval = 1000;
                infoTimer.Tick += new EventHandler(infoTimer_Tick);
                infoTimer.Enabled = true;
#if DEBUG
#else
                infoDebugLabel.Visible = false;
                infoGpsLabel.Visible = false;
                //infoGpsLabel.Text = "";
                infoPowerLabel.Visible = false;
#endif

                properties = Utilities.GetProperties();

                //Set the region
                SetRegion();
                
                Utilities.SaveConfigurations(properties);                    

                //Load the reader information
                LoadReaderInfo();
                InitializeReaderDefaults();
                Utilities.SaveConfigurations(properties);

                //Disable the launching of audio recording tool bar
                Registry.SetValue(@"HKEY_LOCAL_MACHINE\System\AudioRecording", "Enabled", 0, RegistryValueKind.DWord);

                // Force on-screen keyboard away to ensure that our menus are visible
                inputPanel.Enabled = false;
            }
            catch (ReaderCommException rcom)
            {
                logger.Error("In Info_Load: " + rcom.ToString());
                MessageBox.Show(rcom.Message.ToString());
            }
            catch (Exception ex)
            {
                logger.Error("In Info_Load: " + ex.ToString());
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                if (null != rsess)
                {
                    logger.Debug("Calling rsess.Dispose...");
                    rsess.Dispose();
                    logger.Debug("rsess.Dispose completed");
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Form load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Info_Load(object sender, EventArgs e)
        {
            logger.Info("Info form loaded");
            try
            {
                Initialize2();
                logger.Debug("Initialize2 completed");
                InitializeHotkeys();
                logger.Debug("InitializeHotkeys completed");
                GpsMgr.Init();
                logger.Debug("GpsMgr.Init completed");

                try
                {
                    rsess = ReadMgr.GetSession();
                    logger.Debug("ReadMgr.GetSession completed");
                    ReadMgr.ReaderEvent += new ReadMgr.ReadMgrEventHandler(ReadMgr_ReaderEvent);
                    logger.Debug("ReadMgr.ReaderEvent subscribed to");
                }
                catch (Exception ex)
                {
                    logger.Error("In Info_Load ReadMgr: " + ex.ToString());
                    MessageBox.Show(ex.Message.ToString());
                    Application.Exit();
                    return;
                }

                System.Windows.Forms.Timer infoTimer = new System.Windows.Forms.Timer();
                infoTimer.Interval = 1000;
                infoTimer.Tick    += new EventHandler(infoTimer_Tick);
                infoTimer.Enabled  = true;
#if DEBUG
#else
                infoDebugLabel.Visible = false;
                infoGpsLabel.Visible   = false;
                //infoGpsLabel.Text = "";
                infoPowerLabel.Visible = false;
#endif

                properties = Utilities.GetProperties();

                //Set the region
                SetRegion();

                Utilities.SaveConfigurations(properties);

                //Load the reader information
                LoadReaderInfo();
                InitializeReaderDefaults();
                Utilities.SaveConfigurations(properties);

                //Disable the launching of audio recording tool bar
                Registry.SetValue(@"HKEY_LOCAL_MACHINE\System\AudioRecording", "Enabled", 0, RegistryValueKind.DWord);

                // Force on-screen keyboard away to ensure that our menus are visible
                inputPanel.Enabled = false;
            }
            catch (ReaderCommException rcom)
            {
                logger.Error("In Info_Load: " + rcom.ToString());
                MessageBox.Show(rcom.Message.ToString());
            }
            catch (Exception ex)
            {
                logger.Error("In Info_Load: " + ex.ToString());
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                if (null != rsess)
                {
                    logger.Debug("Calling rsess.Dispose...");
                    rsess.Dispose();
                    logger.Debug("rsess.Dispose completed");
                }
            }
        }
コード例 #4
0
        private void AdvancedReaderSettings_Load(object sender, EventArgs e)
        {
            try
            {
                using (ReadMgr.Session rsess = ReadMgr.GetSession())
                {
                    if (properties["tagencoding"] == "")
                    {
                        properties["tagencoding"] = rsess.Reader.ParamGet("/reader/gen2/tagEncoding").ToString();
                    }
                    if (properties["gen2target"] == "")
                    {
                        properties["gen2target"] = rsess.Reader.ParamGet("/reader/gen2/target").ToString();
                    }
                    if (properties["gen2session"] == "")
                    {
                        properties["gen2session"] = rsess.Reader.ParamGet("/reader/gen2/session").ToString();
                    }
                    if (properties["gen2q"] == "")
                    {
                        properties["gen2q"] = rsess.Reader.ParamGet("/reader/gen2/q").ToString();
                    }
                    //Populate tagencoding value
                    switch (properties["tagencoding"].ToLower())
                    {
                    case "fm0":
                        //rbFM0.Checked = true;
                        break;

                    case "m2":
                        rbM2.Checked = true;
                        break;

                    case "m4":
                        rbM4.Checked = true;
                        break;

                    case "m8":
                        rbM8.Checked = true;
                        break;

                    default: break;
                    }
                    //Populate target value
                    switch (properties["gen2target"].ToLower())
                    {
                    case "a":
                        rbA.Checked = true;
                        break;

                    case "b":
                        rbB.Checked = true;
                        break;

                    case "ab":
                        rbAB.Checked = true;
                        break;

                    case "ba":
                        rbBA.Checked = true;
                        break;
                    }
                    //Populate gen2 session value
                    switch (properties["gen2session"].ToLower())
                    {
                    case "s0":
                        rbS0.Checked = true;
                        break;

                    case "s1":
                        rbS1.Checked = true;
                        break;

                    case "s2":
                        rbS2.Checked = true;
                        break;

                    case "s3":
                        rbS3.Checked = true;
                        break;
                    }
                    //Populate Q value
                    switch (properties["gen2q"].ToLower())
                    {
                    case "dynamicq":
                        rbDynamicQ.Checked = true;
                        break;

                    case "staticq":
                        rbStaticQ.Checked      = true;
                        cbStaticQ.SelectedItem = properties["staticqvalue"];
                        cbStaticQ.Enabled      = true;
                        break;
                    }
                    if (properties["recordhighestrssi"].ToLower() == "yes")
                    {
                        rbRecordHighestRSSI.Checked = true;
                    }
                    else
                    {
                        rbRecordHighestRSSI.Checked = false;
                    }
                    if (properties["recordrssioflasttagread"].ToLower() == "yes")
                    {
                        rbRecordRSSIoflastTagRead.Checked = true;
                    }
                    else
                    {
                        rbRecordRSSIoflastTagRead.Checked = false;
                    }
                    txtRFOn.Text      = properties["rfontime"];
                    txtRFOff.Text     = properties["rfofftime"];
                    isSettingsChanged = false;
                }
            }
            catch (Exception ex)
            {
                logger.Error("In AdvancedReaderSettings_Load: " + ex.ToString());
                MessageBox.Show(ex.Message);
            }
        }