public void Release()
        {
            if (m_form != null)
            {
                m_form.CallInFormThread(() =>
                {
                    m_form.Close();
                    m_form.Dispose();
                });
                m_form = null;
            }

            m_thread.Join();
        }
        public void Init()
        {
            bool formInitialized = false;

            m_thread = new Thread((ThreadStart)(() => {
                m_form = new ClipboardForm(ref formInitialized);
                Application.Run(m_form);
            }));

            m_thread.SetApartmentState(ApartmentState.STA);
            m_thread.Start();

            while (formInitialized == false) ;
        }
Ejemplo n.º 3
0
        private QuickPasteCommand(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            this.package = package;

            OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (commandService != null)
            {
                var menuCommandID = new CommandID(CommandSet, CommandId);
                var menuItem      = new MenuCommand(this.OpenPasteMenu, menuCommandID);
                commandService.AddCommand(menuItem);
            }

            m_oContextMenu = new ContextMenu();

            m_oClipboardForm = new ClipboardForm(m_oCopyHistory);
        }