Beispiel #1
0
        public VSLiveBot(VSLiveBotAccessors accessors, BotServices services)
        {
            _accessors = accessors ?? throw new System.ArgumentNullException(nameof(accessors));

            _dialogs = new DialogSet(accessors.ConversationDialogState);

            var userInforDialog = new UserInfoDialog(_accessors);

            // Add named dialogs to the DialogSet. These names are saved in the dialog state.
            _dialogs.Add(new WaterfallDialog("UserInfo", userInforDialog.Steps()));
            _dialogs.Add(new TextPrompt("name"));
            _dialogs.Add(new TextPrompt("adoId"));

            var createNewDialog = new CreateNewDialog(_accessors);

            // Add named dialogs to the DialogSet. These names are saved in the dialog state.
            _dialogs.Add(new WaterfallDialog("CreateNew", createNewDialog.Steps()));
            _dialogs.Add(new TextPrompt("description"));
            _dialogs.Add(new ConfirmPrompt("assignSelf"));

            _services = services ?? throw new System.ArgumentNullException(nameof(services));
            if (!_services.LuisServices.ContainsKey(LuisKey))
            {
                throw new System.ArgumentException($"Invalid configuration....");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 打开用户信息对话框。
        /// </summary>
        /// <param name="o"></param>
        private async void OpenUserInfoDialog(object o)
        {
            var userInfo         = GlobalUser.USER;
            var cardInfo         = GlobalUser.USER.Card;
            var userInfoDialogVM = new UserInfoDialogVM();

            if (userInfo != null)
            {
                //userInfoDialogVM.User = GlobalUser.USER;
                //userInfoDialogVM.UserName = GlobalUser.USER.UserName;
                if (cardInfo != null)
                {
                    cardInfo.Validity = $"{Convert.ToDateTime(GlobalUser.USER.Card.expire_time).ToString("yyyy年MM月dd日")} 到期";
                }
            }
            else
            {
                MessageBox.Show("获取用户信息失败,请重新登录!");
            }
            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new UserInfoDialog(true)
            {
                DataContext = userInfoDialogVM,
                Height      = 500,
                Width       = 370
            };

            #region 验证用户头像是否存在...
            //GlobalUser.USER.Avatar = "http://www.baid2u.com/123.png";
            if (!HttpHelper.RemoteFileExists(GlobalUser.USER.Avatar))
            {
                //GlobalUser.USER.Avatar = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "head.png");
                view.AvatarImage.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.head);
            }

            #endregion
            //show the dialog
            await DialogHostEx.ShowDialog(GlobalUser.MainWin, view, UserInfoDialogOpenedEventHandler,
                                          UserInfoDialogClosingEventHandler);

            //check the result...
            //Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));
        }
Beispiel #3
0
        void on_m_GetInfoMenuItem_activate(object o, EventArgs e)
        {
            UserInfoDialog dialog = new UserInfoDialog(Gui.MainWindow.Window, network, selectedNode);

            dialog.Run();
        }