Esempio n. 1
0
        public CMSConfigPanel[] GetPanels()
        {
            CMSConfigPanel[] panels = new CMSConfigPanel[3];

            if (trackingModule != null)
            {
                panels[0] = this.trackingModule.getPanel();
            }
            if (mouseControlModule != null)
            {
                panels[1] = this.mouseControlModule.getPanel();
            }
            if (clickControlModule != null)
            {
                panels[2] = this.clickControlModule.getPanel();
            }

            return(panels);
        }
Esempio n. 2
0
        /// <summary>
        /// Toggles Whether or not the advanced view shows a tracker.
        /// </summary>
        /// <param name="trackerSelected"></param>
        public void SetTrackerSelected(bool trackerSelected)
        {
            if (trackerSelectionControl == null)
            {
                return;
            }

            this.SuspendLayout();
            this.tabControl.SuspendLayout();
            tabPageAdvancedView.SuspendLayout();

            trackerSelectionControl.SetActive(!trackerSelected);
            if (trackerSelected)
            {
                CMSTrackingSuite currentTracker = viewAdapter.GetCurrentTrackingSuite();

                if (currentTracker == null)
                {
                    throw new Exception("No current tracker");
                }

                if (currentTracker.Name.Equals(selectedSuiteName))
                {
                    foreach (Control control in tabPageAdvancedView.Controls)
                    {
                        CMSConfigPanel configPanel = control as CMSConfigPanel;
                        if (configPanel != null)
                        {
                            configPanel.Init(SendTrackerLog);
                            configPanel.LoadFromControls();
                        }
                    }
                }
                else
                {
                    selectedSuiteName = currentTracker.Name;

                    tabPageAdvancedView.Controls.Clear();
                    int maxWidth    = trackerSelectionControl.Width;
                    int totalHeight = 3 + trackerSelectionControl.Height + this.bottomActiveControl.Height;
                    CMSConfigPanel[] trackerPanels = currentTracker.GetPanels();

                    foreach (CMSConfigPanel configPanel in trackerPanels)
                    {
                        if (configPanel == null)
                        {
                            continue;
                        }
                        configPanel.Init(SendTrackerLog);
                        Control trackerPanel = configPanel as Control;
                        if (trackerPanel == null)
                        {
                            continue;
                        }
                        if (trackerPanel.Width > maxWidth)
                        {
                            maxWidth = trackerPanel.Width;
                        }
                        totalHeight += trackerPanel.Height;
                    }
                    totalHeight += 3;
                    int totalWidth = 12 + maxWidth;
                    tabPageAdvancedView.Size = new Size(totalWidth, totalHeight);
                    tabControl.Size          = new Size(totalWidth + 8, totalHeight + 26);
                    Size = new Size(totalWidth + 19, totalHeight + 55);

                    Point trackerSelectionControlPt = new Point((totalWidth - trackerSelectionControl.Width) / 2, 3);
                    trackerSelectionControl.Location = trackerSelectionControlPt;

                    int curHeight = 3 + trackerSelectionControl.Height;

                    tabPageAdvancedView.Controls.Add(trackerSelectionControl);

                    foreach (Control trackerPanel in trackerPanels)
                    {
                        if (trackerPanel == null)
                        {
                            continue;
                        }
                        Point curPt = new Point((totalWidth - trackerPanel.Width) / 2, curHeight);
                        trackerPanel.Location = curPt;
                        tabPageAdvancedView.Controls.Add(trackerPanel);
                        curHeight += trackerPanel.Height;
                    }
                    Point bottomActivePt = new Point((totalWidth - this.bottomActiveControl.Width) / 2, curHeight);
                    bottomActiveControl.Location = bottomActivePt;
                    tabPageAdvancedView.Controls.Add(bottomActiveControl);
                }
            }
            else
            {
                tabPageAdvancedView.Controls.Clear();
                selectedSuiteName = null;
                trackerSelectionControl.Location = new Point(6, 3);
                tabPageAdvancedView.Controls.Add(trackerSelectionControl);
                Size                     = new Size(697, 435);
                tabControl.Size          = new Size(686, 406);
                tabPageAdvancedView.Size = new Size(678, 380);
                tabPageAdvancedView.Controls.Add(bottomInActiveControl);
            }
            this.ResumeLayout(false);
            this.tabControl.ResumeLayout(false);
            tabPageAdvancedView.ResumeLayout(false);
            tabPageAdvancedView.PerformLayout();
            Invalidate();
        }