public ProfileControl()
     : base("fillProfile")
 {
     Dialogs.Add("fillProfile",
                 new WaterfallStep[]
     {
         async(dc, args, next) =>
         {
             dc.ActiveDialog.State = new Dictionary <string, object>();
             await dc.Prompt("textPrompt", "What's your name?");
         },
         async(dc, args, next) =>
         {
             dc.ActiveDialog.State["name"] = args["Value"];
             await dc.Prompt("textPrompt", "What's your phone number?");
         },
         async(dc, args, next) =>
         {
             dc.ActiveDialog.State["phone"] = args["Value"];
             await dc.End(dc.ActiveDialog.State);
         }
     }
                 );
     Dialogs.Add("textPrompt", new Builder.Dialogs.TextPrompt());
 }
Beispiel #2
0
 public ProfileControl()
     : base("fillProfile")
 {
     Dialogs.Add("fillProfile",
                 new WaterfallStep[]
     {
         async(dc, args, next) =>
         {
             dc.ActiveDialog.State = new Dictionary <string, object>();
             await dc.Prompt("textPrompt", "What is your name?");
         },
         async(dc, args, next) =>
         {
             dc.ActiveDialog.State["name"] = args["Value"];
             GameInfo game  = UserState <GameInfo> .Get(dc.Context);
             game.User.Name = args["Value"].ToString();
             await dc.Prompt("textPrompt", $"Hello {game.User.Name}! Be prepared to lose.");
         },
         async(dc, args, next) =>
         {
             dc.ActiveDialog.State["phone"] = args["Value"];
             await dc.End(dc.ActiveDialog.State);
         }
     });
     Dialogs.Add("textPrompt", new TextPrompt());
 }
Beispiel #3
0
        public void UpdateMessage(Message message)
        {
            if (message.ChatId == 0)
            {
                //личный диалог
                var dialog = Dialogs.SingleOrDefault(d => d.ChatId == message.RecieverId);

                if (dialog is null)
                {
                    //todo: добавляем новый чат в список.
                }
                else
                {
                    dispatcher.BeginInvoke(new Action(() =>
                    {
                        var index = Dialogs.IndexOf(dialog);
                        Dialogs.Remove(dialog);
                        dialog.LastMessageText = message.Text;
                        dialog.Time            = message.Time;
                        Dialogs.Add(dialog);
                        Dialogs.Move(index, 0);
                        Changed("Dialogs");

                        // AppGlobalConfig.NotifyIcon.ShowBalloonTip(500, dialog.ChatTitle, dialog.LastMessageText, ToolTipIcon.Info);
                    }));
                }
            }
        }
        /// <summary>
        /// Creates <see cref="ChangeUserPasswordViewModel"/> entity and opens password dialog window
        /// </summary>
        /// <param name="arg"></param>
        private void OnChangePassword(object arg)
        {
            var changePwdDialog = new ChangeUserPasswordViewModel(User);

            changePwdDialog.DialogClosing += OnChangePasswordDialogDialogClosing;
            Dialogs.Add(changePwdDialog);
        }
Beispiel #5
0
        /// <summary>
        /// Adds new user. Opens <see cref="UserDetailsView"/> dialog window
        /// </summary>
        /// <param name="arg"></param>
        private void OnAddUser(object arg)
        {
            var userDetailsVm = new UserDetailsViewModel(null, true);

            userDetailsVm.DialogClosing += OnAddUserDialogClosing;
            Dialogs.Add(userDetailsVm);
        }
        private void EnsureDependenciesInstalled()
        {
            lock (this)
            {
                if (!installedDependencies)
                {
                    installedDependencies = true;

                    foreach (var trigger in Triggers)
                    {
                        if (trigger is IDialogDependencies depends)
                        {
                            foreach (var dlg in depends.GetDependencies())
                            {
                                Dialogs.Add(dlg);
                            }
                        }
                    }

                    // Wire up selector
                    if (Selector == null)
                    {
                        // Default to most specific then first
                        Selector = new MostSpecificSelector {
                            Selector = new FirstSelector()
                        };
                    }

                    Selector.Initialize(Triggers);
                }
            }
        }
Beispiel #7
0
        public SierraVgaController(AssetManager assets, IMouse mouse)
            : base(assets, mouse)
        {
            this.Assets.RootDirectory = "Content/Gui/Sierra Vga";
            Mouse.Cursor = Cursors.Walk;
            Mouse.SaveCursorToBackup();
            Mouse.ButtonUp += MouseControllerOnButtonUp;

            StatusBar             = new StatusBar(assets);
            StatusBar.MouseEnter += TopBarOnMouseEnter;

            VerbBar             = new VerbBar(assets);
            VerbBar.MouseLeave += VerbBarOnMouseLeave;

            TextBox = new TextBox(assets);

            Rest = new Rest(assets);

            ExtensionBar = new ExtensionBar(assets);

            Windows.Add(StatusBar);
            Windows.Add(VerbBar);
            Dialogs.Add(TextBox);
            Dialogs.Add(Rest);
            Dialogs.Add(ExtensionBar);
        }
        public MakePaymentDialog() : base(Id)
        {
            Dialogs.Add(Id, new WaterfallStep[]
            {
                async(dc, args, next) => {
                    await dc.Prompt("textPrompt", "Who would you like to pay?");
                },
                async(dc, args, next) =>
                {
                    var state          = dc.Context.GetConversationState <Dictionary <string, object> >();
                    state["Recipient"] = (string)args["Value"];
                    await dc.Prompt("numberPrompt",
                                    $"{state["Recipient"]}, got it{Environment.NewLine}How much should I pay?", new PromptOptions
                    {
                        RetryPromptString = "Sorry, please give me a number."
                    });
                },
                async(dc, args, next) =>
                {
                    var state       = dc.Context.GetConversationState <Dictionary <string, object> >();
                    state["Amount"] = (int)args["Value"];
                    await dc.Context.SendActivity(
                        dc.Context.Activity.CreateReply(
                            $"Thank you, I've paid {state["Amount"]} to {state["Recipient"]} 💸"));
                    await dc.End();
                }
            });

            // add the prompts
            Dialogs.Add("textPrompt", new TextPrompt());
            Dialogs.Add("numberPrompt", new NumberPrompt <int>(Culture.English));
        }
Beispiel #9
0
        public SessionEvaluationDialog(ISessionService sessionService) : base(Id)
        {
            _sessionService = sessionService;

            Dialogs.Add(Id, new WaterfallStep[]
            {
                // collection of delegates
                SpeakerNameStep,
                SpeakerConfirmStep,
                SessionStep,
                PresentationSkillsStep,
                ContentStep,
                FeedbackStep,
                DoneStep
            });

            //Define the prompts used in this conversation flow.
            Dialogs.Add("text", new TextPrompt());

            var pickList = new ChoicePrompt(Culture.English);

            pickList.Style = ListStyle.SuggestedAction;
            Dialogs.Add("pickList", pickList);
            Dialogs.Add("confirm", new Microsoft.Bot.Builder.Dialogs.ConfirmPrompt(Culture.English));
        }
Beispiel #10
0
        public void ChoiceDialoglAnsver(int dialolAnsveNumber)
        {
            var character = Level.GetCharacterNextHero(Hero.NextX(), Hero.NextY());

            if (!character.Dialog.CheckEnd())
            {
                Dialogs.Add(character.Dialog.Steps[character.Dialog.CurrentStepNumber].Text);
                Dialogs.Add("-" + character.Dialog.Steps[character.Dialog.CurrentStepNumber].Ansvers[dialolAnsveNumber].Text);
                character.Dialog.SetNextStep(dialolAnsveNumber);
            }
            else
            {
                Dialogs.Add(character.Dialog.Steps[character.Dialog.CurrentStepNumber].Text);
                Dialogs.Add("\n");
                Hero.Notepad.Dilogs.AddRange(Dialogs);
                Dialogs.Clear();
                if (character.Dialog.CheckGoodResult())
                {
                    SetMessage(character.DilogResult(Hero));
                }
                character.Dialog.CurrentStepNumber = 0;
                character.Dialog = new Dialog(new List <DialogStep>()
                {
                    new DialogStep("Здравствуйте! У меня нет для вас новостей.")
                });
                GameState = GameState.Communication;
            }
        }
        protected virtual void ShowDialogFragment(
            Type view,
            MvxDialogFragmentPresentationAttribute attribute,
            MvxViewModelRequest request)
        {
            var fragmentName = FragmentJavaName(attribute.ViewType);
            IMvxFragmentView mvxFragmentView = CreateFragment(attribute, fragmentName);
            var dialog = (DialogFragment)mvxFragmentView;

            // MvxNavigationService provides an already instantiated ViewModel here,
            // therefore just assign it
            if (request is MvxViewModelInstanceRequest instanceRequest)
            {
                mvxFragmentView.ViewModel = instanceRequest.ViewModelInstance;
            }
            else
            {
                mvxFragmentView.LoadViewModelFrom(request, null);
            }

            dialog.Cancelable = attribute.Cancelable;

            Dialogs.Add(mvxFragmentView.ViewModel, dialog);

            var ft = CurrentFragmentManager.BeginTransaction();

            OnBeforeFragmentChanging(ft, attribute);

            if (attribute.AddToBackStack == true)
            {
                ft.AddToBackStack(fragmentName);
            }

            dialog.Show(ft, fragmentName);
        }
Beispiel #12
0
        private void LongPollServiceOnNewMessageEvent(List <Message> msgs)
        {
            foreach (var message in msgs)
            {
                if (message.ChatId == 0)
                {
                    //личный диалог
                    var dialog = Dialogs.SingleOrDefault(d => d.ChatId == message.SenderId);

                    if (dialog is null)
                    {
                        //todo: добавляем новый чат в список.
                    }
                    else
                    {
                        dispatcher.BeginInvoke(new Action(() =>
                        {
                            var index = Dialogs.IndexOf(dialog);
                            Dialogs.Remove(dialog);
                            dialog.LastMessageText = message.Text;
                            dialog.Time            = message.Time;
                            Dialogs.Add(dialog);
                            Dialogs.Move(index, 0);
                            Changed("Dialogs");

                            // AppGlobalConfig.NotifyIcon.ShowBalloonTip(500, dialog.ChatTitle, dialog.LastMessageText, ToolTipIcon.Info);
                        }));
                    }
                }

                //todo: групповой чат
            }
        }
        protected override void ShowDialogFragment(Type view,
                                                   MvxDialogFragmentPresentationAttribute attribute,
                                                   MvxViewModelRequest request)
        {
            var fragmentName = FragmentJavaName(attribute.ViewType);
            IMvxFragmentView mvxFragmentView = CreateFragment(attribute, fragmentName);
            var dialog = (DialogFragment)mvxFragmentView;

            // MvxNavigationService provides an already instantiated ViewModel here,
            // therefore just assign it
            if (request is MvxViewModelInstanceRequest instanceRequest)
            {
                mvxFragmentView.ViewModel = instanceRequest.ViewModelInstance;
            }
            else
            {
                mvxFragmentView.LoadViewModelFrom(request, null);
            }

            dialog.Cancelable = attribute.Cancelable;

            Dialogs.Add(mvxFragmentView.ViewModel, dialog);

            var ft = CurrentFragmentManager.BeginTransaction();

            if (attribute.SharedElements != null)
            {
                foreach (var item in attribute.SharedElements)
                {
                    string name = item.Key;
                    if (string.IsNullOrEmpty(name))
                    {
                        name = ViewCompat.GetTransitionName(item.Value);
                    }
                    ft.AddSharedElement(item.Value, name);
                }
            }
            if (!attribute.EnterAnimation.Equals(int.MinValue) && !attribute.ExitAnimation.Equals(int.MinValue))
            {
                if (!attribute.PopEnterAnimation.Equals(int.MinValue) && !attribute.PopExitAnimation.Equals(int.MinValue))
                {
                    ft.SetCustomAnimations(attribute.EnterAnimation, attribute.ExitAnimation, attribute.PopEnterAnimation, attribute.PopExitAnimation);
                }
                else
                {
                    ft.SetCustomAnimations(attribute.EnterAnimation, attribute.ExitAnimation);
                }
            }
            if (attribute.TransitionStyle != int.MinValue)
            {
                ft.SetTransitionStyle(attribute.TransitionStyle);
            }

            if (attribute.AddToBackStack == true)
            {
                ft.AddToBackStack(fragmentName);
            }

            dialog.Show(ft, fragmentName);
        }
Beispiel #14
0
 /// <summary>
 /// Opens <see cref="UserDetailsView"/> dialog window
 /// </summary>
 /// <param name="arg">Reference to selected <see cref="UserViewModel"/> entity</param>
 private void OnEditCurrentUser(object arg)
 {
     if (!(arg is UserViewModel user))
     {
         return;
     }
     Dialogs.Add(new UserDetailsViewModel(user, false));
 }
Beispiel #15
0
    //TODO Zet hier de tekst van de npc in.
    private void FillDialogList()
    {
        List <string> lines = new List <string>();

        lines.Add("random text");
        lines.Add("Welkom in mijn wereld");
        Dialogs.Add(new Dialog(lines));
    }
Beispiel #16
0
 /// <summary>
 /// 添加对话窗方法
 /// </summary>
 /// <param name="dialog"></param>
 public void AddDialog(ModalDialogBase dialog)
 {
     if (!Dialogs.Any())
     {
         dialog.IsShown = true;
     }
     Dialogs.Add(dialog);
 }
Beispiel #17
0
 /// <summary>
 /// Edits selected organization. Opens <see cref="OrganizationDetailsView"/> dialog window
 /// </summary>
 /// <param name="arg">Reference to selected <see cref="OrganizationViewModel"/> entity.</param>
 private void OnEditCurrentOrganization(object arg)
 {
     if (!(arg is OrganizationViewModel org))
     {
         return;
     }
     Dialogs.Add(new OrganizationDetailsViewModel(org));
 }
Beispiel #18
0
 /// <summary>
 /// Opens <see cref="GroupDetailsView"/> dialog window
 /// </summary>
 /// <param name="arg">Reference to selected <see cref="GroupViewModel"/> entity</param>
 private void OnEditCurrentGroup(object arg)
 {
     if (!(arg is GroupViewModel group))
     {
         return;
     }
     Dialogs.Add(new GroupDetailsViewModel(group));
 }
Beispiel #19
0
        //TODO Zet hier de tekst van de npc in.
        private void FillDialogList()
        {
            List <string> lines = new List <string>();

            lines.Add("Hallo");
            lines.Add("Welkom bij mijn shop");
            lines.Add("Kijk rustig rond");
            Dialogs.Add(new Dialog(lines));
        }
Beispiel #20
0
        public void AddFinishMethod()
        {
            var d = new Dialog();

            d.type      = DialogType.Finish;
            d.startTime = GetStartTime();
            d.endTime   = d.startTime + defaultDuration;
            Dialogs.Add(d);
        }
Beispiel #21
0
        public void AddDialogMethod()
        {
            var d = new Dialog();

            d.startTime = GetStartTime();
            d.endTime   = d.startTime + defaultDuration;
            d.who       = GetWho();
            Dialogs.Add(d);
        }
Beispiel #22
0
 public MessagesController(ICredentialProvider credentialProvider, BotAccessors accessors)
     : base(accessors)
 {
     _credentialProvider = credentialProvider;
     //todo: add dialogs
     Dialogs.Add(new RootDialog());
     Dialogs.Add(new HotelsDialog());
     Dialogs.Add(new SupportDialog());
 }
Beispiel #23
0
        public void AddSkills()
        {
            // Simple skill, no slots
            _skillManifests.Add(ManifestUtilities.CreateSkill(
                                    "testskill",
                                    "testskill",
                                    "https://testskill.tempuri.org/api/skill",
                                    "testSkill/testAction"));

            // Simple skill, with one slot (param1)
            var slots = new List <Slot>();

            slots.Add(new Slot("param1", new List <string>()
            {
                "string"
            }));
            _skillManifests.Add(ManifestUtilities.CreateSkill(
                                    "testskillwithslots",
                                    "testskillwithslots",
                                    "https://testskillwithslots.tempuri.org/api/skill",
                                    "testSkill/testActionWithSlots",
                                    slots));

            // Simple skill, with two actions and multiple slots
            var multiParamSlots = new List <Slot>();

            multiParamSlots.Add(new Slot("param1", new List <string>()
            {
                "string"
            }));
            multiParamSlots.Add(new Slot("param2", new List <string>()
            {
                "string"
            }));
            multiParamSlots.Add(new Slot("param3", new List <string>()
            {
                "string"
            }));

            var multiActionSkill = ManifestUtilities.CreateSkill(
                "testskillwithmultipleactionsandslots",
                "testskillwithmultipleactionsandslots",
                "https://testskillwithslots.tempuri.org/api/skill",
                "testSkill/testAction1",
                multiParamSlots);

            multiActionSkill.Actions.Add(ManifestUtilities.CreateAction("testSkill/testAction2", multiParamSlots));
            _skillManifests.Add(multiActionSkill);

            // Each Skill has a number of actions, these actions are added as their own SkillDialog enabling
            // the SkillDialog to know which action is invoked and identify the slots as appropriate.
            foreach (var skill in _skillManifests)
            {
                Dialogs.Add(new SkillDialogTest(skill, _mockServiceClientCredentials, _mockTelemetryClient, UserState, _mockSkillTransport));
            }
        }
        private DisambiguateDateDialog() : base(Id)
        {
            var recognizer = new DateTimeRecognizer(Culture.English);
            var model      = recognizer.GetDateTimeModel();

            Dialogs.Add(Id, new WaterfallStep[]
            {
                async(dc, args, next) => {
                    await dc.Context.SendActivity("What date?");
                },
                async(dc, args, next) =>
                {
                    var stateWrapper = new DisambiguateDateDialogStateWrapper(dc.ActiveDialog.State);

                    var value = model.Parse(dc.Context.Activity.Text).ParseRecognizer();

                    stateWrapper.Resolutions = value;

                    if (value.ResolutionType != Resolution.ResolutionTypes.DateTime && value.ResolutionType != Resolution.ResolutionTypes.DateTimeRange)
                    {
                        await dc.Context.SendActivity("I don't understand. Please provide a date");
                        await dc.Replace(Id);
                    }
                    else if (value.NeedsDisambiguation)
                    {
                        var amOrPmChoices = new List <Choice>(new [] { new Choice()
                                                                       {
                                                                           Value = "AM"
                                                                       }, new Choice()
                                                                       {
                                                                           Value = "PM"
                                                                       } });
                        await dc.Prompt("choicePrompt", "Is that AM or PM?", new ChoicePromptOptions
                        {
                            Choices = amOrPmChoices
                        }).ConfigureAwait(false);
                    }
                    else
                    {
                        stateWrapper.Date = value.FirstOrDefault().Date1.Value;
                        await dc.End(dc.ActiveDialog.State);
                    }
                },
                async(dc, args, next) =>
                {
                    var stateWrapper   = new DisambiguateDateDialogStateWrapper(dc.ActiveDialog.State);
                    var amOrPmChoice   = ((FoundChoice)args["Value"]).Value;
                    var availableTimes = stateWrapper.Resolutions.Select(x => x.Date1.Value);
                    stateWrapper.Date  = amOrPmChoice == "AM" ? availableTimes.Min() : availableTimes.Max();
                    await dc.End(dc.ActiveDialog.State);
                }
            });

            Dialogs.Add("textPrompt", new TextPrompt());
            Dialogs.Add("choicePrompt", new ChoicePrompt("en"));
        }
Beispiel #25
0
        public OrderTrackingDialog(KenticoRestServiceSettings kenticoRestServiceSettings) : base(_dialogId)
        {
            _kenticoRestService = new KenticoRestService(kenticoRestServiceSettings);

            Dialogs.Add(_dialogId, new WaterfallStep[]
            {
                AskOrderLookupInfo,
                ReturnOrderTrackingNumber
            });
            Dialogs.Add("textPrompt", new Microsoft.Bot.Builder.Dialogs.TextPrompt());
        }
Beispiel #26
0
        public static void Open(UISystemScreen screen)
        {
            if (screen == null || screen == CurrentScreen)
            {
                return;
            }
            if (screen.CurrentState == UISystemScreen.States.Opened || screen.CurrentState == UISystemScreen.States.Opening)
            {
                return;
            }
            switch (screen.Type)
            {
            case UISystemScreen.Types.Window:
                if (screen == CurrentWindow)
                {
                    return;
                }
                for (int i = 0; i < Dialogs.Count; i++)
                {
                    if (!Dialogs[i].PersistendDialog)
                    {
                        Close(Dialogs[i]);
                        i--;
                    }
                }
                Close(CurrentWindow);
                if (Windows.Contains(screen))
                {
                    int index = Windows.FindIndex(window => window == screen);
                    Windows.RemoveFromIndex(index);
                }
                else
                {
                    Windows.Add(screen);
                }
                break;

            case UISystemScreen.Types.Dialog:
                if (screen == CurrentDialog)
                {
                    return;
                }
                if (!Dialogs.Contains(screen))
                {
                    Dialogs.Add(screen);
                }
                screen.transform.SetAsLastSibling();
                break;

            default:
                throw new System.NotSupportedException(screen.name + " have not supported type!");
            }
            screen.CurrentState = UISystemScreen.States.Opening;
        }
 public CheckCurrentAccountBalanceDialog() : base(Id)
 {
     Dialogs.Add(Id, new WaterfallStep[]
     {
         async(dc, args, next) =>
         {
             await dc.Context.SendActivity($"[CheckCurrentAccountBalanceDialog] Your current account balance is £2000");
             await dc.End();
         }
     });
 }
Beispiel #28
0
        private MainDialog(IConfiguration configuration) : base(Id)
        {
            LuisModelId  = configuration.GetValue <string>("LuisModelId");
            LuisModelKey = configuration.GetValue <string>("LuisModelKey");
            LuisEndpoint = configuration.GetValue <string>("LuisEndpoint");

            Dialogs.Add(DialogId, new WaterfallStep[]
            {
                async(dc, args, next) =>
                {
                    var dialogInput = args["Value"] as string;

                    if (string.IsNullOrEmpty(dialogInput))
                    {
                        // 8. introduce bot if its the first time a user has visited
                        await dc.Context.SendActivity($"How can I help?");
                        await dc.End();
                    }
                    else
                    {
                        // 9. otherwise, run NLP in LUIS to start the "Identify" stage
                        var cli = new LUISRuntimeClient(new ApiKeyServiceClientCredentials(LuisModelKey))
                        {
                            BaseUri = new Uri(LuisEndpoint)
                        };
                        var prediction = await cli.Prediction.ResolveWithHttpMessagesAsync(LuisModelId, dialogInput);

                        if (prediction.Body.TopScoringIntent.Intent == "check-room-availability")
                        {
                            var bookingRequest = prediction.Body.ParseLuisBookingRequest();
                            var checkRoomAvailabilityDialogArgs = new Dictionary <string, object> {
                                { "bookingRequest", bookingRequest }
                            };
                            // 10. if the top scoring intent is check-room-availability, then transition into the CheckRoomAvailability dialog
                            await dc.Begin(CheckRoomAvailabilityDialog.Id, checkRoomAvailabilityDialogArgs);
                        }
                        else
                        {
                            await dc.Context.SendActivity($"Sorry, I don't know what you mean");
                            await dc.End();
                        }
                    }
                },
                async(dc, args, next) =>
                {
                    await dc.Prompt("textPrompt", $"Please let me know if I can help with anything else");
                    await dc.End();
                }
            }
                        );

            Dialogs.Add(CheckRoomAvailabilityDialog.Id, CheckRoomAvailabilityDialog.Instance);
            Dialogs.Add("textPrompt", new TextPrompt());
        }
Beispiel #29
0
        /// <summary>
        /// Получает кэшированные данные.
        /// </summary>
        private async Task GetCachedDialogs()
        {
            var dialogs = await ServiceHelper.MessagesCacheService.GetDialogsFromCache();

            if (dialogs != null)
            {
                for (int i = 0; i < dialogs.Count; i++)
                {
                    Dialogs.Add(dialogs[i]);
                }
            }
        }
Beispiel #30
0
        /// <summary>
        /// Adds group new user. Opens <see cref=""/> dialog window
        /// </summary>
        /// <param name="arg"></param>
        private void OnAddNewGroup(object arg)
        {
            var viewModel = new CreateNewGroupViewModel();

            Dialogs.Add(viewModel);
            if (viewModel.NewGroup != null)
            {
                var groups = Groups.ToList();
                groups.Add(viewModel.NewGroup);
                Groups.Clear();
                Groups = new ObservableCollection <GroupViewModel>(groups.OrderBy(g => g.Name));
            }
        }