Changeset 1883


Ignore:
Timestamp:
Aug 28, 2010, 1:35:06 PM (11 years ago)
Author:
Sven Rech
Message:

Much much better presentation for quadratic sieve plug-in.

Thanks to Paul for his cool KeySearcher presentation design.

Location:
trunk/CrypPlugins/QuadraticSieve
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/QuadraticSieve/PeerToPeer.cs

    r1855 r1883  
    218218            double lastPerformance = 0;
    219219            DateTime performanceLastPut = new DateTime();
     220            UpdateActivePeerInformation();
    220221
    221222            try
     
    362363            quadraticSieveQuickWatchPresentation.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    363364            {
    364                 quadraticSieveQuickWatchPresentation.amountOfPeers.Content = "" + activePeers.Count + " other peer" + (activePeers.Count!=1 ? "s" : "") + " active!";
     365                quadraticSieveQuickWatchPresentation.activePeers.Content = (activePeers.Count+1);
    365366            }, null);
    366367        }
     
    375376                    int download = head - loadIndex - ourIndices.Count(x => x > loadIndex);
    376377                    int lost = this.lostIndices.Count;
    377                     quadraticSieveQuickWatchPresentation.queueInformation.Content = "Queue: Upload " + upload + "! Download " + download + "! Lost " + lost + "!";
     378                    quadraticSieveQuickWatchPresentation.queueInformation.Content = "Upload " + upload + "! Download " + download + "! Lost " + lost + "!";
    378379                }, null);
    379380            }
     
    418419            quadraticSieveQuickWatchPresentation.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    419420            {
    420                 quadraticSieveQuickWatchPresentation.relationsInfo.Content = "Downloaded " + size1 + " MB! Uploaded " + size2 + " MB!";
     421                quadraticSieveQuickWatchPresentation.downloaded.Content = size1 + " MB";
     422                quadraticSieveQuickWatchPresentation.uploaded.Content = size2 + " MB";
    421423            }, null);
    422424        }
  • trunk/CrypPlugins/QuadraticSieve/QuadraticSieve.cs

    r1854 r1883  
    6969        private StreamWriter gnuplotFile;
    7070        private double[] relationsPerMS;
     71        private DateTime start_time;
    7172
    7273        private static Assembly msieveDLL = null;
     
    111112            {
    112113                quadraticSieveQuickWatchPresentation.peer2peer.Visibility = settings.UsePeer2Peer ? Visibility.Visible : Visibility.Collapsed;               
    113                 quadraticSieveQuickWatchPresentation.timeLeft.Text = "?";
    114                 quadraticSieveQuickWatchPresentation.endTime.Text = "?";
    115                 quadraticSieveQuickWatchPresentation.logging.Text = "Currently not sieving.";
     114                quadraticSieveQuickWatchPresentation.timeLeft.Content = "-";
     115                quadraticSieveQuickWatchPresentation.endTime.Content = "-";
     116                quadraticSieveQuickWatchPresentation.coresUsed.Content = "-";
    116117            }
    117118            , null);
     
    202203                    }
    203204
    204                     String timeLeft_message = "?";
    205                     String endtime_message = "?";
    206                     String logging_message = "Starting quadratic sieve, please wait!";
    207 
    208                     GuiLogMessage(logging_message, NotificationLevel.Info);
     205                    String info_message = "Starting quadratic sieve, please wait!";
     206
     207                    start_time = DateTime.Now;
     208
     209                    GuiLogMessage(info_message, NotificationLevel.Info);
    209210                    quadraticSieveQuickWatchPresentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    210211                    {
    211212                        quadraticSieveQuickWatchPresentation.ProgressRelationPackages.Clear();
    212                         quadraticSieveQuickWatchPresentation.logging.Text = logging_message;
    213                         quadraticSieveQuickWatchPresentation.endTime.Text = endtime_message;
    214                         quadraticSieveQuickWatchPresentation.timeLeft.Text = timeLeft_message;
     213                        quadraticSieveQuickWatchPresentation.information.Content = info_message;
     214                        quadraticSieveQuickWatchPresentation.endTime.Content = "-";
     215                        quadraticSieveQuickWatchPresentation.timeLeft.Content = "-";
     216                        quadraticSieveQuickWatchPresentation.elapsedTime.Content = "-";
     217                        quadraticSieveQuickWatchPresentation.startTime.Content = ""+start_time;
    215218                        quadraticSieveQuickWatchPresentation.factorList.Items.Clear();
    216219                        quadraticSieveQuickWatchPresentation.factorInfo.Content = "Searching trivial factors!";
    217220                        if (usePeer2Peer)
    218                             quadraticSieveQuickWatchPresentation.relationsInfo.Content = "";
     221                            quadraticSieveQuickWatchPresentation.localSieving.Visibility = Visibility.Hidden;
    219222                        else
    220                             quadraticSieveQuickWatchPresentation.relationsInfo.Content = "Only local sieving!";
     223                            quadraticSieveQuickWatchPresentation.localSieving.Visibility = Visibility.Visible;
    221224                    }
    222225                    , null);
    223 
    224                     DateTime start_time = DateTime.Now;
    225226
    226227                    initMsieveDLL();
     
    247248                    if (!userStopped)
    248249                    {
    249                         timeLeft_message = "0 seconds left";
    250                         endtime_message = "" + (DateTime.Now);
    251                         logging_message = "Sieving finished in " + (DateTime.Now - start_time) + "!";
    252 
    253                         GuiLogMessage(logging_message, NotificationLevel.Info);
     250                        String timeLeft_message = "0 seconds left";
     251                        String endtime_message = "" + (DateTime.Now);
     252
     253                        GuiLogMessage(info_message, NotificationLevel.Info);
    254254                        quadraticSieveQuickWatchPresentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    255255                        {
    256                             quadraticSieveQuickWatchPresentation.logging.Text = logging_message;
    257                             quadraticSieveQuickWatchPresentation.endTime.Text = endtime_message;
    258                             quadraticSieveQuickWatchPresentation.timeLeft.Text = timeLeft_message;
     256                            quadraticSieveQuickWatchPresentation.information.Content = "Sieving finished!";
     257                            quadraticSieveQuickWatchPresentation.endTime.Content = endtime_message;
     258                            quadraticSieveQuickWatchPresentation.timeLeft.Content = timeLeft_message;
    259259                            quadraticSieveQuickWatchPresentation.factorInfo.Content = "";
    260260                        }
     
    267267                    }
    268268                    else
    269                     {
    270                         timeLeft_message = "0 sec left";
    271                         endtime_message = "Stopped";
    272                         logging_message = "Stopped by user!";
    273 
    274                         GuiLogMessage(logging_message, NotificationLevel.Info);
     269                    {                       
     270                        info_message = "Stopped by user!";
     271
     272                        GuiLogMessage(info_message, NotificationLevel.Info);
    275273                        quadraticSieveQuickWatchPresentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    276274                        {
    277                             quadraticSieveQuickWatchPresentation.logging.Text = logging_message;
    278                             quadraticSieveQuickWatchPresentation.endTime.Text = endtime_message;
    279                             quadraticSieveQuickWatchPresentation.timeLeft.Text = timeLeft_message;
     275                            quadraticSieveQuickWatchPresentation.information.Content = info_message;
     276                            quadraticSieveQuickWatchPresentation.endTime.Content = "-";
     277                            quadraticSieveQuickWatchPresentation.timeLeft.Content = "-";
     278                            quadraticSieveQuickWatchPresentation.startTime.Content = "-";
     279                            quadraticSieveQuickWatchPresentation.elapsedTime.Content = "-";
    280280                            quadraticSieveQuickWatchPresentation.factorInfo.Content = "";
    281281                        }
     
    444444        /// <param name="ts"></param>
    445445        /// <returns></returns>
    446         private String showTimeSpan(TimeSpan ts)
     446        private String timeSpanString(TimeSpan ts)
    447447        {
    448448            String res = "";
     
    477477                conf_list = new ArrayList();
    478478
    479                 String message = "Start sieving using " + (threads + 1) + " cores!";
     479                String message = "Sieving now!";
    480480                GuiLogMessage(message, NotificationLevel.Info);
    481481                quadraticSieveQuickWatchPresentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    482482                {
    483                     quadraticSieveQuickWatchPresentation.logging.Text = message;
     483                    quadraticSieveQuickWatchPresentation.coresUsed.Content = (threads+1);
     484                    quadraticSieveQuickWatchPresentation.information.Content = message;
    484485                    if (usePeer2Peer)
    485                         quadraticSieveQuickWatchPresentation.relationsInfo.Content = "";
     486                        quadraticSieveQuickWatchPresentation.localSieving.Visibility = Visibility.Hidden;
    486487                }
    487488                , null);
     
    511512                quadraticSieveQuickWatchPresentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    512513                {
    513                     quadraticSieveQuickWatchPresentation.timeLeft.Text = "";
    514                     quadraticSieveQuickWatchPresentation.endTime.Text = "";
     514                    quadraticSieveQuickWatchPresentation.timeLeft.Content = "-";
     515                    quadraticSieveQuickWatchPresentation.endTime.Content = "-";
    515516                    quadraticSieveQuickWatchPresentation.factorInfo.Content = "Found enough relations! Please wait...";
    516517                }, null);
     
    525526                quadraticSieveQuickWatchPresentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    526527                {
    527                     quadraticSieveQuickWatchPresentation.timeLeft.Text = "";
    528                     quadraticSieveQuickWatchPresentation.endTime.Text = "";
     528                    quadraticSieveQuickWatchPresentation.timeLeft.Content = "-";
     529                    quadraticSieveQuickWatchPresentation.endTime.Content = "-";
    529530                    quadraticSieveQuickWatchPresentation.factorInfo.Content = "Other peer finished sieving!";
    530531                }, null);
     
    597598
    598599        private void showProgressPresentation(int max_relations, int num_relations, int start_relations, DateTime start_sieving_time)
    599         {           
    600             String logging_message = "Found " + num_relations + " of " + max_relations + " relations!";
     600        {
    601601            double msleft = 0;
    602602
     
    625625            String timeLeft_message = "very soon";
    626626            String endtime_message = "very soon";
     627            DateTime now = DateTime.Now;
    627628            if (msleft > 0 && !double.IsInfinity(msleft))
    628629            {
    629630                TimeSpan ts = new TimeSpan(0, 0, 0, 0, (int)msleft);
    630                 timeLeft_message = showTimeSpan(ts) + " left";
    631                 endtime_message = "" + DateTime.Now.AddMilliseconds((long)msleft);
     631                timeLeft_message = timeSpanString(ts) + " left";
     632                endtime_message = "" + now.AddMilliseconds((long)msleft);
    632633            }
    633634
    634635            if (globalPerformance == 0 || double.IsInfinity(msleft))
    635636            {
    636                 timeLeft_message = "?";
    637                 endtime_message = "?";
     637                timeLeft_message = "-";
     638                endtime_message = "-";
    638639            }
    639640
    640641            quadraticSieveQuickWatchPresentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    641642            {
    642                 quadraticSieveQuickWatchPresentation.logging.Text = logging_message;
    643                 quadraticSieveQuickWatchPresentation.timeLeft.Text = timeLeft_message;
    644                 quadraticSieveQuickWatchPresentation.endTime.Text = endtime_message;
     643                quadraticSieveQuickWatchPresentation.foundRelations.Content = num_relations;
     644                quadraticSieveQuickWatchPresentation.maxRelations.Content = max_relations;
     645                quadraticSieveQuickWatchPresentation.timeLeft.Content = timeLeft_message;
     646                quadraticSieveQuickWatchPresentation.endTime.Content = endtime_message;
     647                quadraticSieveQuickWatchPresentation.elapsedTime.Content = timeSpanString(now.Subtract(start_time));
    645648            }, null);
    646649
     
    723726            {
    724727                String compRep;
    725                 if (compositeFactor.ToString().Length < 6)
     728                if (compositeFactor.ToString().Length < 50)
    726729                    compRep = compositeFactor.ToString();
    727730                else
    728                     compRep = compositeFactor.ToString().Substring(0, 4) + "...";
     731                    compRep = compositeFactor.ToString().Substring(0, 48) + "...";
    729732                quadraticSieveQuickWatchPresentation.factorInfo.Content = "Now sieving first composite factor! (" + compRep + ")";
    730733            }, null);
     
    847850                foreach (BigInteger cf in compositeFactors)
    848851                    quadraticSieveQuickWatchPresentation.factorList.Items.Add("Composite Factor: " + cf.ToString());
     852                quadraticSieveQuickWatchPresentation.SelectFirstComposite();
    849853            }, null);
    850854        }
  • trunk/CrypPlugins/QuadraticSieve/QuadraticSievePresentation.xaml

    r1692 r1883  
    22    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    33    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    4     HorizontalAlignment="Stretch"
    5     VerticalAlignment="Stretch"
    64    Background="White"
    75    Name="Presentation">
    8         <Canvas Name="Canvas">
    9             <Grid Name="Grid" ShowGridLines="False">
    10             <Grid.RowDefinitions>
    11                 <RowDefinition Height="*"/>
    12                 <RowDefinition Height="*"/>
    13                 <RowDefinition Height="150"/>
    14                 <RowDefinition Height="*"/>
    15                 <RowDefinition Height="*"/>
    16                 <RowDefinition Height="*"/>
    17             </Grid.RowDefinitions>
    18             <Grid.ColumnDefinitions>
    19                 <ColumnDefinition Width="*" />
    20                 <ColumnDefinition Width="*" />
    21             </Grid.ColumnDefinitions>
    22        
    23             <Label FontSize="12" Name="Label1" Margin="1">Probable time left :</Label>
    24             <Label Grid.Column="1" FontSize="12" Name="Label2" Margin="1">Estimated end time :</Label>
    25        
    26             <TextBox Name="timeLeft" Grid.Row="1" TextAlignment="Center" IsReadOnly="True" TextWrapping="WrapWithOverflow" Focusable="True" BorderThickness="1" Margin="1" BorderBrush="AliceBlue" />
    27             <TextBox Name="endTime" Grid.Row="1" Grid.Column="1" TextAlignment="Center" IsReadOnly="True" TextWrapping="WrapWithOverflow" BorderThickness="1" Margin="1" BorderBrush="AliceBlue" />
    28             <ListBox Grid.Row="2" Grid.ColumnSpan="2" Name="factorList" Canvas.Left="1" Canvas.Top="50" Height="150" Width="233" />
    29             <Label Grid.Row="3" Grid.ColumnSpan="2" Content="" HorizontalAlignment="Stretch" Name="factorInfo" VerticalAlignment="Top" />
     6    <UserControl.Resources>
     7        <RotateTransform x:Key="HeaderRotate" Angle="270" />
     8        <Style x:Key="ValueRow1">
     9            <Setter Property="Label.Margin" Value="80,0,0,0" />
     10        </Style>
     11        <Style x:Key="ValueRow2">
     12            <Setter Property="Label.Margin" Value="80,0,0,0" />
     13        </Style>
     14    </UserControl.Resources>
     15    <Viewbox>
     16        <StackPanel Width="646">
     17           
     18            <Border BorderBrush="Silver" BorderThickness="2,2,2,2">
     19                <Grid Background="#AFFFD4C1">
     20                    <Grid.ColumnDefinitions>
     21                        <ColumnDefinition Width="26" />
     22                        <ColumnDefinition Width="200*" />
     23                        <ColumnDefinition Width="200*" />
     24                    </Grid.ColumnDefinitions>
     25                    <Grid.RowDefinitions>
     26                        <RowDefinition Height="26" />
     27                        <RowDefinition Height="26" />
     28                    </Grid.RowDefinitions>
     29                    <Border BorderThickness="1" BorderBrush="Black" LayoutTransform="{StaticResource HeaderRotate}" Background="#FFE56B00" Grid.Column="0" Grid.RowSpan="2">
     30                        <Label Content="Time" FontSize="11" HorizontalAlignment="Center" Foreground="White" />
     31                    </Border>
     32                    <Label Content="Start:" Grid.Column="1" />
     33                    <Label Name="startTime" Style="{StaticResource ValueRow1}" Grid.Column="1" Content="-" />
     34                    <Label Content="End:" HorizontalAlignment="Left" Grid.Column="2" />
     35                    <Label Name="endTime" Style="{StaticResource ValueRow2}" Grid.Column="2" Content="-" />
     36                    <Label Content="Elapsed:" Grid.Column="1" Grid.Row="1" />
     37                    <Label Name="elapsedTime" Style="{StaticResource ValueRow1}" Grid.Column="1" Grid.Row="1" Content="-" />
     38                    <Label Content="Remaining:" Grid.Column="2" Grid.Row="1" />
     39                    <Label Name="timeLeft" Style="{StaticResource ValueRow2}" Grid.Column="2" Grid.Row="1" Content="-" />
     40                </Grid>
     41            </Border>
    3042
    31             <UserControl Name="peer2peer" Grid.Row="4" Grid.ColumnSpan="2">
     43            <Border BorderBrush="Silver" BorderThickness="2,2,2,2">
    3244                <Grid>
    33                 <Grid.RowDefinitions>
    34                     <RowDefinition />
    35                     <RowDefinition />
    36                     <RowDefinition />
    37                     <RowDefinition />
    38                 </Grid.RowDefinitions>
    39                 <Grid.ColumnDefinitions>
    40                     <ColumnDefinition />
    41                 </Grid.ColumnDefinitions>
     45                    <Grid.ColumnDefinitions>
     46                        <ColumnDefinition Width="26" />
     47                        <ColumnDefinition Width="*" />
     48                    </Grid.ColumnDefinitions>
     49                    <Border BorderThickness="1" BorderBrush="Black" LayoutTransform="{StaticResource HeaderRotate}" Background="#FF479308" Grid.Column="0">
     50                        <Label Content="Factorlist" FontSize="11" HorizontalAlignment="Center" Foreground="White" Width="55" />
     51                    </Border>
     52                    <Grid Grid.Column="1">
     53                        <Grid.RowDefinitions>
     54                            <RowDefinition />
     55                            <RowDefinition />
     56                        </Grid.RowDefinitions>
     57                        <Grid.ColumnDefinitions>
     58                            <ColumnDefinition />
     59                        </Grid.ColumnDefinitions>
     60                        <ListBox Grid.Row="0"  Background="#AFE2FFCE" Name="factorList" Height="150" HorizontalAlignment="Stretch"/>
     61                        <Label Grid.Row="1" Background="#AFE2FFCE" Content="" HorizontalAlignment="Stretch" Name="factorInfo" />
     62                    </Grid>                   
     63                </Grid>
     64            </Border>
    4265
    43                 <Label Grid.Row="1" Content="" HorizontalAlignment="Stretch" Name="relationsInfo" VerticalAlignment="Bottom" />
    44                 <Label Grid.Row="2" Content="" HorizontalAlignment="Stretch" Name="amountOfPeers" VerticalAlignment="Bottom" />
    45                 <Label Grid.Row="3" Content="" HorizontalAlignment="Stretch" Name="queueInformation" VerticalAlignment="Bottom" />
     66            <Border BorderBrush="Silver" BorderThickness="2,2,2,2">
     67                <Grid Background="#AFE2E2E2">
     68                    <Grid.ColumnDefinitions>
     69                        <ColumnDefinition Width="26" />
     70                        <ColumnDefinition Width="200*" />
     71                        <ColumnDefinition Width="200*" />
     72                    </Grid.ColumnDefinitions>
     73                    <Grid.RowDefinitions>
     74                        <RowDefinition Height="26" />
     75                        <RowDefinition Height="26" />
     76                    </Grid.RowDefinitions>
     77                    <Border BorderThickness="1" BorderBrush="Black" LayoutTransform="{StaticResource HeaderRotate}" Background="#FF525252" Grid.Column="0" Grid.RowSpan="2">
     78                        <Label Content="Progress" FontSize="11" HorizontalAlignment="Center" Foreground="White" Width="55" />
     79                    </Border>
     80
     81                    <Label Content="Found Relations:" Grid.Column="1" />
     82                    <Label Name="foundRelations" Grid.Column="1" Content="-" Margin="100,0,0,0" />
     83                    <Label Content="Needed Relations:" HorizontalAlignment="Left" Grid.Column="2" />
     84                    <Label Name="maxRelations" Grid.Column="2" Content="-" Margin="105,0,0,0" />
     85                    <Label Content="Cores used:" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="1" />
     86                    <Label Name="coresUsed" Margin="100,0,0,0" Grid.Column="1" Content="-" Grid.Row="1" />
     87                    <Label Content="Information:" HorizontalAlignment="Left" Grid.Column="2" Grid.Row="1"/>
     88                    <Label Name="information" Grid.Column="2" Content="-" Margin="105,0,0,0" Grid.Row="1"/>
    4689                </Grid>
    47             </UserControl>
     90            </Border>
    4891
    49             <TextBox Name="logging" Grid.Row="5" Grid.ColumnSpan="2" TextAlignment="Left" IsReadOnly="True" TextWrapping="WrapWithOverflow" BorderThickness="1" Margin="1" BorderBrush="AliceBlue" />       
     92            <Border Name="peer2peer" BorderBrush="Silver" BorderThickness="2,2,2,2">
     93                <Grid Background="#AFAAE1E8">
     94                    <Grid.ColumnDefinitions>
     95                        <ColumnDefinition Width="26" />
     96                        <ColumnDefinition Width="200*" />
     97                        <ColumnDefinition Width="200*" />
     98                    </Grid.ColumnDefinitions>
     99                    <Grid.RowDefinitions>
     100                        <RowDefinition Height="130" />
     101                        <RowDefinition Height="26" />
     102                        <RowDefinition Height="26" />
     103                    </Grid.RowDefinitions>
     104                    <Border BorderThickness="1" BorderBrush="Black" LayoutTransform="{StaticResource HeaderRotate}" Background="#FF099BA7" Grid.Column="0" Grid.RowSpan="3">
     105                        <Label Content="Peer2Peer" FontSize="11" HorizontalAlignment="Center" Foreground="White" />
     106                    </Border>
     107                   
     108                    <ScrollViewer Name="peer2peerScrollViewer" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" HorizontalScrollBarVisibility="Auto" CanContentScroll="True">
     109                    </ScrollViewer>
     110                    <Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Content="Local Sieving (Not Connected)" Name="localSieving" ClipToBounds="True" FontSize="40" FontStyle="Normal" FontWeight="Bold" FontFamily="Arial" Foreground="Red" VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch" Visibility="Hidden" />
     111                   
     112                    <Label Content="Downloaded:" Grid.Column="1" Grid.Row="1" />
     113                    <Label Name="downloaded" Style="{StaticResource ValueRow1}" Grid.Column="1" Grid.Row="1" Content="-" />
     114                    <Label Content="Uploaded:" HorizontalAlignment="Left" Grid.Column="2" Grid.Row="1" />
     115                    <Label Name="uploaded" Style="{StaticResource ValueRow2}" Grid.Column="2" Grid.Row="1" Content="-" />
     116                    <Label Content="Active Peers:" Grid.Column="1" Grid.Row="2" />
     117                    <Label Name="activePeers" Style="{StaticResource ValueRow1}" Grid.Column="1" Grid.Row="2" Content="-" />
     118                    <Label Content="Queue:" Grid.Column="2" Grid.Row="2" />
     119                    <Label Name="queueInformation" Style="{StaticResource ValueRow2}" Grid.Column="2" Grid.Row="2" Content="-" />
     120                </Grid>
     121            </Border>
    50122           
    51             </Grid>       
    52         </Canvas>
     123        </StackPanel>
     124    </Viewbox>
    53125</UserControl>
  • trunk/CrypPlugins/QuadraticSieve/QuadraticSievePresentation.xaml.cs

    r1692 r1883  
    2828        public QuadraticSievePresentation()
    2929        {
    30             InitializeComponent();           
    31             SizeChanged += sizeChanged;
     30            InitializeComponent();
    3231
    33             ScrollViewer sviewer = new ScrollViewer();
    34             sviewer.CanContentScroll = true;
    35             sviewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
    36             sviewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
    37             progressRelationPackages = new ProgressRelationPackages(sviewer);
    38             sviewer.Content = progressRelationPackages;
    39             Grid grid = ((Grid)peer2peer.Content);
    40             Grid.SetRow(sviewer, 0);
    41             grid.Children.Add(sviewer);
    42             sviewer.MinHeight = 100;
    43             sviewer.MaxHeight = 100;
    44             progressRelationPackages.MaxWidth = factorList.Width - 10;
     32            progressRelationPackages = new ProgressRelationPackages(peer2peerScrollViewer);
     33            peer2peerScrollViewer.Content = progressRelationPackages;
     34            progressRelationPackages.MaxWidth = 620 - 30;
    4535        }
    4636
    47         public void sizeChanged(Object sender, EventArgs eventArgs)
     37        public void SelectFirstComposite()
    4838        {
    49             double scale = Math.Min((this.ActualWidth / this.Grid.ActualWidth), (this.ActualHeight / this.Grid.ActualHeight));
    50             this.Grid.RenderTransform = new ScaleTransform(scale, scale);
     39            foreach (String item in factorList.Items)
     40            {
     41                if (item.StartsWith("Composite"))
     42                {
     43                    factorList.SelectedItem = item;
     44                    factorList.ScrollIntoView(item);
     45                    return;
     46                }
     47            }
    5148        }
    52 
    5349    }
    5450}
Note: See TracChangeset for help on using the changeset viewer.