Changeset 2424


Ignore:
Timestamp:
Jan 22, 2011, 4:07:46 PM (11 years ago)
Author:
sauer
Message:

Wizard: sample preparations

Location:
trunk/CrypPlugins/Wizard
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/Wizard/Config/Analysis/wizard.config.classicEn.xml

    r2346 r2424  
    1111  <desc lang="en-US" >Select a classic encryption algorithm.</desc>
    1212
    13   <!-- Caesar Item -->
    14   <item id ="CaesarEn" image="Caesar">
     13  <!-- Caesar input -->
     14  <input id ="CaesarEn" image="Caesar">
    1515    <name lang="en-US" >Caesar</name>
    1616    <description lang="en-US" >
    1717      Caesar is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    1818    </description>
    19   </item>
     19    <inputBox plugin="textInput" property="Input" defaultValue="Input your Message here!">
     20      <description lang="en-US">
     21        Message to encrypt
     22      </description>
     23    </inputBox>
    2024
    21   <!-- Vigenère Item -->
    22   <item id ="VigenereEn" image="Vigenere">
     25    <input id ="CaesarEnKey">
     26      <inputBox defaultValue="00 00 00">
     27        <description lang="en-US">
     28          Key
     29        </description>
     30      </inputBox>
     31      <inputBox defaultValue="00 00 00">
     32        <description lang="en-US">
     33          Initialization Vector
     34        </description>
     35      </inputBox>
     36    </input>
     37  </input>
     38
     39  <!-- Vigenère input -->
     40  <input id ="VigenereEn" image="Vigenere">
    2341    <name lang="en-US" >Vigenère</name>
    2442    <description lang="en-US" >
    2543      Vigenère is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    2644    </description>
    27   </item>
     45  </input>
    2846
    29   <!-- Substitution Item -->
    30   <item id ="SubstitutionEn" image="Substitution">
     47  <!-- Substitution input -->
     48  <input id ="SubstitutionEn" image="Substitution">
    3149    <name lang="en-US" >Substitution</name>
    3250    <description lang="en-US" >
    3351      Substitution is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    3452    </description>
    35   </item>
     53  </input>
    3654
    37   <!-- Enigma Item -->
    38   <item id ="EnigmaEn" image="Enigma">
     55  <!-- Enigma input -->
     56  <input id ="EnigmaEn" image="Enigma">
    3957    <name lang="en-US" >Enigma</name>
    4058    <description lang="en-US" >
    4159      Enigma is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    4260    </description>
    43   </item>
     61  </input>
    4462
    45   <!-- Playfair Item -->
    46   <item id ="PlayfairEn" image="Playfair">
     63  <!-- Playfair input -->
     64  <input id ="PlayfairEn" image="Playfair">
    4765    <name lang="en-US" >Playfair</name>
    4866    <description lang="en-US" >
    4967      Playfair is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    5068    </description>
    51   </item>
     69  </input>
    5270
    53   <!-- ADFGVX Item -->
    54   <item id ="ADFGVXEn" image="ADFGVX">
     71  <!-- ADFGVX input -->
     72  <input id ="ADFGVXEn" image="ADFGVX">
    5573    <name lang="en-US" >ADFGVX</name>
    5674    <description lang="en-US" >
    5775      ADFGVX is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    5876    </description>
    59   </item>
     77  </input>
    6078
    61   <!-- XOR Item -->
    62   <item id ="XOREn" image="XOR">
     79  <!-- XOR input -->
     80  <input id ="XOREn" image="XOR">
    6381    <name lang="en-US" >XOR</name>
    6482    <description lang="en-US" >
    6583      XOR is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    6684    </description>
    67   </item>
     85  </input>
    6886
    69   <!-- Vernam Item -->
    70   <item id ="VernamEn" image="Vernam">
     87  <!-- Vernam input -->
     88  <input id ="VernamEn" image="Vernam">
    7189    <name lang="en-US" >Vernam</name>
    7290    <description lang="en-US" >
    7391      Vernam is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    7492    </description>
    75   </item>
     93  </input>
    7694
    77   <!-- Transposition Item -->
    78   <item id ="TranspositionEn" image="Transposition">
     95  <!-- Transposition input -->
     96  <input id ="TranspositionEn" image="Transposition">
    7997    <name lang="en-US" >Transposition</name>
    8098    <description lang="en-US" >
    8199      Transposition is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    82100    </description>
    83   </item>
     101  </input>
    84102
    85   <!-- Scytale Item -->
    86   <item id ="ScytaleEn" image="Scytale">
     103  <!-- Scytale input -->
     104  <input id ="ScytaleEn" image="Scytale">
    87105    <name lang="en-US" >Scytale</name>
    88106    <description lang="en-US" >
    89107      Scytale is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    90108    </description>
    91   </item>
     109  </input>
    92110
    93111</step>
  • trunk/CrypPlugins/Wizard/Config/Analysis/wizard.config.modernEn.xml

    r2346 r2424  
    3333    <desc lang="en-US" >Select an asymmetric encryption/decryption algorithm.</desc>
    3434   
    35     <!-- RSA Item -->
    36     <item id="RSAEn" image="RSA" >
     35    <!-- RSA input -->
     36    <input id="RSAEn" image="RSA" >
    3737      <name lang="en-US" >RSA</name>
    3838      <description lang="en-US" >
    3939        RSA is an asymmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    4040      </description>
    41     </item>
     41    </input>
    4242  </category>
    4343
  • trunk/CrypPlugins/Wizard/Config/Analysis/wizard.config.modernSymEn.xml

    r2346 r2424  
    1111  <desc lang="en-US" >Select a modern symmetric encryption algorithm.</desc>
    1212
    13   <!-- AES Item -->
    14   <item id="AESEn" image="AES" >
     13  <!-- AES input -->
     14  <input id="AESEn" image="AES" >
    1515    <name lang="en-US" >AES</name>
    1616    <description lang="en-US" >
    1717      AES is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    1818    </description>
    19   </item>
     19  </input>
    2020
    21   <!-- DES Item -->
    22   <item id="DESEn" image="DES" >
     21  <!-- DES input -->
     22  <input id="DESEn" image="DES" >
    2323    <name lang="en-US" >DES</name>
    2424    <description lang="en-US" >
    2525      DES is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    2626    </description>
    27   </item>
     27  </input>
    2828
    29   <!-- SDES Item -->
    30   <item id="SDESEn" image="SDES" >
     29  <!-- SDES input -->
     30  <input id="SDESEn" image="SDES" >
    3131    <name lang="en-US" >SDES</name>
    3232    <description lang="en-US" >
    3333      SDES is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    3434    </description>
    35   </item>
     35  </input>
    3636
    37   <!-- Twofish Item -->
    38   <item id="TwoEn" image="Twofish" >
     37  <!-- Twofish input -->
     38  <input id="TwoEn" image="Twofish" >
    3939    <name lang="en-US" >Twofish</name>
    4040    <description lang="en-US" >
    4141      Twofish is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    4242    </description>
    43   </item>
     43  </input>
    4444
    45   <!-- Trivium Item -->
    46   <item id="TriEn" image="Trivium" >
     45  <!-- Trivium input -->
     46  <input id="TriEn" image="Trivium" >
    4747    <name lang="en-US" >Trivium</name>
    4848    <description lang="en-US" >
    4949      Trivium is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    5050    </description>
    51   </item>
     51  </input>
    5252
    53   <!-- TEA Item -->
    54   <item id="TEAEn" image="TEA" >
     53  <!-- TEA input -->
     54  <input id="TEAEn" image="TEA" >
    5555    <name lang="en-US" >TEA</name>
    5656    <description lang="en-US" >
    5757      TEA is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    5858    </description>
    59   </item>
     59  </input>
    6060
    6161</step>
  • trunk/CrypPlugins/Wizard/Config/EnDeCrypt/wizard.config.classicEnDe.xml

    r2346 r2424  
    1111  <desc lang="en-US" >Select a classic encryption/decryption algorithm.</desc>
    1212
    13   <!-- Caesar Item -->
    14   <item id ="Caesar" image="Caesar">
     13  <!-- Caesar input -->
     14  <input id ="Caesar" image="Caesar">
    1515    <name lang="en-US" >Caesar</name>
    1616    <description lang="en-US" >
    1717      Caesar is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    1818    </description>
    19   </item>
     19  </input>
    2020
    21   <!-- Vigenère Item -->
    22   <item id ="Vigenere" image="Vigenere">
     21  <!-- Vigenère input -->
     22  <input id ="Vigenere" image="Vigenere">
    2323    <name lang="en-US" >Vigenère</name>
    2424    <description lang="en-US" >
    2525      Vigenère is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    2626    </description>
    27   </item>
     27  </input>
    2828
    29   <!-- Substitution Item -->
    30   <item id ="Substitution" image="Substitution">
     29  <!-- Substitution input -->
     30  <input id ="Substitution" image="Substitution">
    3131    <name lang="en-US" >Substitution</name>
    3232    <description lang="en-US" >
    3333      Substitution is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    3434    </description>
    35   </item>
     35  </input>
    3636
    37   <!-- Enigma Item -->
    38   <item id ="Enigma" image="Enigma">
     37  <!-- Enigma input -->
     38  <input id ="Enigma" image="Enigma">
    3939    <name lang="en-US" >Enigma</name>
    4040    <description lang="en-US" >
    4141      Enigma is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    4242    </description>
    43   </item>
     43  </input>
    4444
    45   <!-- Playfair Item -->
    46   <item id ="Playfair" image="Playfair">
     45  <!-- Playfair input -->
     46  <input id ="Playfair" image="Playfair">
    4747    <name lang="en-US" >Playfair</name>
    4848    <description lang="en-US" >
    4949      Playfair is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    5050    </description>
    51   </item>
     51  </input>
    5252
    53   <!-- ADFGVX Item -->
    54   <item id ="ADFGVX" image="ADFGVX">
     53  <!-- ADFGVX input -->
     54  <input id ="ADFGVX" image="ADFGVX">
    5555    <name lang="en-US" >ADFGVX</name>
    5656    <description lang="en-US" >
    5757      ADFGVX is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    5858    </description>
    59   </item>
     59  </input>
    6060
    61   <!-- XOR Item -->
    62   <item id ="XOR" image="XOR">
     61  <!-- XOR input -->
     62  <input id ="XOR" image="XOR">
    6363    <name lang="en-US" >XOR</name>
    6464    <description lang="en-US" >
    6565      XOR is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    6666    </description>
    67   </item>
     67  </input>
    6868
    69   <!-- Vernam Item -->
    70   <item id ="Vernam" image="Vernam">
     69  <!-- Vernam input -->
     70  <input id ="Vernam" image="Vernam">
    7171    <name lang="en-US" >Vernam</name>
    7272    <description lang="en-US" >
    7373      Vernam is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    7474    </description>
    75   </item>
     75  </input>
    7676
    77   <!-- Transposition Item -->
    78   <item id ="Transposition" image="Transposition">
     77  <!-- Transposition input -->
     78  <input id ="Transposition" image="Transposition">
    7979    <name lang="en-US" >Transposition</name>
    8080    <description lang="en-US" >
    8181      Transposition is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    8282    </description>
    83   </item>
     83  </input>
    8484
    85   <!-- Scytale Item -->
    86   <item id ="Scytale" image="Scytale">
     85  <!-- Scytale input -->
     86  <input id ="Scytale" image="Scytale">
    8787    <name lang="en-US" >Scytale</name>
    8888    <description lang="en-US" >
    8989      Scytale is a classic algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    9090    </description>
    91   </item>
     91  </input>
    9292
    9393</step>
  • trunk/CrypPlugins/Wizard/Config/EnDeCrypt/wizard.config.modernEnDe.xml

    r2346 r2424  
    3333    <desc lang="en-US" >Select an asymmetric encryption/decryption algorithm.</desc>
    3434   
    35     <!-- RSA Item -->
    36     <item id="RSA" image="RSA" >
     35    <!-- RSA input -->
     36    <input id="RSA" image="RSA" >
    3737      <name lang="en-US" >RSA</name>
    3838      <description lang="en-US" >
    3939        RSA is an asymmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    4040      </description>
    41     </item>
     41    </input>
    4242  </category>
    4343
  • trunk/CrypPlugins/Wizard/Config/EnDeCrypt/wizard.config.modernSymEnDe.xml

    r2346 r2424  
    1111  <desc lang="en-US" >Select a modern symmetric encryption/decryption algorithm.</desc>
    1212
    13   <!-- AES Item -->
    14   <item id="AESEnDe" image="AES" >
     13  <!-- AES input -->
     14  <input id="AESEnDe" image="AES" >
    1515    <name lang="en-US" >AES</name>
    1616    <description lang="en-US" >
    1717      AES is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    1818    </description>
    19   </item>
     19  </input>
    2020
    21   <!-- DES Item -->
    22   <item id="DESEnDe" image="DES" >
     21  <!-- DES input -->
     22  <input id="DESEnDe" image="DES" >
    2323    <name lang="en-US" >DES</name>
    2424    <description lang="en-US" >
    2525      DES is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    2626    </description>
    27   </item>
     27  </input>
    2828
    29   <!-- SDES Item -->
    30   <item id="SDESEnDe" image="SDES" >
     29  <!-- SDES input -->
     30  <input id="SDESEnDe" image="SDES" >
    3131    <name lang="en-US" >SDES</name>
    3232    <description lang="en-US" >
    3333      SDES is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    3434    </description>
    35   </item>
     35  </input>
    3636
    37   <!-- Twofish Item -->
    38   <item id="Two" image="Twofish" >
     37  <!-- Twofish input -->
     38  <input id="Two" image="Twofish" >
    3939    <name lang="en-US" >Twofish</name>
    4040    <description lang="en-US" >
    4141      Twofish is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    4242    </description>
    43   </item>
     43  </input>
    4444
    45   <!-- Trivium Item -->
    46   <item id="Tri" image="Trivium" >
     45  <!-- Trivium input -->
     46  <input id="Tri" image="Trivium" >
    4747    <name lang="en-US" >Trivium</name>
    4848    <description lang="en-US" >
    4949      Trivium is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    5050    </description>
    51   </item>
     51  </input>
    5252
    53   <!-- TEA Item -->
    54   <item id="TEA" image="TEA" >
     53  <!-- TEA input -->
     54  <input id="TEA" image="TEA" >
    5555    <name lang="en-US" >TEA</name>
    5656    <description lang="en-US" >
    5757      TEA is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    5858    </description>
    59   </item>
     59  </input>
    6060
    61   <!-- RC2 Item -->
    62   <item id="RC2" image="RC2" >
     61  <!-- RC2 input -->
     62  <input id="RC2" image="RC2" >
    6363    <name lang="en-US" >RC2</name>
    6464    <description lang="en-US" >
    6565      RC2 is a symmetric modern algorithm to encrypt plaintext or to decrypt ciphertext... (add instead some really helpful text).
    6666    </description>
    67   </item>
     67  </input>
    6868
    6969</step>
  • trunk/CrypPlugins/Wizard/Config/Indiv/wizard.config.hash.xml

    r2394 r2424  
    1111  <desc lang="en-US" >Select a hash function.</desc>
    1212
    13   <!-- MD5 Item -->
    14   <item id="MD5" image="MD5" >
     13  <!-- MD5 input -->
     14  <input id="MD5" image="MD5" >
    1515    <name lang="en-US" >MD5</name>
    1616    <description lang="en-US" >
    1717      MD5 is a hash function... (add instead some really helpful text).
    1818    </description>
    19   </item>
     19  </input>
    2020
    21   <!-- SHA Item -->
    22   <item id="SHA" image="SHA" >
     21  <!-- SHA input -->
     22  <input id="SHA" image="SHA" >
    2323    <name lang="en-US" >SHA</name>
    2424    <description lang="en-US" >
    2525      SHA is a hash function... (add instead some really helpful text).
    2626    </description>
    27   </item>
     27  </input>
    2828
    29   <!-- RIPEMD160 Item -->
    30   <item id="RIPEMD160" image="RIPEMD160" >
     29  <!-- RIPEMD160 input -->
     30  <input id="RIPEMD160" image="RIPEMD160" >
    3131    <name lang="en-US" >RIPEMD160</name>
    3232    <description lang="en-US" >
    3333      RIPEMD160 is a hash function... (add instead some really helpful text).
    3434    </description>
    35   </item>
     35  </input>
    3636
    37   <!-- Tiger Item -->
    38   <item id="Tiger" image="Tiger" >
     37  <!-- Tiger input -->
     38  <input id="Tiger" image="Tiger" >
    3939    <name lang="en-US" >Tiger</name>
    4040    <description lang="en-US" >
    4141      Tiger is a hash function... (add instead some really helpful text).
    4242    </description>
    43   </item>
     43  </input>
    4444
    45   <!-- Whirlpool Item -->
    46   <item id="Whirlpool" image="Whirlpool" >
     45  <!-- Whirlpool input -->
     46  <input id="Whirlpool" image="Whirlpool" >
    4747    <name lang="en-US" >Whirlpool</name>
    4848    <description lang="en-US" >
    4949      Whirlpool is a hash function... (add instead some really helpful text).
    5050    </description>
    51   </item>
     51  </input>
    5252
    5353</step>
  • trunk/CrypPlugins/Wizard/Config/Indiv/wizard.config.indiv.xml

    r2346 r2424  
    4242    <desc lang="en-US" >Select a key exchange algorithm.</desc>
    4343
    44     <!-- Diffie Hellman Item -->
    45     <item id="Diffie" image="Key" >
     44    <!-- Diffie Hellman input -->
     45    <input id="Diffie" image="Key" >
    4646      <name lang="en-US" >Diffie Hellman</name>
    4747      <description lang="en-US" >
    4848        Diffie Hellman is a key exchange algorithm... (add instead some really helpful text).
    4949      </description>
    50     </item>
     50    </input>
    5151  </category>
    5252
  • trunk/CrypPlugins/Wizard/Config/Indiv/wizard.config.prime.xml

    r2346 r2424  
    1111  <desc lang="en-US" >Select a prime number operation.</desc>
    1212
    13   <!-- Factorization Item -->
    14   <item id="Factorization" image="Primes" >
     13  <!-- Factorization input -->
     14  <input id="Factorization" image="Primes" >
    1515    <name lang="en-US" >Prime Number Factorization</name>
    1616    <description lang="en-US" >
    1717      Select to factorize prime numbers.
    1818    </description>
    19   </item>
     19  </input>
    2020
    21   <!-- Generation Item -->
    22   <item id="Generation" image="Primes" >
     21  <!-- Generation input -->
     22  <input id="Generation" image="Primes" >
    2323    <name lang="en-US" >Prime Number Generation</name>
    2424    <description lang="en-US" >
    2525      Select to generate prime numbers.
    2626    </description>
    27   </item>
     27  </input>
    2828
    29   <!-- Test Item -->
    30   <item id="Test" image="Primes" >
     29  <!-- Test input -->
     30  <input id="Test" image="Primes" >
    3131    <name lang="en-US" >Prime Number Test</name>
    3232    <description lang="en-US" >
    3333      Select to test numbers for being prime.
    3434    </description>
    35   </item>
     35  </input>
    3636
    3737</step>
  • trunk/CrypPlugins/Wizard/Config/wizard.config.start.xml

    r2346 r2424  
    33<!-- This is the entry XML file defining the first categories a user can select from (the first step). -->
    44
    5 <step>
     5<category>
    66
    77  <!-- This is the step's headline. It should be short, but precise. -->
     
    4242  </category>
    4343 
    44 </step>
     44</category>
    4545
  • trunk/CrypPlugins/Wizard/WizardControl.xaml

    r2421 r2424  
    8383        <Label HorizontalAlignment="Stretch" Name="descHeader" FontSize="13" Grid.Row="1" Margin="5" />
    8484       
    85         <Grid HorizontalAlignment="Stretch" Name="grid1" VerticalAlignment="Stretch" Grid.Row="2" Margin="10" >
     85        <Grid HorizontalAlignment="Stretch" Name="categoryGrid" VerticalAlignment="Stretch" Grid.Row="2" Margin="10" >
    8686        <Grid.ColumnDefinitions>
    8787            <ColumnDefinition Width="Auto" />
     
    107107            </Border>
    108108        </Grid>
     109
     110        <ScrollViewer Grid.Row="2" HorizontalAlignment="Stretch" Name="inputPanel" VerticalAlignment="Stretch" >
     111            <StackPanel Name="inputStack" Orientation="Vertical"/>
     112        </ScrollViewer>
     113       
    109114        <StackPanel Height="Auto" HorizontalAlignment="Right" Name="buttonStackPanel" VerticalAlignment="Bottom" Margin="2" Grid.Row="3" Orientation="Horizontal" >
    110115            <Button Content="{Loc BackButton}" Height="23" Name="backButton" Width="75" Margin="1" Click="backButton_Click"/>
  • trunk/CrypPlugins/Wizard/WizardControl.xaml.cs

    r2421 r2424  
    129129                descHeader.Content = desc.Value;
    130130
    131             //generate radio buttons
    132             IEnumerable<XElement> categories = element.Elements("category");
    133             IEnumerable<XElement> items = element.Elements("item");
    134 
    135             if (items.Any())
    136                 categories = categories.Union(items);
    137 
    138             if (categories.Any())
    139             {
    140                 foreach (XElement ele in categories)
    141                 {
    142                     Border border = new Border();
    143                     Label l = new Label();
    144                     Image i = new Image();
    145                     StackPanel sp = new StackPanel();
    146 
    147                     border.Child = sp;
    148                     border.VerticalAlignment = VerticalAlignment.Stretch;
    149                     border.CornerRadius = new CornerRadius(5, 0, 0, 5);
    150                     border.BorderBrush = Brushes.LightSeaGreen;
    151 
    152                     l.Height = 30;
    153                     l.HorizontalAlignment = HorizontalAlignment.Stretch;
    154                     XElement label = FindElementInElement(ele, "name");
    155                     if (label != null)
    156                         l.Content = label.Value;
    157 
    158                     i.Width = 26;
    159                     string image = ele.Attribute("image").Value;
    160                     if (image != null)
     131
     132            if (element.Name == "input")
     133            {
     134                categoryGrid.Visibility = Visibility.Hidden;
     135                inputPanel.Visibility = Visibility.Visible;
     136
     137                var inputBoxes = element.Elements("inputBox");
     138                inputStack.Children.Clear();
     139               
     140                foreach (var box in inputBoxes)
     141                {
     142                    var description = new Label();
     143                    description.Content = FindElementInElement(box, "description").Value;
     144                    inputStack.Children.Add(description);
     145
     146                    var textBox = new TextBox();
     147                    textBox.MinLines = 4;
     148                    inputStack.Children.Add(textBox);
     149                    if (box.Attribute("defaultValue") != null)
     150                        textBox.Text = box.Attribute("defaultValue").Value;
     151                }
     152
     153                var next = element.Element("input");
     154                if (next != null)
     155                    inputPanel.Tag = next;
     156                else
     157                    inputPanel.Tag = element.Element("category");
     158
     159                if (inputPanel.Tag != null)
     160                    nextButton.IsEnabled = true;
     161            }
     162            else if (element.Name == "category")
     163            {
     164                categoryGrid.Visibility = Visibility.Visible;
     165                inputPanel.Visibility = Visibility.Hidden;
     166               
     167                radioButtonStackPanel.Children.Clear();
     168                //ResetBackground();
     169
     170                //generate radio buttons
     171                IEnumerable<XElement> categories = element.Elements("category");
     172                IEnumerable<XElement> inputs = element.Elements("input");
     173
     174                if (inputs.Any())
     175                    categories = categories.Union(inputs);
     176
     177                if (categories.Any())
     178                {
     179                    foreach (XElement ele in categories)
    161180                    {
    162                         ImageSource ims = (ImageSource)TryFindResource(image);
    163                         if (ims != null)
     181                        Border border = new Border();
     182                        Label l = new Label();
     183                        Image i = new Image();
     184                        StackPanel sp = new StackPanel();
     185
     186                        border.Child = sp;
     187                        border.VerticalAlignment = VerticalAlignment.Stretch;
     188                        border.CornerRadius = new CornerRadius(5, 0, 0, 5);
     189                        border.BorderBrush = Brushes.LightSeaGreen;
     190
     191                        l.Height = 30;
     192                        l.HorizontalAlignment = HorizontalAlignment.Stretch;
     193                        XElement label = FindElementInElement(ele, "name");
     194                        if (label != null)
     195                            l.Content = label.Value;
     196
     197                        i.Width = 26;
     198                        string image = ele.Attribute("image").Value;
     199                        if (image != null)
    164200                        {
    165                             i.Source = ims;
    166                             sp.Children.Add(i);
     201                            ImageSource ims = (ImageSource) TryFindResource(image);
     202                            if (ims != null)
     203                            {
     204                                i.Source = ims;
     205                                sp.Children.Add(i);
     206                            }
    167207                        }
    168                     }
    169 
    170                     sp.VerticalAlignment = VerticalAlignment.Stretch;
    171                     sp.HorizontalAlignment = HorizontalAlignment.Stretch;
    172                     sp.Orientation = Orientation.Horizontal;
    173                     sp.Children.Add(l);
    174 
    175                     RadioButton rb = new RadioButton();
    176                     string id = ele.Attribute("id").Value;
    177                     if (id != null)
    178                         rb.Name = id;
    179                     rb.Checked += rb_Checked;
    180                     rb.HorizontalAlignment = HorizontalAlignment.Stretch;
    181                     rb.VerticalAlignment = VerticalAlignment.Stretch;
    182                     rb.HorizontalContentAlignment = HorizontalAlignment.Stretch;
    183                     rb.Content = border;
    184                     rb.Tag = ele;
    185 
    186                     radioButtonStackPanel.Children.Add(rb);
    187                     if (choicePath.Count > 0 && id == choicePath.Last())
    188                     {
    189                         choicePath.RemoveAt(choicePath.IndexOf(choicePath.Last()));
    190                         rb.IsChecked = true;
    191                         nextButton.IsEnabled = true;
     208
     209                        sp.VerticalAlignment = VerticalAlignment.Stretch;
     210                        sp.HorizontalAlignment = HorizontalAlignment.Stretch;
     211                        sp.Orientation = Orientation.Horizontal;
     212                        sp.Children.Add(l);
     213
     214                        RadioButton rb = new RadioButton();
     215                        string id = ele.Attribute("id").Value;
     216                        if (id != null)
     217                            rb.Name = id;
     218                        rb.Checked += rb_Checked;
     219                        rb.HorizontalAlignment = HorizontalAlignment.Stretch;
     220                        rb.VerticalAlignment = VerticalAlignment.Stretch;
     221                        rb.HorizontalContentAlignment = HorizontalAlignment.Stretch;
     222                        rb.Content = border;
     223                        rb.Tag = ele;
     224
     225                        radioButtonStackPanel.Children.Add(rb);
     226                        if (choicePath.Count > 0 && id == choicePath.Last())
     227                        {
     228                            choicePath.RemoveAt(choicePath.IndexOf(choicePath.Last()));
     229                            rb.IsChecked = true;
     230                            nextButton.IsEnabled = true;
     231                        }
    192232                    }
    193233                }
     
    275315        private void SetNextContent(object sender, EventArgs e)
    276316        {
    277             ResetBackground();
    278             for (int i = 0; i < radioButtonStackPanel.Children.Count; i++ )
    279             {
    280                 RadioButton b = (RadioButton)radioButtonStackPanel.Children[i];
    281                 if (b.IsChecked != null && (bool)b.IsChecked)
    282                 {
    283                     choicePath.Add(b.Name);
    284                     radioButtonStackPanel.Children.Clear();
    285                     description.Text = "";
    286                     SetupPage((XElement)b.Tag);
    287                     break;
    288                 }
     317            if (categoryGrid.IsVisible)
     318            {
     319                for (int i = 0; i < radioButtonStackPanel.Children.Count; i++)
     320                {
     321                    RadioButton b = (RadioButton) radioButtonStackPanel.Children[i];
     322                    if (b.IsChecked != null && (bool) b.IsChecked)
     323                    {
     324                        choicePath.Add(b.Name);
     325                        SetupPage((XElement) b.Tag);
     326                        break;
     327                    }
     328                }
     329            }
     330            else if (inputPanel.IsVisible)
     331            {
     332                var nextElement = (XElement) inputPanel.Tag;
     333                choicePath.Add(nextElement.Attribute("id").Value);
     334                SetupPage(nextElement);
    289335            }
    290336
     
    296342        private void SetLastContent(object sender, EventArgs e)
    297343        {
    298             ResetBackground();
    299             if (radioButtonStackPanel.Children.Count > 0)
    300             {
    301                 RadioButton b = (RadioButton)radioButtonStackPanel.Children[0];
    302                 XElement ele = (XElement)b.Tag;
    303                 radioButtonStackPanel.Children.Clear();
    304                 description.Text = "";
     344            XElement ele = null;
     345            if (categoryGrid.IsVisible && radioButtonStackPanel.Children.Count > 0)
     346            {
     347                RadioButton b = (RadioButton) radioButtonStackPanel.Children[0];
     348                ele = (XElement) b.Tag;
     349            }
     350            else if (inputPanel.IsVisible)
     351            {
     352                ele = (XElement) inputPanel.Tag;
     353            }
     354
     355            if (ele != null)
     356            {
    305357                XElement grandParent = ele.Parent.Parent;
    306358                if (grandParent != null)
Note: See TracChangeset for help on using the changeset viewer.