Changeset 1507 for trunk/CrypPlugins


Ignore:
Timestamp:
May 26, 2010, 7:54:12 PM (12 years ago)
Author:
Matthäus Wander
Message:

Updated plugin template. The template shall become the default way to create a new CT2 plugin.

Location:
trunk/CrypPlugins/CrypPluginTemplate
Files:
4 added
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/CrypPluginTemplate/ExamplePluginCT2.cs

    r740 r1507  
    1 /*
    2    Copyright 2009 Matthäus Wander, Universität Duisburg-Essen
     1/* HOWTO: Change year, author name and organization.
     2   Copyright 2010 Your Name, University of Duckburg
    33
    44   Licensed under the Apache License, Version 2.0 (the "License");
     
    2424using System.Windows.Controls;
    2525
    26 namespace Cryptool.Plugin.ExamplePluginCT2
     26namespace Cryptool.Plugin
    2727{
     28    // HOWTO: Change author name, email address, organization and URL.
    2829    [Author("Matthäus Wander", "wander@cryptool.org", "Universität Duisburg-Essen, Fachgebiet Verteilte Systeme", "http://www.vs.uni-due.de")]
     30    // HOWTO: Change plugin caption (title to appear in CT2) and tooltip. You can (and should) provide a description XAML and an own icon as well.
    2931    [PluginInfo(false, "Example Plugin", "Subtract one number from another", null, "CrypWin/images/default.png")]
     32    // HOWTO: Change interface to one that fits to your plugin (see CrypPluginBase).
    3033    public class ExamplePluginCT2 : IIOMisc
    3134    {
    3235        #region Private Variables
    3336
    34         private ExamplePluginCT2Settings settings = new ExamplePluginCT2Settings();
     37        // HOWTO: You need to adapt the settings class as well, see the corresponding file.
     38        private readonly ExamplePluginCT2Settings settings = new ExamplePluginCT2Settings();
    3539
    3640        #endregion
     
    3943
    4044        /// <summary>
    41         /// Input interface to read the input data.
     45        /// HOWTO: Input interface to read the input data.
    4246        /// You can add more input properties of other type if needed.
    4347        /// </summary>
     
    5054
    5155        /// <summary>
    52         /// Output interface to write the output data.
     56        /// HOWTO: Output interface to write the output data.
    5357        /// You can add more output properties ot other type if needed.
    5458        /// </summary>
     
    7074
    7175        /// <summary>
    72         /// Optional: provide custom (tabbed) presentation to visualize your algorithm
     76        /// HOWTO: You can provide a custom (tabbed) presentation to visualize your algorithm.
     77        /// Return null if you don't provide one.
    7378        /// </summary>
    7479        public UserControl Presentation
     
    7883
    7984        /// <summary>
    80         /// Optional: provide custom (quickwatch) presentation to visualize your algorithm
     85        /// HOWTO: You can provide custom (quickwatch) presentation to visualize your algorithm.
     86        /// Return null if you don't provide one.
    8187        /// </summary>
    8288        public UserControl QuickWatchPresentation
     
    9096
    9197        /// <summary>
    92         /// The algorithm you'd like to implement
     98        /// HOWTO: Enter the algorithm you'd like to implement in this method.
    9399        /// </summary>
    94100        public void Execute()
    95101        {
     102            // HOWTO: Use this to show the progress of a plugin algorithm execution in the editor.
    96103            ProgressChanged(0, 1);
    97104
     105            // HOWTO: After you have changed an output property, make sure you announce the name of the changed property to the CT2 core.
    98106            Difference = Minuend - settings.Subtrahend;
    99107            OnPropertyChanged("Difference");
    100108
     109            // HOWTO: You can pass error, warning, info or debug messages to the CT2 main window.
    101110            if (settings.Subtrahend < 0)
    102111                GuiLogMessage("Subtrahend is negative", NotificationLevel.Debug);
    103112
     113            // HOWTO: Make sure the progress bar is at maximum when your Execute() finished successfully.
    104114            ProgressChanged(1, 1);
    105115        }
  • trunk/CrypPlugins/CrypPluginTemplate/ExamplePluginCT2Settings.cs

    r740 r1507  
    1 /*
    2    Copyright 2009 Matthäus Wander, Universität Duisburg-Essen
     1/* HOWTO: Change year, author name and organization.
     2   Copyright 2010 Your Name, University of Duckburg
    33
    44   Licensed under the Apache License, Version 2.0 (the "License");
     
    2121using System.ComponentModel;
    2222
    23 namespace Cryptool.Plugin.ExamplePluginCT2
     23namespace Cryptool.Plugin
    2424{
    2525    public class ExamplePluginCT2Settings : ISettings
     
    3434        #region TaskPane Settings
    3535
    36         #region ISettings Members
    37 
     36        /// <summary>
     37        /// HOWTO: This is an example for a setting entity shown in the settings pane on the right of the CT2 main window.
     38        /// This example setting uses a number field input, but there are many more input types available, see ControlType enumeration.
     39        /// </summary>
    3840        [TaskPane("Subtrahend", "Amount to subtract from input number", null, 1, false, DisplayLevel.Beginner, ControlType.NumericUpDown, ValidationType.RangeInteger, 0, Int32.MaxValue)]
    3941        public int Subtrahend
     
    4547            set
    4648            {
     49                // HOWTO: If a setting changes, you must set hasChanges manually to true.
    4750                if (subtrahend != value)
    4851                {
     
    5558        #endregion
    5659
     60        #region ISettings Members
     61
    5762        /// <summary>
    58         /// need to store the change status of the plugin
    59         /// if a property was changed -> hasChangess = true
    60         /// hence CrypTool will ask automatically if you want to save your changes
     63        /// HOWTO: This flags indicates whether some setting has been changed since the last save.
     64        /// If a property was changed, this becomes true, hence CrypTool will ask automatically if you want to save your changes.
    6165        /// </summary>
    6266        public bool HasChanges
  • trunk/CrypPlugins/CrypPluginTemplate/Properties/AssemblyInfo.cs

    r740 r1507  
    66// set of attributes. Change these attribute values to modify the information
    77// associated with an assembly.
    8 [assembly: AssemblyTitle("ExamplePluginCT2")]
     8[assembly: AssemblyTitle("CrypPluginTemplate")]
    99[assembly: AssemblyDescription("")]
    1010[assembly: AssemblyConfiguration("")]
    1111[assembly: AssemblyCompany("")]
    12 [assembly: AssemblyProduct("ExamplePluginCT2")]
    13 [assembly: AssemblyCopyright("Copyright ©  2009")]
     12[assembly: AssemblyProduct("CrypPluginTemplate")]
     13[assembly: AssemblyCopyright("Copyright © 2010")]
    1414[assembly: AssemblyTrademark("")]
    1515[assembly: AssemblyCulture("")]
Note: See TracChangeset for help on using the changeset viewer.