/// <summary> /// Set currently-selected site for current user in current conversation in current channel. /// </summary> /// <param name="site"></param> /// <returns></returns> public async Task SetCurrentSite(BotSite site) { // TODO - neither of these commented-out options work - the getter returns null. Why? //var botData = await GetPrivateConversationDataAsync(); //botData.SetProperty<BotSite>(Constants.StateKeys.CurrentSite, site); //await SetPrivateConversationDataAsync(botData); //var botData = await GeUserDataAsync(); //botData.SetProperty<BotSite>(Constants.StateKeys.CurrentSite, site); //await SetuserDataAsync(botData); BotContext.PrivateConversationData.SetValue <BotSite>(Constants.StateKeys.CurrentSite, site); }
/// <summary> /// Get currently-selected site for current user in current conversation in current channel. /// </summary> /// <returns></returns> public async Task <BotSite> GetCurrentSite() { // TODO - neither of these commented-out options work - the getter returns null. Why? //var botData = await GetPrivateConversationDataAsync(); //return botData.GetProperty<BotSite>(Constants.StateKeys.CurrentSite); //var botData = await GeUserDataAsync(); //return botData.GetProperty<BotSite>(Constants.StateKeys.CurrentSite); BotSite retrieved = null; BotContext.PrivateConversationData.TryGetValue <BotSite>(Constants.StateKeys.CurrentSite, out retrieved); return(retrieved); }