示例#1
0
文件: MainForm.cs 项目: nakijun/adasg
        private void SetupApplicationLauncher()
        {
            if (_autoSyncEnabled)
            {
                string fullyQualifiedName = Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
                _connectionsCount.EnableApplicationLauncher("ADASync", fullyQualifiedName, "-EVENT");
                _cradlePresent.EnableApplicationLauncher("ADASync", fullyQualifiedName, "-EVENT");
            }
            else
            {
                _connectionsCount.DisableApplicationLauncher();
                _cradlePresent.DisableApplicationLauncher();
            }

            menuItemAutoSync.Checked = _autoSyncEnabled;
        }
示例#2
0
        public ReadTags(NotifyIcon notifyIcon)
        {
            try
            {
                InitializeComponent();
                dgTagResult.DataSource = tagdb.TagList;
                //Set the column width of datagrid
                AddGridStyles();

                properties = Utilities.GetProperties();

                playBeep.SoundLocation = properties["decodewavefile"];
                playBeep.LoadAsync();
                playStopAudio.SoundLocation = properties["endscanwavefile"];
                playStopAudio.LoadAsync();
                playStartAudio.SoundLocation = properties["startscanwavefile"];
                playStartAudio.LoadAsync();

                setStatus(Status.READY);
                pvtNotifyIcon = notifyIcon;

                //For battery level
                status = new CoreDLL.SYSTEM_POWER_STATUS_EX();

                tmrBackLightControl          = new System.Windows.Forms.Timer();
                tmrBackLightControl.Interval = 1000 * 30;// Timer will tick every 30 seconds
                tmrBackLightControl.Tick    += new EventHandler(tmrBackLightControl_Tick);

                //Pistol grip read handler
                pistolTriggerEvent          = new SystemState(SystemProperty.HeadsetPresent);
                pistolTriggerEvent.Changed += new ChangeEventHandler(pistolTriggerEvent_Changed);
                pistolTriggerEvent.DisableApplicationLauncher();
            }
            catch (Exception ex)
            {
                logger.Error("In ReadTags: " + ex.ToString());
                MessageBox.Show(ex.Message);
            }
        }
        public MainForm(bool autoSync)
        {
            InitializeComponent();

            string fullyQualifiedName = Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
            string strAppDir          = Path.GetDirectoryName(fullyQualifiedName);

            _databaseFilePath = strAppDir + "\\ADAMobile.sdf";

            FileInfo fileInfo = new FileInfo(_databaseFilePath);

            if (fileInfo.Exists)
            {
                DateTime d = fileInfo.LastWriteTime;
                this.labelModifiedTime.Text = d.ToShortDateString() + " " + d.ToShortTimeString();
            }

            _connectionsCount = new SystemState(SystemProperty.ConnectionsCount);

            _connectionsCount.ComparisonType  = StatusComparisonType.GreaterOrEqual;
            _connectionsCount.ComparisonValue = 1;

            if (IsDeployed)
            {
                _connectionsCount.EnableApplicationLauncher("ADASync", fullyQualifiedName, "-EVENT");
            }
            else
            {
                _connectionsCount.DisableApplicationLauncher();
            }

            _connectionsCount2          = new SystemState(SystemProperty.ConnectionsCount);
            _connectionsCount2.Changed += new ChangeEventHandler(connectionsCount_Changed);

            cradlePresent          = new SystemState(SystemProperty.CradlePresent);
            cradlePresent.Changed += new ChangeEventHandler(connectionsCount_Changed);

            if (autoSync)
            {
                this.timerAutoSync.Enabled = true;
            }

            object syncTimeValue = this.Setting.LocalSetting.GetValue(REGISTRY_SYMBOL_LIBRARY_SYNC_TIME, null) as string;

            if (syncTimeValue != null)
            {
                DateTime d = Convert.ToDateTime(syncTimeValue);
            }

            syncTimeValue = this.Setting.LocalSetting.GetValue(REGISTRY_SCHEDULE_SYNC_TIME, null) as string;
            if (syncTimeValue != null)
            {
                DateTime d = Convert.ToDateTime(syncTimeValue);
                this.labelSyncTime.Text = d.ToShortDateString() + " " + d.ToShortTimeString();
            }

            this._deviceID = this.Setting.GlobalSetting.GetValue(REGISTRY_DEVICE_ID, null) as string;

            if (this._deviceID == null)
            {
                try
                {
                    this._deviceID = DeviceID.GetDeviceID();
                    this.Setting.GlobalSetting.SetValue(REGISTRY_DEVICE_ID, this._deviceID);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
        }
示例#4
0
        public ReadTags(NotifyIcon notifyIcon)
        {
            try
            {
                InitializeComponent();
                dgTagResult.DataSource = tagdb.TagList;
                //Set the column width of datagrid
                AddGridStyles();

                properties = Utilities.GetProperties();

                playBeep.SoundLocation = properties["decodewavefile"];
                playBeep.LoadAsync();
                playStopAudio.SoundLocation = properties["endscanwavefile"];
                playStopAudio.LoadAsync();
                playStartAudio.SoundLocation = properties["startscanwavefile"];
                playStartAudio.LoadAsync();

                setStatus(Status.READY);
                pvtNotifyIcon = notifyIcon;

                //For battery level
                status = new CoreDLL.SYSTEM_POWER_STATUS_EX();

                tmrBackLightControl = new System.Windows.Forms.Timer();
                tmrBackLightControl.Interval = 1000 * 30;// Timer will tick every 30 seconds
                tmrBackLightControl.Tick += new EventHandler(tmrBackLightControl_Tick);

                //Pistol grip read handler
                pistolTriggerEvent = new SystemState(SystemProperty.HeadsetPresent);
                pistolTriggerEvent.Changed += new ChangeEventHandler(pistolTriggerEvent_Changed);
                pistolTriggerEvent.DisableApplicationLauncher();
            }
            catch (Exception ex)
            {
                logger.Error("In ReadTags: " + ex.ToString());
                MessageBox.Show(ex.Message);
            }
        }