public bool PreviewKeypress(string keyStr) { if (string.IsNullOrEmpty(keyStr)) { return(false); } if (keyStr == ApplicationSettings.Instance.JumpTreeTallyKeyStr) { this.DataEntryController.View.GotoTreePage(); return(true); } else if (keyStr == ApplicationSettings.Instance.UntallyKeyStr) { OnUntallyButtonClicked(null, null); return(true); } else if (keyStr.Length == 1) { var keyChar = keyStr.First(); if (StrataHotKeyLookup.ContainsKey(keyChar)) { DisplayTallyPanel(StrataHotKeyLookup[keyChar], true); return(true); } } return(false); }
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); }