私はこの問題をチェックしました:Codeplex NDde Server how to send multiple items、そしてこのAlternative Of client.Advise += OnAdvise; in vb.net NDDE、そしてこの問題を扱うときは他の情報源があります。しかし、それは私がいくつかの基本を理解していないか、それをしようとしている方法で明示的にサポートされていないものだと思われます。複数のトピックと項目のNDdeサーバーとコンテキスト。複数のインスタンスが必要ですか?
DDEの入力を優先的に使用するアプリケーションに、いくつかの値(約半数)を一度にいくつか送るクラスライブラリを作成するのには苦労しています。
私にとってperplexionのソースは、私はちょうどホットリンク public AutoServer(string service, string ItemDataLabel)
: base(service)
{
// Create a timer that will be used to advise clients of new data.
_Timer.Elapsed += this.OnTimerElapsed;
_Timer.Interval = 30;
_Timer.SynchronizingObject = this.Context;
DataLabel = ItemDataLabel;
//OnAdvise(Symbol, DataLabel, 1);
}
private void OnTimerElapsed(object sender, ElapsedEventArgs args)
{
// Advise all topic name and item name pairs.
OnAdvise(Current, DataLabel, 1);
Advise(Current, DataLabel);
}
public string Data;
public string DataLabel;
}
で私のアイテムを送信することができるとしてそこに置くために、このような何かをする必要があるかどうか、されている何
OnAdviceそのものの中で、すべてのラベルの組み合わせの場合に、On Adviseが何をすべきかを書いて、異なる文字列ラベルを持つ複数のOnAdvisesをファッションしますか?
もう1つのオプションは、複数のサーバーインスタンスを登録して、OnAdviceにパラメータの組み合わせごとにすべての詳細を書き込むようです。 しかし、ここでは最も難しいです。私は両方のアプローチを試してみましたが、私は例外が発生している:InvokeまたはBeginInvokeは、ウィンドウハンドルが作成されるまで、コントロールで呼び出すことはできません。言い換えれば、私は、それぞれのサーバーごとに、それぞれの項目ごとに(複数のOnAdvicesが一緒に動作するようには見えない)コンテキストをそれぞれ必要とするということになります。
次に、フォームとコンテキストの初期化をそれぞれのサーバー登録で1つのメソッドに入れて、アイテムと同じように多くのメソッドをまとめて一度に実行しますか?例えば
:
namespace lookout_DDE
{
public partial class lookout_DDE_class : AutoGroup
{
public partial class ServerContextForm : Form
{
private DdeContext context = null;
private void ContextRunner()
{
context = new DdeContext(this);
context.Initialize();
}
}
}
}
と
namespace lookout_DDE
{
public partial class lookout_DDE_class : AutoGroup
{
public partial class ServerContextForm : Form
{
public ServerContextForm()
{
InitializeComponent();
ContextRunner();
}
}
}
}
と
[STAThread]
partial void RunServer()
{
using (ServerContextForm ContextForm = new ServerContextForm())
{
Application.Run(ContextForm);
ServerStarter("A1");
}
using (ServerContextForm ContextForm = new ServerContextForm())
{
Application.Run(ContextForm);
ServerStarter("A2");
}
using (ServerContextForm ContextForm = new ServerContextForm())
{
Application.Run(ContextForm);
ServerStarter("A3");
}
using (ServerContextForm ContextForm = new ServerContextForm())
{
Application.Run(ContextForm);
ServerStarter("A4");
}
using (ServerContextForm ContextForm = new ServerContextForm())
{
Application.Run(ContextForm);
ServerStarter("A5");
}
}
ちょうど私がそう代わりに使用して\の、コンテキストを実行するためのフォームを維持する必要があります考え出し\別個の方法が必要となる。
多分、文脈で複数のフォームを使用する必要があるかどうか、また複数のアイテムを実行するために登録されたサーバーインスタンスが必要かどうか、あるいは何らかの理由でOnAdviceをServerクラス内に実装する必要があります。
私はC#とプログラミング全般については新しいですが、私は "プロセス中"でプログラミングを学ぼうとしています。あなたが助けることができるなら、アドバイスをしてください。 :)