Ignore:
Timestamp:
May 29, 2010, 3:08:17 PM (12 years ago)
Author:
Paul Lelgemann
Message:

o Updated Peer@Play-DLLs to support IrcBootstrapperV2
o CrypP2P: Switched to built-in settings
+ P2PEditor: Moved settings to settings pane and wired them to the new CrypP2P settings style
o P2PEditor: Play button connects P2P network

Location:
trunk/CrypPlugins/P2PEditor
Files:
5 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/P2PEditor/P2PEditor.cs

    r1504 r1527  
    2020using System.Windows.Controls;
    2121using Cryptool.Core;
     22using Cryptool.P2P;
     23using Cryptool.P2P.Worker;
     24using Cryptool.P2PEditor.Distributed;
    2225using Cryptool.P2PEditor.GUI;
    2326using Cryptool.PluginBase;
     
    2932    [Author("Paul Lelgemann", "lelgemann@cryptool.org", "Uni Duisburg-Essen", "http://www.uni-due.de")]
    3033    [PluginInfo("Cryptool.P2PEditor.Resources.Attributes", false, "P2P Interface",
    31         "Control interface for the integrated P2P network.", "P2PEditor/DetailedDescription/Description.xaml",
     34        "Control interface for the integrated P2P network.", null,
    3235        "P2PEditor/images/icon.png")]
    3336    public class P2PEditor : IEditor
    3437    {
    35         public static readonly P2PEditor Instance = new P2PEditor();
    36         private DisplayLevel _displayLevel;
     38        private readonly JobListManager _jobListManager;
    3739
    3840        public P2PEditor()
    3941        {
    40             Presentation = new P2PEditorPresentation(this);
     42            _jobListManager = new JobListManager(this);
     43
     44            Presentation = new P2PEditorPresentation(this, _jobListManager);
     45            Settings = new P2PEditorSettings(this);
    4146        }
    4247
     
    5560        public void New()
    5661        {
     62            GuiLogMessage("P2PEditor: New()", NotificationLevel.Debug);
     63
     64            ((P2PEditorPresentation) Presentation).ShowJobCreation();
     65
     66            if (OnSelectedPluginChanged != null)
     67            {
     68                OnSelectedPluginChanged(this, new PluginChangedEventArgs(this, "P2P Configuration", DisplayPluginMode.Normal));
     69            }
    5770        }
    5871
    5972        public void Open(string fileName)
    6073        {
     74            GuiLogMessage("P2PEditor: Open(" + fileName + ")", NotificationLevel.Debug);
    6175        }
    6276
    6377        public void Save(string fileName)
    6478        {
     79            GuiLogMessage("P2PEditor: Save(" + fileName + ")", NotificationLevel.Debug);
    6580        }
    6681
    6782        public void Add(Type type)
    6883        {
     84            GuiLogMessage("P2PEditor: Add(" + type + ")", NotificationLevel.Debug);
    6985        }
    7086
    7187        public void AddEditorSpecific(EditorSpecificPluginInfo espi)
    7288        {
     89            GuiLogMessage("P2PEditor: AddEditorSpecific()", NotificationLevel.Debug);
    7390        }
    7491
    7592        public void DeleteEditorSpecific(EditorSpecificPluginInfo espi)
    7693        {
     94            GuiLogMessage("P2PEditor: DeleteEditorSpecific()", NotificationLevel.Debug);
    7795        }
    7896
    7997        public void Undo()
    8098        {
     99            GuiLogMessage("P2PEditor: Undo()", NotificationLevel.Debug);
    81100        }
    82101
    83102        public void Redo()
    84103        {
     104            GuiLogMessage("P2PEditor: Redo()", NotificationLevel.Debug);
    85105        }
    86106
    87107        public void ShowHelp()
    88108        {
     109            GuiLogMessage("P2PEditor: ShowHelp()", NotificationLevel.Debug);
    89110        }
    90111
    91112        public void ShowSelectedPluginDescription()
    92113        {
     114            GuiLogMessage("P2PEditor: ShowSelectedPluginDescription()", NotificationLevel.Debug);
    93115        }
    94116
     
    105127        public bool CanExecute
    106128        {
    107             get { return false; }
     129            get { return !P2PManager.Instance.P2PConnected() && !P2PManager.Instance.IsP2PConnecting; }
    108130        }
    109131
    110132        public bool CanStop
    111133        {
     134            // TODO design problem? when set to true, CrypWin will terminate execute Stop() (and terminate the P2P connection) when switching back to an AnotherEditor instance
     135            // get { return P2PManager.Instance.P2PConnected() && !P2PManager.Instance.IsP2PConnecting; }
    112136            get { return false; }
    113137        }
     
    118142        }
    119143
    120         public DisplayLevel DisplayLevel
    121         {
    122             get { return _displayLevel; }
    123             set
    124             {
    125                 _displayLevel = value;
    126                 ((P2PEditorPresentation) Presentation).DisplayLevel = value;
    127             }
    128         }
     144        public DisplayLevel DisplayLevel { get; set; }
    129145
    130146        public List<EditorSpecificPluginInfo> EditorSpecificPlugins
     
    139155        public event PluginProgressChangedEventHandler OnPluginProgressChanged;
    140156
    141         public ISettings Settings
     157        public ISettings Settings { get; private set; }
     158
     159        public UserControl Presentation { get; private set; }
     160
     161        public UserControl QuickWatchPresentation
    142162        {
    143163            get { throw new NotImplementedException(); }
    144164        }
    145165
    146         public UserControl Presentation { get; private set; }
    147 
    148         public UserControl QuickWatchPresentation
    149         {
    150             get { throw new NotImplementedException(); }
    151         }
    152 
    153166        public void PreExecution()
    154167        {
     
    157170        public void Execute()
    158171        {
     172            RunConnectionWorker();
     173        }
     174
     175        private void RunConnectionWorker()
     176        {
     177            var connectionWorker = new ConnectionWorker(P2PManager.Instance.P2PBase, P2PManager.Instance.P2PSettings);
     178            connectionWorker.BackgroundWorker.RunWorkerCompleted += ((P2PEditorPresentation) Presentation).ConnectionWorkerCompleted;
     179            connectionWorker.Start();
    159180        }
    160181
     
    169190        public void Stop()
    170191        {
     192            RunConnectionWorker();
    171193        }
    172194
     
    196218            OnGuiLogNotificationOccured(this, args);
    197219        }
     220
     221        public void SendOpenProjectFileEvent(string filename)
     222        {
     223            if (OnOpenProjectFile != null) OnOpenProjectFile(this, filename);
     224        }
    198225    }
    199226}
  • trunk/CrypPlugins/P2PEditor/P2PEditor.csproj

    r1501 r1527  
    6969  </ItemGroup>
    7070  <ItemGroup>
    71     <Compile Include="Converters\IsBeginnerDisplayModeToVisibilityConverter.cs" />
     71    <Compile Include="GUI\P2PUserControl.cs" />
     72    <Compile Include="P2PEditorSettings.cs" />
    7273    <Compile Include="DetailedDescription\Description.xaml.cs">
    7374      <DependentUpon>Description.xaml</DependentUpon>
     
    9293      <DesignTime>True</DesignTime>
    9394    </Compile>
     95    <Compile Include="Worker\JobParticipationWorker.cs">
     96      <SubType>Component</SubType>
     97    </Compile>
     98    <Compile Include="Worker\JobCreationWorker.cs">
     99      <SubType>Component</SubType>
     100    </Compile>
    94101  </ItemGroup>
    95102  <ItemGroup>
     103    <ProjectReference Include="..\..\CoreDeveloper\CrypPlugins\AnotherEditor\AnotherEditor\AnotherEditor.csproj">
     104      <Project>{1EA91B9A-8961-44C9-BA87-4B60C141470C}</Project>
     105      <Name>AnotherEditor</Name>
     106    </ProjectReference>
    96107    <ProjectReference Include="..\..\CrypCore\CrypCore.csproj">
    97108      <Project>{FF5D473C-0716-4D3E-9078-2EBD979F94C6}</Project>
     
    106117      <Name>CrypPluginBase</Name>
    107118    </ProjectReference>
     119    <ProjectReference Include="..\PeerToPeer\PeerToPeer.csproj">
     120      <Project>{12829116-8FAD-4D09-A0AA-D75D88F07626}</Project>
     121      <Name>PeerToPeer</Name>
     122    </ProjectReference>
    108123  </ItemGroup>
    109124  <ItemGroup>
     
    117132  </ItemGroup>
    118133  <ItemGroup>
    119     <Page Include="DetailedDescription\Description.xaml">
     134    <Resource Include="DetailedDescription\Description.xaml">
    120135      <SubType>Designer</SubType>
    121136      <Generator>MSBuild:Compile</Generator>
    122     </Page>
     137    </Resource>
    123138    <Page Include="GUI\Controls\JobCreation.xaml">
    124139      <SubType>Designer</SubType>
Note: See TracChangeset for help on using the changeset viewer.