public TrackingPopupView(TrackingEventViewModel trackingEventViewModel, TrackingEvent selectedEvent) { InitializeComponent(); trackingPoupViewModel = new TrackingPoupViewModel(trackingEventViewModel, selectedEvent); this.BindingContext = trackingPoupViewModel; SetupActions(); }
private void OnTrackCellRange(object sender, RibbonControlEventArgs e) { if (!ShowMissingItemsWarning()) { return; } // 1. Ask the user to pick a range SelectCellRangeAction action = new SelectCellRangeAction(); action.ActionCompleted += (range) => { if (!ShowMissingItemsWarning()) { return; } /* 2. Submit the range to the TrackingSystem */ ITrackable trackable = tracker.Get <Range>(); trackable.ValueUpdated += (value) => extension.Tracking.Post <Range>(TrackingEvent.Create((Range)value)); trackable.TrackedValue = range; trackable.Enabled = true; }; action.Run(); }
public async Task WP8SL_TrackEventTest2() { MixpanelClient client = await MixpanelClient.GetCurrentClient(); TrackingEvent evt = GetEvent2(); await client.Track <TrackingEvent>(evt); }
public async Task WP8SL_TrySendLocalElementsTest() { MixpanelClient client = await MixpanelClient.GetCurrentClient(); TrackingEvent e1 = GetEvent1(); await client.SaveElement <TrackingEvent>(e1); TrackingEvent e2 = GetEvent2(); await client.SaveElement <TrackingEvent>(e2); ProfileUpdate p1 = GetProfileUpdate1(); await client.SaveElement <ProfileUpdate>(p1); ProfileUpdate p2 = GetProfileUpdate2(); await client.SaveElement <ProfileUpdate>(p2); ProfileUpdate p3 = GetProfileUpdate3(); await client.SaveElement <ProfileUpdate>(p3); ProfileUpdate p4 = GetProfileUpdate4(); await client.SaveElement <ProfileUpdate>(p4); ProfileUpdate p5 = GetProfileUpdate5(); await client.SaveElement <ProfileUpdate>(p5); ProfileUpdate p6 = GetProfileUpdate6(); await client.SaveElement <ProfileUpdate>(p6); ProfileUpdate p7 = GetProfileUpdate7(); await client.SaveElement <ProfileUpdate>(p7); await client.TrySendLocalElements(); }
private void UpdatePosition() { if (mNMEAClient != null) { try { if ((mNMEAClient.Status & NMEAGPSClient.NMEAGPSClient.GPS_STATUS.Fix) == NMEAGPSClient.NMEAGPSClient.GPS_STATUS.Fix) { GPSPosition position = mNMEAClient.PositionInformation; mLocationMessage.SetLocation((uint)position.HorizontalErrorEstimate, position.CurrentPosition.Latitude, position.CurrentPosition.Longitude, position.SpeedOverGround); TrackingEvent tEv = (mNMEAClient.TravellingState == NMEAGPSClient.NMEAGPSClient.MovingState.Moving) ? TrackingEvent.POSITION_MOVING : TrackingEvent.POSITION_STATIONARY; StateMachine(tEv); } else { mLocationMessage.MessageId = (mNMEAClient.Status == NMEAGPSClient.NMEAGPSClient.GPS_STATUS.OFFLINE) ? RTTMesg.RTTOutMsgIds.GPSNone : RTTMesg.RTTOutMsgIds.GPSNoFix; StateMachine(TrackingEvent.LOST_GPS); //CNXLog.WarnFormat("Setting state for No Fix {0}", mMobileMessage);(mNMEAClient.Status == NMEAGPSClient.NMEAGPSClient.GPS_STATUS.OFFLINE) } } catch (Exception ex) { CNXLog.Error("TrackerState GPS position error {0}", ex); } } }
public void sendEvent(TrackingEvent trackingEvent, CustomData customData = null, string section = null, int[] coordinates = null) { //logMessage("RedMetricsManager::sendEvent"); if (Application.isWebPlayer) { TrackingEventDataWithoutIDs data = new TrackingEventDataWithoutIDs(trackingEvent, customData, section, coordinates); string json = getJsonString(data); //logMessage("RedMetricsManager::sendEvent isWebPlayer will rmPostEvent json="+json); Application.ExternalCall("rmPostEvent", json); } else { //logMessage("RedMetricsManager::sendEvent non web player"); //TODO wait on playerID using an IEnumerator if (!string.IsNullOrEmpty(playerID)) { TrackingEventDataWithIDs data = new TrackingEventDataWithIDs(playerID, gameVersion, trackingEvent, customData, section, coordinates); string json = getJsonString(data); //logMessage("RedMetricsManager::sendEvent player already identified - pID="+playerID); sendDataStandalone(redMetricsEvent, json, value => wwwLogger(value, "sendEvent(" + trackingEvent + ")")); } else { logMessage("RedMetricsManager::sendEvent no registered player!", MessageLevel.ERROR); } } }
public void NETFX_TrackEventTest2() { MixpanelClient client = MixpanelClient.GetCurrentClient(); TrackingEvent evt = GetEvent2(); client.Track(evt); }
public TrackingEventDataWithoutIDs( TrackingEvent _trackingEvent, CustomData _customData = null, string _section = null, int[] _coordinates = null ) : base(_trackingEvent, _customData, _section, _coordinates) { }
public void sendEvent(TrackingEvent trackingEvent, Vector2 coordinates, CustomData customData = null, string section = null) { int[] _coordinates = { Mathf.RoundToInt(coordinates.x), Mathf.RoundToInt(coordinates.y) }; sendEvent(trackingEvent, customData, section, _coordinates); }
public async Task Write(TrackingEvent trackingEvent) { using (var context = _contextFactory()) { context.Set <TrackingEvent>().Add(trackingEvent); await context.SaveChangesAsync(); } }
private Dictionary <String, TrackingEvent> ParseMultiObjectTrackHTML(String html) { var ret = new Dictionary <String, TrackingEvent>(); //If something was downloaded... if (!String.IsNullOrWhiteSpace(html)) { HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); //Jump to the first grandchild <tr>, that is, <tag1><tag2><tr> var trs = doc.DocumentNode.SelectNodes("//tr"); if (trs == null) { if (html.IndexOf(PACKAGE_NOT_FOUND_MESSAGE) != 0) { //throw new Exception("Package not found."); return(ret); } throw new Exception("no <tr> found"); } //Skips the first <tr> as it's a header foreach (HtmlNode tr in trs.Skip(1)) { var ev = new TrackingEvent(); HtmlNodeCollection tds = tr.ChildNodes; ev.TrackingNumber = tds[0].FirstChild.InnerText; ev.Description = tds[2].FirstChild.InnerText; // Status String dataString = tds[4].InnerText; ev.Date = DateTime.Parse(dataString, dateCulture); ev.Place = tds[6].InnerText; if (ev.Place.Contains("/")) { string[] city = ev.Place.Trim().Split("/".ToCharArray()); ev.City = city[0]; if (city.Count() == 2) { ev.UF = city[1]; } } ret.Add(ev.TrackingNumber, ev); } } return(ret); }
public void startTracking() { //Start tracking with "Start"-event addTrackingEvent(new TrackingEvent(TrackingEventType.Start, transform.position, transform.rotation, Time.time)); TrackingEvent change = new TrackingEvent(TrackingEventType.Change, transform.position, transform.rotation, Time.time); change.data = wii ? "WII" : "JOY"; addTrackingEvent(change); }
public void change() { //Track controller change TrackingEvent change = new TrackingEvent(TrackingEventType.Change, transform.position, transform.rotation, Time.time); wii = !wii; change.data = wii ? "WII" : "JOY"; addTrackingEvent(change); }
private TrackingEvent GetEvent1() { // Sample event tracking TrackingEvent evt = new TrackingEvent("Signed Up"); evt.Properties = new TrackingEventProperties(Token); evt.Properties.DistinctId = "13793"; evt.Properties.All["Referred by"] = "Friend"; return(evt); }
/// <summary> /// Processes raw open tracker data from current tracking event object, extract the data and transform in to /// Unity3D vector data and passes data to Unity3D game object's transform node. /// </summary> public static void transformOpenTrackerToUnity3D(TrackingEvent ev,out Vector3 position,out Quaternion orientation) { // get current position of tracking event floatvector pos = ev.getPosition(); floatvector orient = ev.getOrientation(); //convert it to unity vectors and rotation matrix position = new Vector3(pos[0], pos[1], pos[2]); orientation = new Quaternion(orient[0], orient[1], orient[2], orient[3]); }
public TrackingEventDataWithIDs( string _playerID, string _gameVersionID, TrackingEvent _trackingEvent, CustomData _customData = null, string _section = null, int[] _coordinates = null ) : base(_trackingEvent, _customData, _section, _coordinates) { player = _playerID; gameVersion = _gameVersionID; }
public TrackingEventDataWithIDs( System.Guid _playerGuid, System.Guid _gameVersionGuid, TrackingEvent _trackingEvent, CustomData _customData = null, string _section = null, int[] _coordinates = null ) : base(_trackingEvent, _customData, _section, _coordinates) { player = new System.Guid(_playerGuid.ToByteArray()); gameVersion = new System.Guid(_gameVersionGuid.ToByteArray()); }
private TrackingEvent GetEvent2() { // other sample using special & custom properties TrackingEvent evt = new TrackingEvent("Level Complete"); evt.Properties = new TrackingEventProperties(Token); evt.Properties.DistinctId = "13793"; evt.Properties.Time = MixpanelClient.ToEpochTime(DateTime.Now); evt.Properties.IP = "203.0.113.9"; evt.Properties.Tag = "Tim Trefren"; evt.Properties.All["Level Number"] = 9; return(evt); }
private void OnTrackWorkbook(object sender, RibbonControlEventArgs e) { if (!ShowMissingItemsWarning()) { return; } // 1. Submit the current workbook to the TrackingSystem ITrackable trackable = tracker.Get <Workbook>(); trackable.ValueUpdated += (value) => extension.Tracking.Post <Workbook>(TrackingEvent.Create((Workbook)value)); trackable.TrackedValue = Globals.ThisAddIn.Application.ActiveWorkbook; trackable.Enabled = true; }
public TrackingEventData( TrackingEvent _trackingEvent, CustomData _customData = null, string _section = null, int[] _coordinates = null ) { //cf http://stackoverflow.com/questions/114983/given-a-datetime-object-how-do-i-get-a-iso-8601-date-in-string-format/115002#115002 userTime = System.DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ", System.Globalization.CultureInfo.InvariantCulture); setTrackingEvent(_trackingEvent); customData = _customData; section = _section; coordinates = _coordinates; }
/// <summary> /// Changes the status of an event, when tracking is stopped or started /// </summary> /// <param name="isTracking"></param> public void SetTrackingStatus(bool isTracking) { TrackingEvent eventResult = Events.Where(e => e.EventId == selectedEvent.EventId).FirstOrDefault(); if (isTracking) { eventResult.Status = "Tracker"; dataController.SaveTrackingEvent(eventResult); } else { eventResult.Status = "Tracking stoppet"; dataController.DeleteTrackingEvent(); } }
public void fix() { //Problem with files was the control method switches to come out as double. Because of that the used movement methods were messed up. //We had to manually change the starting method from some of the files bool started = false; int current = 0; List <int> toRemove = new List <int>(); for (int i = 0; i < trackingPoints.points.Count; i++) { TrackingEvent e = trackingPoints.points[i]; //When the starting event is found, take the next event, which is control method event, and take the method into variable if (e.type == TrackingEventType.Start) { started = true; current = trackingPoints.points[i + 1].data == "WII" ? 0 : 1; i++; } else if (!started) { //If we didn't meet the starting event yet we can delete these events as they are from practice range toRemove.Add(i); } else if (e.type == TrackingEventType.Change) { //When we get control change event we override the information about which control method is used based on the starting method e.data = current == 1 ? "WII" : "JOY"; if (current == 1) { current = 0; } else { current = 1; } i++; toRemove.Add(i); } } //Remove all points that happened before Start-event toRemove.Reverse(); foreach (int i in toRemove) { trackingPoints.points.RemoveAt(i); } }
public TrackingPoupViewModel(TrackingEventViewModel trackingEventViewModel, TrackingEvent selectedEvent) { serverClient = new ServerClient(); sharedData = SingletonSharedData.GetInstance(); sharedData.TrackingPoupViewModel = this; this.selectedEvent = selectedEvent; this.trackingEventViewModel = trackingEventViewModel; SlideCompletedCMD = new Command(SlideCompleted); InitializeTrackingText(); MessagingCenter.Subscribe <String>(this, "TrackingStopped", (value) => { StopTracking(); }); }
public void NETFX_TrySendLocalElementsTest() { MixpanelClient client = MixpanelClient.GetCurrentClient(); TrackingEvent e1 = GetEvent1(); client.SaveElement(e1); TrackingEvent e2 = GetEvent2(); client.SaveElement(e2); ProfileUpdate p1 = GetProfileUpdate1(); client.SaveElement(p1); ProfileUpdate p2 = GetProfileUpdate2(); client.SaveElement(p2); ProfileUpdate p3 = GetProfileUpdate3(); client.SaveElement(p3); ProfileUpdate p4 = GetProfileUpdate4(); client.SaveElement(p4); ProfileUpdate p5 = GetProfileUpdate5(); client.SaveElement(p5); ProfileUpdate p6 = GetProfileUpdate6(); client.SaveElement(p6); ProfileUpdate p7 = GetProfileUpdate7(); client.SaveElement(p7); client.TrySendLocalElements(); }
// see github.com/CyberCri/RedMetrics.js // with type -> eventCode public void sendEvent(TrackingEvent trackingEvent, string customData = null, string section = null, string coordinates = null) { //logMessage("RedMetricsManager::sendEvent"); if (Application.isWebPlayer) { string json = createJsonForRedMetricsJS (prepareEvent (trackingEvent), customData, section, coordinates); //logMessage("RedMetricsManager::sendEvent isWebPlayer will rmPostEvent json="+json); Application.ExternalCall ("rmPostEvent", json); } else { //logMessage("RedMetricsManager::sendEvent non web player"); //TODO wait on playerID using an IEnumerator if (!string.IsNullOrEmpty (playerID)) { //logMessage("RedMetricsManager::sendEvent player already identified - pID="+playerID); string ourPostData = "{\"gameVersion\":" + gameVersion + "," + "\"player\":" + playerID + "," + "\"type\":\"" + prepareEvent (trackingEvent) + "\"}"; sendData (redMetricsEvent, ourPostData, value => wwwLogger (value, "sendEvent(" + prepareEvent (trackingEvent) + ")")); } else { logMessage ("RedMetricsManager::sendEvent no registered player!", MessageLevel.ERROR); } } }
private TrackingEvent ParseSingleObjectTrackHTML(String html) { //If something was downloaded... if (!String.IsNullOrWhiteSpace(html)) { HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); //Jump to the first grandchild <tr>, that is, <tag1><tag2><tr> var tds = doc.DocumentNode.SelectNodes("//td[@bgcolor=\"#f5f5f5\"]"); if (tds == null) { if (html.IndexOf(PACKAGE_NOT_FOUND_MESSAGE) != 0) { return(null); } throw new Exception("CN: Unable to find the track info table"); } var ev = new TrackingEvent(); ev.TrackingNumber = tds[0].InnerText.Trim().Substring(0, 13); ev.Description = tds[2].InnerText.Trim(); String dataString = tds[5].InnerText.Trim().Substring(0, 10); ev.Date = DateTime.Parse(dataString); ev.Place = "CHINA-" + tds[4].InnerText.Trim(); return(ev); } return(null); }
/// <summary> /// Navigates to a PopupPage with the selected event /// </summary> private async void NavigateToEvent() { if (selectedEvent != null) { if (selectedEvent.IsLive || selectedEvent.Status.ToLower().Equals("tracker") || ((selectedEvent.EventStart.Date == DateTime.Now.Date) && (selectedEvent.EventStart - DateTime.Now).Minutes < trackingTimeLimit)) { TrackingEvent currentlyTrackingEvent = dataController.GetTrackingEvent().Result; if ((currentlyTrackingEvent != null && selectedEvent.EventId == currentlyTrackingEvent.EventId) || !Preferences.Get("isTracking", false)) { await PopupNavigation.PushAsync(new TrackingPopupView(this, selectedEvent)); } else { Application.Current.MainPage.DisplayAlert("Tracking", "Du kan kun track et event af gangen", "Ok"); } } else { Application.Current.MainPage.DisplayAlert("Tracking", "Du kan først starte tracking 30 minutter før eventet starter", "Ok"); } } }
public static TrackingInfo Map(JObject obj) { var trackingInfo = new TrackingInfo { Carrier = obj.GetValue("Carrier") == null ? "" : obj.GetValue("Carrier").ToString(), Service = obj.GetValue("Service") == null ? "" : obj.GetValue("Service").ToString(), TrackingNumber = obj.GetValue("TrackingNumber") == null ? "" : obj.GetValue("TrackingNumber").ToString(), DateShipped = obj.GetValue("DateShipped") == null ? "" : obj.GetValue("DateShipped").ToString() }; var trackingRecord = new List <TrackingEvent>(); if (obj.GetValue("TrackingRecord") == null) { trackingInfo.TrackingRecord = new List <TrackingEvent>(); return(trackingInfo); } var jList = JArray.Parse(obj.GetValue("TrackingRecord").ToString()); foreach (JObject item in jList) { var newEvent = new TrackingEvent { EventDate = item.GetValue("EventDate") == null ? "" : item.GetValue("EventDate").ToString(), EventTime = item.GetValue("EventTime") == null ? "" : item.GetValue("EventTime").ToString(), Location = item.GetValue("Location") == null ? "" : item.GetValue("Location").ToString(), Description = item.GetValue("Description") == null ? "" : item.GetValue("Description").ToString(), EventDateTime = item.GetValue("EventDateTime") == null ? "" : item.GetValue("EventDateTime").ToString() }; trackingRecord.Add(newEvent); } trackingInfo.TrackingRecord = trackingRecord; return(trackingInfo); }
/// <summary> /// Create a new TrackingEvent and passes this event to tracker object to receive tracking data from device. /// Update private member variables. /// </summary> /// <returns>TrackingEvent</returns> protected TrackingEvent updateTracking() { // create new tracking event and get current tracker event TrackingEvent trackingEvent = new TrackingEvent(); //update tracking timestamp if(tracker!=null) { if (tracker.getEvent(trackingEvent)) _trackingTimestamp = trackingEvent.getTime(); } return trackingEvent; }
private void StateMachine(TrackingEvent trackingEvent) { // events are from multiple threads // synchronise activity lock (mStateLock) { try { TrackingState newState = mTrackingState; switch (mTrackingState) { case TrackingState.ALARM: switch (trackingEvent) { case TrackingEvent.ALARM_ACTIVE: // refresh the alarm state mLocationMessage.Alarm = true; break; case TrackingEvent.POSITION_MOVING: newState = TrackingState.MOVING; break; case TrackingEvent.POSITION_STATIONARY: newState = TrackingState.STATIONARY; break; case TrackingEvent.LOST_GPS: newState = TrackingState.LOST; mRequiresReport = true; break; case TrackingEvent.TICK: //MakeMinimalReport(); break; case TrackingEvent.TOCK: mFullReportRequired = true; MakeFullReport(); break; case TrackingEvent.CATALOGUE: mFullReportRequired = true; break; default: break; } break; case TrackingState.MOVING: switch (trackingEvent) { case TrackingEvent.ALARM_ACTIVE: // refresh the alarm state mLocationMessage.Alarm = true; newState = TrackingState.ALARM; MakeUnscheduledMinimalReport(); break; case TrackingEvent.POSITION_MOVING: break; case TrackingEvent.POSITION_STATIONARY: newState = TrackingState.STATIONARY; break; case TrackingEvent.LOST_GPS: newState = TrackingState.LOST; mRequiresReport = true; break; case TrackingEvent.TICK: //MakeMinimalReport(); break; case TrackingEvent.TOCK: MakeFullReport(); break; case TrackingEvent.CATALOGUE: mFullReportRequired = true; break; default: break; } break; case TrackingState.STATIONARY: switch (trackingEvent) { case TrackingEvent.ALARM_ACTIVE: // refresh the alarm state mLocationMessage.Alarm = true; newState = TrackingState.ALARM; MakeUnscheduledMinimalReport(); break; case TrackingEvent.POSITION_MOVING: newState = TrackingState.MOVING; mRequiresReport = true; break; case TrackingEvent.POSITION_STATIONARY: break; case TrackingEvent.LOST_GPS: newState = TrackingState.LOST; mRequiresReport = true; break; case TrackingEvent.TICK: //if (mRequiresReport || mBeenMoving) //MakeMinimalReport(); break; case TrackingEvent.TOCK: mFullReportRequired = true; MakeFullReport(); break; case TrackingEvent.CATALOGUE: mFullReportRequired = true; break; default: break; } break; case TrackingState.LOST: switch (trackingEvent) { case TrackingEvent.ALARM_ACTIVE: // refresh the alarm state mLocationMessage.Alarm = true; newState = TrackingState.ALARM; MakeUnscheduledMinimalReport(); break; case TrackingEvent.POSITION_MOVING: newState = TrackingState.MOVING; mRequiresReport = true; break; case TrackingEvent.POSITION_STATIONARY: newState = TrackingState.STATIONARY; mRequiresReport = true; break; case TrackingEvent.LOST_GPS: break; case TrackingEvent.TICK: //if (mRequiresReport || mBeenMoving) //MakeMinimalReport(); break; case TrackingEvent.TOCK: MakeFullReport(); break; case TrackingEvent.CATALOGUE: mFullReportRequired = true; break; default: break; } break; default: break; } mTrackingState = newState; //CNXLog.InfoFormat("TrackingState: {0}", mTrackingState); } catch (Exception e) { CNXLog.Error("TrackingState: ", e); } } }
public void sendEvent(TrackingEvent trackingEvent, CustomData customData = null, string section = null, int[] coordinates = null) { //logMessage("RedMetricsManager::sendEvent"); if(Application.isWebPlayer) { TrackingEventDataWithoutIDs data = new TrackingEventDataWithoutIDs(trackingEvent, customData, section, coordinates); string json = getJsonString(data); //logMessage("RedMetricsManager::sendEvent isWebPlayer will rmPostEvent json="+json); Application.ExternalCall("rmPostEvent", json); } else { //logMessage("RedMetricsManager::sendEvent non web player"); //TODO wait on playerID using an IEnumerator if(!string.IsNullOrEmpty(playerID)) { TrackingEventDataWithIDs data = new TrackingEventDataWithIDs(playerID, gameVersion, trackingEvent, customData, section, coordinates); string json = getJsonString(data); //logMessage("RedMetricsManager::sendEvent player already identified - pID="+playerID); sendDataStandalone(redMetricsEvent, json, value => wwwLogger(value, "sendEvent("+trackingEvent+")")); } else { logMessage("RedMetricsManager::sendEvent no registered player!", MessageLevel.ERROR); } } }
public void sendEvent(TrackingEvent trackingEvent, CustomData customData = null, string section = null, int[] coordinates = null, string userTime = null) { string checkedSection = section; //TODO remove dependency to Hero class if (string.IsNullOrEmpty(section) && (null != Hero.get())) { checkedSection = Hero.get().getLastCheckpointName(); } int[] checkedCoordinates = null; if (null != coordinates) { checkedCoordinates = new int[coordinates.Length]; for (int i = 0; i < coordinates.Length; i++) { checkedCoordinates [i] = coordinates [i]; } } else { if (null != Hero.get()) { Vector3 position = Hero.get().gameObject.transform.position; checkedCoordinates = new int[2] { Mathf.FloorToInt(position.x), Mathf.FloorToInt(position.z) }; } } //logMessage(MessageLevel.DEFAULT, "RedMetricsManager::sendEvent({0})", trackingEvent.ToString()); if (Application.isWebPlayer) { TrackingEventDataWithoutIDs data = new TrackingEventDataWithoutIDs(trackingEvent, customData, checkedSection, checkedCoordinates, userTime); if (isGameSessionGUIDCreated) { string json = getJsonString(data); Application.ExternalCall("rmPostEvent", json); } else { addEventToSendLater(data); //TODO: what if connection fails, or even fails permanently? Should retry connection at different intervals } } else { //TODO wait on gameSessionGUID using an IEnumerator if (defaultGameSessionGUID != gameSessionGUID) { } else { logMessage(MessageLevel.ERROR, "sendEvent default player guid: no registered player!"); } TrackingEventDataWithIDs data = new TrackingEventDataWithIDs(gameSessionGUID, gameVersionGuid, trackingEvent, customData, checkedSection, checkedCoordinates); string json = getJsonString(data); //logMessage (MessageLevel.DEFAULT, string.Format ("RedMetricsManager::sendEvent - gameSessionGUID={0}, gameVersionGuid={1}, json={2}", gameSessionGUID, gameVersionGuid, json)); sendDataStandalone(redMetricsEvent, json, value => wwwLogger(value, "sendEvent(" + trackingEvent + ")")); //TODO pass data as parameter to sendDataStandalone so that it's serialized inside } }
/// <summary> /// Initializes a new instance of the <see cref="AnnounceMessage" /> class. /// </summary> /// <param name="connectionId">The connection identifier.</param> /// <param name="transactionId">The transaction identifier.</param> /// <param name="infoHash">The information hash.</param> /// <param name="peerId">The peer identifier.</param> /// <param name="downloaded">The downloaded.</param> /// <param name="left">The left.</param> /// <param name="uploaded">The uploaded.</param> /// <param name="trackingEvent">The tracking event.</param> /// <param name="key">The key.</param> /// <param name="numberWanted">The number wanted.</param> /// <param name="endpoint">The endpoint.</param> public AnnounceMessage(long connectionId, int transactionId, string infoHash, string peerId, long downloaded, long left, long uploaded, TrackingEvent trackingEvent, uint key, int numberWanted, IPEndPoint endpoint) : base(TrackingAction.Announce, transactionId) { infoHash.CannotBeNullOrEmpty(); infoHash.Length.MustBeEqualTo(40); peerId.CannotBeNullOrEmpty(); peerId.Length.MustBeGreaterThanOrEqualTo(20); downloaded.MustBeGreaterThanOrEqualTo(0); left.MustBeGreaterThanOrEqualTo(0); uploaded.MustBeGreaterThanOrEqualTo(0); endpoint.CannotBeNull(); this.ConnectionId = connectionId; this.InfoHash = infoHash; this.PeerId = peerId; this.Downloaded = downloaded; this.Left = left; this.Uploaded = uploaded; this.TrackingEvent = trackingEvent; this.Key = key; this.NumberWanted = numberWanted; this.Endpoint = endpoint; }
private void setTrackingEvent(TrackingEvent _trackingEvent) { internalTrackingEvent = _trackingEvent; }
public static void Track(TrackingEvent info) { _impl.Track(info); }
public void sendEvent(TrackingEvent trackingEvent, Vector3 coordinates, CustomData customData = null, string section = null) { int[] _coordinates = { Mathf.RoundToInt(coordinates.x), Mathf.RoundToInt(coordinates.y), Mathf.RoundToInt(coordinates.z) }; sendEvent(trackingEvent, customData, section, _coordinates); }
public void sendEvent (TrackingEvent trackingEvent, CustomData customData = null, string section = null, int[] coordinates = null, string userTime = null) { string checkedSection = section; //TODO remove dependency to Hero class if (string.IsNullOrEmpty (section) && (null != Hero.get ())) { checkedSection = Hero.get ().getLastCheckpointName (); } int[] checkedCoordinates = null; if (null != coordinates) { checkedCoordinates = new int[coordinates.Length]; for (int i = 0; i < coordinates.Length; i++) { checkedCoordinates [i] = coordinates [i]; } } else { if (null != Hero.get ()) { Vector3 position = Hero.get ().gameObject.transform.position; checkedCoordinates = new int[2] { Mathf.FloorToInt (position.x), Mathf.FloorToInt (position.z) }; } } //logMessage(MessageLevel.DEFAULT, "RedMetricsManager::sendEvent({0})", trackingEvent.ToString()); if (Application.isWebPlayer) { TrackingEventDataWithoutIDs data = new TrackingEventDataWithoutIDs (trackingEvent, customData, checkedSection, checkedCoordinates, userTime); if(isGameSessionGUIDCreated) { string json = getJsonString (data); Application.ExternalCall ("rmPostEvent", json); } else { addEventToSendLater(data); //TODO: what if connection fails, or even fails permanently? Should retry connection at different intervals } } else { //TODO wait on gameSessionGUID using an IEnumerator if (defaultGameSessionGUID != gameSessionGUID) { } else { logMessage (MessageLevel.ERROR, "sendEvent default player guid: no registered player!"); } TrackingEventDataWithIDs data = new TrackingEventDataWithIDs (gameSessionGUID, gameVersionGuid, trackingEvent, customData, checkedSection, checkedCoordinates); string json = getJsonString (data); //logMessage (MessageLevel.DEFAULT, string.Format ("RedMetricsManager::sendEvent - gameSessionGUID={0}, gameVersionGuid={1}, json={2}", gameSessionGUID, gameVersionGuid, json)); sendDataStandalone (redMetricsEvent, json, value => wwwLogger (value, "sendEvent(" + trackingEvent + ")")); //TODO pass data as parameter to sendDataStandalone so that it's serialized inside } }
private string prepareEvent(TrackingEvent tEvent) { return tEvent.ToString ().ToLower (); }