gpt4 book ai didi

c# - 什么是 CCA 中托管应用程序的应用程序适配器?

转载 作者:行者123 更新时间:2023-11-30 14:54:15 25 4
gpt4 key购买 nike

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

最佳答案

这里是完整的代码

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中找到它

关于c# - 什么是 CCA 中托管应用程序的应用程序适配器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27702849/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com