예제 #1
0
        private static void LaunchOscovaBot()
        {
            var websiteUrl = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);
            var oscovaBot  = new OscovaBot();

            oscovaBot.Dialogs.Add(new HelloBotDialog());
            oscovaBot.CreateRecognizer("start", new Regex(@"(?<!/)(/(?:start))(?(?<=\w)\b)", RegexOptions.IgnoreCase));
            oscovaBot.Trainer.StartTraining();

            _oscovaBotChannel = new WidgetChannel <OscovaBot>(oscovaBot)
            {
                ServiceUrl  = websiteUrl + "/BotService.aspx",
                ResourceUrl = websiteUrl + "/BotResource",
            };
        }
예제 #2
0
        private static void LaunchSimlBot()
        {
            var websiteUrl = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);
            var simlBot    = new SimlBot();

            _simlBotChannel = new WidgetChannel <SimlBot>(simlBot)
            {
                ServiceUrl  = websiteUrl + "/BotService.aspx",
                ResourceUrl = websiteUrl + "/BotResource",
            };

            using (var webClient = new WebClient())
            {
                var result = webClient.DownloadString(_simlBotChannel.ResourceUrl + "//package.txt");
                simlBot.PackageManager.LoadFromString(result);
            }
        }
예제 #3
0
        static BotService()
        {
            Bot           = new OscovaBot();
            WidgetChannel = new WidgetChannel(Bot);

            //Add the pre-built channel test dialog.
            Bot.Dialogs.Add(new ChannelTestDialog(Bot));

            //Start training.
            Bot.Trainer.StartTraining();

            var websiteUrl = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);

            WidgetChannel.ServiceUrl  = websiteUrl + "/BotService.aspx";
            WidgetChannel.ResourceUrl = websiteUrl + "/BotResources";

            WidgetChannel.WidgetTitle      = "Our Smart Bot!";
            WidgetChannel.LaunchButtonText = "Ask";
            WidgetChannel.InputPlaceHolder = "Ask your query here...";
        }
예제 #4
0
        public override void Render(WidgetRenderArgs args)
        {
            GH_Canvas     canvas  = args.Canvas;
            WidgetChannel channel = args.Channel;
            float         zoom    = canvas.Viewport.Zoom;
            int           num     = 255;

            if (zoom < 1f)
            {
                float num2 = (zoom - 0.5f) * 2f;
                num = (int)((float)num * num2);
            }
            _menu.Render(canvas.Graphics, false, false, false);
            if (_expanded && num > 0)
            {
                RenderMenuParameters(canvas, canvas.Graphics);
                foreach (GH_Attr_Widget control in _controls)
                {
                    control.OnRender(args);
                }
            }
        }
예제 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     WidgetChannel.Process(Request, Response);
 }
 public WidgetRenderArgs(GH_Canvas canvas, WidgetChannel channel)
 {
     Canvas  = canvas;
     Channel = channel;
 }