Example #1
0
        /// <summary>
        /// Constructs a Protocol object.
        /// </summary>
        /// <param name="treeView">TreeViewEx object which holds the contact list for the application</param>
        /// <param name="taskbarNotify">TaskbarNotify object which pops up on certain events</param>
        /// <param name="fileName">Filename of the plugin assembly</param>
        /// <param name="mainStorage">IStorage instance where the application's settings are stored</param>
        public Protocol(TreeViewEx treeView, TaskbarNotifier taskbarNotify, string fileName,
                        IStorage mainStorage)
        {
            this.treeView      = treeView;
            this.taskbarNotify = taskbarNotify;

            this.classFactory = new ClassFactory(fileName);

            // create plugin constants class
            IConstants constants = classFactory.CreateConstants();

            this.localStorage = mainStorage.CreateSubSection(constants.Name);

            // create registry key for this protocol to store the settings
            this.settings = classFactory.CreateSettings(constants, this.localStorage, this.optionsList);
            this.settings.Load();

            // create protocol control and register this class to be an event listener
            this.protocolServer = new ProtocolServer();
            this.protocolServer.AddListener(this);

            this.protocolControl = new ProtocolControl(this.protocolServer);

            this.reporter = new NBM.Diagnostics.ProtocolReporter(this);
        }
Example #2
0
    private Timer pingTimer = new Timer(60 * 1000);     // ping timer, ping every minute



    public Protocol(ProtocolControl control, ProtocolSettings settings)
    {
        this.control  = control;
        this.settings = (Settings)settings;

        this.pingTimer.AutoReset = true;
        this.pingTimer.Elapsed  += new ElapsedEventHandler(OnPingTimerElapse);
    }
Example #3
0
    private Timers.Timer timeoutTimer = new Timers.Timer(1000 * 60 * 2); // ping timeout timer, every 2 minutes


    public Protocol(ProtocolControl control, ProtocolSettings settings)
    {
        this.control  = control;
        this.settings = (Settings)settings;

        this.timeoutTimer.AutoReset = false;
        this.timeoutTimer.Elapsed  += new Timers.ElapsedEventHandler(OnTimeoutElapsed);
        this.timer.AutoReset        = true;
        this.timer.Elapsed         += new Timers.ElapsedEventHandler(OnTimerElapse);
    }
Example #4
0
 /// <summary>
 /// Creates an instance of the plugin-implemented IProtocol class.
 /// </summary>
 /// <param name="control"></param>
 /// <param name="settings"></param>
 /// <returns></returns>
 public IProtocol CreateProtocol(ProtocolControl control, ProtocolSettings settings)
 {
     return((IProtocol)this.assembly.CreateInstance(Config.Constants.ProtocolClassName, true,
                                                    BindingFlags.CreateInstance, null,
                                                    new object[] { control, settings }, null, null));
 }