Skip to content

Instantly share code, notes, and snippets.

@noqisofon
Created November 19, 2010 07:53
Show Gist options
  • Save noqisofon/706244 to your computer and use it in GitHub Desktop.
Save noqisofon/706244 to your computer and use it in GitHub Desktop.
リモート用さーばーフォーム。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;
using System.Windows.Forms;
namespace demo.ipc.server.app.widgets {
using demo.ipc.util;
/// <summary>
///
/// </summary>
public partial class IPCRemotingServerForm : Form {
/// <summary>
///
/// </summary>
public IPCRemotingServerForm() {
InitializeComponent();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="ergs"></param>
private void IPCRemotingServerForm_Load(object sender, EventArgs ergs) {
// IPC チャンネルを作成します。
IpcClientChannel client_channel = new IpcClientChannel();
// チャンネルを登録します。
ChannelServices.RegisterChannel( client_channel, true );
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="ergs"></param>
private void tsmiFileRefresh_Click(object sender, EventArgs ergs) {
// リモートオブジェクトを作成します。
//RemoteNotifyMessage message = (RemotingNotifyMessage)Activator.GetObject( typeof( RemoteNotifyMessage ),
// "ipc://remote/message"
// );
RemoteNotifyMessage message = new RemoteNotifyMessage();
StringBuilder result_builder = new StringBuilder( tbResult.Text );
result_builder.AppendFormat( "{0}: {1}", message.title, message.fulltext ).AppendLine();
tbResult.Text = result_builder.ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment