Ignore:
Timestamp:
Dec 29, 2010, 3:43:45 PM (11 years ago)
Author:
kopal
Message:

the request progress is now visible by an animation

Location:
trunk/CrypPlugins/P2PEditor/GUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/P2PEditor/GUI/Controls/GetNewCertificate.xaml

    r2276 r2277  
    44             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    55             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:GUI="clr-namespace:Cryptool.P2PEditor.GUI" mc:Ignorable="d"
    6              d:DesignHeight="200" d:DesignWidth="550">
    7     <Grid Height="203" Width="550">
     6             d:DesignHeight="280" d:DesignWidth="560">   
     7    <Grid Height="280" Width="550">       
    88        <Grid.ColumnDefinitions>
    99            <ColumnDefinition Width="75" />
     
    1111        </Grid.ColumnDefinitions>
    1212        <Grid.RowDefinitions>
    13             <RowDefinition Height="28"/>
     13            <RowDefinition Height="90"/>
    1414            <RowDefinition Height="28"/>
    1515            <RowDefinition Height="28" />
     
    1818            <RowDefinition Height="60*" />
    1919        </Grid.RowDefinitions>
    20 
    21         <Label Content="_Please enter the data below to retrieve your own personal P2P Certificate" Target="{Binding ElementName=UsernameField}" Grid.ColumnSpan="2" />
     20       
     21        <Label Content="_CrypTool 2.0 - Paporator - Certificate Generation"  Grid.ColumnSpan="2" Margin="0,0,0,56" FontSize="15" FontWeight="Bold" />
     22        <TextBlock Grid.ColumnSpan="2" Margin="5,32,0,0" FlowDirection="LeftToRight">
     23            Please enter the data below to request your own personal Peers@Play Certificate (needed for
     24            <LineBreak/>
     25            participating in our Peer2Peer network). CrypTool 2.0 will connect to our certificate server and request
     26            <LineBreak/>
     27            your certificate. This certificate will be stored into your Application Data folder of Windows.
     28        </TextBlock>
    2229        <Label Content="_Username:" Target="{Binding ElementName=UsernameField}" Grid.Row="1" Grid.Column="0" />
    2330        <Label Content="_Email:" Target="{Binding ElementName=EmailField}" Grid.Row="2" Grid.Column="0" />
     
    2936        <PasswordBox x:Name="PasswordField" Grid.Row="3" Grid.Column="1" Height="24" />
    3037        <PasswordBox x:Name="ConfirmField" Grid.Row="4" Grid.Column="1" Height="24" />
    31        
    32         <Button Name="RetrieveButton" Content="_Retrieve" HorizontalAlignment="Right" Width="80" Grid.Row="5" Grid.Column="1" Height="24" Click="Retrieve_Click" Margin="0,17,12,22" />
     38        <Button Name="RequestButton" Content="_Request" HorizontalAlignment="Right" Width="80" Grid.Row="5" Grid.Column="1" Height="24" Click="Request_Click" Margin="0,15,12,31" />
     39        <Image Name="WorldIcon" Source="..\..\images\connected.png" Grid.Column="1" Margin="302,0,92,0" Grid.Row="5" RenderTransformOrigin="0.5,0.5">
     40            <Image.RenderTransform>
     41                <RotateTransform x:Name="WorldIconImageRotate"/>
     42            </Image.RenderTransform>
     43        </Image>
    3344    </Grid>
     45    <GUI:P2PUserControl.Resources>
     46        <Storyboard x:Key="AnimateWorldIcon">
     47            <DoubleAnimation Storyboard.TargetName="WorldIconImageRotate" Storyboard.TargetProperty="Angle" By="360" Duration="00:00:10" BeginTime="00:00:00" RepeatBehavior="Forever"/>
     48        </Storyboard>
     49    </GUI:P2PUserControl.Resources>
    3450</GUI:P2PUserControl>
  • trunk/CrypPlugins/P2PEditor/GUI/Controls/GetNewCertificate.xaml.cs

    r2276 r2277  
    1111using PeersAtPlay.CertificateLibrary.Util;
    1212using System.Windows.Threading;
     13using System.Windows.Media.Animation;
    1314
    1415namespace Cryptool.P2PEditor.GUI.Controls
     
    2324        }
    2425
    25         private void Retrieve_Click(object sender, RoutedEventArgs e)
    26         {
     26        private void Request_Click(object sender, RoutedEventArgs e)
     27        {           
    2728            if (!Verification.IsValidAvatar(this.UsernameField.Text))
    2829            {
     
    5758                this.PasswordField.Focus();
    5859                return;
    59             }         
    60 
     60            }
     61           
     62            WorldIconRotating = true;
    6163            Thread thread = new Thread(new ParameterizedThreadStart(RetrieveCertificate));
    6264            object[] array = new object[3];
     
    9294                });
    9395
    94                 certificateClient.CertificateReceived += CertificateReceived;               
     96                certificateClient.CertificateReceived += CertificateReceived;
    9597
    9698                certificateClient.InvalidCertificateRequest += InvalidCertificateRequest;
     
    109111                {
    110112                    System.Windows.MessageBox.Show("The protocol of the certificate server is different from the clients one. Please update.", "Protocol mismatch");
    111                 });               
     113                });
    112114
    113115                certificateClient.RequestCertificate(username,
     
    120122                System.Windows.MessageBox.Show("An exception occured: " + ex.Message, "Exception occured");
    121123            }
     124            finally
     125            {
     126                WorldIconRotating = false;
     127            }
    122128        }
    123129
    124130        public void InvalidCertificateRequest(object sender, InvalidRequestEventArgs args)
    125131        {
    126             switch(args.ErrorType){
    127                 case RespondType.AvatarAlreadyExists:
    128                     System.Windows.MessageBox.Show("The username already exists. Please chose another one.", "Username already exists");
    129                     break;               
    130                 case RespondType.EmailAlreadyExists:
    131                     System.Windows.MessageBox.Show("The email already exists. Please chose another ones.", "Email already exists");
    132                     break;
    133                 case RespondType.AvatarEmailAlreadyExists:
    134                     System.Windows.MessageBox.Show("The username and email already exist but the entered password was wrong. Either enter a new username and email combination or enter the correct password to receive the certificate again", "Username and email already exist");
    135                     break;
    136                 default:
    137                     System.Windows.MessageBox.Show("Invalid certificate request: " + args.ErrorType, "Invalid certificate request");
    138                     break;
    139             }           
     132            try
     133            {
     134                switch (args.ErrorType)
     135                {
     136                    case RespondType.AvatarAlreadyExists:
     137                        System.Windows.MessageBox.Show("The username already exists. Please chose another one.", "Username already exists");
     138                        break;
     139                    case RespondType.EmailAlreadyExists:
     140                        System.Windows.MessageBox.Show("The email already exists. Please chose another ones.", "Email already exists");
     141                        break;
     142                    case RespondType.AvatarEmailAlreadyExists:
     143                        System.Windows.MessageBox.Show("The username and email already exist but the entered password was wrong. Either enter a new username and email combination or enter the correct password to receive the certificate again", "Username and email already exist");
     144                        break;
     145                    default:
     146                        System.Windows.MessageBox.Show("Invalid certificate request: " + args.ErrorType, "Invalid certificate request");
     147                        break;
     148                }
     149            }
     150            catch (Exception)
     151            {
     152            }
     153            finally
     154            {
     155                WorldIconRotating = false;
     156            }
    140157        }
    141158
     
    161178                       "Error while saving the certificate");
    162179            }
     180            finally
     181            {
     182                WorldIconRotating = false;
     183            }
     184        }
     185
     186        private bool worldIconRotating = false;
     187        public bool WorldIconRotating
     188        {
     189            get { return worldIconRotating; }
     190            set
     191            {
     192                worldIconRotating = value;
     193                try
     194                {
     195                    this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
     196                    {
     197                        Storyboard storyboard = (Storyboard)FindResource("AnimateWorldIcon");
     198                        if (worldIconRotating)
     199                        {
     200                            storyboard.Begin();
     201                        }
     202                        else
     203                        {
     204                            storyboard.Stop();
     205                        }
     206                    }, null);
     207                }
     208                catch (Exception)
     209                {                   
     210                }
     211            }
    163212        }
    164213    }
  • trunk/CrypPlugins/P2PEditor/GUI/P2PEditorPresentation.xaml

    r2276 r2277  
    1414                <controls:ConnectTab IsP2PConnecting="{Binding IsP2PConnecting, ElementName=P2PEditorControl}" />
    1515            </TabItem>
    16             <TabItem Header="Get new Certificate" Name="GetNewCertificateTab" Visibility="{Binding IsP2PConnected, ElementName=P2PEditorControl, Converter={StaticResource ConnectivityToVisibilityConverter}}">
     16            <TabItem Header="Get a certificate!" Name="GetNewCertificateTab">
    1717                <controls:GetNewCertificate />
    1818            </TabItem>
Note: See TracChangeset for help on using the changeset viewer.