private EventTelemetry BuildEventTelemetry(IActivity activity)
        {
            var activityAdapter = new ActivityAdapter(activity);
            var builder         = new EventTelemetryBuilder(activityAdapter, this.settings);

            return(builder.Build());
        }
Exemple #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ActivityActivity);

            list = FindViewById <RecyclerView>(Resource.Id.Activity);
            var lm = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false);

            list.SetLayoutManager(lm);
            list.Visibility = ViewStates.Gone;

            adapter = new ActivityAdapter();
            list.SetAdapter(adapter);

            refresher            = FindViewById <SwipeRefreshLayout>(Resource.Id.Refresher);
            refresher.Refresh   += Refresher_Refresh;
            refresher.Refreshing = true;

            checkin            = FindViewById <MaterialButton>(Resource.Id.Checkin);
            checkin.Visibility = ViewStates.Gone;
            checkin.Click     += Checkin_Click;

            message = FindViewById <TextView>(Resource.Id.Message);

            GetData();

            StateHolder.Instance.OnCheckIn += () => GetData();
            StateHolder.Instance.OnNew     += () => GetData();
            StateHolder.Instance.OnRate    += ShowRate;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.main);

            var recyclerView = FindViewById <RecyclerView>(Resource.Id.activityList);

            var layoutManager = new LinearLayoutManager(this);

            layoutManager.Orientation = LinearLayoutManager.Vertical;

            recyclerView.SetLayoutManager(layoutManager);

            var activityService = new ActivityService();
            var activities      = activityService.FetchActivityList();

            var adapter = new ActivityAdapter(activities);

            recyclerView.SetAdapter(adapter);

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                Window.SetStatusBarColor(new Android.Graphics.Color(ContextCompat.GetColor(Application, Resource.Color.primary_dark)));
            }

            var fab = FindViewById <FloatingActionButton>(Resource.Id.fab_add);

            fab.Click += Fab_Click;

            fab.Visibility = ViewStates.Invisible;
        }
Exemple #4
0
        public async Task OnTurnAsync(
            ITurnContext turnContext,
            NextDelegate next,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            if (this.disposed)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            BotAssert.ContextNotNull(turnContext);

            #pragma warning disable CA1062 // Validate arguments of public methods
            var activityAdapter = new ActivityAdapter(turnContext.Activity);
            #pragma warning restore CA1062 // Validate arguments of public methods

            if (activityAdapter.IsIncomingMessage())
            {
                await this.sentimentInstrumentation.TrackMessageSentiment(turnContext.Activity)
                .ConfigureAwait(false);
            }

            if (next != null)
            {
                await next(cancellationToken)
                .ConfigureAwait(false);
            }
        }
        public void TrackCustomEvent(IActivity activity, string eventName = EventTypes.CustomEvent, IDictionary <string, string> properties = null)
        {
            BotAssert.ActivityNotNull(activity);

            var activityAdapter = new ActivityAdapter(activity);

            activityAdapter.TrackCustomEvent(this.telemetryClient, this.settings, eventName, properties);
        }
Exemple #6
0
        public async Task TrackMessageSentiment(IMessageActivity activity)
        {
            BotAssert.ActivityNotNull(activity);

            var activityAdapter = new ActivityAdapter(activity);

            await activityAdapter.TrackMessageSentiment(this.telemetryClient, this.settings, this.sentimentClient).ConfigureAwait(false);
        }
Exemple #7
0
        public async Task TrackMessageSentiment(IActivity activity)
        {
            if (activity == null)
            {
                throw new ArgumentNullException(nameof(activity));
            }

            var activityAdapter = new ActivityAdapter(activity);

            await activityAdapter.TrackMessageSentiment(this.telemetryClient, this.settings, this.sentimentClient).ConfigureAwait(false);
        }
        private void SetupAdaptors()
        {
            adapter            = new ActivityAdapter(this, activities);
            adapter.ItemClick += Adapter_ItemClick;

            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            recyclerView.SetAdapter(adapter);

            layoutManager = new LinearLayoutManager(this);
            recyclerView.SetLayoutManager(layoutManager);
        }
Exemple #9
0
        public void TrackCustomEvent(IActivity activity, string eventName = EventTypes.CustomEvent, IDictionary <string, string> properties = null)
        {
            if (activity == null)
            {
                throw new ArgumentNullException(nameof(activity));
            }

            var activityAdapter = new ActivityAdapter(activity);

            activityAdapter.TrackCustomEvent(this.telemetryClient, this.settings, eventName, properties);
        }
Exemple #10
0
        public Task TrackActivity(Microsoft.Bot.Connector.IActivity activity)
        {
            if (activity == null)
            {
                throw new ArgumentNullException(nameof(activity));
            }

            return(Task.Run(() =>
            {
                var activityAdapter = new ActivityAdapter(activity);
                activityAdapter.TrackCustomEvent(this.telemetryClient, this.settings, EventTypes.ActivityEvent);
            }));
        }
Exemple #11
0
        public void TrackIntent(IActivity activity, RecognizerResult result)
        {
            BotAssert.ActivityNotNull(activity);

            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            var activityAdapter         = new ActivityAdapter(activity);
            var recognizerResultAdapter = new RecognizerResultAdapter(result);

            activityAdapter.TrackIntent(recognizerResultAdapter.IntentResult, this.telemetryClient, this.settings);
        }
Exemple #12
0
        public void TrackEvent(IMessageActivity activity, QueryResult queryResult)
        {
            BotAssert.ActivityNotNull(activity);

            if (queryResult == null)
            {
                throw new ArgumentNullException(nameof(queryResult));
            }

            var activityAdapter    = new ActivityAdapter(activity);
            var queryResultAdapter = new QueryResultAdapter(queryResult);

            activityAdapter.TrackEvent(queryResultAdapter.QueryResult, this.settings, this.telemetryClient);
        }
        public void TrackEvent(IActivity activity, QnAMakerResults queryResult)
        {
            if (activity == null)
            {
                throw new ArgumentNullException(nameof(activity));
            }

            if (queryResult == null)
            {
                throw new ArgumentNullException(nameof(queryResult));
            }

            var activityAdapter    = new ActivityAdapter(activity);
            var queryResultAdapter = new QueryResultAdapter(queryResult);

            activityAdapter.TrackEvent(queryResultAdapter.QueryResult, this.settings, this.telemetryClient);
        }
        public void TrackIntent(IActivity activity, LuisResult result)
        {
            if (activity == null)
            {
                throw new ArgumentNullException(nameof(activity));
            }

            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            var activityAdapter   = new ActivityAdapter(activity);
            var luisResultAdapter = new LuisResultAdapter(result);

            activityAdapter.TrackIntent(luisResultAdapter.IntentResult, this.telemetryClient, this.settings);
        }
Exemple #15
0
        public void GIVENAnyActivity_WHENActivityAdapterIsInvoked_THENActivityIsMapped(IActivity activity)
        {
            // Arrange
            var adapter = new ActivityAdapter(activity);
            var time    = JsonConvert.SerializeObject(activity.Timestamp?.ToUniversalTime());

            time = time.Substring(1, time.Length - 2);

            // Act
            // Assert
            Assert.Equal(adapter.TimeStampIso8601, time);
            Assert.Equal(adapter.Type, activity.Type);
            Assert.Equal(adapter.ChannelId, activity.ChannelId);
            Assert.Equal(adapter.ReplyToId, activity.ReplyToId);
            Assert.Equal(adapter.MessageActivity.Text, activity.AsMessageActivity().Text);
            Assert.Equal(adapter.MessageActivity.Id, activity.AsMessageActivity().Id);
            Assert.Equal(adapter.ChannelAccount.Name, activity.From.Name);
            Assert.Equal(adapter.ChannelAccount.Id, activity.From.Id);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.main);

            fab            = FindViewById <FloatingActionButton>(Resource.Id.fab_add);
            fab.Click     += OnFabClick;
            fab.Visibility = ViewStates.Invisible;

            var activityList    = FindViewById <RecyclerView>(Resource.Id.activityList);
            var activityService = new ActivityService();
            var activities      = activityService.FetchActivityList();
            var layoutManager   = new LinearLayoutManager(this);
            var adapter         = new ActivityAdapter(activities);

            layoutManager.Orientation = LinearLayoutManager.Vertical;
            activityList.SetLayoutManager(layoutManager);
            activityList.SetAdapter(adapter);
        }
        private void SetRecyclerViewAdapters()
        {
            try
            {
                //Latest Songs RecyclerView >> LinearLayoutManager.Horizontal
                LatestSongsAdapter = new HSoundAdapter(Activity)
                {
                    SoundsList = new ObservableCollection <SoundDataObject>()
                };
                LatestSongsAdapter.OnItemClick += LatestSongsAdapterOnOnItemClick;

                //Top Songs RecyclerView >> LinearLayoutManager.Horizontal
                TopSongsAdapter = new HSoundAdapter(Activity)
                {
                    SoundsList = new ObservableCollection <SoundDataObject>()
                };
                TopSongsAdapter.OnItemClick += TopSongsAdapterOnOnItemClick;

                //Albums RecyclerView >> LinearLayoutManager.Horizontal
                AlbumsAdapter            = new HAlbumsAdapter(Activity);
                AlbumsAdapter.ItemClick += AlbumsAdapterOnItemClick;

                //Store RecyclerView >> LinearLayoutManager.Horizontal
                StoreAdapter = new HSoundAdapter(Activity)
                {
                    SoundsList = new ObservableCollection <SoundDataObject>()
                };
                StoreAdapter.OnItemClick += TopSongsAdapterOnOnItemClick;

                //Activities RecyclerView >> LinearLayoutManager.Vertical
                ActivitiesAdapter = new ActivityAdapter(Activity)
                {
                    ActivityList = new ObservableCollection <ActivityDataObject>()
                };
                ActivitiesAdapter.OnItemClick += ActivitiesAdapterOnOnItemClick;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #18
0
 internal ArrayFilter(ActivityAdapter _enclosing)
 {
     this._enclosing = _enclosing;
 }
Exemple #19
0
				internal ArrayFilter(ActivityAdapter _enclosing)
				{
					this._enclosing = _enclosing;
				}