With Wonderware

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

We now integrate with Microsoft Teams, helping you to connect your internal knowledge base with your chat.

Learn more.

Archestra Client Control Importing dll file


Asked 3 years, 5 months ago Active 3 years, 5 months ago Viewed 2k times

So I have Wonderware Archestra IDE 4.1. Basically latest and greatest that is 2015 on a server

I have a C# class library called WordControls that is created in Visual Studio 2015 on my laptop. When I build it, the release is a dll file
1 of the same name.

I copy and paste the dll file into the server's Documents folder and it should be as simple as moving the mouse to the top left and
drilling down to this: Galaxy -> Import -> Client Control

And from there I select my dll file that I created and click Ok. Then click Ok again on the default. And finally it goes through the import
process. Except that instead of importing the file in, I get something slightly different:

"Processing file WordControls.dll.... Imported total of 0 object(s) from 1 file(s)"

It fails to import the dll and I don't know why. I've done it before in my previous job on a 2014 Archestra and Visual Studio 2013 so I
cannot seem to figure out what I've done wrong.

Has anyone had the experience in working with the client control aspect of Archestra IDE?

When I look at the SMC logger I get these two warnings:

Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c Dependant File does not exist.

Controls not found in C:\Users\vegeto18\Documents\WordControls.dll.

I’m not sure what to make of the first warning besides the fact that my program does use Microsoft.Office.Interop.Word to work with
MS docs and that the server doesn’t have MS Office (the terminal servers that are deployed with Intouch view apps).

The second part I’m not exactly sure how to interpret since that is where the dll is located after I copy it from my laptop and paste it
into that folder.

This would be my code:

using System;
using System.Windows.Forms;
using Microsoft.Office.Interop.Word;
using System.IO;

namespace WordControls
{
public partial class DocBrowser : Form
{
private System.Windows.Forms.WebBrowser webBrowser1;
delegate void ConvertDocumentDelegate(string fileName);

public DocBrowser()
{
InitializeComponent();

// Create the webBrowser control on the UserControl.


// This code was moved from the designer for cut and paste
// ease.
webBrowser1 = new System.Windows.Forms.WebBrowser();

webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
webBrowser1.Location = new System.Drawing.Point(0, 0);
webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
webBrowser1.Name = "webBrowser1";
webBrowser1.Size = new System.Drawing.Size(532, 514);
webBrowser1.TabIndex = 0;

By using our site,Controls.Add(webBrowser1);


you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
// set up an event handler to delete our temp file when we're done with
it.
webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted;

private void Form1_Load(object sender, EventArgs e)


{
var url = "http://qualityworkbench/ivscripts/qwbcgi.dll/docfetchraw?
db=live&id=1090";

LoadDocument(url);
}

string tempFileName = null;

public void LoadDocument(string fileName)


{
// Call ConvertDocument asynchronously.
ConvertDocumentDelegate del = new
ConvertDocumentDelegate(ConvertDocument);

// Call DocumentConversionComplete when the method has completed.


del.BeginInvoke(fileName, DocumentConversionComplete, null);
}

void ConvertDocument(string fileName)


{
object m = System.Reflection.Missing.Value;
object oldFileName = (object)fileName;
object readOnly = (object)false;
Microsoft.Office.Interop.Word.Application ac = null;

try
{
// First, create a new
Microsoft.Office.Interop.Word.ApplicationClass.
ac = new Microsoft.Office.Interop.Word.Application();

// Now we open the document.


Document doc = ac.Documents.Open(ref oldFileName, ref m, ref
readOnly,
ref m, ref m, ref m, ref m, ref m, ref m, ref m,
ref m, ref m, ref m, ref m, ref m, ref m);

// Create a temp file to save the HTML file to.


tempFileName = GetTempFile("html");

// Cast these items to object. The methods we're calling


// only take object types in their method parameters.
object newFileName = (object)tempFileName;

// We will be saving this file as HTML format.


object fileType = (object)WdSaveFormat.wdFormatHTML;

// Save the file.


doc.SaveAs(ref newFileName, ref fileType,
ref m, ref m, ref m, ref m, ref m, ref m, ref m,
ref m, ref m, ref m, ref m, ref m, ref m, ref m);

}
finally
{
// Make sure we close the application class.
if (ac != null)
ac.Quit(ref readOnly, ref m, ref m);
}
}

void DocumentConversionComplete(IAsyncResult result)


{
// navigate to our temp file.
webBrowser1.Navigate(tempFileName);
}

void webBrowser1_DocumentCompleted(object sender,


WebBrowserDocumentCompletedEventArgs e)
{
if (tempFileName != string.Empty)
{
// delete the temp file we created.
File.Delete(tempFileName);

By using our site, you//acknowledge that you have


set the tempFileName to read and understand
an empty string. our Cookie Policy, Privacy Policy, and our Terms of Service.
tempFileName = string.Empty;
}
}

string GetTempFile(string extension)


{
// Uses the Combine, GetTempPath, ChangeExtension,
// and GetRandomFile methods of Path to
// create a temp file of the extension we're looking for.
return Path.Combine(Path.GetTempPath(),
Path.ChangeExtension(Path.GetRandomFileName(), extension));
}

}
}

c# dll wonderware

edited Jun 10 '16 at 13:40 asked Jun 7 '16 at 19:22


leppie vegeto18
101k 16 177 278 25 6

It seems to be complaining that your DLL doesn't have any valid controls to import to archestra. What are you importing, some type of custom Form?
Try creating a Visual Studio project and importing the control into that and see if it works in VS. If not then it's an issue with the DLL and not ArchestrA
– Grambot Jun 8 '16 at 14:34

@Grambot I am creating a Window form that references a Word document from online. I figured out the Microsoft.Office.Interop.Word problem as the
solution to that was making sure my .NET framework is at the latest and greatest (4.6.1). The second issue regarding Controls is in relation to
System.Windows.Forms -> Control.ControlCollection -> Controls. I have the references System.Windows.Forms and even
System.Windows.Controls.Ribbon (not sure what this does. i'm guessing really) – vegeto18 Jun 8 '16 at 19:52

I assumed that ArchestrA looks for instances of UserControl to import. It'd open the DLL and see nothing to import but I'm just guessing right now,
I've never attempted to import a control derived from Form before – Grambot Jun 9 '16 at 16:34

1 Answer

There was nothing wrong with my code, it was my project type. I wrote this on Visual Studio as a Window Forms Application. I was
supposed to use Window Forms User Control. This ended up resolving my issue.
1 edited Jun 10 '16 at 13:20 answered Jun 10 '16 at 13:17
Sebastian Simon vegeto18
11.7k 6 34 56 25 6

By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.

You might also like