public CategoryDisplayFormW3M1(CategoryContext ctx, Point? anchor) { this.ctx = ctx; this.anchor = anchor; InitializeComponent(); if (ctx.MaxCategoryNameLength > 0) txtNewCategory.MaxLength = ctx.MaxCategoryNameLength; /* TODO: Whoops, missed UI Freeze... do this later txtFilter.AccessibleName = Res.Get(StringId.CategoryCategoryFilter); cbParent.AccessibleName = Res.Get(StringId.CategoryNewCategoryParent); */ txtNewCategory.AccessibleName = Res.Get(StringId.CategoryCategoryName); btnRefresh.AccessibleName = Res.Get(StringId.CategoryRefreshList); grpAdd.Enter += delegate { AcceptButton = btnDoAdd; }; grpAdd.Leave += delegate { AcceptButton = null; }; grpAdd.Text = Res.Get(StringId.CategoryAdd); btnDoAdd.Text = Res.Get(StringId.AddButton2); toolTip.SetToolTip(btnRefresh, Res.Get(StringId.CategoryRefreshList)); ControlHelper.SetCueBanner(txtNewCategory, Res.Get(StringId.CategoryCategoryName)); lblNone.Text = Res.Get(StringId.CategoryControlNoCategories2); RefreshParentCombo(); btnRefresh.Image = ResourceHelper.LoadAssemblyResourceBitmap("OpenPost.Images.RefreshPostListEnabled.png"); btnRefresh.ImageAlign = ContentAlignment.MiddleCenter; pictureBox1.Image = ResourceHelper.LoadAssemblyResourceBitmap("PostPropertyEditing.CategoryControl.Images.Search.png"); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; DismissOnDeactivate = true; Control selectorControl; if (ctx.SelectionMode == CategoryContext.SelectionModes.SingleSelect) selectorControl = new RadioCategorySelector(ctx); else if (ctx.SelectionMode == CategoryContext.SelectionModes.MultiSelect) selectorControl = new TreeCategorySelector(ctx); else throw new ArgumentException("Unexpected selection mode: " + ctx.SelectionMode); lblNone.BringToFront(); lblNone.Visible = ctx.Categories.Length == 0; selector = (ICategorySelector)selectorControl; AdaptAddCategories(); ctx.Changed += ctx_Changed; Disposed += delegate { ctx.Changed -= ctx_Changed; }; selectorControl.Dock = DockStyle.Fill; selectorContainer.Controls.Add(selectorControl); txtFilter.AccessibleName = Res.Get(StringId.FindCategory); cbParent.AccessibleName = ControlHelper.ToAccessibleName(Res.Get(StringId.CategoryParentAccessible)); }
public CategoryDisplayFormW3M1(CategoryContext ctx, Point?anchor) { this.ctx = ctx; this.anchor = anchor; InitializeComponent(); if (ctx.MaxCategoryNameLength > 0) { txtNewCategory.MaxLength = ctx.MaxCategoryNameLength; } /* TODO: Whoops, missed UI Freeze... do this later * txtFilter.AccessibleName = Res.Get(StringId.CategoryCategoryFilter); * cbParent.AccessibleName = Res.Get(StringId.CategoryNewCategoryParent); */ txtNewCategory.AccessibleName = Res.Get(StringId.CategoryCategoryName); btnRefresh.AccessibleName = Res.Get(StringId.CategoryRefreshList); grpAdd.Enter += delegate { AcceptButton = btnDoAdd; }; grpAdd.Leave += delegate { AcceptButton = null; }; grpAdd.Text = Res.Get(StringId.CategoryAdd); btnDoAdd.Text = Res.Get(StringId.AddButton2); toolTip.SetToolTip(btnRefresh, Res.Get(StringId.CategoryRefreshList)); ControlHelper.SetCueBanner(txtNewCategory, Res.Get(StringId.CategoryCategoryName)); lblNone.Text = Res.Get(StringId.CategoryControlNoCategories2); RefreshParentCombo(); btnRefresh.Image = ResourceHelper.LoadAssemblyResourceBitmap("OpenPost.Images.RefreshPostListEnabled.png"); btnRefresh.ImageAlign = ContentAlignment.MiddleCenter; pictureBox1.Image = ResourceHelper.LoadAssemblyResourceBitmap("PostPropertyEditing.CategoryControl.Images.Search.png"); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; DismissOnDeactivate = true; Control selectorControl; if (ctx.SelectionMode == CategoryContext.SelectionModes.SingleSelect) { selectorControl = new RadioCategorySelector(ctx); } else if (ctx.SelectionMode == CategoryContext.SelectionModes.MultiSelect) { selectorControl = new TreeCategorySelector(ctx); } else { throw new ArgumentException("Unexpected selection mode: " + ctx.SelectionMode); } lblNone.BringToFront(); lblNone.Visible = ctx.Categories.Length == 0; selector = (ICategorySelector)selectorControl; AdaptAddCategories(); ctx.Changed += ctx_Changed; Disposed += delegate { ctx.Changed -= ctx_Changed; }; selectorControl.Dock = DockStyle.Fill; selectorContainer.Controls.Add(selectorControl); txtFilter.AccessibleName = Res.Get(StringId.FindCategory); cbParent.AccessibleName = ControlHelper.ToAccessibleName(Res.Get(StringId.CategoryParentAccessible)); }