【问题标题】:What is an application adapters for hosted application in CCA?CCA 中托管应用程序的应用程序适配器是什么?
【发布时间】:2014-12-30 09:33:32
【问题描述】:

我是 Microsoft CRM CCA 的新手。目前我面临一些问题。 我创建了一个 winform 并将其托管在我的 Agent Desktop 中。 winform 应该在 winform 的文本区域中显示记事本的内容。如何实现呢?我完全不知道,因为关于这个主题的文档不多。 .....请帮帮我。

【问题讨论】:

  • 欢迎来到 SO。您应该向我们展示您当前的进度(代码)和您发生的错误。您当前的问题没有提供足够的信息,听起来更像是“为我做”

标签: c# winforms winapi crm


【解决方案1】:

这里有完整的代码

using System;
using Microsoft.Uii.Csr;

namespace Microsoft.Uii.QuickStarts
{
    public partial class QsHostedControl : HostedControl
    {
        public QsHostedControl()
        {
            InitializeComponent();
        }

        // Necessary constructor
        public QsHostedControl(Guid appID, string appName, string initString)
            : base(appID, appName, initString)
        {
            InitializeComponent();
        }

        private void QSHostedControl_Load(object sender, EventArgs e) {}

        // This is the context change event handler.
        public override void NotifyContextChange(Context context)
        {
            // This is the context change handler.

            // Populating text fields from context information.
            txtFirstName.Text = context["CustomerFirstName"];
            txtLastName.Text = context["CustomerLastName"];
            txtAddress.Text = context["Street"];
            txtID.Text = context["CustomerID"];

            // Hands control back over to the base class to notify next app of context change.
            base.NotifyContextChange(context);
        }

        protected override void DoAction(RequestActionEventArgs args)
        {
            //Check the action name to see if it's something we know how to handle and perform appropriate work
            switch (args.Action)
            {
                case "UpdateFirstName":
                    txtFirstName.Text = args.Data;
                    break;

                case "UpdateLastName":
                    txtLastName.Text = args.Data;
                    break;                  

            }
        }

        private void updateData_Click(object sender, EventArgs e)
        {
            // This is how you fire an action to other hosted applications. Your DoAction() code
            // in your other application or application adapter will get called via this.
            FireRequestAction(new RequestActionEventArgs("QSExternalApplication", "UpdateFirstName", txtFirstName.Text));
            FireRequestAction(new RequestActionEventArgs("QSExternalApplication", "UpdateLastName", txtLastName.Text));

            FireRequestAction(new RequestActionEventArgs("QSWebApplication", "UpdateFirstName", txtFirstName.Text));
            FireRequestAction(new RequestActionEventArgs("QSWebApplication", "UpdateLastName", txtLastName.Text));
            FireRequestAction(new RequestActionEventArgs("QSWebApplication", "UpdateAddress", txtAddress.Text));
            FireRequestAction(new RequestActionEventArgs("QSWebApplication", "UpdateID", txtID.Text));
        }

        private void btnFireContextChange_Click(object sender, EventArgs e)
        {
            // Get the current context and create a new context object from it.
            string temp = Context.GetContext();
            Context updatedContext = new Context(temp);

            // Update the new context with the changed information.
            updatedContext["CustomerFirstName"] = txtFirstName.Text;
            updatedContext["CustomerLastName"] = txtLastName.Text;

            // Notify everyone of this new context information
            FireChangeContext(new ContextEventArgs(updatedContext));
            // Tell self about this change
            NotifyContextChange(updatedContext);

        }
    }
}

你也可以在sdk中找到它

【讨论】:

    【解决方案2】:

    如果您想使用适配器创建托管应用程序,那么您必须使用 AIF(application intregation frame work) 您可以查看此链接 hosted control

    application adapter

    【讨论】:

      猜你喜欢
      • 2012-09-17
      • 2018-05-14
      • 2010-10-31
      • 2020-12-15
      • 1970-01-01
      • 2018-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多