]> O.S.I.I.S - jp/crow.git/commitdiff
directory viewer tests
authorjpbruyere <jp.bruyere@hotmail.com>
Wed, 9 Sep 2015 08:44:37 +0000 (10:44 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Wed, 9 Sep 2015 08:47:42 +0000 (10:47 +0200)
Tests/GOLIBTest_DirViewer.cs
Tests/Interfaces/testDirViewer.goml
Tests/Interfaces/testTypeViewer.goml
Tests/Interfaces/tmpDirItem.goml
Tests/Tests.csproj

index 1980f5821de5e61ad5b2e174cf133d70e4557038..f5c31921835f765de955a3792f5fdc0368007efb 100644 (file)
@@ -14,71 +14,61 @@ using go;
 using System.Threading;\r
 using System.Reflection;\r
 using System.Linq;\r
+using System.IO;\r
 \r
 \r
-namespace test\r
+namespace test2\r
 {\r
-       class GOLIBTest_TypeViewer : OpenTKGameWindow\r
+       class GOLIBTest_DirViewer : OpenTKGameWindow\r
        {\r
-               public GOLIBTest_TypeViewer ()\r
+               public GOLIBTest_DirViewer ()\r
                        : base(1024, 600,"test")\r
                {}\r
 \r
-               VerticalStack g;\r
-               TypeContainer type;\r
+               public DirContainer CurDir;\r
 \r
                protected override void OnLoad (EventArgs e)\r
                {\r
                        base.OnLoad (e);\r
-                       type = new TypeContainer(typeof (GraphicObject));\r
+                       CurDir = new DirContainer(new DirectoryInfo ("/home/jp/"));\r
 \r
-                       this.AddWidget(Interface.Load ("Interfaces/testTypeViewer.goml", type));\r
+                       this.AddWidget(Interface.Load ("Interfaces/testDirViewer.goml", CurDir));\r
                        //LoadInterface("Interfaces/testTypeViewer.goml", out g);\r
                }\r
 \r
-               protected override void OnRenderFrame (FrameEventArgs e)\r
-               {\r
-                       GL.Clear (ClearBufferMask.ColorBufferBit);\r
-                       base.OnRenderFrame (e);\r
-                       SwapBuffers ();\r
-\r
-                       MemberInfo mi;\r
-\r
-\r
-               }\r
-\r
                [STAThread]\r
                static void Main ()\r
                {\r
                        Console.WriteLine ("starting example");\r
 \r
-                       using (GOLIBTest_TypeViewer win = new GOLIBTest_TypeViewer( )) {\r
+                       using (GOLIBTest_DirViewer win = new GOLIBTest_DirViewer( )) {\r
                                win.Run (30.0);\r
                        }\r
                }\r
        }\r
-       public class TypeContainer\r
+       public class DirContainer\r
        {\r
-               public Type Type;\r
-               public TypeContainer(Type _type){\r
-                       Type = _type;\r
+               public DirectoryInfo CurDir;\r
+               public DirContainer(DirectoryInfo _dir){\r
+                       CurDir = _dir;\r
                }\r
                public string Name {\r
-                       get { return Type.Name; }\r
+                       get { return CurDir.Name; }\r
                }\r
-               public MemberInfo[] Members {\r
+               public FileSystemInfo[] GetFileSystemInfos\r
+               {\r
                        get {\r
-                               MemberInfo[] mi = Properties.Cast<MemberInfo> ().Concat (Methods.Cast<MemberInfo> ()).ToArray(); \r
-                               return mi;\r
+                               return CurDir.GetFileSystemInfos ().Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToArray();\r
                        }\r
                }\r
-               public MethodInfo[] Methods {\r
-                       get { return Type.GetMethods (BindingFlags.Public | BindingFlags.Instance).Where (m => !m.IsSpecialName).ToArray(); }\r
+               void onDirUp(object sender, MouseButtonEventArgs e)\r
+               {\r
+                       \r
                }\r
-               public PropertyInfo[] Properties {\r
-                       get { return Type.GetProperties (); }\r
+               public void onMouseDown(object sender, MouseButtonEventArgs e)\r
+               {\r
+                       Debug.WriteLine (sender.ToString ());\r
                }\r
-                               \r
        }\r
 \r
 }
\ No newline at end of file
index aea7ca077befd6eca8a916d9a2f2705e86db84ea..7383dc122703c9daca36f4649667d2dc8becfc02 100755 (executable)
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
 
-       <VerticalStack Height="-1" Width="250" Name="hstack" Margin="0" Spacing="0">
+       <VerticalStack Height="-1" Width="600" Name="hstack" Margin="0" Spacing="0">
                <Border Height="-1" Width="0" BorderWidth="2" CornerRadius="10">
                        <Label Name="labName" Text="{Name}" Width="0" Height="-1"/>
                </Border>
-               <ListBox Data="{Members}" Width="0" Height="400" ItemTemplate="Interfaces/tmpMembers.goml" Focusable="true">
+               <ListBox Data="{GetFileSystemInfos}" Width="0" Height="400" ItemTemplate="Interfaces/tmpDirItem.goml" Focusable="true">
                        <Template>
                                <Border Width="0" Height="0" BorderWidth="1" Margin="1" MinimumSize="0;100" >
                                        <HorizontalStack Width="0" Height="0">
index eacf49592ae9d9558ff8dc91388ba7e37cc02e8f..aea7ca077befd6eca8a916d9a2f2705e86db84ea 100755 (executable)
@@ -4,7 +4,7 @@
                <Border Height="-1" Width="0" BorderWidth="2" CornerRadius="10">
                        <Label Name="labName" Text="{Name}" Width="0" Height="-1"/>
                </Border>
-               <ListBox Data="{Members}" Width="0" Height="400" ItemTemplate="Interfaces/tmpMembers.goml">
+               <ListBox Data="{Members}" Width="0" Height="400" ItemTemplate="Interfaces/tmpMembers.goml" Focusable="true">
                        <Template>
                                <Border Width="0" Height="0" BorderWidth="1" Margin="1" MinimumSize="0;100" >
                                        <HorizontalStack Width="0" Height="0">
index 12a2b75abae0f643d4be157663aa31b0d634e212..3e5d9d60430e184341c52dcd7afc9127639f0f72 100755 (executable)
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>\r
-       <HorizontalStack Width="0" Height="-1" Focusable="true" \r
+       <HorizontalStack Width="0" Height="-1" Focusable="true" MouseClick="onMouseDown"\r
                        MouseEnter="{Background=Red}"\r
                        MouseLeave="{Background=Transparent}">\r
-               <Image Width="8" Height="8" Path="#go.Images.Icons.member.svg" SvgSub="{GetIcon}"/>\r
+<!--           <Image Width="8" Height="8" Path="#go.Images.Icons.member.svg" SvgSub="{GetIcon}"/>-->\r
                <Label Text="{Name}" Width="0" Height="-1" Margin="0"/>\r
-               <Label Text="{MemberType}" Width="-1" Height="-1" Margin="0"/>\r
+               <Label Text="{Attributes}" Width="-1" Height="-1" Margin="0"/>\r
        </HorizontalStack>\r
 \r
index 3fa1d1d994ec64f99d2209400eb4efbe6bf4d8d4..6c994d0e163eaa2c8a44af12c2664f9c6709b08e 100644 (file)
@@ -65,6 +65,7 @@
     <Compile Include="GOLIBTest_TypeViewer.cs" />
     <Compile Include="GOLIBTest_stack.cs" />
     <Compile Include="GOLIBTest_HStack.cs" />
+    <Compile Include="GOLIBTest_DirViewer.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="image\u.svg">
     <None Include="Interfaces\testHStack.goml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\testDirViewer.goml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\tmpDirItem.goml">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />