Ignore:
Timestamp:
May 21, 2010, 4:00:55 PM (12 years ago)
Author:
Paul Lelgemann
Message:
  • Removed unused references and using statement in CrypP2P, PeerToPeer, PeerToPeerBaseProxy

+ Skeleton for P2PEditor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypP2P/Worker/ConnectionWorker.cs

    r1438 r1458  
    1616
    1717using System;
    18 using System.Collections.Generic;
    19 using System.Linq;
    20 using System.Text;
     18using System.ComponentModel;
     19using System.Windows.Controls;
     20using System.Windows.Media;
     21using System.Windows.Media.Imaging;
     22using Cryptool.P2P.Helper;
     23using Cryptool.P2P.Internal;
     24using Cryptool.PluginBase;
    2125using DevComponents.WpfRibbon;
    22 using System.Windows.Controls;
    23 using System.Windows.Media.Imaging;
    24 using System.Windows.Media;
    25 using Cryptool.PluginBase;
    26 using Cryptool.P2P.Internal;
    27 using Cryptool.P2P.Helper;
    2826
    2927namespace Cryptool.P2P.Worker
    3028{
    31     class ConnectionWorker : WorkerBase
     29    internal class ConnectionWorker : WorkerBase
    3230    {
    33         P2PBase p2pBase;
    34         P2PSettings p2pSettings;
    35         ButtonDropDown p2pButton;
     31        private readonly P2PBase _p2PBase;
     32        private readonly ButtonDropDown _p2PButton;
     33        private readonly P2PSettings _p2PSettings;
    3634
    37         public ConnectionWorker(P2PBase p2pBase, P2PSettings p2pSettings, ButtonDropDown p2pButton)
     35        public ConnectionWorker(P2PBase p2PBase, P2PSettings p2PSettings, ButtonDropDown p2PButton)
    3836        {
    39             this.p2pBase = p2pBase;
    40             this.p2pSettings = p2pSettings;
    41             this.p2pButton = p2pButton;
     37            _p2PBase = p2PBase;
     38            _p2PSettings = p2PSettings;
     39            _p2PButton = p2PButton;
    4240        }
    4341
    44         protected override void PerformWork(object sender, System.ComponentModel.DoWorkEventArgs e)
     42        protected override void PerformWork(object sender, DoWorkEventArgs e)
    4543        {
    4644            //p2pButton.IsEnabled = false;
    4745
    48             if (!p2pBase.Started)
     46            if (!_p2PBase.Started)
    4947            {
    5048                P2PManager.Instance.GuiLogMessage("Connecting to P2P network...", NotificationLevel.Info);
     
    5351                if (!PAPCertificate.CheckAndInstallPAPCertificates())
    5452                {
    55                     P2PManager.Instance.GuiLogMessage("Certificates not validated, P2P might not be working!", NotificationLevel.Error);
     53                    P2PManager.Instance.GuiLogMessage("Certificates not validated, P2P might not be working!",
     54                                                      NotificationLevel.Error);
    5655                    return;
    5756                }
    5857
    59                 p2pBase.Initialize(p2pSettings);
    60                 p2pBase.SynchStart();
     58                _p2PBase.Initialize(_p2PSettings);
     59                _p2PBase.SynchStart();
    6160            }
    6261            else
    6362            {
    6463                P2PManager.Instance.GuiLogMessage("Disconnecting from P2P network...", NotificationLevel.Info);
    65                 p2pBase.SynchStop();
     64                _p2PBase.SynchStop();
    6665            }
    6766        }
    6867
    69         protected override void WorkComplete(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
     68        protected override void WorkComplete(object sender, RunWorkerCompletedEventArgs e)
    7069        {
    7170            // Update image according to new state
    72             Image newImage = new Image();
     71            var newImage = new Image();
    7372
    7473            if (P2PManager.Instance.P2PConnected())
    7574            {
    7675                P2PManager.Instance.GuiLogMessage("Connection to P2P network established.", NotificationLevel.Info);
    77                 P2PManager.Instance.GuiLogMessage("P2P user info: " + P2PManager.Instance.UserInfo(), NotificationLevel.Debug);
    78                 newImage.Source = new BitmapImage(new Uri(P2PManager.P2PDisconnectImageURI, UriKind.RelativeOrAbsolute));
     76                P2PManager.Instance.GuiLogMessage("P2P user info: " + P2PManager.Instance.UserInfo(),
     77                                                  NotificationLevel.Debug);
     78                newImage.Source = new BitmapImage(new Uri(P2PManager.P2PDisconnectImageUri, UriKind.RelativeOrAbsolute));
    7979            }
    8080            else
    8181            {
    8282                P2PManager.Instance.GuiLogMessage("Connection to P2P network terminated.", NotificationLevel.Info);
    83                 newImage.Source = new BitmapImage(new Uri(P2PManager.P2PConnectImageURI, UriKind.RelativeOrAbsolute));
     83                newImage.Source = new BitmapImage(new Uri(P2PManager.P2PConnectImageUri, UriKind.RelativeOrAbsolute));
    8484            }
    8585
     
    8787            newImage.Width = 40;
    8888            newImage.Height = 40;
    89             p2pButton.Image = newImage;
     89            _p2PButton.Image = newImage;
    9090
    91             p2pButton.IsEnabled = true;
     91            _p2PButton.IsEnabled = true;
    9292        }
    9393
    9494        protected override void PrePerformWork()
    9595        {
    96             p2pButton.IsEnabled = false;
     96            _p2PButton.IsEnabled = false;
    9797        }
    9898    }
Note: See TracChangeset for help on using the changeset viewer.