Bonjour à tous !

Alors j'ai quelque problème. J'aimerai en fait sérialiser, déserialiser et récupérer mon fichier .xml à la racine de mon bin.

Je n'ai pas d'erreur dans mon programme, il compile bien, mais je ne retrouve pas mon fichier .xml dans mon bin, il ne se passe rien. J'aimerai lorsque je clique sur valider que mon programme sérialise et donc créer un fichier .xml.

Par contre dans un programme secondaire j'ai réussi à sérialiser et déserialiser des données. Après je lisais ma déserialisation dans une console.

Alors voilà "une partie" de mon prog :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Xml.Serialization
Imports System.Xml.Linq
Imports System.IO
 
 
''' <summary>
''' Interaction logic for ModeMenu.xaml
''' </summary>
Public Partial Class ModeMenu
	Inherits UserControl
 
	Event MainMenuButtonClicked(Index As Integer)
 
	Public Shared ReadOnly CommandEscapeButton As New RoutedCommand()
	Public Shared ReadOnly CommandValidateButton As New RoutedCommand()
 
	Public Shared ReadOnly CommandUSBButton As New RoutedCommand()
	Public Shared ReadOnly CommandBTButton As New RoutedCommand()
	Public Shared ReadOnly CommandPermButton As New RoutedCommand()
	Public Shared ReadOnly CommandInterButton As New RoutedCommand()
 
	Public Sub New()
		InitializeComponent()
	End Sub
 
	Private Sub CommandBinding_Executed (sender As Object, e As ExecutedRoutedEventArgs)
		If (e.Command Is CommandUSBButton) Then
 
		ElseIf (e.Command Is CommandBTButton) Then
 
		ElseIf (e.Command Is CommandPermButton) Then
 
		ElseIf (e.Command Is CommandInterButton) Then
 
		End If
	End Sub
 
	Private Sub CommandBinding_Validate (ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
		RaiseEvent MainMenuButtonClicked(1)
	End Sub
	Private Sub CommandBinding_Escape (ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
		RaiseEvent MainMenuButtonClicked(0)
	End Sub
End Class
Voici ce que j'ai rajouté afin de faire un "test" et cette partie fonctionne lorsqu'elle est seule :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'///////////////////// Exemple de sérialisation avec Id ////////////////////////////////////
 
Public Class Test
'Methods 	
		Public Sub New()
		End Sub
'Properties		
		Public Property Id() As Integer
			Get
				Return m_Id
			End Get
			Set
				m_Id = Value
			End Set
		End Property
'Déclarations		
		Private m_Id As Integer
End Class
 
 
 
Public Class Program
 
	Private Shared Sub Main(args As String())
 
			Dim p As New Test() 
 
			p.Id = 123
 
			Dim xs As New XmlSerializer(GetType(Test))
			Using wr As New StreamWriter("test.xml")
 
				xs.Serialize(wr, p)
 
			End Using
 
		End Sub
End Class
Donc voilà ce que j'ai au total :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Public Partial Class ModeMenu
	Inherits UserControl
 
	Event MainMenuButtonClicked(Index As Integer)
 
	Public Shared ReadOnly CommandEscapeButton As New RoutedCommand()
	Public Shared ReadOnly CommandValidateButton As New RoutedCommand()
 
	Public Shared ReadOnly CommandUSBButton As New RoutedCommand()
	Public Shared ReadOnly CommandBTButton As New RoutedCommand()
	Public Shared ReadOnly CommandPermButton As New RoutedCommand()
	Public Shared ReadOnly CommandInterButton As New RoutedCommand()
 
	Public Sub New()
		InitializeComponent()
	End Sub
 
	Private Sub CommandBinding_Executed (sender As Object, e As ExecutedRoutedEventArgs)
		If (e.Command Is CommandUSBButton) Then
 
		ElseIf (e.Command Is CommandBTButton) Then
 
		ElseIf (e.Command Is CommandPermButton) Then
 
		ElseIf (e.Command Is CommandInterButton) Then
 
		End If
	End Sub
 
	Private Sub CommandBinding_Validate (ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
		RaiseEvent MainMenuButtonClicked(1)
	End Sub
	Private Sub CommandBinding_Escape (ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
		RaiseEvent MainMenuButtonClicked(0)
	End Sub
End Class
 
'///////////////////// Exemple de sérialisation avec Id ////////////////////////////////////
 
Public Class Test
'Methods 	
		Public Sub New()
		End Sub
'Properties		
		Public Property Id() As Integer
			Get
				Return m_Id
			End Get
			Set
				m_Id = Value
			End Set
		End Property
'Déclarations		
		Private m_Id As Integer
End Class
 
 
 
Public Class Program
 
	Private Shared Sub Main(args As String())
 
			Dim p As New Test() 
 
			p.Id = 123
 
			Dim xs As New XmlSerializer(GetType(Test))
			Using wr As New StreamWriter("test.xml")
 
				xs.Serialize(wr, p)
 
			End Using
 
		End Sub
End Class
Quelqu'un peut-il m'aider Svp ??