Visual studio 2010 盒子。通过外部调用,messagebox在您关闭“撰写电子邮件”窗口之前不会显示。这可能就是我出问题的原因:(这可能是由于MessageBox的家长问题。当你在ThisAddIn中时,你没有指定哪个窗口是家长。我有一种方法可以在外部compose窗口启动之

Visual studio 2010 盒子。通过外部调用,messagebox在您关闭“撰写电子邮件”窗口之前不会显示。这可能就是我出问题的原因:(这可能是由于MessageBox的家长问题。当你在ThisAddIn中时,你没有指定哪个窗口是家长。我有一种方法可以在外部compose窗口启动之,visual-studio-2010,vsto,outlook-2010,customtaskpane,Visual Studio 2010,Vsto,Outlook 2010,Customtaskpane,盒子。通过外部调用,messagebox在您关闭“撰写电子邮件”窗口之前不会显示。这可能就是我出问题的原因:(这可能是由于MessageBox的家长问题。当你在ThisAddIn中时,你没有指定哪个窗口是家长。我有一种方法可以在外部compose窗口启动之前启动ThisAddIn\u?如果你能共享这样的方法,那就太好了:) private void ThisAddIn_Startup(object sender, System.EventArgs e) { //Mess


盒子。通过外部调用,messagebox在您关闭“撰写电子邮件”窗口之前不会显示。这可能就是我出问题的原因:(这可能是由于MessageBox的家长问题。当你在ThisAddIn中时,你没有指定哪个窗口是家长。我有一种方法可以在外部compose窗口启动之前启动ThisAddIn\u?如果你能共享这样的方法,那就太好了:)
private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {

        //MessageBox.Show(,"TEST");
        try
        {               
            inspectors = Globals.ThisAddIn.Application.Inspectors;
            inspectors.NewInspector += new InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            foreach (Inspector insp in inspectors)
            {
                //insp.
                Inspectors_NewInspector(insp);
            }
        }
        catch (System.Exception ex)
        {
            List<string> lalala = new List<string>();
            lalala.Add(ex.GetType().ToString());
            lalala.Add(ex.Message);
            lalala.Add(ex.StackTrace);
            File.WriteAllLines(@"C:\outdebug",lalala.ToArray());
        }
    }
void Inspectors_NewInspector(Inspector Inspect)
    {
        try
        {
            if (Inspect.CurrentItem is MailItem)
            {
                Global.mail = Inspect.CurrentItem;
                Global.inspectorWrappersValue.Add(Inspect, new InspectorWrapper(Inspect, Global.mail));
                //inspectorw
            }
        }
        catch (System.Exception ex)
        {
            List<string> lalala = new List<string>();
            lalala.Add(ex.GetType().ToString());
            lalala.Add(ex.Message);
            lalala.Add(ex.StackTrace);
            lalala.Add(Global.SiteConnectionManager.ToString());
            File.WriteAllText(@"C:\Users\cat\Desktop\outdebug.txt", string.Join("\n", lalala), Encoding.UTF8);
        }
    }
public partial class ThisAddIn
{
    private DispatchTimer _newInspectorStartupTimer;

    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        try
        {
            // check for existing explorers and inspectors and
            // set up event handlers for new ones

            // here is how you set up the inspector event handler:
            ThisAddIn.Application.Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            // create a timer.  When the timer fires, check if any
            // Inspector windows currently exist, and add task panes
            // for them if needed.
            _newInspectorStartupTimer = new DispatcherTimer();
            _newInspectorStartupTimer.Interval = TimeSpan.FromSeconds(2.0);
            _newInspectorStartupTimer.Tick += new EventHandler(NewInspectorStartupTimer_Tick);
            _newInspectorStartupTimer.Start();
        }
        catch (System.Exception ex)
        {
            // log the exception type, message, and stack trace here
        }
    }

    private void NewInspectorStartupTimer_Tick(object sender, EventArgs e)
    {
        int inspectorCount = _inspectors.Count;
        if (inspectorCount > 0)
        {
            for (int i = 1; i <= _inspectors.Count; ++i)
            {
                Inspector inspector = _inspectors[i];
                Inspectors_NewInspector(inspector);
            }
        }
    }

    // Inspectors_NewInspector also has a try/catch.  Note that
    // Inspectors_NewInspector will be called multiple times
    // for each inspector, due to the timer.
    private void Inspectors_NewInspector(Inspector inspector)
    {
        try
        {
            // you need to check whether you have already created a
            // task pane for this inspector.  If not, create your
            // task pane here.
        }
        catch (System.Exception ex)
        {
            // log the exception type, message, and stack trace here
        }
    }