Changeset 2394


Ignore:
Timestamp:
Jan 19, 2011, 10:45:38 PM (11 years ago)
Author:
sauer
Message:

Wizard:

  • added selection animation
  • added page forward animation
  • reworked appearance
Location:
trunk/CrypPlugins/Wizard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/Wizard/Config/Indiv/wizard.config.hash.xml

    r2346 r2394  
    2929  <!-- RIPEMD160 Item -->
    3030  <item id="RIPEMD160" image="RIPEMD160" >
    31     <name lang="en" >RIPEMD160</name>
     31    <name lang="en-US" >RIPEMD160</name>
    3232    <description lang="en-US" >
    3333      RIPEMD160 is a hash function... (add instead some really helpful text).
  • trunk/CrypPlugins/Wizard/WizardControl.xaml

    r2346 r2394  
    4141        <BitmapImage x:Key="Sym" UriSource="Images/Sym.png"/>
    4242        <BitmapImage x:Key="Asym" UriSource="Images/Asym.png"/>
     43
     44        <Style TargetType="RadioButton">
     45            <Style.Triggers>
     46                <EventTrigger RoutedEvent="RadioButton.Checked">
     47                    <BeginStoryboard>
     48                        <Storyboard>
     49                            <DoubleAnimation Storyboard.TargetProperty="Content.Background.Opacity" To="1" From="0" Duration="0:0:0.5"/>
     50                        </Storyboard>
     51                    </BeginStoryboard>
     52                </EventTrigger>
     53            </Style.Triggers>
     54        </Style>
     55       
     56        <Storyboard x:Key="MainGridStoryboardLeft">
     57            <DoubleAnimation Storyboard.TargetName="MainGridTransform" Storyboard.TargetProperty="X" From="0" To="-900" Duration="0:0:0.5" Completed="LeftAnimation_Completed"/>
     58        </Storyboard>
     59        <Storyboard x:Key="MainGridStoryboardRight">
     60            <DoubleAnimation Storyboard.TargetName="MainGridTransform" Storyboard.TargetProperty="X" From="900" To="0" Duration="0:0:0.5" Completed="RightAnimation_Completed"/>
     61        </Storyboard>
    4362    </UserControl.Resources>
    4463    <Grid>
     
    4968            <RowDefinition Height="Auto" />
    5069        </Grid.RowDefinitions>
     70
     71        <Grid.RenderTransform>
     72            <TranslateTransform x:Name="MainGridTransform"/>
     73        </Grid.RenderTransform>
     74
    5175        <Label HorizontalAlignment="Center" Name="taskHeader" FontSize="18" />
    5276        <Label HorizontalAlignment="Stretch" Name="descHeader" FontSize="13" Grid.Row="1" Margin="5" />
     77       
    5378        <Grid HorizontalAlignment="Stretch" Name="grid1" VerticalAlignment="Stretch" Grid.Row="2" Margin="10" >
    5479        <Grid.ColumnDefinitions>
     
    5681            <ColumnDefinition />
    5782        </Grid.ColumnDefinitions>
    58             <ScrollViewer  HorizontalAlignment="Stretch" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" Name="radioButtonScroll" >
     83            <ScrollViewer  HorizontalAlignment="Stretch" VerticalAlignment="Center" VerticalScrollBarVisibility="Auto" Name="radioButtonScroll">
    5984                <StackPanel Name="radioButtonStackPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
    6085            </ScrollViewer>
    61             <ScrollViewer Name="descScroll" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" Grid.Column="1" >
    62                 <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="{Binding ElementName=radioButtonScroll, Path=ActualHeight}">
    63                     <Grid.RowDefinitions>
    64                         <RowDefinition Height="Auto" />
    65                         <RowDefinition Height="Auto" />
    66                     </Grid.RowDefinitions>
    67                     <Grid.ColumnDefinitions>
    68                         <ColumnDefinition />
    69                     </Grid.ColumnDefinitions>
    70                     <Label HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="{Loc Description}" />
    71                     <TextBlock Name="description" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextAlignment="Left" Grid.Row="1" />
    72                 </Grid>
    73             </ScrollViewer>
     86            <Border BorderBrush="LightSeaGreen" BorderThickness="1" Grid.Column="1" CornerRadius="5" Background="#FFC8DCF5" MinHeight="{Binding ElementName=radioButtonScroll, Path=ActualHeight}">
     87                <ScrollViewer Name="descScroll" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" >
     88                    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
     89                        <Grid.RowDefinitions>
     90                            <RowDefinition Height="Auto" />
     91                            <RowDefinition Height="Auto" />
     92                        </Grid.RowDefinitions>
     93                        <Grid.ColumnDefinitions>
     94                            <ColumnDefinition />
     95                        </Grid.ColumnDefinitions>
     96                        <Label HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="{Loc Description}" />
     97                        <TextBlock Name="description" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextAlignment="Left" Grid.Row="1" />
     98                    </Grid>
     99                </ScrollViewer>
     100            </Border>
    74101        </Grid>
    75102        <StackPanel Height="Auto" HorizontalAlignment="Right" Name="buttonStackPanel" VerticalAlignment="Bottom" Margin="2" Grid.Row="3" Orientation="Horizontal" >
  • trunk/CrypPlugins/Wizard/WizardControl.xaml.cs

    r2357 r2394  
    99using System.Windows.Input;
    1010using System.Windows.Media;
     11using System.Windows.Media.Animation;
    1112using System.Windows.Media.Imaging;
    1213using System.Windows.Navigation;
     
    5354
    5455            selectionBrush.Color = Color.FromArgb(255, 200, 220, 245);
    55             descScroll.Background = selectionBrush;
    5656            SetupPage(wizardConfigXML);
    5757        }
     
    140140                foreach (XElement ele in categories)
    141141                {
    142                     ContentControl c = new ContentControl();
     142                    Border border = new Border();
    143143                    Label l = new Label();
    144144                    Image i = new Image();
    145145                    StackPanel sp = new StackPanel();
    146                     c.Content = sp;
    147                     c.VerticalAlignment = VerticalAlignment.Stretch;
     146
     147                    border.Child = sp;
     148                    border.VerticalAlignment = VerticalAlignment.Stretch;
     149                    border.CornerRadius = new CornerRadius(5, 0, 0, 5);
     150                    border.BorderBrush = Brushes.LightSeaGreen;
    148151
    149152                    l.Height = 30;
     
    178181                    rb.VerticalAlignment = VerticalAlignment.Stretch;
    179182                    rb.HorizontalContentAlignment = HorizontalAlignment.Stretch;
    180                     rb.Content = c;
     183                    rb.Content = border;
    181184                    rb.Tag = ele;
    182185
     
    197200            ResetBackground();
    198201            RadioButton b = (RadioButton)sender;
    199             ContentControl c = (ContentControl)b.Content;
    200             StackPanel sp = (StackPanel)c.Content;
    201             sp.Background = selectionBrush;
     202            b.Background = Brushes.LightSeaGreen;
     203            Border c = (Border)b.Content;
     204            c.BorderThickness = new Thickness(1, 1, 0, 1);
     205            c.Background = selectionBrush;
    202206            XElement ele = (XElement)b.Tag;
    203207            XElement desc = FindElementInElement(ele, "description");
     
    209213        private void ResetBackground()
    210214        {
    211             UIElement[] uiea = new UIElement[radioButtonStackPanel.Children.Count];
    212             radioButtonStackPanel.Children.CopyTo(uiea, 0);
    213             foreach (UIElement uie in uiea)
    214             {
    215                 RadioButton b = (RadioButton)uie;
    216                 ContentControl c = (ContentControl)b.Content;
    217                 StackPanel sp = (StackPanel)c.Content;
    218                 sp.Background = Brushes.Transparent;
     215            for (int i = 0; i < radioButtonStackPanel.Children.Count; i++)
     216            {
     217                RadioButton b = (RadioButton)radioButtonStackPanel.Children[i];
     218                b.Background = Brushes.Transparent;
     219                Border c = (Border)b.Content;
     220                c.BorderThickness = new Thickness(0);
     221                c.Background = Brushes.Transparent;
    219222            }
    220223        }
     
    251254        private void nextButton_Click(object sender, RoutedEventArgs e)
    252255        {
     256            Storyboard mainGridStoryboardLeft = (Storyboard)FindResource("MainGridStoryboardLeft");
     257            mainGridStoryboardLeft.Begin();
     258        }
     259
     260        private void backButton_Click(object sender, RoutedEventArgs e)
     261        {
    253262            ResetBackground();
    254             UIElement[] uiea = new UIElement[radioButtonStackPanel.Children.Count];
    255             radioButtonStackPanel.Children.CopyTo(uiea, 0);
    256             foreach (UIElement uie in uiea)
    257             {
    258                 RadioButton b = (RadioButton)uie;
     263            if (radioButtonStackPanel.Children.Count > 0)
     264            {
     265                RadioButton b = (RadioButton)radioButtonStackPanel.Children[0];
     266                XElement ele = (XElement)b.Tag;
     267                radioButtonStackPanel.Children.Clear();
     268                description.Text = "";
     269                XElement grandParent = ele.Parent.Parent;
     270                if (grandParent != null)
     271                    SetupPage(grandParent);
     272                else
     273                    SetupPage(wizardConfigXML);
     274            }
     275        }
     276
     277        private void abortButton_Click(object sender, RoutedEventArgs e)
     278        {
     279            ResetBackground();
     280            radioButtonStackPanel.Children.Clear();
     281            choicePath.Clear();
     282            description.Text = "";
     283            SetupPage(wizardConfigXML);
     284        }
     285
     286        private void LeftAnimation_Completed(object sender, EventArgs e)
     287        {
     288            ResetBackground();
     289            for (int i = 0; i < radioButtonStackPanel.Children.Count; i++ )
     290            {
     291                RadioButton b = (RadioButton)radioButtonStackPanel.Children[i];
    259292                if (b.IsChecked != null && (bool)b.IsChecked)
    260293                {
     
    266299                }
    267300            }
    268         }
    269 
    270         private void backButton_Click(object sender, RoutedEventArgs e)
    271         {
    272             ResetBackground();
    273             UIElement[] uiea = new UIElement[radioButtonStackPanel.Children.Count];
    274             radioButtonStackPanel.Children.CopyTo(uiea, 0);
    275             if (uiea.Length > 0)
    276             {
    277                 RadioButton b = (RadioButton)uiea[0];
    278                 XElement ele = (XElement)b.Tag;
    279                 radioButtonStackPanel.Children.Clear();
    280                 description.Text = "";
    281                 XElement grandParent = ele.Parent.Parent;
    282                 if (grandParent != null)
    283                     SetupPage(grandParent);
    284                 else
    285                     SetupPage(wizardConfigXML);
    286             }
    287         }
    288 
    289         private void abortButton_Click(object sender, RoutedEventArgs e)
    290         {
    291             ResetBackground();
    292             radioButtonStackPanel.Children.Clear();
    293             choicePath.Clear();
    294             description.Text = "";
    295             SetupPage(wizardConfigXML);
     301
     302            Storyboard mainGridStoryboardLeft = (Storyboard)FindResource("MainGridStoryboardRight");
     303            mainGridStoryboardLeft.Begin();
     304        }
     305
     306        private void RightAnimation_Completed(object sender, EventArgs e)
     307        {
     308
    296309        }
    297310
Note: See TracChangeset for help on using the changeset viewer.