/// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            this.host  = (IGreenshotHost)pluginHost;
            Attributes = myAttributes;


            // Register configuration (don't need the configuration itself)
            config    = IniConfig.GetIniSection <FlickrConfiguration>();
            resources = new ComponentResourceManager(typeof(FlickrPlugin));

            ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem();

            itemPlugInRoot.Text  = "Flickr";
            itemPlugInRoot.Tag   = host;
            itemPlugInRoot.Image = (Image)resources.GetObject("flickr");

            ToolStripMenuItem itemPlugInHistory = new ToolStripMenuItem();

            itemPlugInHistory.Text   = lang.GetString(LangKey.History);
            itemPlugInHistory.Tag    = host;
            itemPlugInHistory.Click += new System.EventHandler(HistoryMenuClick);
            itemPlugInRoot.DropDownItems.Add(itemPlugInHistory);

            ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();

            itemPlugInConfig.Text   = lang.GetString(LangKey.Configure);
            itemPlugInConfig.Tag    = host;
            itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
            itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);

            PluginUtils.AddToContextMenu(host, itemPlugInRoot);

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="metadata">IDictionary<string, object></param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public override bool Initialize(IGreenshotHost pluginHost, IDictionary <string, object> metadata)
        {
            this.host = pluginHost;

            // Get configuration
            config    = IniConfig.GetIniSection <ImgurConfiguration>();
            resources = new ComponentResourceManager(typeof(ImgurPlugin));

            ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur");

            itemPlugInRoot.Image = (Image)resources.GetObject("Imgur");

            historyMenuItem        = new ToolStripMenuItem(Language.GetString("imgur", LangKey.history));
            historyMenuItem.Tag    = host;
            historyMenuItem.Click += delegate {
                ImgurHistory.ShowHistory();
            };
            itemPlugInRoot.DropDownItems.Add(historyMenuItem);

            PluginUtils.AddToContextMenu(host, itemPlugInRoot);
            Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);

            // retrieve history in the background
            Thread backgroundTask = new Thread(new ThreadStart(CheckHistory));

            backgroundTask.Name         = "Imgur History";
            backgroundTask.IsBackground = true;
            backgroundTask.SetApartmentState(ApartmentState.STA);
            backgroundTask.Start();

            // Register our configuration
            SettingsWindow.RegisterSettingsPage <ImgurSettingsPage>("settings_plugins,imgur.settings_title");
            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            _host      = pluginHost;
            Attributes = myAttributes;

            // Get configuration
            _config    = IniConfig.GetIniSection <ImgurConfiguration>();
            _resources = new ComponentResourceManager(typeof(ImgurPlugin));

            ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur")
            {
                Image = (Image)_resources.GetObject("Imgur")
            };

            _historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.history))
            {
                Tag = _host
            };
            _historyMenuItem.Click += delegate {
                ImgurHistory.ShowHistory();
            };
            itemPlugInRoot.DropDownItems.Add(_historyMenuItem);

            _itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure))
            {
                Tag = _host
            };
            _itemPlugInConfig.Click += delegate {
                _config.ShowConfigDialog();
            };
            itemPlugInRoot.DropDownItems.Add(_itemPlugInConfig);

            PluginUtils.AddToContextMenu(_host, itemPlugInRoot);
            Language.LanguageChanged += OnLanguageChanged;

            // retrieve history in the background
            Thread backgroundTask = new Thread(CheckHistory)
            {
                Name         = "Imgur History",
                IsBackground = true
            };

            backgroundTask.SetApartmentState(ApartmentState.STA);
            backgroundTask.Start();
            return(true);
        }
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            this.host  = (IGreenshotHost)pluginHost;
            Attributes = myAttributes;

            // Get configuration
            config    = IniConfig.GetIniSection <PicasaConfiguration>();
            resources = new ComponentResourceManager(typeof(PicasaPlugin));

            itemPlugInRoot        = new ToolStripMenuItem();
            itemPlugInRoot.Text   = Language.GetString("picasa", LangKey.Configure);
            itemPlugInRoot.Tag    = host;
            itemPlugInRoot.Image  = (Image)resources.GetObject("Picasa");
            itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
            PluginUtils.AddToContextMenu(host, itemPlugInRoot);
            Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
            return(true);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute pluginAttribute)
        {
            _host      = pluginHost;
            Attributes = pluginAttribute;

            // Register configuration (don't need the configuration itself)
            _config    = IniConfig.GetIniSection <BoxConfiguration>();
            _resources = new ComponentResourceManager(typeof(BoxPlugin));

            _itemPlugInConfig = new ToolStripMenuItem {
                Image = (Image)_resources.GetObject("Box"),
                Text  = Language.GetString("box", LangKey.Configure)
            };
            _itemPlugInConfig.Click += ConfigMenuClick;

            PluginUtils.AddToContextMenu(_host, _itemPlugInConfig);
            Language.LanguageChanged += OnLanguageChanged;
            return(true);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            this.host  = (IGreenshotHost)pluginHost;
            Attributes = myAttributes;

            // Register configuration (don't need the configuration itself)
            config    = IniConfig.GetIniSection <DropboxPluginConfiguration>();
            resources = new ComponentResourceManager(typeof(DropboxPlugin));

            itemPlugInConfig        = new ToolStripMenuItem();
            itemPlugInConfig.Text   = Language.GetString("dropbox", LangKey.Configure);
            itemPlugInConfig.Tag    = host;
            itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
            itemPlugInConfig.Image  = (Image)resources.GetObject("Dropbox");

            PluginUtils.AddToContextMenu(host, itemPlugInConfig);
            Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
            return(true);
        }
Exemplo n.º 7
0
        /// <summary>
        ///     Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        public bool Initialize()
        {
            Log.Debug().WriteLine("Initialize called");

            // Check configuration & cleanup
            foreach (var command in _externalCommandConfig.Commands.Where(command => !IsCommandValid(command)).ToList())
            {
                _externalCommandConfig.Delete(command);
            }

            _itemPlugInRoot = new ToolStripMenuItem {
                Tag = _greenshotHost
            };
            _greenshotHost.ContextMenuDpiHandler.OnDpiChanged.Subscribe(OnIconSizeChanged);
            OnLanguageChanged(this, null);

            PluginUtils.AddToContextMenu(_greenshotHost, _itemPlugInRoot);
            Language.LanguageChanged += OnLanguageChanged;
            return(true);
        }
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            this.host  = (IGreenshotHost)pluginHost;
            Attributes = myAttributes;

            // Get configuration
            config    = IniConfig.GetIniSection <FogBugzConfiguration>();
            resources = new ComponentResourceManager(typeof(FogBugzPlugin));

            itemPlugInRoot        = new ToolStripMenuItem(Language.GetString("fogbugz", LangKey.fogbugz_configure));
            itemPlugInRoot.Image  = (Image)resources.GetObject("FogBugz");
            itemPlugInRoot.Tag    = host;
            itemPlugInRoot.Click += delegate {
                config.ShowConfigDialog();
            };

            PluginUtils.AddToContextMenu(host, itemPlugInRoot);
            Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
            return(true);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            _host      = pluginHost;
            Attributes = myAttributes;

            // Get configuration
            _config    = IniConfig.GetIniSection <PicasaConfiguration>();
            _resources = new ComponentResourceManager(typeof(PicasaPlugin));

            _itemPlugInRoot = new ToolStripMenuItem
            {
                Text  = Language.GetString("picasa", LangKey.Configure),
                Tag   = _host,
                Image = (Image)_resources.GetObject("Picasa")
            };
            _itemPlugInRoot.Click += ConfigMenuClick;
            PluginUtils.AddToContextMenu(_host, _itemPlugInRoot);
            Language.LanguageChanged += OnLanguageChanged;
            return(true);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            _host      = pluginHost;
            Attributes = myAttributes;

            // Get configuration
            _config    = IniConfig.GetIniSection <ImgurConfiguration>();
            _resources = new ComponentResourceManager(typeof(ImgurPlugin));

            ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur")
            {
                Image = (Image)_resources.GetObject("Imgur")
            };

            _historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.history))
            {
                Tag = _host
            };
            _historyMenuItem.Click += delegate {
                ImgurHistory.ShowHistory();
            };
            itemPlugInRoot.DropDownItems.Add(_historyMenuItem);

            _itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure))
            {
                Tag = _host
            };
            _itemPlugInConfig.Click += delegate {
                _config.ShowConfigDialog();
            };
            itemPlugInRoot.DropDownItems.Add(_itemPlugInConfig);

            PluginUtils.AddToContextMenu(_host, itemPlugInRoot);
            Language.LanguageChanged += OnLanguageChanged;

            // Enable history if there are items available
            UpdateHistoryMenuItem();
            return(true);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            LOG.DebugFormat("Initialize called of {0}", myAttributes.Name);

            List <string> commandsToDelete = new List <string>();

            // Check configuration
            foreach (string command in config.commands)
            {
                if (!isCommandValid(command))
                {
                    commandsToDelete.Add(command);
                }
            }

            // cleanup
            foreach (string command in commandsToDelete)
            {
                config.runInbackground.Remove(command);
                config.commandlines.Remove(command);
                config.arguments.Remove(command);
                config.commands.Remove(command);
            }

            this.host         = pluginHost;
            this.myAttributes = myAttributes;


            itemPlugInRoot     = new ToolStripMenuItem();
            itemPlugInRoot.Tag = host;
            OnIconSizeChanged(this, new PropertyChangedEventArgs("IconSize"));
            OnLanguageChanged(this, null);
            itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);

            PluginUtils.AddToContextMenu(host, itemPlugInRoot);
            Language.LanguageChanged   += OnLanguageChanged;
            coreConfig.PropertyChanged += OnIconSizeChanged;
            return(true);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            _host      = pluginHost;
            Attributes = myAttributes;

            // Get configuration
            _config    = IniConfig.GetIniSection <PhotobucketConfiguration>();
            _resources = new ComponentResourceManager(typeof(PhotobucketPlugin));

            _itemPlugInConfig = new ToolStripMenuItem(Language.GetString("photobucket", LangKey.configure))
            {
                Tag   = _host,
                Image = (Image)_resources.GetObject("Photobucket")
            };
            _itemPlugInConfig.Click += delegate {
                _config.ShowConfigDialog();
            };

            PluginUtils.AddToContextMenu(_host, _itemPlugInConfig);
            Language.LanguageChanged += OnLanguageChanged;
            return(true);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            try
            {
                this.host  = (IGreenshotHost)pluginHost;
                Attributes = myAttributes;

                // Get configuration
                config    = IniConfig.GetIniSection <TFSConfiguration>();
                resources = new ComponentResourceManager(typeof(TFSPlugin));

                ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem();
                itemPlugInRoot.Text = "TFS";
                itemPlugInRoot.Tag  = host;
                //itemPlugInRoot.Image = (Image)resources.GetObject("TFS");

                ToolStripMenuItem itemPlugInHistory = new ToolStripMenuItem();
                itemPlugInHistory.Text   = Language.GetString("tfs", LangKey.History);
                itemPlugInHistory.Tag    = host;
                itemPlugInHistory.Click += new System.EventHandler(HistoryMenuClick);
                itemPlugInRoot.DropDownItems.Add(itemPlugInHistory);

                ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();

                itemPlugInConfig.Text   = Language.GetString("tfs", LangKey.Configure);
                itemPlugInConfig.Tag    = host;
                itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
                itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);

                PluginUtils.AddToContextMenu(host, itemPlugInRoot);

                return(true);
            }
            catch (Exception eError)
            {
                MessageBox.Show("Error init : " + eError.ToString());
                return(false);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            Log.DebugFormat("Initialize called of {0}", myAttributes.Name);

            List <string> commandsToDelete = new List <string>();

            // Check configuration
            foreach (string command in ExternalCommandConfig.Commands)
            {
                if (!IsCommandValid(command))
                {
                    commandsToDelete.Add(command);
                }
            }

            // cleanup
            foreach (string command in commandsToDelete)
            {
                ExternalCommandConfig.Delete(command);
            }

            _host         = pluginHost;
            _myAttributes = myAttributes;


            _itemPlugInRoot = new ToolStripMenuItem {
                Tag = _host
            };
            OnIconSizeChanged(this, new PropertyChangedEventArgs("IconSize"));
            OnLanguageChanged(this, null);
            _itemPlugInRoot.Click += ConfigMenuClick;

            PluginUtils.AddToContextMenu(_host, _itemPlugInRoot);
            Language.LanguageChanged   += OnLanguageChanged;
            CoreConfig.PropertyChanged += OnIconSizeChanged;
            return(true);
        }