Esempio n. 1
0
        private void viewProxyDefinitionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                ListView view = GetListViewForMenu(sender);
                if (view != null && view.SelectedIndices.Count > 0)
                {
                    ListViewItem item = view.SelectedItems[0];
                    Tuple <COMInterfaceInstance, COMInterfaceEntry> intf =
                        item.Tag as Tuple <COMInterfaceInstance, COMInterfaceEntry>;

                    if (m_registry.Clsids.ContainsKey(intf.Item2.ProxyClsid))
                    {
                        COMCLSIDEntry clsid = m_registry.Clsids[intf.Item2.ProxyClsid];
                        using (var resolver = Program.GetProxyParserSymbolResolver())
                        {
                            Program.GetMainForm(m_registry).HostControl(new TypeLibControl(m_registry,
                                                                                           Path.GetFileName(clsid.DefaultServer), COMProxyInstance.GetFromCLSID(clsid, resolver), intf.Item1.Iid));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Program.ShowError(this, ex);
            }
        }
Esempio n. 2
0
 private void menuFileOpenProxyDll_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.Filter = "Executable Files (*.dll;*.ocx)|*.dll;*.ocx|All Files (*.*)|*.*";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             try
             {
                 using (var resolver = Program.GetProxyParserSymbolResolver())
                 {
                     COMProxyInstance proxy = COMProxyInstance.GetFromFile(dlg.FileName, resolver);
                     HostControl(new TypeLibControl(m_registry, Path.GetFileName(dlg.FileName), proxy, Guid.Empty));
                 }
             }
             catch (Exception ex)
             {
                 Program.ShowError(this, ex);
             }
         }
     }
 }