Author: toshok
Date: 2006-11-08 12:15:08 -0500 (Wed, 08 Nov 2006)
New Revision: 67545

Added:
   trunk/winforms/propertygrid/swf-propertygrid-array.cs
Modified:
   trunk/winforms/propertygrid/
   trunk/winforms/propertygrid/Makefile
Log:
add a test for a propertygrid displaying an array, and make the Makefile a bit 
more sane/extensible


Property changes on: trunk/winforms/propertygrid
___________________________________________________________________
Name: svn:ignore
   + *.exe
*.mdb


Modified: trunk/winforms/propertygrid/Makefile
===================================================================
--- trunk/winforms/propertygrid/Makefile        2006-11-08 16:55:17 UTC (rev 
67544)
+++ trunk/winforms/propertygrid/Makefile        2006-11-08 17:15:08 UTC (rev 
67545)
@@ -1,10 +1,21 @@
-all: mono
+EXE= swf-propertygrid.exe \
+     swf-propertygrid-array.exe
 
-mono: swf-propertygrid.cs
-       mcs swf-propertygrid.cs /r:System.Windows.Forms.dll 
/r:System.Drawing.dll
+MDB= 
 
-dotnet: swf-propertygrid.cs
-       csc swf-propertygrid.cs /r:System.Windows.Forms.dll 
/r:System.Drawing.dll
+CSC=mcs
 
+all: $(EXE)
+
+mono:
+       make all CSC=mcs
+
+dotnet:
+       make all CSC=csc
+
 clean:
-       rm swf-propertygrid.exe -r -f
+       rm -f $(EXE) $(EXE:%.exe=%.exe.mdb)
+
+%.exe: %.cs
+       $(CSC) -out:$@ -debug $< /r:System.Windows.Forms.dll 
/r:System.Drawing.dll
+

Added: trunk/winforms/propertygrid/swf-propertygrid-array.cs
===================================================================
--- trunk/winforms/propertygrid/swf-propertygrid-array.cs       2006-11-08 
16:55:17 UTC (rev 67544)
+++ trunk/winforms/propertygrid/swf-propertygrid-array.cs       2006-11-08 
17:15:08 UTC (rev 67545)
@@ -0,0 +1,63 @@
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace MWFTestApplication {
+       class MainWindow : System.Windows.Forms.Form {  
+               static MainWindow       main_window;
+               static Control          active;
+
+               PropertyGrid            propertygrid;
+
+               public MainWindow() {
+                       ClientSize = new System.Drawing.Size (520, 520);
+                       Text = "Property Grid Array Test";
+
+                       int[] testarray = new int[10];
+                       for (int i = 0; i < testarray.Length; i ++)
+                               testarray[i] = 10-i;
+
+
+                       TypeConverter cvt = TypeDescriptor.GetConverter 
(testarray);
+                       PropertyDescriptorCollection props = cvt.GetProperties 
(testarray);
+                       PropertyDescriptorCollection tdprops = 
TypeDescriptor.GetProperties (testarray); 
+                       Console.WriteLine ("Converter is {0}", cvt.GetType());
+                       Console.WriteLine ("converter properties length = {0}", 
props.Count);
+                       Console.WriteLine ("typedescriptor properties length = 
{0}", tdprops.Count);
+                       foreach (PropertyDescriptor prop in props) {
+                               Console.WriteLine ("{0} : {1}", prop.Name, 
prop.GetType());
+                               Console.WriteLine (" + {0} {1} {2} {3}", 
prop.PropertyType, prop.ComponentType, prop.CanResetValue (testarray), 
prop.ShouldSerializeValue (testarray));
+                       }
+
+                       Console.WriteLine (testarray[5]);
+
+                       propertygrid = new PropertyGrid();
+                       propertygrid.CommandsVisibleIfAvailable = true;
+                       propertygrid.Dock = DockStyle.Fill;
+                       propertygrid.TabIndex = 2;
+                       propertygrid.Text = "Property Grid";
+                       propertygrid.Dock = DockStyle.Fill;
+
+                       this.Controls.Add(propertygrid);
+
+                       propertygrid.SelectedObject = testarray;
+
+                       propertygrid.PropertyValueChanged += delegate (object 
o, PropertyValueChangedEventArgs e) {
+                               //Console.WriteLine (Environment.StackTrace);
+                       };
+
+                       propertygrid.SelectedGridItemChanged += delegate 
(object o, SelectedGridItemChangedEventArgs e) {
+                               //Console.WriteLine (Environment.StackTrace);
+                       };
+               }               
+               
+               public static int Main(string[] args) {
+                       main_window = new MainWindow();
+                       active = main_window;
+
+                       Application.Run(main_window);
+                       return 0;
+               }
+       }
+}

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to