コード例 #1
0
 void ViewProviderOnUpdateCustomTaskPanesVisibilityForContext(object sender,
                                                              HideCustomTaskPanesForContextEventArgs hideCustomTaskPanesForContextEventArgs)
 {
     customTaskPaneRegister.ChangeVisibilityForContext(hideCustomTaskPanesForContextEventArgs.Context,
                                                       hideCustomTaskPanesForContextEventArgs.Visible);
 }
コード例 #2
0
 void ViewProviderOnUpdateCustomTaskPanesVisibilityForContext(object sender, 
     HideCustomTaskPanesForContextEventArgs hideCustomTaskPanesForContextEventArgs)
 {
     customTaskPaneRegister.ChangeVisibilityForContext(hideCustomTaskPanesForContextEventArgs.Context,
         hideCustomTaskPanesForContextEventArgs.Visible);
 }
コード例 #3
0
        void OnInitialise(Workbook wb)
        {
            var handler = NewView;

            if (handler == null)
            {
                return;
            }
            if (!workbooks.ContainsKey(wb))
            {
                workbooks.Add(wb, new List <Window>());
            }

            if (IsMdi())
            {
                if (singleWindow == null)
                {
                    singleWindow = wb.Windows[1];
                }
                workbooks[wb].Add(singleWindow);
                handler(this, new NewViewEventArgs(singleWindow, wb, ExcelRibbonType.ExcelWorkbook.GetEnumDescription()));
            }
            else
            {
                foreach (Window window in wb.Windows)
                {
                    workbooks[wb].Add(window);
                    handler(this, new NewViewEventArgs(window, wb, ExcelRibbonType.ExcelWorkbook.GetEnumDescription()));
                }
            }

            wb.WindowActivate += wn =>
            {
                if (IsMdi() && !workbooks[wb].Contains(singleWindow))
                {
                    workbooks[wb].Add(singleWindow);
                }
                if (!IsMdi() && !workbooks[wb].Contains(wn))
                {
                    var windows = workbooks[wb];
                    if (windows.All(w => ((dynamic)w).Hwnd != ((dynamic)wn).Hwnd))
                    {
                        windows.Add(wn);
                        handler(this, new NewViewEventArgs(wn, wb, ExcelRibbonType.ExcelWorkbook.GetEnumDescription()));
                    }
                }

                if (IsMdi())
                {
                    UpdateCustomTaskPanesVisibilityForContext(this, new HideCustomTaskPanesForContextEventArgs(wb, true));
                }
            };
            wb.WindowDeactivate += wn =>
            {
                if (IsMdi())
                {
                    var args = new HideCustomTaskPanesForContextEventArgs(wb, false);
                    UpdateCustomTaskPanesVisibilityForContext(this, args);
                }
            };
        }