Changeset 2358


Ignore:
Timestamp:
Jan 17, 2011, 11:37:46 AM (10 years ago)
Author:
kopal
Message:
  • multiple connections to the p2p network are now avoided
  • some design changes
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypP2P/Internal/ConnectionManager.cs

    r2348 r2358  
    102102                disconnected = false;
    103103                lastConnectionAttempt = DateTime.Now;
    104 
    105                 try
    106                 {
    107                     if (CertificateServices.GetPeerCertificateByAvatar(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "PeersAtPlay" + Path.DirectorySeparatorChar + "Certificates" + Path.DirectorySeparatorChar),
    108                         P2PSettings.Default.PeerName, P2PSettings.Default.Password) == null)
    109                     {
    110                         P2PManager.GuiLogMessage("Cannot connect, account \"" + P2PSettings.Default.PeerName + "\" not found!",
    111                                                  NotificationLevel.Warning);
    112                         return;
    113                     }
    114                 }
    115                 catch (Exception ex)
    116                 {
    117                     P2PManager.GuiLogMessage("Cannot connect using account \"" + P2PSettings.Default.PeerName + "\": " + (ex.InnerException != null ? ex.InnerException.Message : ex.Message),
    118                                                  NotificationLevel.Warning);
    119                     return;
    120                 }
    121 
     104               
    122105                if (p2PBase.IsConnected || IsConnecting)
    123106                {
  • trunk/CrypPlugins/P2PEditor/Converters/ConnectivityToVisibilityConverter.cs

    r1918 r2358  
    1818
    1919            if ((bool) value)
    20                 return Visibility.Collapsed;
     20                return Visibility.Hidden;
    2121            else
    2222                return Visibility.Visible;
  • trunk/CrypPlugins/P2PEditor/GUI/Controls/ConnectView.xaml.cs

    r2348 r2358  
    107107            this.Username.Text = ((P2PEditorSettings)((P2PEditor)GetValue(P2PEditorProperty)).Settings).PeerName;
    108108            this.Worldname.Text = ((P2PEditorSettings)((P2PEditor)GetValue(P2PEditorProperty)).Settings).WorldName;
    109             this.Password.Password = ((P2PEditorSettings)((P2PEditor)GetValue(P2PEditorProperty)).Settings).Password;                   
     109            this.Password.Password = ((P2PEditorSettings)((P2PEditor)GetValue(P2PEditorProperty)).Settings).Password;
     110            if (this.IsP2PConnecting)
     111            {
     112                Storyboard storyboard = (Storyboard)FindResource("AnimateBigWorldIcon");
     113                storyboard.Begin();
     114            }
     115            else
     116            {
     117                Storyboard storyboard = (Storyboard)FindResource("AnimateBigWorldIcon");
     118                storyboard.Stop();
     119            }
    110120        }
    111121    }
  • trunk/CrypPlugins/P2PEditor/GUI/P2PEditorPresentation.xaml

    r2344 r2358  
    1 <GUI:P2PUserControl x:Class="Cryptool.P2PEditor.GUI.P2PEditorPresentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:controls="clr-namespace:Cryptool.P2PEditor.GUI.Controls" xmlns:GUI="clr-namespace:Cryptool.P2PEditor.GUI" xmlns:Converters="clr-namespace:Cryptool.P2PEditor.Converters" mc:Ignorable="d" d:DesignHeight="278" d:DesignWidth="656" x:Name="P2PEditorControl">
     1<GUI:P2PUserControl x:Class="Cryptool.P2PEditor.GUI.P2PEditorPresentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:controls="clr-namespace:Cryptool.P2PEditor.GUI.Controls" xmlns:GUI="clr-namespace:Cryptool.P2PEditor.GUI" xmlns:Converters="clr-namespace:Cryptool.P2PEditor.Converters" mc:Ignorable="d" d:DesignHeight="278" d:DesignWidth="656" x:Name="P2PEditorControl" IsVisibleChanged="P2PEditorControl_IsVisibleChanged">
    22        <GUI:P2PUserControl.Resources>
    33        <Converters:ConnectivityToVisibilityConverter x:Key="ConnectivityToVisibilityConverter" />
  • trunk/CrypPlugins/P2PEditor/GUI/P2PEditorPresentation.xaml.cs

    r2347 r2358  
    159159            //to be implemented
    160160        }
     161
     162        private void P2PEditorControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
     163        {
     164            if (this.IsP2PConnecting || !this.IsP2PConnected)
     165            {
     166                Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(ShowConnectView));               
     167            }
     168        }
    161169    }
    162170}
Note: See TracChangeset for help on using the changeset viewer.