Correct path for menu.iri in the menu control
authorymh
Tue, 15 Sep 2009 16:09:45 +0200
changeset 59 1043e7c13ffc
parent 58 d7313fb1806c
child 60 b4008a356f90
Correct path for menu.iri in the menu control
src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj
src/FingersDance.Control.Menu/FingersDance.Control.Menu.xml
src/FingersDance.Control.Menu/UserControlMenu.xaml.cs
src/FingersDance/FingersDance.csproj
src/FingersDance/Menu.iri
src/FingersDance/Resources/menu.xml
--- a/src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj	Tue Sep 15 15:40:40 2009 +0200
+++ b/src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj	Tue Sep 15 16:09:45 2009 +0200
@@ -122,7 +122,6 @@
     <Content Include="Resources\iconPreview.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Resource Include="FingersDance.Control.Menu.xml" />
   </ItemGroup>
   <ItemGroup>
     <Resource Include="Resources\WindowBackground.jpg" />
--- a/src/FingersDance.Control.Menu/FingersDance.Control.Menu.xml	Tue Sep 15 15:40:40 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<!--
-This file contains the information needed to install your application
-with the Surface Shell. Please refer to the documentation for deployment
-instructions.
--->
-<ss:ApplicationInfo
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ss="http://schemas.microsoft.com/Surface/2007/ApplicationMetadata">
-  <Application>
-    <Title>FingersDance.Control.Menu</Title>
-    <Description>FingersDance.Control.Menu</Description>
-    <ExecutableFile>FingersDance.Control.Menu.exe</ExecutableFile>
-    <Arguments></Arguments>
-    <IconImageFile>Resources\icon.png</IconImageFile>
-    <Preview>
-      <PreviewImageFile>Resources\iconPreview.png</PreviewImageFile>
-    </Preview>
-    <Tags>
-      <!--
-      If your application uses tagged objects, please uncomment this section to register the tags with the Shell. 
-      You can register ByteTag(s), IdentityTag(s) or both by using the appropriate instructions below.
-      -->
-      <!--
-      To register ByteTags:
-      1. Please uncomment the Byte Tag Element below.
-      2. Replace "C0" below with the value of your Byte Tag (in hexadecimal format). Repeat this section (this element and its children) for other Byte Tags
-      3. Please remove the Launch element if you do not want to register the tag with Object Routing.
-      -->
-      <!--
-      <ByteTag Value="C0">
-        <Actions>
-          <Launch />
-        </Actions>
-      </ByteTag>
-      -->
-      <!--
-      To register IdentityTags:
-      1. Please uncomment the Identity Tag Element below.
-      2. Replace "0000000000000000" below with the series of your Identity Tag (in hexadecimal format). Repeat this section (this element and its children) for other Identity Tags
-      3. Please remove the Launch element if you do not want to register the tag with Object Routing.
-      -->
-      <!--
-      <IdentityTag Series="0000000000000000">
-        <Actions>
-          <Launch /> 
-        </Actions>
-      </IdentityTag>
-      -->
-    </Tags>
-  </Application>
-
-  <!--
-  Uncomment this section and comment out the Application element above
-  if you are creating an Attract Mode Application.
-  -->
-  <!--
-  <AttractApplication>
-    <ExecutableFile>FingersDance.Control.Menu.exe</ExecutableFile>
-    <Arguments></Arguments>
-  </AttractApplication>
-  -->
-</ss:ApplicationInfo>
\ No newline at end of file
--- a/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs	Tue Sep 15 15:40:40 2009 +0200
+++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs	Tue Sep 15 16:09:45 2009 +0200
@@ -10,6 +10,7 @@
 using Microsoft.Surface;
 using Microsoft.Surface.Presentation;
 using System.Xml.Serialization;
+using System.Reflection;
 
 namespace FingersDance.Control.Menu
 {
@@ -27,7 +28,16 @@
          private void initChildSize()
         {
             StreamReader reader = null;
-            reader = new StreamReader("../../Menu.iri");
+            FileInfo assemblyPath = new FileInfo(Assembly.GetExecutingAssembly().Location);
+            DirectoryInfo info = assemblyPath.Directory;
+            try
+            {
+                reader = new StreamReader(info.FullName.ToString() + "\\Resources\\menu.xml");
+            }
+            catch (Exception e)
+            {
+                // do nothing
+            }
             XmlSerializer serializer = new XmlSerializer(typeof(Menu));
             Menu temp = (Menu)serializer.Deserialize(reader);
             foreach (Item elt in temp.Items)
--- a/src/FingersDance/FingersDance.csproj	Tue Sep 15 15:40:40 2009 +0200
+++ b/src/FingersDance/FingersDance.csproj	Tue Sep 15 16:09:45 2009 +0200
@@ -95,6 +95,9 @@
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
     </None>
+    <Content Include="Resources\menu.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <Compile Include="Properties\Resources.Designer.cs">
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
--- a/src/FingersDance/Menu.iri	Tue Sep 15 15:40:40 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?> 
-<Menu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-	<Items>
-		<Item>
-			<Name>Annotation</Name>
-			<Items>
-				<Item>
-					<Name>Cinematographique</Name>
-					<Items>
-						<Item>
-							<Name>MouvCam1</Name>
-							<Items/>
-							<Action>MouvCam1</Action>
-						</Item>
-						<Item>
-							<Name>MouvCam2</Name>
-							<Items/>
-							<Action>MouvCam2</Action>
-						</Item>
-					</Items>
-					<Action>Cinematographique</Action>
-				</Item>
-				<Item>
-					<Name>Camera</Name>
-					<Items>
-						<Item>
-							<Name>Axe camera1</Name>
-							<Items/>
-							<Action>Axe camera1</Action>
-						</Item>
-						<Item>
-							<Name>Axe camera2</Name>
-							<Items/>
-							<Action>Axe camera2</Action>
-						</Item>
-						<Item>
-							<Name>Axe camera3</Name>
-							<Items/>
-							<Action>Axe camera3</Action>
-						</Item>
-						<Item>
-							<Name>Axe camera4</Name>
-							<Items/>
-							<Action>Axe camera4</Action>
-						</Item>
-					</Items>
-					<Action>Camera</Action>
-				</Item>
-				<Item>
-					<Name>Choregraphique</Name>
-					<Items>
-						<Item>
-							<Name>ChildChore1</Name>
-							<Items/>
-							<Action>ChildChore1</Action>
-						</Item>
-						<Item>
-							<Name>ChildChore2</Name>
-							<Items/>
-							<Action>ChildChore2</Action>
-						</Item>
-					</Items>
-					<Action>Choregraphique</Action>
-				</Item>
-			</Items>
-			<Action>Annotation</Action>
-		</Item>
-		<Item>
-			<Name>ButtonRecherche</Name>
-			<Items/>
-			<Action>ButtonRecherche</Action>
-		</Item>
-	</Items>
-</Menu>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance/Resources/menu.xml	Tue Sep 15 16:09:45 2009 +0200
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<Menu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<Items>
+		<Item>
+			<Name>Annotation</Name>
+			<Items>
+				<Item>
+					<Name>Cinematographique</Name>
+					<Items>
+						<Item>
+							<Name>MouvCam1</Name>
+							<Items/>
+							<Action>MouvCam1</Action>
+						</Item>
+						<Item>
+							<Name>MouvCam2</Name>
+							<Items/>
+							<Action>MouvCam2</Action>
+						</Item>
+					</Items>
+					<Action>Cinematographique</Action>
+				</Item>
+				<Item>
+					<Name>Camera</Name>
+					<Items>
+						<Item>
+							<Name>Axe camera1</Name>
+							<Items/>
+							<Action>Axe camera1</Action>
+						</Item>
+						<Item>
+							<Name>Axe camera2</Name>
+							<Items/>
+							<Action>Axe camera2</Action>
+						</Item>
+						<Item>
+							<Name>Axe camera3</Name>
+							<Items/>
+							<Action>Axe camera3</Action>
+						</Item>
+						<Item>
+							<Name>Axe camera4</Name>
+							<Items/>
+							<Action>Axe camera4</Action>
+						</Item>
+					</Items>
+					<Action>Camera</Action>
+				</Item>
+				<Item>
+					<Name>Choregraphique</Name>
+					<Items>
+						<Item>
+							<Name>ChildChore1</Name>
+							<Items/>
+							<Action>ChildChore1</Action>
+						</Item>
+						<Item>
+							<Name>ChildChore2</Name>
+							<Items/>
+							<Action>ChildChore2</Action>
+						</Item>
+					</Items>
+					<Action>Choregraphique</Action>
+				</Item>
+			</Items>
+			<Action>Annotation</Action>
+		</Item>
+		<Item>
+			<Name>ButtonRecherche</Name>
+			<Items/>
+			<Action>ButtonRecherche</Action>
+		</Item>
+	</Items>
+</Menu>
\ No newline at end of file