Click here to Skip to main content
15,881,172 members
Home / Discussions / WPF
   

WPF

 
QuestionToggleButton with Images [SOLVED - sort of] Pin
#realJSOP14-Apr-09 9:58
mve#realJSOP14-Apr-09 9:58 
AnswerRe: ToggleButton with Images Pin
Eslam Afifi14-Apr-09 11:05
Eslam Afifi14-Apr-09 11:05 
AnswerRe: ToggleButton with Images [SOLVED - sort of] Pin
DemonPT30-Aug-11 5:07
DemonPT30-Aug-11 5:07 
QuestionVisual Studio 2008/Expression Blend Wierdness [SOLVED!!!] Pin
BlitzPackage14-Apr-09 7:23
BlitzPackage14-Apr-09 7:23 
AnswerRe: Visual Studio 2008/Expression Blend Wierdness Pin
BlitzPackage14-Apr-09 7:53
BlitzPackage14-Apr-09 7:53 
QuestionCanvas or Grid inside Viewport3D? Pin
emptythetill14-Apr-09 5:38
emptythetill14-Apr-09 5:38 
AnswerRe: Canvas or Grid inside Viewport3D? Pin
sivaddrahcir20-Apr-09 8:17
sivaddrahcir20-Apr-09 8:17 
QuestionReading a XML file from IsolatedStorage ? [modified] Pin
Mohammad Dayyan13-Apr-09 18:00
Mohammad Dayyan13-Apr-09 18:00 
Hi.
I'm reading a XML file that has been stored in IsolatedStorage.
But this Exception was occurring Root element is missing.
I'm dead sure that there isn't any troubles in the XML file, So I don't the know the result of the Exception Frown | :(

Could you guide me ?
Thank you.

This is my snippet code :
using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
{
	.
        .
        .
   
    string SettingFilePath = "CodeColorizer\\setting.xml";
    using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(SettingFilePath, FileMode.Create, isoStore))
    {
        isoStream.Position = 0;
        XmlReader xmlReader;
        xmlReader = XmlReader.Create(isoStream);
        //Moves the reader to the root element.                        
        <code>xmlReader.MoveToContent();</code>//Exception was occurring here
        string value;
        while (xmlReader.Read())
        {
            switch (xmlReader.NodeType)
            {
                case XmlNodeType.Element:
                    {
                        if (xmlReader.Name == "IsVB")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.IsVB.IsChecked = true; this.IsCsharp.IsChecked = false; }
                            else if (value == "False") { this.IsVB.IsChecked = false; this.IsCsharp.IsChecked = true; }
                        }
                        else if (xmlReader.Name == "IsCsharp")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.IsVB.IsChecked = false; this.IsCsharp.IsChecked = true; }
                            else if (value == "False") { this.IsVB.IsChecked = true; this.IsCsharp.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "IsStriped")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.IsStriped.IsChecked = true; }
                            else if (value == "False") { this.IsStriped.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "HasLineNumber")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.HasLineNumber.IsChecked = true; }
                            else if (value == "False") { this.HasLineNumber.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "AddDefaultStylesWithinPreTags")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.addDefaultStylesWithinPreTags.IsChecked = true; }
                            else if (value == "False") { this.addDefaultStylesWithinPreTags.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "CssClassName")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            this.cssClassName.Text = value;
                        }
                        else if (xmlReader.Name == "AddPreTag")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.AddPreTag.IsChecked = true; }
                            else if (value == "False") { this.AddPreTag.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "AddBGColor")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.AddBGColor.IsChecked = true; }
                            else if (value == "False") { this.AddBGColor.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "TextBoxColor")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            this.TextBoxColor.Text = value;
                        }
                        break;
                    }
            }
        }
    }   
 

}


modified on Tuesday, April 14, 2009 12:08 AM

QuestionRe: Reading a XML file from IsolatedStorage ? Pin
Mark Salsbery13-Apr-09 20:08
Mark Salsbery13-Apr-09 20:08 
AnswerRe: Reading a XML file from IsolatedStorage ? Pin
Mohammad Dayyan13-Apr-09 21:53
Mohammad Dayyan13-Apr-09 21:53 
AnswerRe: Reading a XML file from IsolatedStorage ? Pin
Mohammad Dayyan13-Apr-09 22:34
Mohammad Dayyan13-Apr-09 22:34 
QuestionRe: Reading a XML file from IsolatedStorage ? Pin
Mark Salsbery14-Apr-09 6:24
Mark Salsbery14-Apr-09 6:24 
AnswerRe: Reading a XML file from IsolatedStorage ? Pin
Mohammad Dayyan14-Apr-09 10:56
Mohammad Dayyan14-Apr-09 10:56 
QuestionXAML - TreeView with CheckBoxes Pin
Jack Kril13-Apr-09 13:26
Jack Kril13-Apr-09 13:26 
AnswerRe: XAML - TreeView with CheckBoxes Pin
Eslam Afifi13-Apr-09 13:59
Eslam Afifi13-Apr-09 13:59 
QuestionClipping To Rounded Corners Pin
#realJSOP13-Apr-09 5:27
mve#realJSOP13-Apr-09 5:27 
AnswerRe: Clipping To Rounded Corners [modified] Pin
Eslam Afifi13-Apr-09 7:42
Eslam Afifi13-Apr-09 7:42 
AnswerRe: Clipping To Rounded Corners Pin
Mark Salsbery13-Apr-09 9:45
Mark Salsbery13-Apr-09 9:45 
AnswerRe: Clipping To Rounded Corners Pin
sivaddrahcir20-Apr-09 8:31
sivaddrahcir20-Apr-09 8:31 
QuestionOnRenderComplete like event for WPF controls Pin
Pankaj Chamria13-Apr-09 1:38
Pankaj Chamria13-Apr-09 1:38 
QuestionContext menu in Datatemplate Pin
mikla52111-Apr-09 5:39
mikla52111-Apr-09 5:39 
QuestionRe: Context menu in Datatemplate Pin
Mark Salsbery11-Apr-09 7:42
Mark Salsbery11-Apr-09 7:42 
AnswerRe: Context menu in Datatemplate [modified] Pin
mikla52111-Apr-09 19:54
mikla52111-Apr-09 19:54 
QuestionRe: Context menu in Datatemplate Pin
Mark Salsbery13-Apr-09 8:47
Mark Salsbery13-Apr-09 8:47 
AnswerRe: Context menu in Datatemplate Pin
mikla52113-Apr-09 21:11
mikla52113-Apr-09 21:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.