From: <br...@us...> - 2008-06-26 22:43:12
|
Revision: 282 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=282&view=rev Author: brus07 Date: 2008-06-26 15:43:10 -0700 (Thu, 26 Jun 2008) Log Message: ----------- Added to plugins UserControl. Loading each UserControl of plugin to Mediator MainForm. For example, can view and change web site address in WebGatePluginUserControl. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs ACMServer/trunk/ACMServer/Mediator/Form1.cs ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsFramework.csproj ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs Added Paths: ----------- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx Modified: ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Library/Connector/Getter/WebGetter.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -13,6 +13,19 @@ //"http://127.0.0.1/d"; string fullPathToWebPages = ""; + public string FullPathToWebPages + { + get + { + checkAddress(); + return fullPathToWebPages; + } + set + { + fullPathToWebPages = value; + } + } + private void checkAddress() { if (fullPathToWebPages == "") @@ -25,7 +38,6 @@ public void Send(string message) { - checkAddress(); SendX(message); } Modified: ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -20,6 +20,19 @@ timer.Enabled = true; } + public string Address + { + //TODO: + get + { + return ((WebGetter)getter).FullPathToWebPages; + } + set + { + ((WebGetter)getter).FullPathToWebPages = value; + } + } + // Specify what you want to happen when the Elapsed event is // raised. private void OnTimedEvent(object source, ElapsedEventArgs e) Modified: ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Mediator/Form1.Designer.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -33,10 +33,13 @@ this.label1 = new System.Windows.Forms.Label(); this.button3 = new System.Windows.Forms.Button(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox(); this.timerUpdateTextLog = new System.Windows.Forms.Timer(this.components); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); this.SuspendLayout(); // // button2 @@ -53,7 +56,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 72); + this.label1.Location = new System.Drawing.Point(122, 17); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(23, 13); this.label1.TabIndex = 3; @@ -78,18 +81,9 @@ this.statusStrip1.TabIndex = 9; this.statusStrip1.Text = "statusStrip1"; // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(12, 95); - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(236, 20); - this.textBox1.TabIndex = 10; - this.textBox1.Text = "http://acm.lviv.ua/version3/table.php"; - // // textBox2 // - this.textBox2.Location = new System.Drawing.Point(41, 69); + this.textBox2.Location = new System.Drawing.Point(151, 14); this.textBox2.Name = "textBox2"; this.textBox2.ReadOnly = true; this.textBox2.Size = new System.Drawing.Size(110, 20); @@ -97,14 +91,12 @@ // // textBox3 // - this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox3.Location = new System.Drawing.Point(12, 121); + this.textBox3.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox3.Location = new System.Drawing.Point(3, 3); this.textBox3.Multiline = true; this.textBox3.Name = "textBox3"; this.textBox3.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.textBox3.Size = new System.Drawing.Size(345, 171); + this.textBox3.Size = new System.Drawing.Size(343, 190); this.textBox3.TabIndex = 12; // // timerUpdateTextLog @@ -113,14 +105,36 @@ this.timerUpdateTextLog.Interval = 2000; this.timerUpdateTextLog.Tick += new System.EventHandler(this.timerUpdateTextLog_Tick); // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Location = new System.Drawing.Point(12, 70); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(357, 222); + this.tabControl1.TabIndex = 13; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.textBox3); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(349, 196); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Main"; + this.tabPage1.UseVisualStyleBackColor = true; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(369, 317); - this.Controls.Add(this.textBox3); + this.Controls.Add(this.tabControl1); this.Controls.Add(this.textBox2); - this.Controls.Add(this.textBox1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.button3); this.Controls.Add(this.label1); @@ -129,6 +143,9 @@ this.Text = "Gate"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -140,10 +157,11 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button3; private System.Windows.Forms.StatusStrip statusStrip1; - private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.Timer timerUpdateTextLog; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; } } Modified: ACMServer/trunk/ACMServer/Mediator/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Mediator/Form1.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -29,14 +29,33 @@ kernel = new AcmContester.Mediator.Library.MediatorKernel(); kernel.onWorkingData += WorkingData; System.Threading.ThreadPool.QueueUserWorkItem(RunLoadDll); - //kernel.LoadLists(); } void RunLoadDll(Object ob) { + kernel.AddControl += new EventHandler<AcmContester.Mediator.Library.MediatorKernel.ControlEventArds>(kernel_AddControl); kernel.LoadLists(); } + delegate void AddControlCallback(object sender, AcmContester.Mediator.Library.MediatorKernel.ControlEventArds e); + void kernel_AddControl(object sender, AcmContester.Mediator.Library.MediatorKernel.ControlEventArds e) + { + if (this.tabControl1.InvokeRequired) + { + AddControlCallback d = new AddControlCallback(kernel_AddControl); + this.Invoke(d, new object[] { sender, e }); + } + else + { + Control control = e.Control; + control.Dock = DockStyle.Fill; + string name = e.Name; + TabPage page = new TabPage(name); + page.Controls.Add(control); + tabControl1.TabPages.Add(page); + } + } + private void WorkingData(string message) { string s = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + ": "; Modified: ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs =================================================================== --- ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Mediator/Library/MediatorKernel.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -2,6 +2,7 @@ using System.Collections; using AcmContester.Plugins.PluginsFramework; using System.Collections.Generic; +using System.Windows.Forms; namespace AcmContester.Mediator.Library { @@ -10,22 +11,67 @@ List<BaseMediatorPlugin> clientSideList; List<BaseMediatorPlugin> testerSideList; - public void LoadLists() + public Panel panel; + + internal sealed class ControlEventArds : EventArgs { - clientSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Web"); - foreach (BaseMediatorPlugin plugin in clientSideList) + Control control; + string name; + public ControlEventArds(Control in_Control, string in_Name) { - plugin.onDataArrived += DataArrivedFromClientList; - plugin.onWorkingData += WorkingData; + control = in_Control; + name = in_Name; } + public Control Control + { + get + { + return control; + } + } + public string Name + { + get + { + return name; + } + } + + } + + public event EventHandler<ControlEventArds> AddControl; + + public void LoadLists() + { testerSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Tester"); foreach (BaseMediatorPlugin plugin in testerSideList) { plugin.onDataArrived += DataArrivedFromTesterList; plugin.onWorkingData += WorkingData; + if (plugin.Control != null) + { + this.OnAddControl(new ControlEventArds(plugin.Control, plugin.GetType().Name)); + } } + clientSideList = PluginsLoader<BaseMediatorPlugin>.Load("Dll_Web"); + foreach (BaseMediatorPlugin plugin in clientSideList) + { + plugin.onDataArrived += DataArrivedFromClientList; + plugin.onWorkingData += WorkingData; + if (plugin.Control != null) + { + this.OnAddControl(new ControlEventArds(plugin.Control, plugin.GetType().Name)); + } + } } + private void OnAddControl(ControlEventArds e) + { + EventHandler<ControlEventArds> temp = AddControl; + if (temp != null) + temp(this, e); + } + public delegate void WorkingData_EventHandler(string message); public event WorkingData_EventHandler onWorkingData; private void WorkingData(string message) Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -1,5 +1,6 @@ using System; using AcmContester.Plugins.PluginsFramework; +using SocketServerGatePlugin; namespace AcmContester.Plugins.MediatorPlugins.SocketServerGatePlugin { @@ -11,6 +12,8 @@ { socketServerGate = SocketServerGate.GetInstance(); socketServerGate.onDataArrived += DataArrived; + + base.Control = new TestUserControl(); } public override void Send(string message) @@ -20,8 +23,8 @@ socketServerGate.Stop(); return; } - WorkingData("WebGatePlugin::Send(" + message + ")"); - WorkingData("WebGatePlugin::Send CountClients = "+ socketServerGate.CountClients().ToString()); + WorkingData("SocketServerGatePlugin::Send(" + message + ")"); + WorkingData("SocketServerGatePlugin::Send CountClients = " + socketServerGate.CountClients().ToString()); socketServerGate.Send(message); } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/SocketServerGatePlugin.csproj 2008-06-26 22:43:10 UTC (rev 282) @@ -29,11 +29,21 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SocketServerGate.cs" /> <Compile Include="SocketServerGatePlugin.cs" /> + <Compile Include="TestUserControl.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="TestUserControl.Designer.cs"> + <DependentUpon>TestUserControl.cs</DependentUpon> + </Compile> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\Library\Connector\Connector.csproj"> @@ -53,6 +63,12 @@ <Name>PluginsFramework</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="TestUserControl.resx"> + <SubType>Designer</SubType> + <DependentUpon>TestUserControl.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.Designer.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,87 @@ +namespace SocketServerGatePlugin +{ + partial class TestUserControl + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.setButton = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.clearButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // setButton + // + this.setButton.Location = new System.Drawing.Point(3, 3); + this.setButton.Name = "setButton"; + this.setButton.Size = new System.Drawing.Size(63, 23); + this.setButton.TabIndex = 0; + this.setButton.Text = "setButton"; + this.setButton.UseVisualStyleBackColor = true; + this.setButton.Click += new System.EventHandler(this.setButton_Click); + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Location = new System.Drawing.Point(3, 32); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBox1.Size = new System.Drawing.Size(144, 115); + this.textBox1.TabIndex = 1; + // + // clearButton + // + this.clearButton.Location = new System.Drawing.Point(72, 3); + this.clearButton.Name = "clearButton"; + this.clearButton.Size = new System.Drawing.Size(75, 23); + this.clearButton.TabIndex = 2; + this.clearButton.Text = "clearButton"; + this.clearButton.UseVisualStyleBackColor = true; + this.clearButton.Click += new System.EventHandler(this.clearButton_Click); + // + // TestUserControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.clearButton); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.setButton); + this.Name = "TestUserControl"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button setButton; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button clearButton; + } +} Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; + +namespace SocketServerGatePlugin +{ + public partial class TestUserControl : UserControl + { + public TestUserControl() + { + InitializeComponent(); + } + + private void clearButton_Click(object sender, EventArgs e) + { + textBox1.Text = ""; + } + + private void setButton_Click(object sender, EventArgs e) + { + textBox1.Text = "A"; + } + } +} Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/SocketServerGatePlugin/TestUserControl.resx 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -1,5 +1,6 @@ using System; using AcmContester.Plugins.PluginsFramework; +using WebGatePlugin; namespace AcmContester.Plugins.MediatorPlugins.WebGatePlugin { @@ -11,6 +12,8 @@ { webGate = WebGate.GetInstance(); webGate.onDataArrived += DataArrived; + + base.Control = new WebGatePluginUserControl(); } public override void Send(string message) Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.csproj 2008-06-26 22:43:10 UTC (rev 282) @@ -30,12 +30,20 @@ <ItemGroup> <Reference Include="System" /> <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="WebGate.cs" /> <Compile Include="WebGatePlugin.cs" /> + <Compile Include="WebGatePluginUserControl.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="WebGatePluginUserControl.Designer.cs"> + <DependentUpon>WebGatePluginUserControl.cs</DependentUpon> + </Compile> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\Library\Connector\Connector.csproj"> @@ -47,6 +55,12 @@ <Name>PluginsFramework</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="WebGatePluginUserControl.resx"> + <SubType>Designer</SubType> + <DependentUpon>WebGatePluginUserControl.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,93 @@ +namespace WebGatePlugin +{ + partial class WebGatePluginUserControl + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.textBox2 = new System.Windows.Forms.TextBox(); + this.setAddressButton = new System.Windows.Forms.Button(); + this.addressComboBox = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // textBox2 + // + this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox2.Location = new System.Drawing.Point(3, 32); + this.textBox2.Multiline = true; + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(263, 193); + this.textBox2.TabIndex = 2; + // + // setAddressButton + // + this.setAddressButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.setAddressButton.Location = new System.Drawing.Point(191, 3); + this.setAddressButton.Name = "setAddressButton"; + this.setAddressButton.Size = new System.Drawing.Size(75, 23); + this.setAddressButton.TabIndex = 3; + this.setAddressButton.Text = "Set Address"; + this.setAddressButton.UseVisualStyleBackColor = true; + this.setAddressButton.Click += new System.EventHandler(this.setAddressButton_Click); + // + // addressComboBox + // + this.addressComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.addressComboBox.FormattingEnabled = true; + this.addressComboBox.Items.AddRange(new object[] { + "http://acm.lviv.ua/version3", + "http://127.0.0.1/d"}); + this.addressComboBox.Location = new System.Drawing.Point(3, 5); + this.addressComboBox.Name = "addressComboBox"; + this.addressComboBox.Size = new System.Drawing.Size(182, 21); + this.addressComboBox.TabIndex = 4; + this.addressComboBox.Text = "http://127.0.0.1/d"; + // + // WebGatePluginUserControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.addressComboBox); + this.Controls.Add(this.setAddressButton); + this.Controls.Add(this.textBox2); + this.Name = "WebGatePluginUserControl"; + this.Size = new System.Drawing.Size(269, 228); + this.Load += new System.EventHandler(this.WebGatePluginUserControl_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button setAddressButton; + private System.Windows.Forms.ComboBox addressComboBox; + } +} Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; +using AcmContester.Plugins.MediatorPlugins.WebGatePlugin; + +namespace WebGatePlugin +{ + public partial class WebGatePluginUserControl : UserControl + { + public WebGatePluginUserControl() + { + InitializeComponent(); + } + + private void setAddressButton_Click(object sender, EventArgs e) + { + WebGate gate = WebGate.GetInstance(); + lock (gate.Address) + gate.Address = addressComboBox.Text; + } + + private void WebGatePluginUserControl_Load(object sender, EventArgs e) + { + WebGate gate = WebGate.GetInstance(); + addressComboBox.Text = gate.Address; + } + } +} Added: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx (rev 0) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.resx 2008-06-26 22:43:10 UTC (rev 282) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/BaseMediatorPlugin.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -1,4 +1,5 @@ using System; +using System.Windows.Forms; namespace AcmContester.Plugins.PluginsFramework { @@ -12,6 +13,20 @@ public abstract void Send(string message); + private UserControl control = null; + + public UserControl Control + { + get + { + return control; + } + protected set + { + control = value; + } + } + protected virtual void DataArrived(string message) { WorkingData("BaseMediatorPlugin::DataArrived(" + message + ")"); Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsFramework.csproj =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsFramework.csproj 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsFramework.csproj 2008-06-26 22:43:10 UTC (rev 282) @@ -29,6 +29,7 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.Windows.Forms" /> </ItemGroup> <ItemGroup> <Compile Include="BaseMediatorPlugin.cs" /> Modified: ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-06-26 21:07:37 UTC (rev 281) +++ ACMServer/trunk/ACMServer/Plugins/PluginsFramework/PluginsLoader.cs 2008-06-26 22:43:10 UTC (rev 282) @@ -18,6 +18,9 @@ List<T> plugins = new List<T>(); if (!Directory.Exists(path)) throw new ArgumentException("Specified path does not exists!"); + //TODO: + if (Directory.Exists(path) == false) + return plugins; string[] allDirectories = Directory.GetDirectories(path); //string[] allFiles = Directory.GetFiles(path, "*.dllx", SearchOption.TopDirectoryOnly); foreach (string directory in allDirectories) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |