Esempio n. 1
0
        public PluginInformationViewModel(IPluginInformation plugin, SecurityLicenseContent license)
        {
            ID             = plugin.ID;
            Name           = plugin.Name;
            Version        = plugin.Version;
            AssemblyName   = plugin.AssemblyName;
            IsLicensed     = false;
            Information    = plugin.Info;
            LicenseExpires = "license is not applied.";

            if (license != null)
            {
                try
                {
                    var token =
                        license.Tokens.FirstOrDefault(
                            x =>
                            x.AssemblyKey.SequenceEqual(
                                plugin.GetInstance().GetType().Assembly.GetName().GetPublicKey()));

                    if (token != null)
                    {
                        IsLicensed     = true;
                        LicenseExpires = token.ExpireDate?.ToString() ?? "never";
                    }
                }
                catch (Exception e)
                {
                    Logger.LogWarn(e);
                }
            }
        }
Esempio n. 2
0
 private static void TryStartPlugin(IPluginInformation plugin)
 {
     try
     {
         plugin.Start();
     }
     catch (Exception e)
     {
         Logger.LogWarn(e);
     }
 }
Esempio n. 3
0
        public PluginManagerWrapper(IPluginInformation pluginInformation, ICore core, ISettingsManagerSection settingsManager)
        {
            _core = core;

            Plugins = new [] { pluginInformation };

            Core = core.CreateChildCore(new CoreSettings {
                PluginManager   = this,
                SettingsManager = settingsManager,
            });
        }
Esempio n. 4
0
 private void SetStartStopButtonStates(IPluginInformation plugin)
 {
     if (plugin.IsStarted)
     {
         this.buttonPluginStart.Enabled = false;
         this.buttonPluginStop.Enabled  = true;
     }
     else
     {
         this.buttonPluginStart.Enabled = true;
         this.buttonPluginStop.Enabled  = false;
     }
 }