/// <summary>
 /// Updates the currently refered to layer pane
 /// </summary>
 /// <param name="layerManagerPane"></param>
 private void UpdateLayerManagerPaneInstance(LayerManagerPane layerManagerPane)
 {
     this.layerManagerPaneInstance = layerManagerPane;
     this.layerManagerPaneInstance.DataContext = this.layerDetailsViewModel;
 }
        /// <summary>
        /// This function is used to initialize the WorkflowController class.
        /// </summary>
        internal void Initialize(LayerManagerPane layerManagerPane, Ribbon ribbon)
        {
            if (ribbon != null)
            {
                this.layerManagerPaneInstance = layerManagerPane;
                this.ribbonInstance = ribbon;
                this.AttachRibbonEventHandlers();

                // Create WorkbookMap for Active workbook
                // Check if Active workbook has a BookMap stored. If yes de-serialize it. Else create a new map
                this.currentWorkbookMap = ThisAddIn.ExcelApplication.ActiveWorkbook.GetWorkbookMap();
                this.currentViewpointMap = ThisAddIn.ExcelApplication.ActiveWorkbook.GetViewpointMap();

                // Add this to the workbook map list
                this.workBookMaps.Add(this.currentWorkbookMap);
                this.viewpointMaps.Add(this.currentViewpointMap);

                this.ribbonInstance.BuildViewpointMenu(this.currentViewpointMap.SerializablePerspective);
                this.BuildAndBindLayerDetailsViewModel();

                // check for updates
                this.updateManager.CheckForUpdates();

                //When launched from installer, Excel is already up and running before the addIn loads. Events are already fired!
                //Functionality of LayerTaskPaneController does not work as expected. So we explicitly set the WorkflowController to refer to the LayerManagerPane.
                if(LayerTaskPaneController.IsExcelInstanceSDI)
                    if (ThisAddIn.ExcelApplication.Workbooks.Count == 1)    //During Initialization if count is 1, workbook is already opened. Other scenarios count is 0 during Initialization
                        UpdateLayerManagerPaneInstance(LayerTaskPaneController.Instance.CurrentPaneHost.LayerManagerPane);
            }
        }
 /// <summary>
 /// When in Excel is SDI, the pane-workbook collection is managed by 'LayerTaskPaneController'.
 /// When active workbook changes, corresponding task pane changes. Workflow controller needs to be refering to current task pane
 /// </summary>
 void OnLayerPaneChangedEvent(LayerManagerPane pane)
 {
     UpdateLayerManagerPaneInstance(pane);
 }