Пример #1
0
        private ErrorCode StartPlugin()
        {
            pimBroker.ErrorLogging.AddStartupInformation("ITNVPluginPlayMsg.Plugin.StartPlugin: starting.");

            AgileSoftware.Plugin.ErrorCode result = ErrorCode.NoError;

            if (guiHost == null)
            {
                return(ErrorCode.UnknowError);
            }

            try
            {
                worker = new Worker();

                //Notify the Worker object that the plugin has started.
                worker.StartWorking();
            }
            catch (Exception e)
            {
                pimBroker.ErrorLogging.AddErrorToListFatal(
                    "ITNVPluginPlayMsg.Plugin.StartPlugin: an exception was thrown while creating a new worker object.  {0}",
                    e.ToString());

                result = ErrorCode.UnknowError;
            }

            pimBroker.ErrorLogging.AddStartupInformation("ITNVPluginPlayMsg.Plugin.StartPlugin: started with result {0}.", result);
            return(result);
        }
Пример #2
0
        /// <summary>
        /// Changes the run state of the plugin, either starting or stopping it. This method is called by the CCE Desktop host after
        /// calling the IASPIMClient.Initialise methods of all the plugins which have been loaded successfully.
        /// </summary>
        /// <param name="state">The target state into which the plugin will be placed.</param>
        /// <returns>Returns an <see cref="AgileSoftware.Plugin.ErrorCode"/> describing whether the change succeeded or failed.</returns>
        public AgileSoftware.Plugin.ErrorCode Run(AgileSoftware.Plugin.RunState state)
        {
            AgileSoftware.Plugin.ErrorCode result = AgileSoftware.Plugin.ErrorCode.NoError;

            if (state == AgileSoftware.Plugin.RunState.Start)
            {
                // try to start the plugin
                result = StartPlugin();
                if (result != AgileSoftware.Plugin.ErrorCode.UnknowError)
                {
                    runState = AgileSoftware.Plugin.RunState.Start;
                }
            }
            else if (state == AgileSoftware.Plugin.RunState.Stop)
            {
                // try to stop the plugin
                result = StopPlugin();
                if (result != AgileSoftware.Plugin.ErrorCode.UnknowError)
                {
                    runState = AgileSoftware.Plugin.RunState.Stop;
                }
            }

            return(result);
        }
Пример #3
0
        private ErrorCode StopPlugin()
        {
            pimBroker.ErrorLogging.AddStatusInformation("ITNVPluginPlayMsg.Plugin.StopPlugin: stopping.");

            //Notifies the Worker class that the plugin has been stopped
            if (this.worker != null)
            {
                this.worker.StopWorking();
            }

            AgileSoftware.Plugin.ErrorCode result = ErrorCode.NoError;

            pimBroker.ErrorLogging.AddStatusInformation("ITNVPluginPlayMsg.Plugin.StopPlugin: stopped with result {0}.", result);

            return(result);
        }
Пример #4
0
        /// <summary>
        /// Initialises the plugin. This method is called by the CCE Desktop host when it is started. It is the first method of the plugin
        /// being invoked by the host application, or say, it is the starting point of a plugin.
        /// </summary>
        /// <param name="asPIMBroker">The PIM broker to be used by the plugin.</param>
        /// <param name="configurationSectionName">The name of the confiugration section in which the plugin will store data.</param>
        /// <returns>Returns an <see cref="AgileSoftware.Plugin.ErrorCode"/> describing the success, or otherwise, of initialisation.</returns>
        public AgileSoftware.Plugin.ErrorCode Initialise(AgileSoftware.Plugin.IASPIMBroker asPIMBroker, string configurationSectionName)
        {
            configsectionname = configurationSectionName;
            asPIMBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg.Plugin.Initialise: initializing.");

            AgileSoftware.Plugin.ErrorCode result = AgileSoftware.Plugin.ErrorCode.NoError;

            //Get the PIMBroker object
            pimBroker = asPIMBroker;

            //Get the configuration settings for this plugin
            pluginConfiguration.LoadConfiguration(configurationSectionName);

            pimBroker.ErrorLogging.AddErrorToListInformation("ITNVPluginPlayMsg.Plugin.Initialise: initialized with result {0}.", result);

            return(result);
        }