Esempio n. 1
0
 void OnLocationNotify(object sender, LocationData ld)
 {
     try {
         this.textBoxLatitude.Text  = ld.LatitudeString;
         this.textBoxLongitude.Text = ld.LongitudeString;
         this.textBoxAltitude.Text  = ld.Altitude.ToString();
         this.textBoxTime.Text      = ld.LocationTime.ToString();
         TerminalsFactory.SaveGPSData(convertLatitude(ld), convertLongitude(ld), Convert.ToInt32(ld.Altitude), ld.LocationTime);
     }
     catch (LocationServicesException e2) { MessageBox.Show(e2.Message); }
 }
Esempio n. 2
0
 private void OnUpdateLocation(object sender, EventArgs e)
 {
     try {
         this.mReceiver.UpdateLocationData();
         LocationData ld = this.mReceiver.CurrentLocation;
         this.textBoxLatitude.Text  = ld.LatitudeString;
         this.textBoxLongitude.Text = ld.LongitudeString;
         this.textBoxAltitude.Text  = ld.Altitude.ToString();
         this.textBoxTime.Text      = ld.LocationTime.ToString();
         TerminalsFactory.SaveGPSData(convertLatitude(ld), convertLongitude(ld), Convert.ToInt32(ld.Altitude), ld.LocationTime);
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
 }
Esempio n. 3
0
 private void OnClientChanged(object sender, EventArgs e)
 {
     //Event handler for change in client selected value event
     try {
         //Update store selections
         this.mStores.Clear();
         if (this.cboClient.SelectedValue != null)
         {
             this.mStores.Merge(TerminalsFactory.GetStores(this.cboClient.SelectedValue.ToString()));
         }
         OnStoreChanged(null, EventArgs.Empty);
     }
     catch (Exception ex) { App.ReportError(ex); }
 }
Esempio n. 4
0
        private void OnItemClick(object sender, EventArgs e)
        {
            //Event handler for menu item clicked
            try {
                MenuItem item = (MenuItem)sender;
                switch (item.Text.ToLower())
                {
                case "new":
                    this.txtScan.Text = "";
                    break;

                case "save":
                    TerminalsFactory.SaveScan(this.cboClient.SelectedValue.ToString(), this.cboStore.SelectedValue.ToString(), this.txtScan.Text);
                    break;

                case "sync":
                    this.mSyncAgent.Synchronize();
                    this.mClients.Merge(TerminalsFactory.GetClients());
                    if (this.cboClient.Items.Count > 0)
                    {
                        this.cboClient.SelectedIndex = 0;
                    }
                    OnClientChanged(null, EventArgs.Empty);
                    break;

                case "close":
                    this.Close();
                    break;

                case "refresh":
                    //Populate clients
                    this.mClients.Merge(TerminalsFactory.GetClients());
                    if (this.cboClient.Items.Count > 0)
                    {
                        this.cboClient.SelectedIndex = 0;
                    }
                    OnClientChanged(null, EventArgs.Empty);
                    break;

                case "about": break;
                }
            }
            catch (Exception ex) { App.ReportError(ex); }
        }
Esempio n. 5
0
        private void OnFormLoad(object sender, EventArgs e)
        {
            //Event handler for form load event
            try {
                // Initialize the ScanSampleAPI reference.
                this.mScanAPI             = new Symbol.BarcodeAPI();
                this.mIsReaderInitialized = this.mScanAPI.InitReader();
                if (!(this.mIsReaderInitialized))
                {
                    // Display a message & exit the application.
                    MessageBox.Show("The application will now exit.");
                    Application.Exit();
                }
                else
                {
                    // Clear the statusbar where subsequent status information would be displayed.
                    this.sbMain.Text = "";

                    //Set scanner behavior
                    switch (this.mScanAPI.Reader.ReaderParameters.ReaderType)
                    {
                    case Symbol.Barcode.READER_TYPE.READER_TYPE_IMAGER: this.mScanAPI.Reader.ReaderParameters.ReaderSpecific.ImagerSpecific.AimType = Symbol.Barcode.AIM_TYPE.AIM_TYPE_TRIGGER; break;

                    case Symbol.Barcode.READER_TYPE.READER_TYPE_LASER: this.mScanAPI.Reader.ReaderParameters.ReaderSpecific.LaserSpecific.AimType = Symbol.Barcode.AIM_TYPE.AIM_TYPE_TRIGGER; break;

                    case Symbol.Barcode.READER_TYPE.READER_TYPE_CONTACT: /* AimType is not supported by the contact readers. */ break;
                    }
                    this.mScanAPI.Reader.Actions.SetParameters();
                    switch (this.mScanAPI.Reader.ReaderParameters.ReaderType)
                    {
                    case Symbol.Barcode.READER_TYPE.READER_TYPE_IMAGER: this.mScanAPI.Reader.ReaderParameters.ReaderSpecific.ImagerSpecific.AimMode = Symbol.Barcode.AIM_MODE.AIM_MODE_DOT; break;

                    case Symbol.Barcode.READER_TYPE.READER_TYPE_LASER: this.mScanAPI.Reader.ReaderParameters.ReaderSpecific.LaserSpecific.AimMode = Symbol.Barcode.AIM_MODE.AIM_MODE_DOT; break;

                    case Symbol.Barcode.READER_TYPE.READER_TYPE_CONTACT: /* AimMode is not supported by the contact readers. */ break;
                    }
                    this.mScanAPI.Reader.Actions.SetParameters();
                    this.mScanAPI.Reader.Parameters.ScanType = Symbol.Barcode.ScanTypes.Foreground;
                    this.mScanAPI.Reader.Actions.SetParameters();
                    this.mScanAPI.Reader.Decoders.CODE128.Enabled = true;
                    this.mScanAPI.Reader.Decoders.CODE39.Enabled  = false;
                    this.mScanAPI.Reader.Actions.SetParameters();

                    // Attach a status natification handler.
                    this.mStatusNotifyHandler = new EventHandler(OnAPIStatusNotify);
                    this.mScanAPI.AttachStatusNotify(this.mStatusNotifyHandler);

                    //Start a read operation & attach a handler
                    this.mScanAPI.StartRead(false);
                    this.mReadNotifyHandler = new EventHandler(OnAPIReadNotify);
                    this.mScanAPI.AttachReadNotify(this.mReadNotifyHandler);
                }
                this.mFormActivatedEventHandler   = new EventHandler(OnFormActivated);
                this.mFormDeactivatedEventHandler = new EventHandler(OnFormDeactivated);
                this.Activated  += this.mFormActivatedEventHandler;
                this.Deactivate += this.mFormDeactivatedEventHandler;

                //Populate clients
                this.mClients.Merge(TerminalsFactory.GetClients());
                if (this.cboClient.Items.Count > 0)
                {
                    this.cboClient.SelectedIndex = 0;
                }
                OnClientChanged(null, EventArgs.Empty);
            }
            catch (Exception ex) { App.ReportError(ex); }
        }