private void lstCategory_DoubleClick(object sender, EventArgs e) { string lcKey; lcKey = Convert.ToString(lstCategory.SelectedItem); if (lcKey != null) { try { FrmCategory.Run(lstCategory.SelectedItem as string); } catch (Exception ex) { MessageBox.Show(ex.Message, "This should never occur"); } } }
public static void Run(string prCategory) { FrmCategory lcCategoryForm; if (string.IsNullOrEmpty(prCategory) || !_CategoryFormList.TryGetValue(prCategory, out lcCategoryForm)) { lcCategoryForm = new FrmCategory(); if (string.IsNullOrEmpty(prCategory)) { lcCategoryForm.SetDetails(new clsCategory()); } else { _CategoryFormList.Add(prCategory, lcCategoryForm); lcCategoryForm.refreshFormFromDBAsync(prCategory); } } else { lcCategoryForm.Show(); lcCategoryForm.Activate(); } }