From: <br...@us...> - 2008-08-18 21:48:39
|
Revision: 335 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=335&view=rev Author: brus07 Date: 2008-08-18 21:48:42 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Added LogDataGridView project. Added Paths: ----------- ACMServer/trunk/tasks/LogDataGridView/ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.Designer.cs ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.cs ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.csproj ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.resx ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Message.cs ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Properties/ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Properties/AssemblyInfo.cs ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/SystemMessage.cs ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/SystemMessageMode.cs ACMServer/trunk/tasks/LogDataGridView/LogDataGridView.sln Property changes on: ACMServer/trunk/tasks/LogDataGridView ___________________________________________________________________ Added: svn:ignore + *.suo *.NoLoad Added: tsvn:logminsize + 5 Property changes on: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView ___________________________________________________________________ Added: svn:ignore + bin obj *.user Added: tsvn:logminsize + 5 Added: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.Designer.cs =================================================================== --- ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.Designer.cs (rev 0) +++ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.Designer.cs 2008-08-18 21:48:42 UTC (rev 335) @@ -0,0 +1,93 @@ +namespace LogDataGridView +{ + partial class LogDataGridView + { + /// <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() + { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + this.dataGridView = new System.Windows.Forms.DataGridView(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView + // + this.dataGridView.AllowUserToAddRows = false; + this.dataGridView.AllowUserToDeleteRows = false; + this.dataGridView.AllowUserToOrderColumns = true; + this.dataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; + this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridView.DefaultCellStyle = dataGridViewCellStyle2; + this.dataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView.Location = new System.Drawing.Point(0, 0); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.ReadOnly = true; + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + this.dataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; + this.dataGridView.RowHeadersVisible = false; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle4; + this.dataGridView.Size = new System.Drawing.Size(150, 150); + this.dataGridView.TabIndex = 0; + // + // LogDataGridView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.dataGridView); + this.Name = "LogDataGridView"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataGridView dataGridView; + } +} Added: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.cs =================================================================== --- ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.cs (rev 0) +++ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.cs 2008-08-18 21:48:42 UTC (rev 335) @@ -0,0 +1,59 @@ +using System; +using System.Data; +using System.Windows.Forms; +using System.Collections.Generic; + +namespace LogDataGridView +{ + + public partial class LogDataGridView : UserControl + { + Type systemMessageType = null; + + public LogDataGridView() + { + InitializeComponent(); + } + + private void Init(IList<DataGridViewColumn> columns) + { + foreach(DataGridViewColumn column in columns) + { + dataGridView.Columns.Add(column); + } + } + + private void AddRowInner(Message message) + { + if (systemMessageType == null) + { + systemMessageType = message.GetType(); + Init(message.GetDataGridViewColumns()); + } + if (message.GetType() != systemMessageType) + //TODO: + throw new ArgumentException(); + + + //TODO: \xEF\xEE\xF2\xF0\xB3\xE1\xED\xEE \xE4\xEE\xE1\xE0\xE2\xEB\xFF\xF2\xE8 \xF3 \xEA\xB3\xED\xE5\xF6\xFC + // \xEF\xF0\xEE\xE1\xEB\xE5\xEC\xE0 \xF3 \xF2\xEE\xEC\xF3, \xF9\xEE \xFF \xED\xE5 \xE7\xED\xE0\xFE \xFF\xEA \xE7\xF0\xEE\xE1\xE8\xF2\xE8 \xE0\xE2\xF2\xEE\xEF\xF0\xEE\xEA\xF0\xF3\xF2\xEA\xF3 + dataGridView.Rows.Insert(0, message.GetValues()); + + dataGridView.Rows[0].DefaultCellStyle.BackColor = message.Color; + } + + delegate void AddRowCallback(Message message); + public void AddRow(Message message) + { + if (this.dataGridView.InvokeRequired) + { + AddRowCallback d = new AddRowCallback(AddRow); + this.Invoke(d, new object[] { message }); + } + else + { + AddRowInner(message); + } + } + } +} Added: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.csproj =================================================================== --- ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.csproj (rev 0) +++ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.csproj 2008-08-18 21:48:42 UTC (rev 335) @@ -0,0 +1,62 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{263DC481-D532-43CE-AB44-BC99918E5A44}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>LogDataGridView</RootNamespace> + <AssemblyName>LogDataGridView</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + </ItemGroup> + <ItemGroup> + <Compile Include="LogDataGridView.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="LogDataGridView.Designer.cs"> + <DependentUpon>LogDataGridView.cs</DependentUpon> + </Compile> + <Compile Include="Message.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SystemMessage.cs" /> + <Compile Include="SystemMessageMode.cs" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="LogDataGridView.resx"> + <DependentUpon>LogDataGridView.cs</DependentUpon> + <SubType>Designer</SubType> + </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. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file Added: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.resx =================================================================== --- ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.resx (rev 0) +++ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/LogDataGridView.resx 2008-08-18 21:48:42 UTC (rev 335) @@ -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 Added: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Message.cs =================================================================== --- ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Message.cs (rev 0) +++ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Message.cs 2008-08-18 21:48:42 UTC (rev 335) @@ -0,0 +1,21 @@ +using System.Drawing; +using System.Windows.Forms; +using System.Collections.Generic; + +namespace LogDataGridView +{ + public abstract class Message + { + public abstract IList<DataGridViewColumn> GetDataGridViewColumns(); + public abstract object[] GetValues(); + public virtual Color Color + { + get + { + return Color.Empty; + } + } + } + +} + Property changes on: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Properties ___________________________________________________________________ Added: tsvn:logminsize + 5 Added: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Properties/AssemblyInfo.cs =================================================================== --- ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Properties/AssemblyInfo.cs (rev 0) +++ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/Properties/AssemblyInfo.cs 2008-08-18 21:48:42 UTC (rev 335) @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LogDataGridView")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Home")] +[assembly: AssemblyProduct("LogDataGridView")] +[assembly: AssemblyCopyright("Copyright © Home 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b6419cf4-71e2-4811-aef9-7f0b9a4ad510")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] Added: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/SystemMessage.cs =================================================================== --- ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/SystemMessage.cs (rev 0) +++ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/SystemMessage.cs 2008-08-18 21:48:42 UTC (rev 335) @@ -0,0 +1,192 @@ +using System; +using System.Drawing; +using System.Windows.Forms; +using System.Collections.Generic; + +namespace LogDataGridView +{ + public class SystemMessage : Message + { + string text; + SystemMessageMode mode; + + + private ContextMenuStrip contextMenuStrip = new ContextMenuStrip(); + private ToolStripMenuItem toolStripMenuItemTime = new ToolStripMenuItem(); + private ToolStripMenuItem toolStripMenuItemText = new ToolStripMenuItem(); + private ToolStripMenuItem toolStripMenuItemMode = new ToolStripMenuItem(); + private void InitContexMenu() + { + contextMenuStrip.Items.AddRange(new ToolStripItem[]{ + toolStripMenuItemTime, + toolStripMenuItemText, + toolStripMenuItemMode}); + contextMenuStrip.Name = "ContexMenoStrip"; + contextMenuStrip.ShowCheckMargin = true; + contextMenuStrip.ShowImageMargin = false; + contextMenuStrip.Size = new Size(180, 92); + + toolStripMenuItemTime.Size = new Size(179, 22); + toolStripMenuItemTime.Text = "Visible Time Column"; + toolStripMenuItemTime.Checked = true; + toolStripMenuItemTime.Click += new EventHandler(toolStripMenuItem_Click); + + toolStripMenuItemText.Size = new Size(179, 22); + toolStripMenuItemText.Text = "Visible Text Column"; + toolStripMenuItemText.Checked = true; + toolStripMenuItemText.Click += new EventHandler(toolStripMenuItem_Click); + + toolStripMenuItemMode.Size = new Size(179, 22); + toolStripMenuItemMode.Text = "Visible Mode Columna"; + toolStripMenuItemMode.Checked = true; + toolStripMenuItemMode.Click += new EventHandler(toolStripMenuItem_Click); + } + + void toolStripMenuItem_Click(object sender, EventArgs e) + { + ToolStripMenuItem toolStrip = (ToolStripMenuItem)sender; + if (toolStrip == toolStripMenuItemTime) + { + if (toolStripMenuItemTime.Checked) + { + columns[0].Visible = false; + toolStripMenuItemTime.Checked = false; + } + else + { + columns[0].Visible = true; + toolStripMenuItemTime.Checked = true; + } + } + if (toolStrip == toolStripMenuItemText) + { + if (toolStripMenuItemText.Checked) + { + columns[1].Visible = false; + toolStripMenuItemText.Checked = false; + } + else + { + columns[1].Visible = true; + toolStripMenuItemText.Checked = true; + } + } + if (toolStrip == toolStripMenuItemMode) + { + if (toolStripMenuItemMode.Checked) + { + columns[2].Visible = false; + toolStripMenuItemMode.Checked = false; + } + else + { + columns[2].Visible = true; + toolStripMenuItemMode.Checked = true; + } + } + } + + IList<DataGridViewColumn> columns; + + public override IList<DataGridViewColumn> GetDataGridViewColumns() + { + InitContexMenu(); + IList<DataGridViewColumn> result = new List<DataGridViewColumn>(); + + DataGridViewColumn column = new DataGridViewTextBoxColumn(); + column.Name = "Time"; + column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; + column.ContextMenuStrip = this.contextMenuStrip; + result.Add(column); + + column = new DataGridViewTextBoxColumn(); + column.Name = "Log text"; + column.MinimumWidth = 150; + column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + column.ContextMenuStrip = this.contextMenuStrip; + result.Add(column); + + column = new DataGridViewTextBoxColumn(); + column.Name = "Mode"; + column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; + column.ContextMenuStrip = this.contextMenuStrip; + result.Add(column); + + columns = result; + return result; + } + + public SystemMessage(string text, string type) + { + this.text = text; + try + { + this.mode = (SystemMessageMode)Enum.Parse(typeof(SystemMessageMode), type, true); + } + catch (ArgumentException) + { + this.mode = SystemMessageMode.Other; + } + } + public SystemMessage(string text, SystemMessageMode type) + { + this.text = text; + this.mode = type; + } + + + public override object[] GetValues() + { + object[] result = new object[3]; + result[0] = this.Time; + result[1] = this.Text; + result[2] = this.Mode; + return result; + } + + private string Time + { + get + { + DateTime dt = DateTime.Now; + string result = ""; + result += dt.ToShortDateString(); + result += Environment.NewLine; + result += dt.ToLongTimeString(); + result += "."; + result += dt.Millisecond.ToString(); + return result; + } + } + private string Text + { + get + { + return text; + } + } + private string Mode + { + get + { + return mode.ToString(); + } + } + public override Color Color + { + get + { + if (mode == SystemMessageMode.Send) + return Color.LimeGreen; + if (mode == SystemMessageMode.Receive) + return Color.LightGreen; + if (mode == SystemMessageMode.SystemSend) + return Color.LightSkyBlue; + if (mode == SystemMessageMode.SystemReceive) + return Color.LightBlue; + return Color.Empty; + } + } + } + +} Added: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/SystemMessageMode.cs =================================================================== --- ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/SystemMessageMode.cs (rev 0) +++ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView/SystemMessageMode.cs 2008-08-18 21:48:42 UTC (rev 335) @@ -0,0 +1,11 @@ +namespace LogDataGridView +{ + public enum SystemMessageMode + { + Send, + Receive, + SystemSend, + SystemReceive, + Other + } +} Added: ACMServer/trunk/tasks/LogDataGridView/LogDataGridView.sln =================================================================== --- ACMServer/trunk/tasks/LogDataGridView/LogDataGridView.sln (rev 0) +++ ACMServer/trunk/tasks/LogDataGridView/LogDataGridView.sln 2008-08-18 21:48:42 UTC (rev 335) @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LogDataGridView", "LogDataGridView\LogDataGridView.csproj", "{263DC481-D532-43CE-AB44-BC99918E5A44}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {263DC481-D532-43CE-AB44-BC99918E5A44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {263DC481-D532-43CE-AB44-BC99918E5A44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {263DC481-D532-43CE-AB44-BC99918E5A44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {263DC481-D532-43CE-AB44-BC99918E5A44}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |