Skip to content

Commit

Permalink
Button GetAgent Support Added
Browse files Browse the repository at this point in the history
  • Loading branch information
NizamLZ committed Jul 5, 2017
1 parent 6da79b7 commit 2e82fc5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ANAConversationSimulator/Helpers/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ public static IPropertySet LocalStore
}

public static void InitMemoryStack()
{
InitDeviceIdInMemoryStack();
}

public static void InitDeviceIdInMemoryStack()
{
if (!Utils.LocalStore.ContainsKey("DEVICE_ID"))
Utils.LocalStore["DEVICE_ID"] = Utils.DeviceId;
Utils.LocalStore["DEVICE_ID"] = Utils.GetFinalDeviceId();
}

public static void ShowDialog(string txt)
Expand Down Expand Up @@ -163,17 +168,15 @@ public static ChatActivityEvent GetClickEvent(string nodeId, string userId, stri
};
}

private static string _deviceId;
public static string DeviceId
{
get
{
if (_deviceId == null)
_deviceId = CalculateMD5Hash(GetDeviceId());
return _deviceId;
return (string)Utils.LocalStore["DEVICE_ID"];
}
}

public static string GetFinalDeviceId() => CalculateMD5Hash(GetDeviceId());
private static string GetDeviceId()
{
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.System.Profile.HardwareIdentification"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Collections.Generic;
using Windows.System.Threading;
using ANAConversationSimulator.Models.Chat.Sections;
using ANAConversationSimulator.ViewModels;

namespace ANAConversationSimulator.Services.ChatInterfaceServices
{
Expand Down Expand Up @@ -152,6 +153,12 @@ public async void Execute(object parameter)
if (!button.Hidden)
ButtonActionHelper.HandlePostTextToThread(button.ButtonText);
break;
case ButtonTypeEnum.GetAgent:
if (MainPageViewModel.CurrentInstance != null)
MainPageViewModel.CurrentInstance.AgentChat();
if (!button.Hidden)
ButtonActionHelper.HandlePostTextToThread(button.ButtonText);
break;
default:
Utils.ShowDialog($"Button type: {button.ButtonType} not supported");
break;
Expand Down

0 comments on commit 2e82fc5

Please sign in to comment.