Can't populate a ListPicker - Windows Phone 7 Software Development

I'm not sure if this is right place to ask and if stuff like this gets anwsers here but I'm getting really frustrated by this issue I'm ahving and I'd like to get some help from you guys.
I'm trying to create a Silverlight Toolkit ListPicker to allow user to choose from a set of background colors, using the example on http://windowsphonegeek.com/articles/listpicker-for-wp7-in-depth I've done this so far but the list picker still shows nothing at all. Do you guys have any idea of what's wrong?
P.S.: The ideia is having a color picker just like the accent color picker in the theme section of the phone settings.
XAML Code with the templates and the listpicker control:
Code:
<Grid.Resources>
<DataTemplate x:Name="PickerItemTemplate">
<StackPanel Orientation="Horizontal">
<Rectangle Fill="{Binding ColorBrush}" Width="34" Height="34"/>
<TextBlock Text="{Binding ColorName}" Margin="12 0 0 0"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Name="PickerFullModeItemTemplate">
<StackPanel Orientation="Horizontal" Margin="16 21 0 20">
<Rectangle Fill="{Binding ColorBrush}" Width="34" Height="34"/>
<TextBlock Text="{Binding ColorName}" Margin="16 0 0 0" FontSize="43" FontFamily="{StaticResource PhoneFontFamilyLight}"/>
</StackPanel>
</DataTemplate>
</Grid.Resources>
<toolkit:ListPicker x:Name="listPicker" ItemTemplate="{StaticResource PickerItemTemplate}" FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" Header="Colors" FullModeHeader="Colors" Margin="8,8,8,554" ExpansionMode="FullScreenOnly" ItemsSource="{Binding}"/>
And here is the code to populate it:
Code:
Public Class ListPickerSources
Public ColorName As String
Public ColorBrush As SolidColorBrush
End Class
[and then somewhere else]
Dim items As New List(Of ListPickerSources)
items.Add(New ListPickerSources With {.ColorName = "White", .ColorBrush = New SolidColorBrush(Colors.White)})
items.Add(New ListPickerSources With {.ColorName = "Blue", .ColorBrush = New SolidColorBrush(Colors.Blue)})
items.Add(New ListPickerSources With {.ColorName = "Brown", .ColorBrush = New SolidColorBrush(Colors.Brown)})
items.Add(New ListPickerSources With {.ColorName = "Gray", .ColorBrush = New SolidColorBrush(Colors.Gray)})
items.Add(New ListPickerSources With {.ColorName = "Green", .ColorBrush = New SolidColorBrush(Colors.Green)})
items.Add(New ListPickerSources With {.ColorName = "Magenta", .ColorBrush = New SolidColorBrush(Colors.Magenta)})
items.Add(New ListPickerSources With {.ColorName = "Orange", .ColorBrush = New SolidColorBrush(Colors.Orange)})
items.Add(New ListPickerSources With {.ColorName = "Purple", .ColorBrush = New SolidColorBrush(Colors.Purple)})
items.Add(New ListPickerSources With {.ColorName = "Red", .ColorBrush = New SolidColorBrush(Colors.Red)})
items.Add(New ListPickerSources With {.ColorName = "Yellow", .ColorBrush = New SolidColorBrush(Colors.Yellow)})
items.Add(New ListPickerSources With {.ColorName = "Black", .ColorBrush = New SolidColorBrush(Colors.Black)})
listPicker.ItemsSource = items

Your items should be a public class property, not just a variable (I don't know the VB syntax).

sensboston said:
Your items should be a public class property, not just a variable (I don't know the VB syntax).
Click to expand...
Click to collapse
Thank you good sir, thank you very much, that did the trick, thank you so much. Oh god that was driving me crazy.

Related

Weird XDA DHTML Behaviour

I'm trying to dynamically update the innerHTML of
a span in PIE. However in the page generated by
the below code when I click on the abc link and then
enter some text in the prompt and then click on OK
it crashes PIE. Am I doing something wrong here or is it
beyond the capability of the XDA?
Code:
<html>
<head>
<title>Test</title>
<script language="Javascript">
function Add()
{
var ihtml;
ihtml = "<table border=1>";
ihtml += "<tr><td width=60>";
ihtml += "<span id=a1>";
ihtml += "<a href=javascript:Edit('a1" + "')>abc</a></span></td>";
ihtml += "</tr></table>";
tt.innerHTML = ihtml;
}
function Edit(s)
{
var ihtml;
var p = prompt("Type something in here", "");
ihtml = "<a href=javascript:Edit('" + s + "')>" + p + "</a>";
eval(s + ".innerHTML = ihtml;");
}
</script>
</head>
<body onLoad="Add();">
<form>
<div id="tt"></div>
</form>
</body>
</html>
Thanks for your help
PAD

[HOW TO] Create a Windows 6.5 Theme, by ansar

Dear forum members,
This is a simple way to create a 6.5 theme:
1. Using your 6.1 MyOwn.tsk file, for me Mobile_Vista.tsk and
2. Creating your MyOwn_theme.cab with the following cab structure, using:
2.1 Your favorite stwater_240_320.jpg and stwater_320_240.jpg icons.
2.2 Your favorite bar icons shown as MyOwn_****.png where MyOwn can be your alias or name.
3. Install your theme as follows:
3.1 First install your 6.1 MyOwn.tsk as usual
3.2 Install your MyOwn.cab with your favorite file exlorer and
3.3 Now power off your device (not reset) and then power on.
If you know how to convert it to MyOwn_theme.provxml or MyOwn_theme.xml, then this is another way too.
Till next version, enjoy!!
Regards, ansar.
**************************
Theme cab structure:
**************************
[Version]
Signature = "$Chicago$"
CESignature = "$Windows CE$"
Provider = "Microsoft"
[CEStrings]
Appname = "MyOwn_theme" ; (replace with your favorite theme name)
InstallDir = "%CE2%" ; (\Windows)
[CEDevice]
ProcessorType = 2577
VersionMin = 3.0
VersionMax = 100.0
[SourceDisksNames]
1 = ,"Dir1",,.\Windows
[SourceDisksFiles]
"stwater_240_320.jpg" = 1
"stwater_320_240.jpg" = 1
[DefaultInstall]
AddReg = ClesRegistre
CopyFiles = CopierVersDir00
[CopierVersDir00] ; (%CE2% : \Windows)
"stwater_240_320.jpg"
"stwater_320_240.jpg"
[DestinationDirs]
CopierVersDir00 = 0, %InstallDir%
[Strings]
reg_path00 = Software\Microsoft\Color\MultiColorTheme
reg_path01 = Software\Microsoft\Today\SoftKeyBar
reg_path02 = Software\Microsoft\Today\Toolbar
reg_path03 = Software\Microsoft\Today\TaskBar
reg_path04 = Software\Microsoft\Today\ScrollBar
reg_path05 = Software\Microsoft\Today\Bubble
reg_path06 = Software\Microsoft\Today\Toast
reg_path07 = Software\Microsoft\Today\MessageBox
reg_path08 = Software\Microsoft\Today\Menu
reg_path09 = Software\Microsoft\Today\ListView
reg_path10 = Software\Microsoft\Today\TabView
reg_path11 = Software\Microsoft\Today\UpDownControl
reg_path12 = Software\Microsoft\Today\BubbleTile
reg_path13 = Software\Microsoft\Today\Magnifier
reg_path14 = Software\Microsoft\Today\PropertySheet
reg_path15 = Software\Microsoft\Today\CutCopyPasteControl
reg_path16 = Software\Microsoft\Today\PushButton
reg_path17 = Software\Microsoft\Today\CheckBox
reg_path18 = Software\Microsoft\Today\RadioButton
reg_path19 = Software\Microsoft\Today\Combobox
reg_path20 = Software\Microsoft\Today
reg_path21 = Software\Microsoft\Color
[ClesRegistre]
HKLM,%reg_path00%,BaseColor1,0x00010001,7676696 ; this and the following five are the classic blue colors
HKLM,%reg_path00%,BaseColor2,0x00010001,16777215
HKLM,%reg_path00%,BaseColor3,0x00010001,15687213
HKLM,%reg_path00%,BaseColor4,0x00010001,16627387
HKLM,%reg_path12%,ThemeColors,0x00000001,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
HKLM,%reg_path12%,ThemeValues,0x00000001,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2D,5E,CF,00,FF,FF,FF,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
HKCU,%reg_path01%,SoftKeyBarThemeImage,0x00000000,\Windows\MyOwn_softkeybar.png
HKCU,%reg_path01%,SoftKeyBarThemeImageTopMargin,0x00010001,6
HKCU,%reg_path01%,SoftKeyBarThemeImageBottomMargin,0x00010001,6
HKCU,%reg_path01%,SoftKeyBarThemeImageLeftMargin,0x00010001,2
HKCU,%reg_path01%,SoftKeyBarThemeImageRightMargin,0x00010001,2
HKCU,%reg_path01%,SoftKeyBarThemeImageTiled,0x00010001,0
HKCU,%reg_path01%,SoftKeyBarThemeHighlight,0x00000000,\Windows\black_softkeyHighlight.png
HKCU,%reg_path01%,SoftKeyBarThemeHighlightTopMargin,0x00010001,12
HKCU,%reg_path01%,SoftKeyBarThemeHighlightBottomMargin,0x00010001,12
HKCU,%reg_path01%,SoftKeyBarThemeHighlightLeftMargin,0x00010001,30
HKCU,%reg_path01%,SoftKeyBarThemeHighlightRightMargin,0x00010001,30
HKCU,%reg_path01%,SoftKeyBarThemeHighlightTiled,0x00010001,0
HKCU,%reg_path01%,SoftKeyBarThemeSipHighlight,0x00000000,\Windows\black_sipHighlight.png
HKCU,%reg_path01%,SoftKeyBarThemeSipHighlightTopMargin,0x00010001,12
HKCU,%reg_path01%,SoftKeyBarThemeSipHighlightBottomMargin,0x00010001,12
HKCU,%reg_path01%,SoftKeyBarThemeSipHighlightLeftMargin,0x00010001,20
HKCU,%reg_path01%,SoftKeyBarThemeSipHighlightRightMargin,0x00010001,20
HKCU,%reg_path01%,SoftKeyBarThemeSipHighlightTiled,0x00010001,0
HKCU,%reg_path02%,ToolbarIconBubbleButtonThemeImage,0x00000000,\Windows\default_toolbarIconBubbleButton.png
HKCU,%reg_path02%,ToolbarIconBubbleButtonThemeImageTopMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonThemeImageBottomMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonThemeImageLeftMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonThemeImageRightMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonThemeImageTiled,0x00010001,0
HKCU,%reg_path02%,ToolbarIconBubbleButtonSelectedThemeImage,0x00000000,\Windows\default_toolbarIconBubbleButtonSelected.png
HKCU,%reg_path02%,ToolbarIconBubbleButtonSelectedThemeImageTopMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonSelectedThemeImageBottomMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonSelectedThemeImageLeftMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonSelectedThemeImageRightMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonSelectedThemeImageTiled,0x00010001,0
HKCU,%reg_path02%,ToolbarIconBubbleButtonDisabledThemeImage,0x00000000,\Windows\default_toolbarIconBubbleButtonDisabled.png
HKCU,%reg_path02%,ToolbarIconBubbleButtonDisabledThemeImageTopMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonDisabledThemeImageBottomMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonDisabledThemeImageLeftMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonDisabledThemeImageRightMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarIconBubbleButtonDisabledThemeImageTiled,0x00010001,0
HKCU,%reg_path02%,ToolbarTextBubbleButtonThemeImage,0x00000000,\Windows\default_toolbarTextBubbleButton.png
HKCU,%reg_path02%,ToolbarTextBubbleButtonThemeImageTopMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonThemeImageBottomMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonThemeImageLeftMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonThemeImageRightMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonThemeImageTiled,0x00010001,0
HKCU,%reg_path02%,ToolbarTextBubbleButtonSelectedThemeImage,0x00000000,\Windows\default_toolbarTextBubbleButtonSelected.png
HKCU,%reg_path02%,ToolbarTextBubbleButtonSelectedThemeImageTopMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonSelectedThemeImageBottomMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonSelectedThemeImageLeftMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonSelectedThemeImageRightMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonSelectedThemeImageTiled,0x00010001,0
HKCU,%reg_path02%,ToolbarTextBubbleButtonDisabledThemeImage,0x00000000,\Windows\default_toolbarTextBubbleButtonDisabled.png
HKCU,%reg_path02%,ToolbarTextBubbleButtonDisabledThemeImageTopMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonDisabledThemeImageBottomMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonDisabledThemeImageLeftMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonDisabledThemeImageRightMargin,0x00010001,16
HKCU,%reg_path02%,ToolbarTextBubbleButtonDisabledThemeImageTiled,0x00010001,0
HKCU,%reg_path03%,TaskBarThemeImage,0x00000000,\Windows\black_taskbar.png
HKCU,%reg_path03%,TaskBarThemeImageTopMargin,0x00010001,0
HKCU,%reg_path03%,TaskBarThemeImageBottomMargin,0x00010001,0
HKCU,%reg_path03%,TaskBarThemeImageLeftMargin,0x00010001,0
HKCU,%reg_path03%,TaskBarThemeImageRightMargin,0x00010001,0
HKCU,%reg_path03%,TaskBarThemeImageTiled,0x00010001,0
HKCU,%reg_path03%,TaskBarThemeHighlight,0x00000000,\Windows\black_taskbarHighlight.png
HKCU,%reg_path03%,TaskBarThemeHighlightTopMargin,0x00010001,12
HKCU,%reg_path03%,TaskBarThemeHighlightBottomMargin,0x00010001,12
HKCU,%reg_path03%,TaskBarThemeHighlightLeftMargin,0x00010001,20
HKCU,%reg_path03%,TaskBarThemeHighlightRightMargin,0x00010001,20
HKCU,%reg_path03%,TaskBarThemeHighlightTiled,0x00010001,0
HKCU,%reg_path04%,ScrollBarTrackThemeImage,0x00000000,\Windows\black_scrollbarTrack.png
HKCU,%reg_path04%,ScrollBarTrackThemeImageTopMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarTrackThemeImageBottomMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarTrackThemeImageLeftMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarTrackThemeImageRightMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarTrackThemeImageTiled,0x00010001,0
HKCU,%reg_path04%,ScrollBarThumbThemeImage,0x00000000,\Windows\black_scrollbarThumb.png
HKCU,%reg_path04%,ScrollBarThumbThemeImageTopMargin,0x00010001,17
HKCU,%reg_path04%,ScrollBarThumbThemeImageBottomMargin,0x00010001,17
HKCU,%reg_path04%,ScrollBarThumbThemeImageLeftMargin,0x00010001,4
HKCU,%reg_path04%,ScrollBarThumbThemeImageRightMargin,0x00010001,4
HKCU,%reg_path04%,ScrollBarThumbThemeImageTiled,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonThemeImage,0x00000000,\Windows\black_scrollbarUpArrowButton.png
HKCU,%reg_path04%,ScrollBarUpArrowButtonThemeImageTopMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonThemeImageBottomMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonThemeImageLeftMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonThemeImageRightMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonThemeImageTiled,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonSelectedThemeImage,0x00000000,\Windows\MyOwn_scrollbarUpArrowButtonSelected.png
HKCU,%reg_path04%,ScrollBarUpArrowButtonSelectedThemeImageTopMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonSelectedThemeImageBottomMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonSelectedThemeImageLeftMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonSelectedThemeImageRightMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonSelectedThemeImageTiled,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonDisabledThemeImage,0x00000000,\Windows\black_scrollbarUpArrowButtonDisabled.png
HKCU,%reg_path04%,ScrollBarUpArrowButtonDisabledThemeImageTopMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonDisabledThemeImageBottomMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonDisabledThemeImageLeftMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonDisabledThemeImageRightMargin,0x00010001,0
HKCU,%reg_path04%,ScrollBarUpArrowButtonDisabledThemeImageTiled,0x00010001,0
HKCU,%reg_path05%,BubbleBorderThemeImage,0x00000000,\Windows\MyOwn_msgboxBorder.png
HKCU,%reg_path05%,BubbleBorderThemeImageTopMargin,0x00010001,16
HKCU,%reg_path05%,BubbleBorderThemeImageBottomMargin,0x00010001,18
HKCU,%reg_path05%,BubbleBorderThemeImageLeftMargin,0x00010001,17
HKCU,%reg_path05%,BubbleBorderThemeImageRightMargin,0x00010001,17
HKCU,%reg_path05%,BubbleBorderThemeImageTiled,0x00010001,0
HKCU,%reg_path05%,BubbleBorderThemeImageTopPadding,0x00010001,4
HKCU,%reg_path05%,BubbleBorderThemeImageBottomPadding,0x00010001,18
HKCU,%reg_path05%,BubbleBorderThemeImageLeftPadding,0x00010001,6
HKCU,%reg_path05%,BubbleBorderThemeImageRightPadding,0x00010001,10
HKCU,%reg_path05%,BubbleTitleThemeImage,0x00000000,\Windows\MyOwn_msgboxTitle.png
HKCU,%reg_path05%,BubbleTitleThemeImageTopMargin,0x00010001,8
HKCU,%reg_path05%,BubbleTitleThemeImageBottomMargin,0x00010001,1
HKCU,%reg_path05%,BubbleTitleThemeImageLeftMargin,0x00010001,8
HKCU,%reg_path05%,BubbleTitleThemeImageRightMargin,0x00010001,8
HKCU,%reg_path05%,BubbleTitleThemeImageTiled,0x00010001,0
HKCU,%reg_path05%,BubbleTitleThemeImageTopPadding,0x00010001,3
HKCU,%reg_path05%,BubbleTitleThemeImageBottomPadding,0x00010001,0
HKCU,%reg_path05%,BubbleTitleThemeImageLeftPadding,0x00010001,5
HKCU,%reg_path05%,BubbleTitleThemeImageRightPadding,0x00010001,9
Continue to post #2
Continues from#1 post:
HKCU,%reg_path06%,ToastBorderThemeImage,0x00000000,\Windows\MyOwn_toastBorder.png
HKCU,%reg_path06%,ToastBorderThemeImageTopMargin,0x00010001,18
HKCU,%reg_path06%,ToastBorderThemeImageBottomMargin,0x00010001,0
HKCU,%reg_path06%,ToastBorderThemeImageLeftMargin,0x00010001,20
HKCU,%reg_path06%,ToastBorderThemeImageRightMargin,0x00010001,20
HKCU,%reg_path06%,ToastBorderThemeImageCropBottom,0x00010001,0
HKCU,%reg_path06%,ToastBorderThemeImageTiled,0x00010001,0
HKCU,%reg_path06%,ToastBorderThemeImageTopPadding,0x00010001,7
HKCU,%reg_path06%,ToastBorderThemeImageBottomPadding,0x00010001,0
HKCU,%reg_path06%,ToastBorderThemeImageLeftPadding,0x00010001,8
HKCU,%reg_path06%,ToastBorderThemeImageRightPadding,0x00010001,8
HKCU,%reg_path06%,ToastTitleThemeImage,0x00000000,\Windows\MyOwn_msgboxTitle.png
HKCU,%reg_path06%,ToastTitleThemeImageTopMargin,0x00010001,8
HKCU,%reg_path06%,ToastTitleThemeImageBottomMargin,0x00010001,1
HKCU,%reg_path06%,ToastTitleThemeImageLeftMargin,0x00010001,8
HKCU,%reg_path06%,ToastTitleThemeImageRightMargin,0x00010001,8
HKCU,%reg_path06%,ToastTitleThemeImageTiled,0x00010001,0
HKCU,%reg_path06%,ToastTitleThemeImageTopPadding,0x00010001,3
HKCU,%reg_path06%,ToastTitleThemeImageBottomPadding,0x00010001,0
HKCU,%reg_path06%,ToastTitleThemeImageLeftPadding,0x00010001,7
HKCU,%reg_path06%,ToastTitleThemeImageRightPadding,0x00010001,7
HKCU,%reg_path06%,ToastLeftArrowSpinnerThemeImage,0x00000000,\Windows\black_toastLeftArrowSpinner.png
HKCU,%reg_path20%,UseStartImage,0x00010001,1
HKCU,%reg_path20%,DPI,0x00010001,96
HKCU,%reg_path07%,MessageBoxBorderThemeImage,0x00000000,\Windows\MyOwn_msgboxBorder.png
HKCU,%reg_path07%,MessageBoxBorderThemeImageTopMargin,0x00010001,16
HKCU,%reg_path07%,MessageBoxBorderThemeImageBottomMargin,0x00010001,16
HKCU,%reg_path07%,MessageBoxBorderThemeImageLeftMargin,0x00010001,16
HKCU,%reg_path07%,MessageBoxBorderThemeImageRightMargin,0x00010001,16
HKCU,%reg_path07%,MessageBoxBorderThemeImageTiled,0x00010001,0
HKCU,%reg_path07%,MessageBoxBorderThemeImageTopPadding,0x00010001,4
HKCU,%reg_path07%,MessageBoxBorderThemeImageBottomPadding,0x00010001,11
HKCU,%reg_path07%,MessageBoxBorderThemeImageLeftPadding,0x00010001,5
HKCU,%reg_path07%,MessageBoxBorderThemeImageRightPadding,0x00010001,9
HKCU,%reg_path07%,MessageBoxAlpha,0x00010001,255
HKCU,%reg_path07%,MessageBoxCaptionThemeImage,0x00000000,\Windows\MyOwn_msgboxTitle.png
HKCU,%reg_path07%,MessageBoxCaptionThemeImageTopMargin,0x00010001,6
HKCU,%reg_path07%,MessageBoxCaptionThemeImageBottomMargin,0x00010001,2
HKCU,%reg_path07%,MessageBoxCaptionThemeImageLeftMargin,0x00010001,6
HKCU,%reg_path07%,MessageBoxCaptionThemeImageRightMargin,0x00010001,6
HKCU,%reg_path07%,MessageBoxCaptionThemeImageTiled,0x00010001,0
HKCU,%reg_path07%,MessageBoxCaptionThemeImageTopPadding,0x00010001,4
HKCU,%reg_path07%,MessageBoxCaptionThemeImageBottomPadding,0x00010001,4
HKCU,%reg_path07%,MessageBoxCaptionThemeImageLeftPadding,0x00010001,4
HKCU,%reg_path07%,MessageBoxCaptionThemeImageRightPadding,0x00010001,4
HKCU,%reg_path07%,MessageBoxCaptionThemeImageHeight,0x00010001,20
HKCU,%reg_path08%,MenuBorderThemeImage,0x00000000,\Windows\MyOwn_menuBorder.png
HKCU,%reg_path08%,MenuBorderThemeImageTopMargin,0x00010001,17
HKCU,%reg_path08%,MenuBorderThemeImageBottomMargin,0x00010001,18
HKCU,%reg_path08%,MenuBorderThemeImageLeftMargin,0x00010001,17
HKCU,%reg_path08%,MenuBorderThemeImageRightMargin,0x00010001,25
HKCU,%reg_path08%,MenuBorderThemeImageTiled,0x00010001,0
HKCU,%reg_path08%,MenuBorderThemeImageTopPadding,0x00010001,5
HKCU,%reg_path08%,MenuBorderThemeImageBottomPadding,0x00010001,11
HKCU,%reg_path08%,MenuBorderThemeImageLeftPadding,0x00010001,9
HKCU,%reg_path08%,MenuBorderThemeImageRightPadding,0x00010001,21
HKCU,%reg_path08%,MenuBorderThemeImageHeight,0x00010001,222
HKCU,%reg_path08%,MenuUpArrowThemeImage,0x00000000,\Windows\black_menuUpArrow.png
HKCU,%reg_path08%,MenuUpArrowDisabledThemeImage,0x00000000,\Windows\black_menuUpArrowDisabled.png
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImage,0x00000000,\Windows\MyOwn_menuUpArrowBackground.png
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImageTopMargin,0x00010001,0
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImageBottomMargin,0x00010001,0
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImageLeftMargin,0x00010001,50
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImageRightMargin,0x00010001,18
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImageTiled,0x00010001,0
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImageHeight,0x00010001,31
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImageTopPadding,0x00010001,0
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImageBottomPadding,0x00010001,5
HKCU,%reg_path08%,MenuUpArrowBackgroundThemeImageLeftPadding,0x00010001,6
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImage,0x00000000,\Windows\MyOwn_menuDownArrowBackground.png
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImageTopMargin,0x00010001,0
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImageBottomMargin,0x00010001,0
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImageLeftMargin,0x00010001,50
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImageRightMargin,0x00010001,18
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImageTiled,0x00010001,0
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImageHeight,0x00010001,31
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImageTopPadding,0x00010001,5
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImageBottomPadding,0x00010001,0
HKCU,%reg_path08%,MenuDownArrowBackgroundThemeImageLeftPadding,0x00010001,6
HKCU,%reg_path08%,MenuSelectorThemeImage,0x00000000,\Windows\MyOwn_menuSelector.png
HKCU,%reg_path08%,MenuSelectorThemeImageTopMargin,0x00010001,20
HKCU,%reg_path08%,MenuSelectorThemeImageBottomMargin,0x00010001,8
HKCU,%reg_path08%,MenuSelectorThemeImageLeftMargin,0x00010001,8
HKCU,%reg_path08%,MenuSelectorThemeImageRightMargin,0x00010001,7
HKCU,%reg_path08%,MenuSelectorThemeImageTiled,0x00010001,0
HKCU,%reg_path08%,MenuSelectorThemeImageTopPadding,0x00010001,9
HKCU,%reg_path08%,MenuSelectorThemeImageBottomPadding,0x00010001,9
HKCU,%reg_path08%,MenuSelectorThemeImageLeftPadding,0x00010001,6
HKCU,%reg_path08%,MenuSelectorThemeImageRightPadding,0x00010001,6
HKCU,%reg_path09%,ListViewSelectorThemeImage,0x00000000,\Windows\MyOwn_listviewSelector.png
HKCU,%reg_path09%,ListViewSelectorThemeImageTopMargin,0x00010001,20
HKCU,%reg_path09%,ListViewSelectorThemeImageBottomMargin,0x00010001,8
HKCU,%reg_path09%,ListViewSelectorThemeImageLeftMargin,0x00010001,8
HKCU,%reg_path09%,ListViewSelectorThemeImageRightMargin,0x00010001,7
HKCU,%reg_path09%,ListViewSelectorThemeImageTiled,0x00010001,0
HKCU,%reg_path09%,ListViewSelectorThemeImageTopPadding,0x00010001,9
HKCU,%reg_path09%,ListViewSelectorThemeImageBottomPadding,0x00010001,9
HKCU,%reg_path09%,ListViewSelectorThemeImageLeftPadding,0x00010001,6
HKCU,%reg_path09%,ListViewSelectorThemeImageRightPadding,0x00010001,6
HKCU,%reg_path09%,ListViewSelectorThemeImageMaxHeight,0x00010001,47
HKCU,%reg_path09%,ListViewSelectorThemeImageHeaderHeight,0x00010001,32
HKCU,%reg_path10%,BackgroundColor,0x00010001,1073741830
HKCU,%reg_path10%,SelectedItemColor,0x00010001,1073741829
HKCU,%reg_path10%,UnselectedItemColor,0x00010001,1073741839
HKCU,%reg_path10%,EdgeBitmap,0x00000000,\windows\Black_TabCurveEdgeH.png
HKCU,%reg_path10%,EdgeShadowBitmap,0x00000000,\windows\Black_TabCurveEdgeHShadow.png
HKCU,%reg_path10%,EdgeBitmapUpperRightColor,0x00010001,11886758
HKCU,%reg_path10%,EdgeBitmapLowerLeftColor,0x00010001,11780917
HKCU,%reg_path11%,Bitmap,0x00000000,\windows\Black_UpDownArrow.png
HKCU,%reg_path11%,PushedBitmap,0x00000000,\windows\MyOwn_UpDownArrowPushed.png
HKCU,%reg_path11%,RightBitmap,0x00000000,\windows\Black_UpDownArrowRight.png
HKCU,%reg_path11%,RightPushedBitmap,0x00000000,\windows\MyOwn_UpDownArrowPushedRight.png
HKCU,%reg_path12%,BubbleTileFooIcon,0x00000000,\Windows\MyOwn_bubble_foo.png
HKCU,%reg_path12%,BubbleTileFooDisabledIcon,0x00000000,\Windows\MyOwn_bubble_foo_disabled.png
HKCU,%reg_path12%,BubbleTileOKIcon,0x00000000,\Windows\MyOwn_bubble_ok.png
HKCU,%reg_path12%,BubbleTileOKDisabledIcon,0x00000000,\Windows\MyOwn_bubble_ok_disabled.png
HKCU,%reg_path12%,BubbleTileNavBackIcon,0x00000000,\Windows\MyOwn_bubble_navback.png
HKCU,%reg_path12%,BubbleTileNavBackDisabledIcon,0x00000000,\Windows\MyOwn_bubble_navback_disabled.png
HKCU,%reg_path12%,BubbleTileNavFwdIcon,0x00000000,\Windows\MyOwn_bubble_navfwd.png
HKCU,%reg_path12%,BubbleTileNavFwdDisabledIcon,0x00000000,\Windows\MyOwn_bubble_navfwd_disabled.png
HKCU,%reg_path12%,BubbleTileMenuIcon,0x00000000,\Windows\MyOwn_bubble_menu.png
HKCU,%reg_path12%,BubbleTileMenuDisabledIcon,0x00000000,\Windows\MyOwn_bubble_menu_disabled.png
HKCU,%reg_path12%,BubbleTileFlagIcon,0x00000000,\Windows\MyOwn_bubble_flag.png
HKCU,%reg_path12%,BubbleTileFlagDisabledIcon,0x00000000,\Windows\MyOwn_bubble_flag_disabled.png
HKCU,%reg_path12%,BubbleTileLockIcon,0x00000000,\Windows\MyOwn_bubble_lock.png
HKCU,%reg_path12%,BubbleTileLockDisabledIcon,0x00000000,\Windows\MyOwn_bubble_lock_disabled.png
HKCU,%reg_path12%,BubbleTileContactsIcon,0x00000000,\Windows\MyOwn_bubble_contacts.png
HKCU,%reg_path12%,BubbleTileContactsDisabledIcon,0x00000000,\Windows\MyOwn_bubble_contacts_disabled.png
HKCU,%reg_path12%,BubbleTilePhoneIcon,0x00000000,\Windows\MyOwn_bubble_phone.png
HKCU,%reg_path12%,BubbleTilePhoneDisabledIcon,0x00000000,\Windows\MyOwn_bubble_phone_disabled.png
HKCU,%reg_path12%,BubbleTileNewIcon,0x00000000,\Windows\MyOwn_bubble_new.png
HKCU,%reg_path12%,BubbleTileNewDisabledIcon,0x00000000,\Windows\MyOwn_bubble_new_disabled.png
HKCU,%reg_path12%,BubbleTileEditIcon,0x00000000,\Windows\MyOwn_bubble_edit.png
HKCU,%reg_path12%,BubbleTileEditDisabledIcon,0x00000000,\Windows\MyOwn_bubble_edit_disabled.png
HKCU,%reg_path12%,BubbleTileDeleteIcon,0x00000000,\Windows\MyOwn_bubble_delete.png
HKCU,%reg_path12%,BubbleTileDeleteDisabledIcon,0x00000000,\Windows\MyOwn_bubble_delete_disabled.png
HKCU,%reg_path12%,BubbleTileHomeIcon,0x00000000,\Windows\MyOwn_bubble_home.png
HKCU,%reg_path12%,BubbleTileHomeDisabledIcon,0x00000000,\Windows\MyOwn_bubble_home_disabled.png
HKCU,%reg_path12%,BubbleTileSnoozeIcon,0x00000000,\Windows\MyOwn_bubble_snooze.png
HKCU,%reg_path12%,BubbleTileSnoozeDisabledIcon,0x00000000,\Windows\MyOwn_bubble_snooze_disabled.png
HKCU,%reg_path12%,BubbleTileDismissIcon,0x00000000,\Windows\MyOwn_bubble_dismiss.png
HKCU,%reg_path12%,BubbleTileDismissDisabledIcon,0x00000000,\Windows\MyOwn_bubble_dismiss_disabled.png
HKCU,%reg_path13%,MagnifierZoomOutIcon,0x00000000,\Windows\MyOwn_magnifier_zoomout.png
HKCU,%reg_path14%,PropertySheetPivotBackgroundThemeImage,0x00000000,\windows\MyOwn_pivot_background.png
HKCU,%reg_path14%,PropertySheetPivotBackgroundThemeImageTopMargin,0x00010001,6
HKCU,%reg_path14%,PropertySheetPivotBackgroundThemeImageBottomMargin,0x00010001,6
HKCU,%reg_path14%,PropertySheetPivotBackgroundThemeImageLeftMargin,0x00010001,2
HKCU,%reg_path14%,PropertySheetPivotBackgroundThemeImageRightMargin,0x00010001,2
HKCU,%reg_path14%,PropertySheetPivotBackgroundThemeImageTiled,0x00010001,0
HKCU,%reg_path14%,PropertySheetPivotLeftArrowThemeImage,0x00000000,\windows\MyOwn_pivot_leftarrow.png
HKCU,%reg_path14%,PropertySheetPivotRightArrowThemeImage,0x00000000,\windows\MyOwn_pivot_rightarrow.png
Continue to #3 post
Continues from #2 post
HKCU,%reg_path15%,SelectButtonThemeImage,0x00000000,\windows\MyOwn_CutCopyPasteSelectButton.png
HKCU,%reg_path15%,CutButtonThemeImage,0x00000000,\windows\MyOwn_CutCopyPasteCutButton.png
HKCU,%reg_path15%,CopyButtonThemeImage,0x00000000,\windows\MyOwn_CutCopyPasteCopyButton.png
HKCU,%reg_path15%,PasteButtonThemeImage,0x00000000,\windows\MyOwn_CutCopyPastePasteButton.png
HKCU,%reg_path15%,MenuButtonThemeImage,0x00000000,\windows\MyOwn_CutCopyPasteMenuButton.png
HKCU,%reg_path15%,PositionAnchorThemeImage,0x00000000,\windows\MyOwn_CutCopyPastePositionAnchor.png
HKCU,%reg_path15%,SelectionStartAnchorThemeImage,0x00000000,\windows\MyOwn_CutCopyPasteSelectionStartAnchor.png
HKCU,%reg_path15%,SelectionEndAnchorThemeImage,0x00000000,\windows\MyOwn_CutCopyPasteSelectionEndAnchor.png
HKCU,%reg_path16%,PushButtonNormalThemeImage,0x00000000,\windows\PushButtonNormal.png
HKCU,%reg_path16%,PushButtonNormalThemeImageTopMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonNormalThemeImageBottomMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonNormalThemeImageLeftMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonNormalThemeImageRightMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonNormalThemeImageTiled,0x00010001,0
HKCU,%reg_path16%,PushButtonDisabledThemeImage,0x00000000,\windows\PushButtonDisabled.png
HKCU,%reg_path16%,PushButtonDisabledThemeImageTopMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonDisabledThemeImageBottomMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonDisabledThemeImageLeftMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonDisabledThemeImageRightMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonDisabledThemeImageTiled,0x00010001,0
HKCU,%reg_path16%,PushButtonFocusThemeImage,0x00000000,\windows\PushButtonFocus.png
HKCU,%reg_path16%,PushButtonFocusThemeImageTopMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonFocusThemeImageBottomMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonFocusThemeImageLeftMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonFocusThemeImageRightMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonFocusThemeImageTiled,0x00010001,0
HKCU,%reg_path16%,PushButtonPushedThemeImage,0x00000000,\windows\PushButtonPushed.png
HKCU,%reg_path16%,PushButtonPushedThemeImageTopMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonPushedThemeImageBottomMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonPushedThemeImageLeftMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonPushedThemeImageRightMargin,0x00010001,7
HKCU,%reg_path16%,PushButtonPushedThemeImageTiled,0x00010001,0
HKCU,%reg_path17%,CheckBoxUncheckedThemeImage,0x00000000,\windows\CheckBoxUncheckedThemeImage.png
HKCU,%reg_path17%,CheckBoxUncheckedPushedThemeImage,0x00000000,\windows\CheckBoxUncheckedPushedThemeImage.png
HKCU,%reg_path17%,CheckBoxUncheckedInactiveThemeImage,0x00000000,\windows\CheckBoxUncheckedInactiveThemeImage.png
HKCU,%reg_path17%,CheckBoxCheckedThemeImage,0x00000000,\windows\CheckBoxCheckedThemeImage.png
HKCU,%reg_path17%,CheckBoxCheckedPushedThemeImage,0x00000000,\windows\CheckBoxCheckedPushedThemeImage.png
HKCU,%reg_path17%,CheckBoxCheckedInactiveThemeImage,0x00000000,\windows\CheckBoxCheckedInactiveThemeImage.png
HKCU,%reg_path18%,RadioButtonUncheckedThemeImage,0x00000000,\windows\RadioButtonUncheckedThemeImage.png
HKCU,%reg_path18%,RadioButtonUncheckedPushedThemeImage,0x00000000,\windows\RadioButtonUncheckedPushedThemeImage.png
HKCU,%reg_path18%,RadioButtonUncheckedInactiveThemeImage,0x00000000,\windows\RadioButtonUncheckedInactiveThemeImage.png
HKCU,%reg_path18%,RadioButtonCheckedThemeImage,0x00000000,\windows\RadioButtonCheckedThemeImage.png
HKCU,%reg_path18%,RadioButtonCheckedPushedThemeImage,0x00000000,\windows\RadioButtonCheckedPushedThemeImage.png
HKCU,%reg_path18%,RadioButtonCheckedInactiveThemeImage,0x00000000,\windows\RadioButtonCheckedInactiveThemeImage.png
HKCU,%reg_path19%,ComboBoxArrowButtonThemeImage,0x00000000,\windows\ComboBoxArrowButtonThemeImage.png
HKCU,%reg_path19%,ComboBoxArrowButtonPushedThemeImage,0x00000000,\windows\ComboBoxArrowButtonPushedThemeImage.png
HKCU,%reg_path19%,ComboBoxArrowButtonInactiveThemeImage,0x00000000,\windows\ComboBoxArrowButtonInactiveThemeImage.png
HKCU,%reg_path19%,ComboBoxArrowNarrowButtonThemeImage,0x00000000,\windows\ComboBoxArrowNarrowButtonThemeImage.png
HKCU,%reg_path19%,ComboBoxArrowNarrowButtonPushedThemeImage,0x00000000,\windows\ComboBoxArrowNarrowButtonPushedThemeImage.png
HKCU,%reg_path19%,ComboBoxArrowNarrowButtonInactiveThemeImage,0x00000000,\windows\ComboBoxArrowNarrowButtonInactiveThemeImage.png
End of cab structure
reserved 3
thanks for the great info!

[Q] Writing in an XML File Problem

Hey Guys!
I'm sitting in front of an XML-Problem for five days now and really don't know what's to do. Expect of asking you.
I want to write a small shopping list application that manages the data in an XML-File looking like that:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<Items>
<Item>
<Name>Bananas</Name>
<Store>supermarket</Store>
<Repeat>true</Repeat>
</Item>
<Item>
<Name>LG E900 Optimus 7</Name>
<Store>superhandy</Store>
<Repeat>false</Repeat>
</Item>
(...)
I have a ListBox called ItemShowcase that I fill with instances of my ShowCaseEntry-Class
Reading Data from the FIle works perfectly with this code:
Code:
private void updateItemList()
{
// load XML-File
var items = XElement.Load("MissingItems.xml");
foreach (var a in items.Elements())
{
ShowCaseEntry sce = new ShowCaseEntry(a.Element("Name").Value, "Store: " + a.Element("Store").Value, false);
ItemShowcase.Items.Add(sce);
}
}
No Problem until here.
But now I want to add a new Iem to my XML-File.
I have 2 Textfields in what I ask for the Item-Name and Store-Name. Repeat is always true.
I tried that:
Code:
public void addXMLItem(String name, String store, Boolean repeat)
{
// XML-Datei Laden
var items = XDocument.Load("MissingItems.xml");
// neues Item erstellen
XElement newItem = new XElement("Item",
new XElement("Name", name),
new XElement("Store", store),
new XElement("Repeat", repeat) );
// Hinzufügen und spreichern
items.Root.Add(newItem);
FileStream F = new FileStream("MissingItems.xml", FileMode.Open);
items.Save(F);
}
The last line give me the following Error:
Attempt to access the method failed: System.IO.FileStream..ctor(System.String, System.IO.FileMode)
Is anyone here who would help me?
You would save my weekend!
Thank you so much!
Best wishes and greets
Robby
Try something like this:
Code:
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream("MissingItems.xml", FileMode.Create, FileAccess.Write, isoStore);
//Add your xml items here.
xml.Save(isoStream);
isoStream.Close();
First of all thanks for your answer.
Unfortunately I don't really know how to add the XML-Items.
Like this?
Code:
public void addXMLItem(String name, String store, Boolean repeat)
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream("MissingItems.xml", FileMode.Create, FileAccess.Write, isoStore);
//Add your xml items here.
var items = XDocument.Load("MissingItems.xml");
XElement newItem = new XElement("Item",
new XElement("Name", name),
new XElement("Store", store),
new XElement("Repeat", repeat));
items.Root.Add(newItem);
items.Save(isoStream);
isoStream.Close();
}
Another answer would be very nice
Best regards
Robby
I don't have time to test it but hopefully this works for you.
Code:
public void addXMLItem(String name, String store, Boolean repeat)
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream("MissingItems.xml", FileMode.Create, FileAccess.Write, isoStore);
//Add your xml items here.
XDocument items = XDocument.Load(isoStream);
items.Element("Items").Add(
new XElement("Item",
new XElement("Name", name),
new XElement("Store", store),
new XElement("Repeat", repeat)));
items.Save(isoStream);
isoStream.Close();
}
Thank you really much for your engangement, but there is still one problem.
In this line the program throws an XML-Error called "root element is missing":
XDocument items = XDocument.Load(isoStream);
How to explain the Load-Method that "Items" is my root Element?
Greets
Robby
Sorry my code had errors. This is tested and working.
Code:
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream("MissingItems.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read, isoStore);
XDocument items = XDocument.Load(isoStream);
isoStream.Close();
items.Element("Items").Add(
new XElement("Item",
new XElement("Name", name),
new XElement("Store", store),
new XElement("Repeat", repeat.ToString())));
isoStream = new IsolatedStorageFileStream("MissingItems.xml", FileMode.Create, FileAccess.Write, isoStore);
items.Save(isoStream);
isoStream.Close();
That code results in this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Items>
<Item>
<Name>Bananas</Name>
<Store>supermarket</Store>
<Repeat>true</Repeat>
</Item>
<Item>
<Name>LG E900 Optimus 7</Name>
<Store>superhandy</Store>
<Repeat>false</Repeat>
</Item>
<Item>
<Name>Test Name</Name>
<Store>Test Store</Store>
<Repeat>False</Repeat>
</Item>
</Items>
I really, really thank you for your anxiety. Thank you for your time, but I just have one more error.
This line throwes an Isolated Storage Exception called "Operation not permitted on IsolatedStorageFileStream.":
isoStream = new IsolatedStorageFileStream("MissingItems.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read, isoStore);
You would save my week with a short answer!
Thank you so much till yet
Robby
It sounds like the file stream is already open somewhere else. If you are doing any other reads or writes to the file prior to your addxmlitem method you need to close the stream before calling addxmlitem.
Not really
Sorry, I am sure that I'm annoying but I really need to fix that problem.
My last try to solve ist is to send you the full code:
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Xml.Linq;
using System.Xml;
using System.Text;
using System.IO;
using System.IO.IsolatedStorage;
namespace MyShoppingList
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
Item[] itemArray = new Item[2];
CheckBox[] checkBoxArray = new CheckBox[2];
// Set the data context of the listbox control to the sample data
DataContext = App.ViewModel;
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
updateItemList();
}
// Load data for the ViewModel Items
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
if (!App.ViewModel.IsDataLoaded)
{
App.ViewModel.LoadData();
}
}
/// <summary>
/// Adds new Item to the XML-File
/// </summary>
/// <param name="name">Itemname</param>
/// <param name="store">Storename</param>
/// <param name="repeat">Repeat</param>
public void addXMLItem(String name, String store, Boolean repeat)
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream("MissingItems.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read, isoStore);
XDocument items = XDocument.Load(isoStream);
isoStream.Close();
items.Element("Items").Add(
new XElement("Item",
new XElement("Name", name),
new XElement("Store", store),
new XElement("Repeat", repeat.ToString())));
isoStream = new IsolatedStorageFileStream("MissingItems.xml", FileMode.Create, FileAccess.Write, isoStore);
items.Save(isoStream);
isoStream.Close();
}
/// <summary>
/// Updates Item List
/// </summary>
private void updateItemList()
{
// XML-Datei Laden
var items = XElement.Load("MissingItems.xml");
foreach (var a in items.Elements())
{
ShowCaseEntry sce = new ShowCaseEntry(a.Element("Name").Value, "Store: " + a.Element("Store").Value, false);
ItemShowcase.Items.Add(sce);
}
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
addXMLItem(tBoxAddItemName.Text, tBoxAddItemStore.Text, false);
//updateItemList();
}
}
}
Can you find any mistakes?
I'm getting desperate...
Thanks a lot for your engagement!
I'n not really sure why that's happening. The only thing I can think of is XElement.Load() is causing the problem so here's how to use XDocument.Load() instead. I really hope this works for you because I'm out of ideas.
Code:
private void updateItemList()
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream isoStream;
isoStream = new IsolatedStorageFileStream("MissingItems.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read, isoStore);
XDocument xml = XDocument.Load(isoStream);
var items = from c in xml.Elements("Items").Elements("Item")
select new {
name = c.Element("Name").Value,
store = c.Element("Store").Value,
repeat = c.Element("Repeat").Value
};
foreach (var item in items)
{
ShowCaseEntry sce = new ShowCaseEntry(item.name, "Store: " + item.store, false);
ItemShowcase.Items.Add(sce);
}
isoStream.Close();
}
Same Error on this line:
isoStream = new IsolatedStorageFileStream("MissingItems.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read, isoStore);
Operation not permitted on IsolatedStorageFileStream.
I'm at the end of my motivation
I really tried everything, you really tried everything and I cannot find anything helpful to this error message..
Does anyone has an idea?
Does this line works for you?
Big Thanks to Ren13B till yet!
Attached is my working test project. Maybe it will help you.
If you are accessing the Isolated Storage from within a referenced assembly, you will need to access the IsolatedStorageFile for that assembly
Thanks for your reply but how to do that?

[Q] WP7 - Removing an XElement from an XML file

Hi there,
I'm having a big issue, when trying to remove an XElement from an XML file created in IsolatedStorage.
--------------------------------------------------------------------------------------------
Code to CREATE the XML file
Dim File_to_Create As String = "Tracks.xml"
Dim file As XDocument = <?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlnsd="urn:schemas-microsoft-comfficedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Cartridges.xsd" generated="2010-11-23T14:26:55">
<Carts>
<CART_NAME>First</CART_NAME>
<CART_COLOR>White</CART_COLOR>
</Carts>
<Carts>
<CART_NAME>Second</CART_NAME>
<CART_COLOR>Black</CART_COLOR>
</Carts>
</dataroot>
Dim isoStore As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
Try
If isoStore.FileExists(File_to_Create) Then
MessageBox.Show(File_to_Create + " TRUE")
Else
MessageBox.Show(File_to_Create + " FALSE")
Dim oStream As New IsolatedStorageFileStream(File_to_Create, FileMode.Create, isoStore)
Dim writer As New StreamWriter(oStream)
writer.WriteLine(file)
writer.Close()
MessageBox.Show("OK")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
'open selected file
Dim isoStream As IsolatedStorageFileStream
isoStream = New IsolatedStorageFileStream(File_to_Create, System.IO.FileMode.Open, System.IO.FileAccess.Read, isoStore)
Dim XML_File As XDocument = XDocument.Load(isoStream)
Dim Cart_Query As System.Collections.IEnumerable = From query In XML_File.Descendants("Carts") Order By _
CStr(query.Element("CART_NAME")) Descending, CStr(query.Element("CART_NAME"))
Select New Class_Cartridge_Data With {.Cart_Name = CStr(query.Element("CART_NAME")), _
.Cart_Color = CStr(query.Element("CART_COLOR"))}
Me.ListBox_Cartridges.ItemsSource = Cart_Query
isoStore.Dispose()
isoStream.Close()
End Try
--------------------------------------------------------------------------------------------
Code to ADD / EDIT XElement
Dim File_to_Create As String = "Tracks.xml"
Dim XML_IsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()
' Check that the file exists if not create it
If Not (XML_IsolatedStorage.FileExists(File_to_Create)) Then
Return
End If
Dim XML_StreamReader As New StreamReader(XML_IsolatedStorage.OpenFile(File_to_Create, FileMode.Open, FileAccess.Read))
Dim XML_Document As XDocument = XDocument.Parse(XML_StreamReader.ReadToEnd())
XML_StreamReader.Close()
' Update the element if it exist or create it if it doesn't
Dim XML_XElement As XElement = XML_Document.Descendants("Carts").Where(Function(c) c.Element("CART_NAME").Value.Equals("First")).FirstOrDefault()
If XML_XElement IsNot Nothing Then
XML_XElement.SetElementValue("CART_NAME", "Third")
Else
' Add new
Dim newProgress As New XElement("Cartridges", New XElement("CART_NAME", "Fourth"), New XElement("CART_COLOR", "Blue"))
Dim rootNode As XElement = XML_Document.Root
rootNode.Add(newProgress)
End If
Using XML_StreamWriter As New StreamWriter(XML_IsolatedStorage.OpenFile(File_to_Create, FileMode.Open, FileAccess.Write))
XML_StreamWriter.Write(XML_Document.ToString())
XML_StreamWriter.Close()
End Using
--------------------------------------------------------------------------------------------
Now my issue and request for some help!
If I use
XML_XElement.Remove
then the following exception is raised whenever I try to "refresh" the bounded ListBox
System.Xml.XmlException was unhandled
LineNumber=37
LinePosition=12
Message=Data at the root level is invalid. Line 37, position 12.
SourceUri=""
StackTrace:
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(Int32 res, String resString, String[] args)
at System.Xml.XmlTextReaderImpl.Throw(Int32 res, String resString)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Load(Stream stream, LoadOptions options)
at System.Xml.Linq.XDocument.Load(Stream stream)
at ListBox_Data_from_XML_LINQ.MainPage.Button_Create_XML_Click(Object sender, RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
InnerException:
--------------------------------------------------------------------------------------------
In short, I can add or edit, but cannot DELETE an XElement...
Any ideas?
Thanks in advance!
Can you post the code you are using for XElement.Remove and use code tags so the formatting is right. Its the # button on the post toolbar.
Ren13B said:
Can you post the code you are using for XElement.Remove and use code tags so the formatting is right. Its the # button on the post toolbar.
Click to expand...
Click to collapse
Well, I did nothing special, just the XML_Element.remove, instead of adding a new xelement.
Then the error raises whenever I try to reopen the XML file.
My point is, how can I delete an specific xelement?
As far as I know, the following code should work
Code:
Dim XML_XElement As XElement = XML_Document.Descendants("Carts").Where(Function(c ) c.Element("CART_NAME").Value.Equals("First")).Firs tOrDefault()
If XML_XElement IsNot Nothing Then
XML_XElement.SetElementValue("CART_NAME", "Third")
Else
' remove the selected record
XML_XElement.Remove
End If
Honestly I don't know if the foregoing code is correct or if the issue is related to how WP7 handles the removal thus corrupting the original file.
Please let me know if you need anything else.
Any help is very appreciated!
PS: Thanks for the other replies, helped a lot!
Here's how I did it in c#. My xml file is very different than yours so the query will be different but the important parts are where you load and close the file streams and then write.
Code:
//Get users private store info
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream isoStream;
//open selected file
isoStream = new IsolatedStorageFileStream(list, System.IO.FileMode.Open, System.IO.FileAccess.Read, isoStore);
XDocument xml = XDocument.Load(isoStream);
isoStream.Close();
//Find section
XElement sectionElement = xml.Descendants("section").Where(c => c.Attribute("name").Value.Equals(groupn)).FirstOrDefault();
//Find item and remove it
sectionElement.Elements("setting").Where(c => c.Attribute("name").Value.Equals(litem)).FirstOrDefault().Remove();
isoStream.Close(); //Seems unnecessary but it's needed.
//Write xml file
isoStream = new IsolatedStorageFileStream(list, FileMode.Create, FileAccess.Write, isoStore);
xml.Save(isoStream);
isoStream.Close();
Thanks again for your help, greatly appreciated.
However I'm still getting the same error.
Sorry for asking, but are you getting any errors when deleting in WP7 ?
My knowledge on XML is extremely new and I'm sure that I'm making some mistakes somewhere...
But so far, I cannot get past the same exception.
Seems that the XML gots "corrupted" after the delete operation.
On the other hand, if is not too much to ask for, using my current code, how will handle the delete of the selected record?
Thanks!
I have no problem at all removing elements in c#. I don't have vb support even installed right now. If you think it's a bug you should post on the forums at http://forums.create.msdn.com/forums/98.aspx
Ren13B said:
I have no problem at all removing elements in c#. I don't have vb support even installed right now. If you think it's a bug you should post on the forums at http://forums.create.msdn.com/forums/98.aspx
Click to expand...
Click to collapse
Problem is my country is not listed so I cannot register...
Here is the C# version of my current code for adding/editing
Code:
public static void ADD_XML_Record()
{
string File_to_Create = "Tracks.xml";
var XML_IsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
// Check that the file exists if not create it
if (! (XML_IsolatedStorage.FileExists(File_to_Create)))
{
return;
}
StreamReader XML_StreamReader = new StreamReader(XML_IsolatedStorage.OpenFile(File_to_Create, FileMode.Open, FileAccess.Read));
XDocument XML_Document = XDocument.Parse(XML_StreamReader.ReadToEnd());
XML_StreamReader.Close();
// Update the element if it exist or create it if it doesn't
XElement XML_XElement = XML_Document.Descendants("Carts").Where((c) => c.Element["CART_NAME"].Value.Equals("dd")).FirstOrDefault();
if (XML_XElement != null)
{
XML_XElement.SetElementValue("CART_NAME", "bbbbb");
}
else
{
// Add new
XElement newProgress = new XElement("Carts", new XElement("CART_NAME", "dd"), new XElement("CART_COLOR", "ff"));
XElement rootNode = XML_Document.Root;
rootNode.Add(newProgress);
}
using (StreamWriter XML_StreamWriter = new StreamWriter(XML_IsolatedStorage.OpenFile(File_to_Create, FileMode.Open, FileAccess.Write)))
{
XML_StreamWriter.Write(XML_Document.ToString());
XML_StreamWriter.Close();
}
}
I tried your code but I'm having a bad time making it to work.
If not a big deal, please could you tell me how to modify it ?
I mean, if a record is found, instead of editing, to remove it?
Honestly I'm stuck and any help is more than apprecisted!
Ren13B said:
I have no problem at all removing elements in c#. I don't have vb support even installed right now. If you think it's a bug you should post on the forums at http://forums.create.msdn.com/forums/98.aspx
Click to expand...
Click to collapse
Ren,
Just to say thank you for your last code. I made a little mod and now it works ok!
Thanks a lot for helping me out!

[Q] How to convert IR Pattern from Android ~4.4.2 to 4.4.3

Is there a way to convert a IR pattern from a Android ~4.4.2 to 4.4.3 compatible pattern.
Here is a example how they look like
Code:
private static final int SAMPLE_FREQ = 38400;
private static final int[] IR_SIGNAL_PULSE_COUNT = {171,171,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,21,22,64,22,64,22,64,22,64,22,64,22,876};
private static final int[] IR_SIGNAL_TIME_LENGTH = {4499,4499,578,1683,578,1683,578,1683,578,552,578,552,578,552,578,552,578,552,578,1683,578,1683,578,1683,578,552,578,552,578,552,578,552,578,552,578,552,578,552,578,1683,578,552,578,552,578,552,578,552,578,552,578,1683,578,1683,578,552,578,1683,578,1683,578,1683,578,1683,578,1683,578,23047};
I'm getting a close but not perfect result with this..
Code:
private int[] toCompIR(IrDataCompat data){
int inUs = 1000000/data.getFrequency();
int[] frame = data.getFrame();
int[] arrayOfInt = new int[-1 + frame.length];
for (int j = 1; j < frame.length; j++)
arrayOfInt[(j - 1)] = frame[(j - 1)] * inUs;
return arrayOfInt;
}

Categories

Resources