public static async Task CreateUserActivityAsync(UserActivityData activityData, IAdaptiveCard adaptiveCard) { var activity = await activityData.ToUserActivity(); activity.VisualElements.Content = adaptiveCard; //Save await SaveAsync(activity); }
public static async Task AddSampleUserActivity() { var activityId = nameof(SchemeActivationSamplePage); var displayText = "PIANTE E FIORI"; var description = $"Torna alle schede botaniche '{Package.Current.DisplayName}' at {DateTime.Now.ToShortTimeString()}"; var imageUrl = "ms-appx:///Assets/lotus_1600.png"; //var imageUrl = "http://adaptivecards.io/content/cats/2.png"; var activityData = new UserActivityData(activityId, CreateActivationDataSample(), displayText, Colors.DarkRed); var adaptiveCard = CreateAdaptiveCardSample(displayText, description, imageUrl); await UserActivityService.CreateUserActivityAsync(activityData, adaptiveCard); }
public static async Task CreateUserActivityAsync(UserActivityData activityData) { UserActivityChannel channel = UserActivityChannel.GetDefault(); UserActivity userActivity = await channel.GetOrCreateUserActivityAsync("HomePagePage"); // Populate required properties userActivity.VisualElements.DisplayText = "Home Page"; userActivity.ActivationUri = new Uri("pf-app://HomePagePage"); //Save await userActivity.SaveAsync(); //save the new metadata // Dispose of any current UserActivitySession, and create a new one. _currentActivity?.Dispose(); _currentActivity = userActivity.CreateSession(); // Cleanup any content assigned earlier //activity.VisualElements.Content = null; // await SaveAsync(activity); }