public void Update(TrackingStatus status, string trackingId, string message = null)
        {
            if (String.IsNullOrEmpty(trackingId))
            {
                Log.Warn("Unable to track message: empty trackingID");
                return;
            }

            try
            {
                var updateFields = new BsonDocument()
                                   .Add("Updated", DateTime.UtcNow)
                                   .Add("Status", status);
                if (message != null)
                {
                    updateFields.Add("Description", message);
                }
                var update = new UpdateDocument("$set", updateFields);
                _trackCollection.Update(Query <TrackingRecord> .EQ(e => e.Id, trackingId), update,
                                        WriteConcern.Unacknowledged);
            }
            catch (Exception ex)
            {
                Log.Error("Tracking failed", ex);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TrackingPageViewModel"/> class.
        /// </summary>
        /// <param name="gpxHandler">The Gpx handler implementation it depends on.</param>
        /// <param name="locationTracker">The location tracker implementation it depends on.</param>
        /// <param name="settingOperator">The setting operator implementation it depends on.</param>
        public TrackingPageViewModel(IGpxHandler gpxHandler, ILocationTracker locationTracker, ISettingOperator settingOperator)
        {
            this.gpxHandler      = gpxHandler ?? throw new ArgumentNullException(nameof(gpxHandler));
            this.locationTracker = locationTracker ?? throw new ArgumentNullException(nameof(locationTracker));
            this.settingOperator = settingOperator ?? throw new ArgumentNullException(nameof(settingOperator));

            this.status = TrackingStatus.Stopped;
            this.StartPauseClickedCommand = new DelegateCommand <ItemClickEventArgs>(this.OnStartPauseClicked, this.CanStartPauseClick);
            this.StopClickedCommand       = new DelegateCommand <ItemClickEventArgs>(this.OnStopClicked, this.CanStopClick);
            this.SelectedActivity         = ActivityType.Unknown;
            this.CoordinateInformation    = "Your location information";

            this.settingOperator.ResetSettings();

            this.refreshTimer = new DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 30)
            };

            this.refreshTimer.Tick += async(object sender, object e) => { await this.DisplayMostRecentLocationData(string.Empty); };

            Debug.WriteLine($"{DateTime.Now} - Attached LocationTracker_OnTrackingProgressChangedEvent event handler.");
            this.locationTracker.OnTrackingProgressChangedEvent += this.LocationTracker_OnTrackingProgressChangedEvent;

            this.trackingMechanism = TrackingMechanismDisplay.GetSavedTrackingMechanism(this.settingOperator);
        }
        private void TrackingStatusUpdated(object sender, RouteTrackerTrackingStatusChangedEventArgs e)
        {
            TrackingStatus status = e.TrackingStatus;

            if (status.DestinationStatus == DestinationStatus.NotReached || status.DestinationStatus == DestinationStatus.Approaching)
            {
                DistanceTB  = status.RouteProgress.RemainingDistance.DisplayText;
                DistanceLbl = status.RouteProgress.RemainingDistance.DisplayTextUnits.PluralDisplayName;
                TimeTB      = status.RouteProgress.RemainingTime.ToString(@"hh\:mm\:ss");
            }
            else if (status.DestinationStatus == DestinationStatus.Reached)
            {
                this._dispatcher.Invoke(() =>
                {
                    isNavigating = false;
                    ClearGraphics();
                });
            }
            if (_directionsList != null && status.CurrentManeuverIndex + 1 < _directionsList.Count)
            {
                DirectionManeuver dm = _directionsList[status.CurrentManeuverIndex + 1];

                if (status.CurrentManeuverIndex + 1 < _directionsList.Count)
                {
                    this._dispatcher.Invoke(() =>
                    {
                        DirectionLbl.Text = dm.DirectionText;
                        SetDirectionIcon(dm.ManeuverType.ToString());
                    });
                }
            }
        }
        public static ExpressTrackingViewModel ConvertFromFedEx(FedExTrackingViewModel fedExModel, GetExpressTrackResponse_V01 expressInfoResponse)
        {
            ExpressTrackingViewModel expressTrack      = new ExpressTrackingViewModel();
            List <steps>             expressTrackSteps = new List <steps>();
            TrackingStatus           status            = TrackingStatus.PreparingShipment;

            expressTrack.mailno = fedExModel.tracking.detail.tn;
            expressTrack.remark = expressInfoResponse.ExpressCompanyName;
            expressTrack.result = "false";

            if (fedExModel.tracking.detail.activities.Count >= 1)
            {
                expressTrack.result = "true";
                status = TrackingStatus.InTransit;
            }

            if (fedExModel.tracking.detail.status == "已取件")
            {
                //Shipped
                status            = TrackingStatus.Shipped;
                expressTrack.time = fedExModel.tracking.detail.shipdate;
            }
            else if (fedExModel.tracking.detail.status == "已送达")
            {
                status            = TrackingStatus.Delivered;
                expressTrack.time = fedExModel.tracking.detail.deliverydate;
            }
            else
            {
                status            = TrackingStatus.InTransit;
                expressTrack.time = fedExModel.tracking.detail.deliverydate;
            }


            if (fedExModel.tracking.detail.activities != null && fedExModel.tracking.detail.activities.Count >= 1)
            {
                foreach (var trace in fedExModel.tracking.detail.activities)
                {
                    var eachstep = new steps
                    {
                        time          = trace.datetime,
                        address       = trace.scan,
                        station       = trace.location,
                        station_phone = string.Empty,
                        status        = string.Empty,
                        remark        = trace.details,
                        next          = string.Empty,
                        next_name     = string.Empty
                    };
                    expressTrackSteps.Add(eachstep);
                }
            }

            expressTrack.status = getNumberValue(status).ToString();
            expressTrack.steps  = expressTrackSteps;

            return(expressTrack);
        }
Beispiel #5
0
 protected TrackingHistoryPoint GenerateTrackingPoint(TrackingStatus status, string location=null)
 {
     return new TrackingHistoryPoint()
     {
         Author = CurrentUser.Id,
         DateTime = DateTime.Now,
         Status = status,
         Location = location ?? CurrentUser.UserInfo.Location
     };
 }
Beispiel #6
0
 protected TrackingHistoryPoint GenerateTrackingPoint(TrackingStatus status, string location = null)
 {
     return(new TrackingHistoryPoint()
     {
         Author = CurrentUser.Id,
         DateTime = DateTime.Now,
         Status = status,
         Location = location ?? CurrentUser.UserInfo.Location
     });
 }
Beispiel #7
0
        private async void TrackingStatusUpdated(object sender, RouteTrackerTrackingStatusChangedEventArgs e)
        {
            TrackingStatus status = e.TrackingStatus;

            // Start building a status message for the UI.
            System.Text.StringBuilder statusMessageBuilder = new System.Text.StringBuilder("Route Status:\n");

            // Check the destination status.
            if (status.DestinationStatus == DestinationStatus.NotReached || status.DestinationStatus == DestinationStatus.Approaching)
            {
                statusMessageBuilder.AppendLine("Distance remaining: " +
                                                status.RouteProgress.RemainingDistance.DisplayText + " " +
                                                status.RouteProgress.RemainingDistance.DisplayTextUnits.PluralDisplayName);

                statusMessageBuilder.AppendLine("Time remaining: " +
                                                status.RouteProgress.RemainingTime.ToString(@"hh\:mm\:ss"));

                if (status.CurrentManeuverIndex + 1 < _directionsList.Count)
                {
                    statusMessageBuilder.AppendLine("Next direction: " + _directionsList[status.CurrentManeuverIndex + 1].DirectionText);
                }

                // Set geometries for progress and the remaining route.
                _routeAheadGraphic.Geometry    = status.RouteProgress.RemainingGeometry;
                _routeTraveledGraphic.Geometry = status.RouteProgress.TraversedGeometry;
            }
            else if (status.DestinationStatus == DestinationStatus.Reached)
            {
                statusMessageBuilder.AppendLine("Destination reached.");

                // Set the route geometries to reflect the completed route.
                _routeAheadGraphic.Geometry    = null;
                _routeTraveledGraphic.Geometry = status.RouteResult.Routes[0].RouteGeometry;

                // Navigate to the next stop (if there are stops remaining).
                if (status.RemainingDestinationCount > 1)
                {
                    await _tracker.SwitchToNextDestinationAsync();
                }
                else
                {
                    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        // Stop the simulated location data source.
                        MyMapView.LocationDisplay.DataSource.StopAsync();
                    });
                }
            }

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                // Show the status information in the UI.
                MessagesTextBlock.Text = statusMessageBuilder.ToString();
            });
        }
        public void Clear()
        {
            _dataHistory.Clear();
            //_leftValidity = 0;
            //_rightValidity = 0;
            _eyesValidity = TrackingStatus.BothEyesTracked;
            _leftEye      = new Point2D();
            _rightEye     = new Point2D();

            Invalidate();
        }
        private void TrackEvent(object tag, TrackingStatus status, string message)
        {
            var eventId = tag as string;

            if (eventId == null)
            {
                Log.WarnFormat("Incorrect tag {0}, can't track event message {1}: {2}", tag, status, message);
                return;
            }
            trackingService.Update(TrackingStatus.Delivered, eventId, message);
        }
Beispiel #10
0
 /// <summary>
 /// Updates the tracking status of the simulation.
 /// </summary>
 /// <param name="status"></param>
 public void UpdateTrackingStatus(TrackingStatus status)
 {
     if (status.DestinationStatus == DestinationStatus.Reached)
     {
         State = SimulationState.Stopped;
     }
     else if (status.CurrentManeuverIndex > _maneuverIndex)
     {
         _maneuverIndex    = status.CurrentManeuverIndex;
         _maneuverProgress = 0;
     }
 }
Beispiel #11
0
        private void TrackingStatusUpdated(object sender, RouteTrackerTrackingStatusChangedEventArgs e)
        {
            TrackingStatus status = e.TrackingStatus;

            // Start building a status message for the UI.
            System.Text.StringBuilder statusMessageBuilder = new System.Text.StringBuilder();

            // Check the destination status.
            if (status.DestinationStatus == DestinationStatus.NotReached || status.DestinationStatus == DestinationStatus.Approaching)
            {
                statusMessageBuilder.AppendLine("Distance remaining: " +
                                                status.RouteProgress.RemainingDistance.DisplayText + " " +
                                                status.RouteProgress.RemainingDistance.DisplayTextUnits.PluralDisplayName);

                statusMessageBuilder.AppendLine("Time remaining: " + status.RouteProgress.RemainingTime.ToString(@"hh\:mm\:ss"));

                if (status.CurrentManeuverIndex + 1 < _directionsList.Count)
                {
                    statusMessageBuilder.AppendLine("Next direction: " + _directionsList[status.CurrentManeuverIndex + 1].DirectionText);
                }

                // Set geometries for progress and the remaining route.
                _routeAheadGraphic.Geometry    = status.RouteProgress.RemainingGeometry;
                _routeTraveledGraphic.Geometry = status.RouteProgress.TraversedGeometry;
            }
            else if (status.DestinationStatus == DestinationStatus.Reached)
            {
                statusMessageBuilder.AppendLine("Destination reached.");

                // Set the route geometries to reflect the completed route.
                _routeAheadGraphic.Geometry    = null;
                _routeTraveledGraphic.Geometry = status.RouteResult.Routes[0].RouteGeometry;

                // Navigate to the next stop (if there are stops remaining).
                if (status.RemainingDestinationCount > 1)
                {
                    _tracker.SwitchToNextDestinationAsync();
                }
                else
                {
                    // This is needed because measurement change events occur on a non-UI thread and this code accesses UI object.
                    BeginInvokeOnMainThread(() =>
                    {
                        // Stop the simulated location data source.
                        _myMapView.LocationDisplay.DataSource.StopAsync();
                    });
                }
            }

            // Show the status information in the UI.
            _statusMessage = statusMessageBuilder.ToString().TrimEnd('\n').TrimEnd('\r');
            BeginInvokeOnMainThread(UpdateStatusText);
        }
Beispiel #12
0
        public void Setup()
        {
            StructureMapBootStrapper.ConfigureDependencies("test");
            _uow = ObjectFactory.GetInstance<IUnitOfWork>();

            _trackingStatusRepository = new TrackingStatusRepository(_uow);
            _emailRepo = new EmailRepository(_uow);


            _trackingStatus = new TrackingStatus<EmailDO>(_trackingStatusRepository, _emailRepo);

            _fixture = new FixtureData(_uow);
        }
Beispiel #13
0
        public static TrackingStatus GetTrackingStatus(Event even)
        {
            var friendlyDescription = GetFriendlyTrackingDescription(even);
            var trackingStatus      = new TrackingStatus()
            {
                EventTime                   = even.ScheduledDateTimeUtc,
                FriendlyEventTime           = even.ScheduledDateTimeUtc.ToLongTimeString() + ",  " + even.ScheduledDateTimeUtc.ToLongDateString(),
                FriendlyTrackingName        = friendlyDescription.Item1,
                FriendlyTrackingDescription = friendlyDescription.Item2
            };

            return(trackingStatus);
        }
Beispiel #14
0
        private void TrackingStatusUpdated(object sender, RouteTrackerTrackingStatusChangedEventArgs e)
        {
            TrackingStatus status = e.TrackingStatus;

            // Start building a status message for the UI.
            System.Text.StringBuilder statusMessageBuilder = new System.Text.StringBuilder("Route Status:\n");

            // Check if navigation is on route.
            if (status.IsOnRoute && !status.IsRouteCalculating)
            {
                // Check the destination status.
                if (status.DestinationStatus == DestinationStatus.NotReached || status.DestinationStatus == DestinationStatus.Approaching)
                {
                    statusMessageBuilder.AppendLine("Distance remaining: " +
                                                    status.RouteProgress.RemainingDistance.DisplayText + " " +
                                                    status.RouteProgress.RemainingDistance.DisplayTextUnits.PluralDisplayName);

                    statusMessageBuilder.AppendLine("Time remaining: " +
                                                    status.RouteProgress.RemainingTime.ToString(@"hh\:mm\:ss"));

                    if (status.CurrentManeuverIndex + 1 < _directionsList.Count)
                    {
                        statusMessageBuilder.AppendLine("Next direction: " + _directionsList[status.CurrentManeuverIndex + 1].DirectionText);
                    }

                    // Set geometries for progress and the remaining route.
                    _routeAheadGraphic.Geometry    = status.RouteProgress.RemainingGeometry;
                    _routeTraveledGraphic.Geometry = status.RouteProgress.TraversedGeometry;
                }
                else if (status.DestinationStatus == DestinationStatus.Reached)
                {
                    statusMessageBuilder.AppendLine("Destination reached.");

                    // Set the route geometries to reflect the completed route.
                    _routeAheadGraphic.Geometry         = null;
                    _routeTraveledGraphic.Geometry      = status.RouteResult.Routes[0].RouteGeometry;
                    MyMapView.LocationDisplay.IsEnabled = false;
                }
            }
            else
            {
                statusMessageBuilder.AppendLine("Off route!");
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                // Show the status information in the UI.
                MessagesTextBlock.Text = statusMessageBuilder.ToString().TrimEnd('\n').TrimEnd('\r');
            });
        }
Beispiel #15
0
        public StatusChangeMessage(string[] parts) : base(MessageOpcode.StatusChange, parts)
        {
            var statusType = MessageUtil.GetField(parts, TransmissionField.Callsign);

            Status = statusType switch
            {
                "PL" => TrackingStatus.PositionLost,
                "SL" => TrackingStatus.SignalLost,
                "RM" => TrackingStatus.Remove,
                "AD" => TrackingStatus.Delete,
                "OK" => TrackingStatus.Ok,
                _ => throw new InvalidDataException(string.Format(Lang.UnknownStatus, statusType))
            };
        }
    }
        public TrackStatusControlMirada()
        {
            InitializeComponent();

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);

            _dataHistory = new Queue <GazeData>(HistorySize);

            _eyeBrush  = new SolidBrush(Color.White);
            _eyeBrushL = new SolidBrush(Color.Red);
            _eyeBrushR = new SolidBrush(Color.Blue);

            _eyesValidity = TrackingStatus.NoEyesTracked;
        }
Beispiel #17
0
        private void TrackingStatusUpdated(object sender, RouteTrackerTrackingStatusChangedEventArgs e)
        {
            TrackingStatus status = e.TrackingStatus;

            // Start building a status message for the UI.
            System.Text.StringBuilder statusMessageBuilder = new System.Text.StringBuilder();

            // Check the destination status.
            if (status.DestinationStatus == DestinationStatus.NotReached || status.DestinationStatus == DestinationStatus.Approaching)
            {
                statusMessageBuilder.AppendLine("Distance remaining: " +
                                                status.RouteProgress.RemainingDistance.DisplayText + " " +
                                                status.RouteProgress.RemainingDistance.DisplayTextUnits.PluralDisplayName);

                statusMessageBuilder.AppendLine("Time remaining: " +
                                                status.RouteProgress.RemainingTime.ToString(@"hh\:mm\:ss"));

                if (status.CurrentManeuverIndex + 1 < _directionsList.Count)
                {
                    statusMessageBuilder.AppendLine("Next direction: " + _directionsList[status.CurrentManeuverIndex + 1].DirectionText);
                }

                // Set geometries for progress and the remaining route.
                _routeAheadGraphic.Geometry    = status.RouteProgress.RemainingGeometry;
                _routeTraveledGraphic.Geometry = status.RouteProgress.TraversedGeometry;
            }
            else if (status.DestinationStatus == DestinationStatus.Reached)
            {
                statusMessageBuilder.AppendLine("Destination reached.");

                // Set the route geometries to reflect the completed route.
                _routeAheadGraphic.Geometry    = null;
                _routeTraveledGraphic.Geometry = status.RouteResult.Routes[0].RouteGeometry;

                // Navigate to the next stop (if there are stops remaining).
                if (status.RemainingDestinationCount > 1)
                {
                    _tracker.SwitchToNextDestinationAsync();
                }
            }

            _statusMessage = statusMessageBuilder.ToString().TrimEnd('\n').TrimEnd('\r');

            // Update the status in the UI.
            RunOnUiThread(SetLabelText);
        }
Beispiel #18
0
        private TrackingStatus TrackByProvider(Tracking tracking)
        {
            TrackingStatus trackingStatus = new TrackingStatus();

            trackingStatus.tracking = tracking;

            try
            {
                ITrackProvider trackProvider = (ITrackProvider)(Activator.CreateInstance(Type.GetType(tracking.ProviderCompany.ProviderCompanyServiceClassName)));
                trackProvider.Track(tracking.TrackingNumber);
                trackingStatus.jsonStatus = trackProvider.ToJson();
            }
            catch (Exception ex)
            {
                trackingStatus.jsonStatus = "{IS_ERROR = true, ERROR = " + ex.Message + "}";
            }
            return(trackingStatus);
        }
        public void OnGazeData(Tobii.Gaze.Core.GazeData gd)
        {
            // Add data to history
            _dataHistory.Enqueue(gd);

            // Remove history item if necessary
            while (_dataHistory.Count > HistorySize)
            {
                _dataHistory.Dequeue();
            }

            _eyesValidity = gd.TrackingStatus;

            _leftEye  = gd.Left.GazePointOnDisplayNormalized;
            _rightEye = gd.Right.GazePointOnDisplayNormalized;

            Invalidate();
        }
        /// <summary>
        /// Handle start/pause button clicked event.
        /// </summary>
        /// <param name="argument">The event argument.</param>
        private async void OnStartPauseClicked(ItemClickEventArgs argument)
        {
            this.trackingId = DateTime.Now.ToString("yyyyMMddHHmmss");

            Window.Current.VisibilityChanged += this.VisibilityChanged;

            var locationAccessStatus = await Geolocator.RequestAccessAsync();

            if (locationAccessStatus == GeolocationAccessStatus.Allowed)
            {
                // Set the accuracy expectation in setting, so that background task can access the information.
                if (this.SelectedActivity == ActivityType.Unknown)
                {
                    this.settingOperator.SetGpsAccuracyExpectation(null);
                }
                else
                {
                    var activityDetail = this.SupportedActivityTypes.Where(x => x.ActivityType == this.SelectedActivity).First();
                    this.settingOperator.SetGpsAccuracyExpectation(activityDetail.DesiredAccuracy);
                }

                this.settingOperator.SetTrackingId(this.trackingId);
                this.mostRecentLocationUpdateTime = DateTime.Now;

                // Step 1, create background task as fall back plan for extended session. RequestAccessAsync must be called on the UI thread.
                var backGroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();

                if (backGroundAccessStatus == BackgroundAccessStatus.AlwaysAllowed || backGroundAccessStatus == BackgroundAccessStatus.AllowedSubjectToSystemPolicy)
                {
                    this.StartBackgroundTask();
                    Debug.WriteLine($"{DateTime.Now} - Background task started");
                    this.refreshTimer.Start();
                    await this.DisplayMostRecentLocationData("In progress.");
                }

                this.status = TrackingStatus.Started;
                this.OnPropertyChanged(nameof(this.IsStartPauseButtonEnabled));
                this.OnPropertyChanged(nameof(this.IsStopButtonEnabled));
                this.OnPropertyChanged(nameof(this.IsActivityOptionEnabled));

                // Step 2, request extended session.
                await this.StartExtendedExecution();
            }
        }
            /// <summary>
            /// Sets the marker's status, reprojection error, and updates it's pose data.
            /// </summary>
            internal void UpdateMarker(TrackingStatus status, float reprojectionError)
            {
#if PLATFORM_LUMIN
                TrackingStatus previousStatus = this.Status;

                this.status            = status;
                this.reprojectionError = reprojectionError;

                if (this.Status == TrackingStatus.Tracked)
                {
                    MagicLeapNativeBindings.UnityMagicLeap_TryGetPose(this.cfuid, out this.pose);
                }

                if (previousStatus != this.Status)
                {
                    OnStatusChange(this, this.Status);
                }
#endif
            }
        private void estatusCaja(C_cajas cc)
        {
            using (var context = new DB_CORPORATIVA_DEVEntities())
            {
                if (cc.codigo_sucursal != null)
                {
                    var objcaja = context.C_cajas.Where(a => a.codigo_sucursal.Equals(cc.codigo_sucursal)).FirstOrDefault();


                    string estatus = objcaja.status.Trim();



                    if (estatus.Equals("A"))
                    {
                        estatus = "I";
                    }
                    else if (estatus.Equals("I"))
                    {
                        estatus = "A";
                    }
                    context.Database.ExecuteSqlCommand("UPDATE C_CAJAS SET STATUS = '" + estatus + "' WHERE CODIGO_SUCURSAL = '" + cc.codigo_sucursal + "'");

                    List <C_cajas> objLista = new List <C_cajas>();
                    objLista.Add(cc);
                    ViewBag.sucEstado = objLista;
                    List <DeliveryModel> listaPedidosSucCocina     = TrackingStatus.estadoCocina();
                    List <DeliveryModel> listaPedidosSucRecibido   = TrackingStatus.estadoRecibido();
                    List <DeliveryModel> listaPedidosSucPorAsignar = TrackingStatus.estadoPorAsignar();
                    List <DeliveryModel> listaRepaSuc = TrackingStatus.totalRepaSuc();
                    List <DeliveryModel> listaPedidosSucEntregados = TrackingStatus.estadoEntregados();
                    List <DeliveryModel> listaPedidosSucEntregando = TrackingStatus.estadoEntregando();
                    ViewBag.pedidosSucCocina     = listaPedidosSucCocina;
                    ViewBag.pedidosSucRecibido   = listaPedidosSucRecibido;
                    ViewBag.pedidosSucPorAsignar = listaPedidosSucPorAsignar;
                    ViewBag.pedidosSucEntregados = listaPedidosSucEntregados;
                    ViewBag.pedidosSucEntregando = listaPedidosSucEntregando;
                    ViewBag.totalRepaSuc         = listaRepaSuc;
                    ViewBag.totalRepaEntregando  = TrackingStatus.totalRepaEntregando();
                    context.Entry(objcaja).Reload();
                }
            }
        }
        public TrackStatusControl()
        {
            InitializeComponent();

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);

            //_dataHistory = new Queue<IGazeDataItem>(HistorySize);
            _dataHistory = new Queue<GazeData>(HistorySize);

            _brush = new SolidBrush(Color.Red);
            _eyeBrush = new SolidBrush(Color.White);
            _eyeBrushL = new SolidBrush(Color.Red);
            _eyeBrushR = new SolidBrush(Color.Blue);

            //_leftValidity = 4;
            //_rightValidity = 4;
            _eyesValidity = TrackingStatus.NoEyesTracked;
        }
        /// <summary>
        /// Handle stop button clicked event.
        /// </summary>
        /// <param name="argument">The event argument.</param>
        private async void OnStopClicked(ItemClickEventArgs argument)
        {
            this.settingOperator.ResetSettings();
            Window.Current.VisibilityChanged -= this.VisibilityChanged;

            this.StopLocationUpdateTracking();
            this.StopLocationIntervalTracking();
            this.FindAndCancelExistingBackgroundTask();

            int wayPointNumber = await this.gpxHandler.ComposeGpxFile(this.trackingId, this.SelectedActivity.ToString());

            this.status = TrackingStatus.Stopped;
            this.OnPropertyChanged(nameof(this.IsStartPauseButtonEnabled));
            this.OnPropertyChanged(nameof(this.IsStopButtonEnabled));
            this.OnPropertyChanged(nameof(this.IsActivityOptionEnabled));

            await this.DisplayMostRecentLocationData($"Gpx file created with {wayPointNumber} points collected.");

            this.refreshTimer.Stop();
        }
Beispiel #25
0
        //public void OnGazeData(TETCSharpClient.Data.GazeData gd)
        //{
        //    //// Add data to history
        //    //_dataHistory.Enqueue(gd);

        //    //// Remove history item if necessary
        //    //while (_dataHistory.Count > HistorySize)
        //    //{
        //    //    _dataHistory.Dequeue();
        //    //}

        //    ////_leftValidity = gd.LeftValidity;
        //    ////_rightValidity = gd.RightValidity;
        //    _eyesValidity = tobiiValidity2EyeTribeValidity(gd);

        //    //_leftEye = gd.LeftEyePosition3DRelative;
        //    //_rightEye = gd.RightEyePosition3DRelative;

        //    _leftEye = new Point3D(1-gd.LeftEye.PupilCenterCoordinates.X, gd.LeftEye.PupilCenterCoordinates.Y, 0);// gd.Left.EyePositionInTrackBoxNormalized;
        //    _rightEye = new Point3D(1-gd.RightEye.PupilCenterCoordinates.X, gd.RightEye.PupilCenterCoordinates.Y, 0);

        //    Invalidate();
        //}

        //private TrackingStatus tobiiValidity2EyeTribeValidity(TETCSharpClient.Data.GazeData gd)
        //{
        //    if (
        //        ((gd.State & TETCSharpClient.Data.GazeData.STATE_TRACKING_GAZE) != 0) ||
        //        ((gd.State & TETCSharpClient.Data.GazeData.STATE_TRACKING_EYES) != 0)
        //        )
        //        return TrackingStatus.BothEyesTracked;
        //    else
        //        return TrackingStatus.BothEyesTracked; //TrackingStatus.NoEyesTracked;
        //}

        public void OnGazeData(Tobii.Gaze.Core.GazeData gd)
        {
            // Add data to history
            _dataHistory.Enqueue(gd);

            // Remove history item if necessary
            while (_dataHistory.Count > HistorySize)
            {
                _dataHistory.Dequeue();
            }

            //_leftValidity = gd.LeftValidity;
            //_rightValidity = gd.RightValidity;
            _eyesValidity = gd.TrackingStatus;

            //_leftEye = gd.LeftEyePosition3DRelative;
            //_rightEye = gd.RightEyePosition3DRelative;
            _leftEye  = gd.Left.EyePositionInTrackBoxNormalized;
            _rightEye = gd.Right.EyePositionInTrackBoxNormalized;

            Invalidate();
        }
        // GET: DELIVERY
        public ActionResult Index()
        {
            //List<DeliveryModel> listaPedidosSucCocina = TrackingStatus.estadoCocina();
            //List<DeliveryModel> listaPedidosSucRecibido = TrackingStatus.estadoRecibido();
            //List<DeliveryModel> listaPedidosSucPorAsignar = TrackingStatus.estadoPorAsignar();
            //List<DeliveryModel> listaPedidosSucEntregados = TrackingStatus.estadoEntregados();
            //List<DeliveryModel> listaPedidosSucEntregando = TrackingStatus.estadoEntregando();
            //List<DeliveryModel> listaRepaSuc = TrackingStatus.totalRepaSuc();


            ViewBag.pedidosSucCocina     = TrackingStatus.estadoCocina();
            ViewBag.pedidosSucRecibido   = TrackingStatus.estadoRecibido();
            ViewBag.pedidosSucPorAsignar = TrackingStatus.estadoPorAsignar();
            ViewBag.pedidosSucEntregando = TrackingStatus.estadoEntregando();
            ViewBag.pedidosSucEntregados = TrackingStatus.estadoEntregados();
            ViewBag.totalRepaSuc         = TrackingStatus.totalRepaSuc();
            ViewBag.totalRepaEntregando  = TrackingStatus.totalRepaEntregando();
            C_cajas t = new C_cajas();

            t.codigo_sucursal = "SUC038";
            estatusCajaInicial(t);

            return(View("/Views/Delivery/Index.cshtml"));
        }
        public static eyesWeigh trackingStatus2Weigh(TrackingStatus trackingStatus)
        {
            eyesWeigh pesoOjos;

            switch (trackingStatus)
            {
            //los dos ojos
            case TrackingStatus.BothEyesTracked:
                pesoOjos.leftWeigh  = 1;
                pesoOjos.rightWeigh = 1;
                pesoOjos.totalWeigh = 0.5;
                break;

            //left solo
            case TrackingStatus.OneEyeTrackedProbablyLeft:
                pesoOjos.leftWeigh  = 1;
                pesoOjos.rightWeigh = 0;
                pesoOjos.totalWeigh = 1;
                break;

            case TrackingStatus.OnlyLeftEyeTracked:
                pesoOjos.leftWeigh  = 1;
                pesoOjos.rightWeigh = 0;
                pesoOjos.totalWeigh = 1;
                break;

            //rigth solo
            case TrackingStatus.OneEyeTrackedProbablyRight:
                pesoOjos.leftWeigh  = 0;
                pesoOjos.rightWeigh = 1;
                pesoOjos.totalWeigh = 1;
                break;

            case TrackingStatus.OnlyRightEyeTracked:
                pesoOjos.leftWeigh  = 0;
                pesoOjos.rightWeigh = 1;
                pesoOjos.totalWeigh = 1;
                break;

            //peores casos
            case TrackingStatus.NoEyesTracked:
                pesoOjos.leftWeigh  = Double.NaN;
                pesoOjos.rightWeigh = Double.NaN;
                pesoOjos.totalWeigh = Double.NaN;
                break;

            case TrackingStatus.OneEyeTrackedUnknownWhich:
                pesoOjos.leftWeigh  = Double.NaN;
                pesoOjos.rightWeigh = Double.NaN;
                pesoOjos.totalWeigh = Double.NaN;
                break;


            default:
                pesoOjos.leftWeigh  = Double.NaN;
                pesoOjos.rightWeigh = Double.NaN;
                pesoOjos.totalWeigh = Double.NaN;
                break;
            }

            return(pesoOjos);
        }
        public void Clear()
        {
            _dataHistory.Clear();
            //_leftValidity = 0;
            //_rightValidity = 0;
            _eyesValidity = TrackingStatus.BothEyesTracked;
            _leftEye = new Point3D();
            _rightEye = new Point3D();

            Invalidate();
        }
        public void OnGazeData(Tobii.Gaze.Core.GazeData gd)
        {
            // Add data to history
            _dataHistory.Enqueue(gd);

            // Remove history item if necessary
            while (_dataHistory.Count > HistorySize)
            {
                _dataHistory.Dequeue();
            }

            //_leftValidity = gd.LeftValidity;
            //_rightValidity = gd.RightValidity;
            _eyesValidity = gd.TrackingStatus;

            //_leftEye = gd.LeftEyePosition3DRelative;
            //_rightEye = gd.RightEyePosition3DRelative;
            _leftEye = gd.Left.EyePositionInTrackBoxNormalized;
            _rightEye = gd.Right.EyePositionInTrackBoxNormalized;

            Invalidate();
        }
 public static int getNumberValue(TrackingStatus thisStatus)
 {
     return((int)thisStatus);
 }
        public static ExpressTrackingViewModel ConvertFromSfModel(SFTrackingViewModel sfModel, GetExpressTrackResponse_V01 expressInfoResponse)
        {
            ExpressTrackingViewModel expressTrack      = new ExpressTrackingViewModel();
            List <steps>             expressTrackSteps = new List <steps>();
            TrackingStatus           status            = TrackingStatus.PreparingShipment;
            List <Route>             traceses;

            if (expressInfoResponse != null)
            {
                expressTrack.remark = expressInfoResponse.ExpressCompanyName;
            }

            expressTrack.result = "false";

            if (sfModel.Response != null && sfModel.Response.Body != null && sfModel.Response.Body.RouteResponse != null && sfModel.Response.Body.RouteResponse.Route != null && sfModel.Response.Body.RouteResponse.Route.Count >= 1)
            {
                expressTrack.mailno = sfModel.Response.Body.RouteResponse.mailno;
                expressTrack.result = "true";
                expressTrack.time   = sfModel.Response.Body.RouteResponse.Route[0].accept_time;
                status = TrackingStatus.InTransit;
            }
            if (sfModel.Response != null && sfModel.Response.Body != null &&
                sfModel.Response.Body.RouteResponse != null && sfModel.Response.Body.RouteResponse.Route != null)
            {
                traceses = sfModel.Response.Body.RouteResponse.Route;
            }
            else
            {
                traceses = null;
            }

            if (traceses != null)
            {
                foreach (var trace in traceses)
                {
                    steps eachStep = new steps();
                    if (trace.opcode == "50")
                    {
                        status = TrackingStatus.Shipped;
                    }
                    else if (trace.opcode == "8000")
                    {
                        status = TrackingStatus.Delivered;
                    }
                    else
                    {
                        status = TrackingStatus.InTransit;
                    }
                    eachStep.time          = trace.accept_time;
                    eachStep.address       = trace.accept_address;
                    eachStep.status        = trace.opcode;
                    eachStep.remark        = trace.remark;
                    eachStep.station       = "";
                    eachStep.station_phone = "";
                    eachStep.next          = "";
                    eachStep.next_name     = "";
                    expressTrackSteps.Add(eachStep);
                }
            }

            expressTrack.status = getNumberValue(status).ToString();
            expressTrack.steps  = expressTrackSteps;

            return(expressTrack);
        }
        public static ExpressTrackingViewModel ConvertFromBestway(BestwayTrackingViewModel bestwayModel, GetExpressTrackResponse_V01 expressInfoResponse)
        {
            ExpressTrackingViewModel expressTrack      = new ExpressTrackingViewModel();
            List <steps>             expressTrackSteps = new List <steps>();
            TrackingStatus           status            = TrackingStatus.PreparingShipment;

            if (bestwayModel != null && bestwayModel.traceLogs != null && bestwayModel.traceLogs.Count > 0)
            {
                expressTrack.mailno = bestwayModel.traceLogs[0].mailNo;
            }
            if (expressInfoResponse != null && !string.IsNullOrEmpty(expressInfoResponse.ExpressCompanyName))
            {
                expressTrack.remark = expressInfoResponse.ExpressCompanyName;
            }

            expressTrack.result = "false";


            if (bestwayModel != null && bestwayModel.traceLogs != null && bestwayModel.traceLogs.Count > 0 && bestwayModel.traceLogs[0].traces != null && bestwayModel.traceLogs[0].traces.Count >= 1)
            {
                expressTrack.result = "true";
                expressTrack.time   = bestwayModel.traceLogs[0].traces[0].acceptTime;
                status = TrackingStatus.Delivered;
            }


            if (bestwayModel != null && bestwayModel.traceLogs != null && bestwayModel.traceLogs.Count > 0)
            {
                var traceses = bestwayModel.traceLogs[0].traces;
                if (traceses != null)
                {
                    foreach (var trace in traceses)
                    {
                        steps eachStep = new steps();
                        if (trace.scanType == "收件")
                        {
                            status = TrackingStatus.Shipped;
                        }
                        else if (trace.scanType == "签收")
                        {
                            status = TrackingStatus.Delivered;
                        }
                        else
                        {
                            status = TrackingStatus.InTransit;
                        }
                        eachStep.time          = trace.acceptTime;
                        eachStep.address       = trace.acceptAddress;
                        eachStep.status        = trace.scanType;
                        eachStep.remark        = trace.remark;
                        eachStep.station       = "";
                        eachStep.station_phone = "";
                        eachStep.next          = "";
                        eachStep.next_name     = "";
                        expressTrackSteps.Add(eachStep);
                    }
                }
            }

            expressTrack.status = getNumberValue(status).ToString();
            expressTrack.steps  = expressTrackSteps;
            return(expressTrack);
        }