コード例 #1
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);
        }
コード例 #2
0
ファイル: ImgurHistory.cs プロジェクト: logtcn/greenshot
		public static void ShowHistory() {
			// Make sure the history is loaded, will be done only once
			ImgurUtils.LoadHistory();
			if (instance == null) {
				instance = new ImgurHistory();
			}
			instance.Show();
			instance.redraw();
		}
コード例 #3
0
 public static void ShowHistory()
 {
     // Make sure the history is loaded, will be done only once
     ImgurUtils.LoadHistory();
     if (instance == null)
     {
         instance = new ImgurHistory();
     }
     instance.Show();
     instance.redraw();
 }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
ファイル: ImgurHistory.cs プロジェクト: zhk/greenshot
        public static void ShowHistory()
        {
            lock (Lock)
            {
                if (ImgurUtils.IsHistoryLoadingNeeded())
                {
                    // Run upload in the background
                    new PleaseWaitForm().ShowAndWait("Imgur " + Language.GetString("imgur", LangKey.history), Language.GetString("imgur", LangKey.communication_wait),
                                                     ImgurUtils.LoadHistory
                                                     );
                }

                // Make sure the history is loaded, will be done only once
                if (_instance == null)
                {
                    _instance = new ImgurHistory();
                }
                if (!_instance.Visible)
                {
                    _instance.Show();
                }
                _instance.Redraw();
            }
        }
コード例 #7
0
 void ButtonHistoryClick(object sender, EventArgs e)
 {
     ImgurHistory.ShowHistory();
 }
コード例 #8
0
ファイル: ImgurHistory.cs プロジェクト: oneminot/greenshot
 void ImgurHistoryFormClosing(object sender, FormClosingEventArgs e)
 {
     instance = null;
 }
コード例 #9
0
ファイル: ImgurHistory.cs プロジェクト: zhk/greenshot
 private void ImgurHistoryFormClosing(object sender, FormClosingEventArgs e)
 {
     _instance = null;
 }