protected void DisplayTallyPanel(Stratum stratumInfo, bool leaveOpen) { System.Diagnostics.Debug.Assert(StrataViews.ContainsKey(stratumInfo)); if (!StrataViews.ContainsKey(stratumInfo)) { return; } Panel tallyContainer = StrataViews[stratumInfo]; // if strata is already displayed if (_visableTallyPanel != null && _visableTallyPanel == tallyContainer && tallyContainer.Visible == true) { if (!leaveOpen) { // toggle off visibility _visableTallyPanel.Visible = false; this.SelectedStratum = null; _visableTallyPanel = null; } return; } else if (_visableTallyPanel != null && _visableTallyPanel != tallyContainer) { // hide current stratum _visableTallyPanel.Visible = false; } this.SelectedStratum = stratumInfo; _visableTallyPanel = tallyContainer; if (_visableTallyPanel != null) { _visableTallyPanel.Visible = true; } }
protected void InitializeStrataViews() { SuspendLayout(); foreach (Stratum stratum in DataService.TreeStrata) { if (stratum.Method == CruiseDAL.Schema.CruiseMethods.H_PCT) { continue; } //if ((Controller.GetStrataDataEntryMode(stratum) & DataEntryMode.Plot) // == DataEntryMode.Plot) { continue; } Button strataButton = new Button(); Panel tallyContainer = new Panel(); //StratumInfo stratumInfo = new StratumInfo(stratum); //stratum.TallyContainer = tallyContainer; //Strata.Add(stratumInfo); //tallyContainer.SuspendLayout(); //strataButton.SuspendLayout(); tallyContainer.Dock = DockStyle.Top; tallyContainer.Visible = false; tallyContainer.Parent = this.StrataViewContainer; tallyContainer.Tag = stratum; strataButton.Height = 25; strataButton.BackColor = System.Drawing.Color.FromArgb(0x2F, 0x4F, 0x4F); //Color.DarkSlateGray;// DarkGray;// Green;System.Drawing.Color.FromArgb(0x2F, 0x4F, 0x4F); strataButton.ForeColor = Color.White; strataButton.Text = stratum.GetDescriptionShort(); if (stratum.Hotkey != null && stratum.Hotkey.Length > 0) { strataButton.Text += "[" + stratum.Hotkey.Substring(0, 1) + "]"; } strataButton.Click += new EventHandler(OnStrataButtonClicked); strataButton.Dock = DockStyle.Top; #if NetCF FMSC.Controls.DpiHelper.AdjustControl(strataButton); #endif strataButton.Parent = this.StrataViewContainer; strataButton.Tag = stratum; StrataViews.Add(stratum, tallyContainer); foreach (CountTree count in stratum.Counts) { MakeTallyRow(tallyContainer, count); AdjustPanelHeight(tallyContainer); } if (string.IsNullOrEmpty(stratum.Hotkey) == false) { StrataHotKeyLookup.Add(char.ToUpper(stratum.Hotkey[0]), stratum); } } //if there is only one strata in the unit //display the counts for that stratum var strata = DataService.TreeStrata; if (strata.Count() == 1) { var singleStratum = strata.First(); this.DisplayTallyPanel(singleStratum); } this.ResumeLayout(false); }