2017-07-07 19 views
1

我爲Revit(Autodesk)製作了一個插件,該插件使用:System.Windows.Forms啓動外部窗體;在組裝PresentationCore的c#中。知道我想用Zendesk Chat(Zopim)來填補這個窗口。不幸的是,我不知道如何在c#中使用REST API。今天我只是在討論這個話題。如何在c#中實現Zendesk Chat(Zopim)表單

如此詳細的我想要的:我希望當窗體打開時,程序加載Zopim聊天窗體並將其放入我的c#窗體中。

我已經知道我以某種方式需要獲取聊天窗體,並且需要將其解析爲我的窗體。

問題是:我找不到zopim聊天窗體。 我不知道如何將其轉換爲我的用戶界面。

Zendesk API
A Screenshot of my Form i created

我對形式的代碼:

[Transaction(TransactionMode.Manual)] 
class DoSomething : IExternalCommand 
{ 
    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) 
    { 
     this.StartForm(); 
     return Result.Succeeded; 
    } 

    public void StartForm() 
    { 
     //EXECUTE AN EXTERNAL WINDOW 
     System.Windows.Forms.Form myF = new System.Windows.Forms.Form(); 
     myF.FormBorderStyle = FormBorderStyle.SizableToolWindow; 
     myF.StartPosition = FormStartPosition.CenterScreen; 
     myF.Width = 400; 
     myF.Height = 600; 
     myF.HelpButton = true; 
     Button cButton = new Button(); 
     cButton.Text = "Cancel"; 
     myF.CancelButton = cButton; 
     myF.FormClosing += delegate (object sender, FormClosingEventArgs e) 
     { 
      e.Cancel = true; 
      myF.WindowState = FormWindowState.Minimized; 
     }; 
     myF.Show(); 
    } 
} 

回答

0

我發現的另一種方式。 Zendesk Chat(Zopim)確實提供了JavaScript加載項。最好的方法是啓動一個System.Windows.Forms.WebBrowser,並在您的HTML文件中實現來自Zopim的JavaScript代碼,該代碼引用WebBrowser的適配。