Exemple #1
0
        public ICANPASSMESSAGE() : base("ICANPASSMESSAGEv1")
        {
            utility = new ICANPASSMESSAGEUtility();
            helper  = new ICANPASSMESSAGEHelper(utility, Hub);

            Hub.Subscribe <IUserResponse>(this.ProcessUserResponse);
            Hub.Subscribe <IBotResult>(this.ProcessBotResult);
            Hub.Subscribe <IMachineMessage>(this.ProcessMachineMessage);
            Hub.Subscribe <IUserFriendlyMachineMessage>(this.ProcessUserFriendlyMachineMessage);

            PrintHelp();
        }
Exemple #2
0
        public ICANPASSMESSAGEHelper(ICANPASSMESSAGEUtility utility, IHub hub, string configFilename = "ICANPASSMESSAGE_Subscribers.json")
        {
            this.utility        = utility;
            this.configFilename = configFilename;
            this.hub            = hub;

            if (File.Exists(this.configFilename))
            {
                subscribers = JsonConvert.DeserializeObject <Dictionary <string, StateValue> >(File.ReadAllText(this.configFilename));
                var list = subscribers.Keys.ToList();
                for (int i = 0; i < list.Count; i++)
                {
                    // Reset count
                    subscribers[list[i]].FailureCount = 0;
                }
            }
            else
            {
                subscribers = new Dictionary <string, StateValue>();
            }
        }
Exemple #3
0
 public override void Dispose()
 {
     utility = null;
     helper  = null;
 }