The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

wrong string - RTF ?

Last post 07-03-2008, 3:52 AM by tronic. 10 replies.
Sort Posts: Previous Next
  •  06-24-2008, 8:09 AM 7765

    wrong string - RTF ?

    Hey.

    When I Invoke to a Method in my C# Class and committ and String from mcml (e.g. name=[Labnel.Content]) to this Method, the string is in this format:

    {\\rtf xxx}

    Is it Rich Text Format?
    And how can I avoid this format (I only want to receive xxx)

    regards, tronic
  •  06-24-2008, 11:39 AM 7770 in reply to 7765

    Re: wrong string - RTF ?

    Can you post the MCML and C# code that does this, as this isn't normal behaviour of MCML.

    Cheers,
    Andrew

  •  06-25-2008, 1:52 AM 7777 in reply to 7770

    Re: wrong string - RTF ?

    Hey.

    Here it is.
    (I have not fouond a "Code" Tag for Highlighting?!)

    <UI Name="RegistrationView">

        <Locals>
          <ScrollingHandler Name="ScrollingHandler" HandlerStage="Bubbled"/>
          <ScrollingData Name="ScrollingData" />
          <as:RegisteredProfiles Name="RegisteredProfiles"/>
        </Locals>

        <Rules>
          <Default Target="[ScrollingHandler.ScrollingData]" Value="[ScrollingData]"/>
          <Default Target="[ScrollingData.Repeater]" Value="[ListRepeater]"/>
          <!--Binding for dynamic Content over Property-->
          <Binding Source="[RegisteredProfiles.ProfileNames]" Target="[ListRepeater.Source]"/>
        </Rules>

        <Content>
          <Panel Layout="Center">
            <Children>
              <Scroller Orientation="Vertical" ScrollingData="[ScrollingData]" MinimumSize="0,250" MaximumSize="0,250" FadeSize="-5" >
                <Children>
                  <Repeater Name="ListRepeater" >
                    <Layout>
                      <FlowLayout Spacing="5,0" Orientation="Vertical"/>
                    </Layout>
                    <Content>       
                      <me:ListItem Description="[RepeatedItem!cor:String]" MyColor="White" RegisteredProfiles="[RegisteredProfiles]">
                      </me:ListItem>
                    </Content>
                  </Repeater>
                </Children>
              </Scroller>
            </Children>
          </Panel>
        </Content>
      </UI>

      <UI Name="ListItem">
        <Properties>
          <cor:String Name="Description" String=""/>
          <Color Name="MyColor" Color="White"/>
          <as:RegisteredProfiles Name="RegisteredProfiles" RegisteredProfiles="$Required"/>
        </Properties>

        <Locals>
          <!--<ClickHandler Name="Clicker"/>-->
          <KeyHandler Key="Enter" Name="EnterHandler"/>
        </Locals>
        <Rules>
          <Condition Source="[Input.KeyFocus]" SourceValue="true">
            <Actions>
              <Set Target="[Background.Content]" Value="LightGoldenrodYellow"/>
              <Set Target="[Label.Color]" Value="Firebrick"/>
            </Actions>
          </Condition>

          <Condition Source="[EnterHandler.Pressing]" SourceValue="true">
            <Actions>
              <Invoke Target="[RegisteredProfiles.Register]"
                      name="[Label.Content]"/>
            </Actions>
          </Condition>
         
        </Rules>

        <Content>
          <ColorFill Name="Background" Content="SlateGray" Padding="5,5,5,5" MinimumSize="150,75">
            <Children>
              <Text Name="Label" Content="[Description]" Color="[MyColor]" Font="Arial,18"/>
            </Children>
          </ColorFill>
        </Content>

      </UI>

    C#

     public void Register(string name)
            {          

    do anything
                here is name = {\\rtf xxx}

            }


    regards, tronic
  •  06-25-2008, 11:29 PM 7787 in reply to 7777

    Re: wrong string - RTF ?

    So just to check I understand, you are passing in the values in the repeater that ultimately get passed back to the Register method as "name".  What does the data look like?  Is it just entered as strings in code, or do you get it from somewhere?   Could it be in a character encoding that Media Center doesn't like, so converts it to RTF?

    Cheers,
    Andrew

  •  07-01-2008, 3:03 AM 7805 in reply to 7787

    Re: wrong string - RTF ?

    Hey Andy.

    I get the Data from an  Dictionary<TKey, TValue> and fill it with an while loop to an ArrayListDataSet.
    I have checked the data by debugging. They are normal strings when they put into the ArrayListDataSet.
    Only when I hit enter to invoke Register( string name)....they return to the C# in this strange form ({//rtf xxx}.

    regards, tronic
  •  07-01-2008, 6:07 AM 7807 in reply to 7805

    Re: wrong string - RTF ?

    Is "({//rtf xxx}" exactly what it says, or are you putting the xxx as shorthand for what it actually says?

    If the latter, can you post one example of what it looks like?  I'm thinking somewhere along the line, the data you put into the .Content is being converted in to RTF because it can't be dealt with properly, just not yet sure why.

    Cheers,
    Andrew

  •  07-01-2008, 7:28 AM 7808 in reply to 7807

    Re: wrong string - RTF ?

    An Example is "Alice". That will be put into the ArrayListDataSet. A normal String.
    This Array will be displayed by an Repeater and is scrollable.
    And when it returns to C# (because of the EnterHandler Invoking) it looks like this: {\\rtf Alice}.

    Thats a short abstract.

    Maybe, it would be the Repeater?! When he gets the data from the Property. But when I look inside the Property by debugging the Strings are all ok.

    regards, rog
  •  07-01-2008, 1:20 PM 7812 in reply to 7808

    Re: wrong string - RTF ?

    I have to say I'm completely stumped at the moment - can you create a complete project that replicates the issue and post it, and I'll have a look to see if I can work out whats causing it.

    Cheers,
    Andrew

  •  07-02-2008, 6:47 AM 7822 in reply to 7812

    Re: wrong string - RTF ?

    Hey.

    Here is an Project.

    http://rapidshare.com/files/126558168/App.zip.html

    You must run it inside of Media Center. When you hit Enter on any Name you will get a Dialog with the Name....without problems. looks like all ok. but when you debug the C# Code and show inside the variable "name" at the Method Register you will see the problem {\\rtf xxx}...thats what return from Media Center.

    Its really scary. The Dialog displays all ok, but back to Code (for processing the data) the wrong string.

    regards, tronic
  •  07-02-2008, 12:20 PM 7831 in reply to 7822

    Re: wrong string - RTF ?

    Well that was a new one on me... the issue is that you are bring back the content which apparently is stored in RTF format (which I didn't know).  If you change

    <Invoke Target="[TestClass.Register]" name="[Label.Content]"/>

    to

    <Invoke Target="[TestClass.Register]" name="[Description]"/>

    everything works fine.

    Cheers,
    Andrew

  •  07-03-2008, 3:52 AM 7839 in reply to 7831

    Re: wrong string - RTF ?

    Thanks. It works fine.

    Good to know. It is very strange that these strings are stored in rtf in this part of Text Element :).

    problem fixed :)

    thanks a lot, tonic
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems