private void Add_Executed(object sender, ExecutedRoutedEventArgs e) { var ofd = new OpenFileDialog { AddExtension = true, CheckFileExists = true, Title = "Open a Resource Dictionay", Filter = "Resource Dictionay (*.xaml)|*.xaml;" }; var result = ofd.ShowDialog(); if (result.HasValue && result.Value) { #region Validation var subs = ofd.FileName.Substring(ofd.FileName.IndexOf("StringResources")); if (Application.Current.Resources.MergedDictionaries.Any(x => x.Source.OriginalString.Contains(subs))) { Dialog.Ok("Action Denied", "You can't add a resource with the same name.", "Try renaming like: StringResources.[Language Code].xaml"); return; } var pieces = subs.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries); if (pieces.Length != 3) { Dialog.Ok("Action Denied", "Filename wrong format.", "Try renaming like: StringResources.[Language Code].xaml"); return; } var culture = new CultureInfo(pieces[1]); if (culture.EnglishName.Contains("Unknown")) { Dialog.Ok("Action Denied", "Unknown Language.", $"The \"{pieces[1]}\" was not recognized as a valid language code."); return; } #endregion if (LocalizationHelper.ImportStringResource(ofd.FileName)) { var resourceDictionary = Application.Current.Resources.MergedDictionaries.LastOrDefault(); var imageItem = new ImageListBoxItem(); imageItem.Tag = resourceDictionary.Source.OriginalString; imageItem.Content = resourceDictionary.Source.OriginalString; imageItem.Image = FindResource("Vector.Translate") as Canvas; imageItem.Author = "Recognized as " + pieces[1]; ResourceListBox.Items.Add(imageItem); } } }
private void UpdateEffectGroupList() { if (lstEffectDLL.SelectedIndex < 0) { lstEffectGroup.Items.Clear(); lstEffect.Items.Clear(); lblEffectDescription.Text = ""; imgEffectPreview.Source = original; return; } String asmName = (lstEffectDLL.SelectedItem as ListBoxItem).Tag as String; var list = from value in Plugin.Manager.PluginManager.PluginEffectList where value.GetType().Assembly.Location.EqualsIgnoreCase(asmName) orderby value.Group.Name ascending group value by value.Group; lstEffectGroup.Items.Clear(); foreach (var group in list) { ImageListBoxItem lbi = new ImageListBoxItem(); lbi.Icon = group.Key.Image.Source; lbi.Content = group.Key.Name; lbi.Tag = group.Key; lstEffectGroup.Items.Add(lbi); } }
private void UpdateEffectList() { if (lstEffectGroup.SelectedIndex < 0) { lstEffect.Items.Clear(); lblEffectDescription.Text = ""; imgEffectPreview.Source = original; return; } EffectGroup effGroup = (lstEffectGroup.SelectedItem as ListBoxItem).Tag as EffectGroup; var list = from value in Plugin.Manager.PluginManager.PluginEffectList where value.Group.Equals(effGroup) orderby value.Name ascending select value; lstEffect.Items.Clear(); foreach (IEffect eff in list) { ImageListBoxItem lbi = new ImageListBoxItem(); lbi.Icon = eff.Icon.Source; lbi.Content = eff.Name; lbi.Tag = eff; lstEffect.Items.Add(lbi); } }
private void UpdateRenderList() { if (lstRenderGroup.SelectedIndex < 0) { lstRenderer.Items.Clear(); lblRenderDescription.Text = ""; imgRenderPreview.Source = original; return; } RendererGroup rendererGroup = (lstRenderGroup.SelectedItem as ListBoxItem).Tag as RendererGroup; var list = from value in Plugin.Manager.PluginManager.PluginRendererList where value.Group.Equals(rendererGroup) orderby value.Name ascending select value; lstRenderer.Items.Clear(); foreach (IRenderer renderer in list) { ImageListBoxItem lbi = new ImageListBoxItem(); lbi.Icon = renderer.Icon.Source; lbi.Content = renderer.Name; lbi.Tag = renderer; lstRenderer.Items.Add(lbi); } }
public void Search(DataTable Employees, string Value) { this.imgListEmployee.Items.Clear(); if (Employees.Rows.Count > 0) { foreach (DataRow row in Employees.Rows) { if ((row["EmployeeCode"].ToString().ToLower().Contains(Value.ToLower()) || row["FirstName"].ToString().ToLower().Contains(Value.ToLower()) ? true : row["LastName"].ToString().ToLower().Contains(Value.ToLower()))) { ImageListBoxItem imageListBoxItem = new ImageListBoxItem(); if (!(bool)row["Sex"]) { imageListBoxItem.ImageIndex = 1; } else { imageListBoxItem.ImageIndex = 0; } string[] str = new string[] { "(", row["EmployeeCode"].ToString(), ") - ", row["FirstName"].ToString(), " ", row["LastName"].ToString() }; imageListBoxItem.Value = string.Concat(str); this.imgListEmployee.Items.Add(imageListBoxItem); } } } }
void listBoxControl1_Click(object sender, EventArgs e) { ImageListBoxItem item = imageListBoxControl1.SelectedItem as ImageListBoxItem; (item.Value as DXMenuItemWrapper).GenerateClickEvent(); Close(); }
public void LoadData(int Status, int Level, string Code) { this.m_Status = Status; this.m_Level = Level; this.m_Code = Code; HRM_EMPLOYEE hRMEMPLOYEE = new HRM_EMPLOYEE(); this.dt_Employee = hRMEMPLOYEE.GetListCurrentNow(this.m_Level, this.m_Code, this.m_Status); this.imgListEmployee.Items.Clear(); if (this.dt_Employee.Rows.Count > 0) { foreach (DataRow row in this.dt_Employee.Rows) { ImageListBoxItem imageListBoxItem = new ImageListBoxItem(); if (!bool.Parse(row["Sex"].ToString())) { imageListBoxItem.ImageIndex = 1; } else { imageListBoxItem.ImageIndex = 0; } string[] str = new string[] { "(", row["EmployeeCode"].ToString(), ") - ", row["FirstName"].ToString(), " ", row["LastName"].ToString() }; imageListBoxItem.Value = string.Concat(str); this.imgListEmployee.Items.Add(imageListBoxItem); } } }
private void ilstMaterialPreparation_SelectedIndexChanged(object sender, EventArgs e) { ImageListBoxItem item = ilstMaterialPreparation.SelectedItem as ImageListBoxItem; if (item != null) { TMaterialPreparationInfo mp = item.Value as TMaterialPreparationInfo; if (mp != null) { grdPWOs.DataSource = mp.PWOs; } else { grdPWOs.DataSource = null; } } else { grdPWOs.DataSource = null; } grdvPWOs.BestFitColumns(); Refresh(); }
private void ilstBatchNo_SelectedIndexChanged(object sender, EventArgs e) { if (ilstBatchNo.SelectedItem == null) { grdPWOs.DataSource = null; GetMethodStandards(0, 0, ""); return; } ImageListBoxItem item = ilstBatchNo.SelectedItem as ImageListBoxItem; if (item.Value is BatchByWorkday) { ImageComboBoxItem cboItem = icboEquipment.SelectedItem as ImageComboBoxItem; int t107LeafID = (cboItem.Value as WIPStation).T107LeafID; string batchNo = ((BatchByWorkday)item.Value).BatchNumber; List <BatchPWOInfo> pwos = GetPWOWithBatchNo(t107LeafID, batchNo); grdPWOs.DataSource = pwos; grdvPWOs.BestFitColumns(); GetMethodStandards(0, (cboItem.Value as WIPStation).T216LeafID, batchNo); } else { IRAPMessageBox.Instance.Show("选择项值对象的类型不是 BatchByWorkday", "", MessageBoxIcon.Error); } }
public override HitBox HitTest() { if (!IsVisible()) { return(HitBox.Miss); } HitBox hit; if ((hit = _scrollBar.HitTest()).IsHit) { return(hit); } for (int i = VerticalScrollIndex; i < _items.Count && i - VerticalScrollIndex < VerticalMaxVisibleItems; i++) { if (!_items[i].HitTest()) { continue; } _selectedItem = _items[i]; OnSelect?.Invoke(_items[i].Value); return(HitBox.Hit(this)); } _clickable.HitTest(MouseButton.Left); if (_clickable.IsDown(MouseButton.Left)) { return(HitBox.Hit(this)); } return(HitBox.Miss); }
/// <summary> /// Adds the item to ListBox. /// </summary> /// <param name="iconType">Type of the icon.</param> /// <param name="sValue">The s value.</param> /// <param name="imageListBoxControl1">The image ListBox control1.</param> public static void AddItemToListBox(IconType iconType, string sValue, ImageListBoxControl imageListBoxControl1) { ImageListBoxItem imageListBoxItem = new ImageListBoxItem(); imageListBoxItem.ImageIndex = (int)iconType; imageListBoxItem.Value = sValue; imageListBoxControl1.Items.Add(imageListBoxItem); }
/// <summary> /// 向报表列表添加项目 /// </summary> /// <param name="objItem"></param> private void AddItem(object objItem) { ImageListBoxItem Litem = new ImageListBoxItem(); Litem.ImageIndex = 0; Litem.Value = objItem; ReportList.Items.Add(Litem); }
public void Select(T value) { var index = _items.FindIndex(it => it.Value.Equals(value)); _selectedItem = _items[index]; OnSelect?.Invoke(value); VerticalScrollTo(index.Clamp(0, VerticalMaxScrollIndex)); }
/// <summary> /// Handles the <see cref="ButtonBase.Click"/> event for the "Add Image" <see /// cref="Button"/>.</summary> /// <param name="sender"> /// The <see cref="Object"/> where the event handler is attached.</param> /// <param name="args"> /// A <see cref="RoutedEventArgs"/> object containing event data.</param> /// <remarks><para> /// <b>OnImageAdd</b> shows an error message if the "Image File" list view is empty. /// Otherwise, <b>OnImageAdd</b> displays a <see cref="Dialog.ChangeIdentifier"/> dialog, /// followed by a <see cref="Dialog.ChangeImage"/> dialog, allowing the user to define a new /// image. The new image copies the properties of the selected image, if any; otherwise, it /// is created with default properties. /// </para><para> /// If the user confirmed both dialogs, <b>OnImageAdd</b> adds the new image to the <see /// cref="ImageListBox"/> and to the current <see cref="ImageSection"/>, and sets the <see /// cref="SectionTabItem.DataChanged"/> flag.</para></remarks> private void OnImageAdd(object sender, RoutedEventArgs args) { args.Handled = true; // abort if there are no image files if (FileList.Items.Count == 0) { MessageBox.Show(MainWindow.Instance, Global.Strings.DialogImageFileNone, Global.Strings.TitleImageFileNone, MessageBoxButton.OK, MessageBoxImage.Information); return; } // ask user for new image ID var images = MasterSection.Instance.Images.Collection; var dialog = new Dialog.ChangeIdentifier("image-id", Global.Strings.TitleImageIdEnter, images.ContainsKey, false); dialog.Owner = MainWindow.Instance; if (dialog.ShowDialog() != true) { return; } // retrieve new image ID string id = String.Intern(dialog.Identifier); // create new image based on selected image, if any var selection = ImageList.SelectedItem as ImageListBoxItem; EntityImage image = (selection == null ? new EntityImage() : (EntityImage)((EntityImage)selection.Content).Clone()); image.Id = id; // let user make changes to new image var imageDialog = new Dialog.ChangeImage(image) { Owner = MainWindow.Instance }; if (imageDialog.ShowDialog() != true) { return; } // add image to section table images.Add(id, image); // update list box and select new item var item = new ImageListBoxItem(image); int index = ImageList.Insert(item); ImageList.SelectAndShow(index); // broadcast data changes EnableListButtons(); SectionTab.DataChanged = true; }
public void addChangeLog(ImageListBox listBox, Changelog changelog, String updateName, String baseType, int imageIndex) { Logger.log(Logger.TYPE.DEBUG, "Add changelog."); String text = "[" + changelog.getVersion() + baseType + "] " + updateName; ImageListBoxItem item = new ImageListBoxItem(text, imageIndex); listBox.Items.Add(item); }
private void C_BtnRemove_Click(object sender, System.EventArgs e) { ImageListBoxItem selectedItem = this.C_ListHorizontalColumns.SelectedItem as ImageListBoxItem; if (selectedItem != null && selectedItem.Value is HorizontalGridColumn) { hGridColumns.Remove(selectedItem.Value as HorizontalGridColumn); this.C_ListHorizontalColumns.Items.Remove(selectedItem); } }
private void LoadImage(string[] lstImage) { devImageList.ImageList = imlImages; for (int i = 0, len = lstImage.Length; i < len; i++) { var item = lstImage[i]; Image img = Image.FromFile(item); imlImages.Images.Add(img); ImageListBoxItem itemListImage = new ImageListBoxItem(item, i); devImageList.Items.Add(itemListImage); } }
public override void SetView(Webb.Reports.ExControls.Views.ExControlView i_View) { this.C_ListSeries.Items.Clear(); foreach (Series series in Setting.SeriesCollection) { ImageListBoxItem item = new ImageListBoxItem(series, 0); this.C_ListSeries.Items.Add(item); } this.C_ListSeries.SelectedIndex = 0; }
private void Localization_OnLoaded(object sender, RoutedEventArgs e) { foreach (var resourceDictionary in Application.Current.Resources.MergedDictionaries) { var imageItem = new ImageListBoxItem { Tag = resourceDictionary.Source?.OriginalString ?? "Settings", Content = resourceDictionary.Source?.OriginalString ?? "Settings" }; if (resourceDictionary.Source == null) { imageItem.IsEnabled = false; imageItem.Image = FindResource("Vector.No") as Canvas; imageItem.Author = "This is a settings dictionary."; } else if (resourceDictionary.Source.OriginalString.Contains("StringResources")) { imageItem.Image = FindResource("Vector.Translate") as Canvas; #region Name var subs = resourceDictionary.Source.OriginalString.Substring(resourceDictionary.Source.OriginalString.IndexOf("StringResources")); var pieces = subs.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries); if (pieces.Length == 3) { imageItem.Author = "Recognized as " + pieces[1]; } else { imageItem.Author = "Not recognized"; } #endregion } else { imageItem.IsEnabled = false; imageItem.Image = FindResource("Vector.No") as Canvas; imageItem.Author = "This is a style dictionary."; } ResourceListBox.Items.Add(imageItem); } ResourceListBox.SelectedIndex = ResourceListBox.Items.Count - 1; ResourceListBox.ScrollIntoView(ResourceListBox.SelectedItem); CommandManager.InvalidateRequerySuggested(); }
private void RefreshImageList() { SelectedImageListItem = null; ImageListItems.Clear(); for (var i = 0; i < models.Images.NumImages; ++i) { var item = new ImageListBoxItem(models.Images.GetFilename(i), models.Images.GetFileFormat(i), i, models.Images); ImageListItems.Add(item); } OnPropertyChanged(nameof(ImageListItems)); OnPropertyChanged(nameof(SelectedImageListItem)); }
public void AddItem(ImageBox image, string text, T value) { image.Parent = this; image.Window = Window; var item = new ImageListBoxItem { Value = value, Label = new Label(Window, this, Rectangle.Empty, text, ZIndex + 1), ImageBox = image }; _items.Add(item); IsDirty = true; }
public ImageListBoxItem getLogItem(Update update, ImageListBox listBox) { ImageListBoxItem item = null; foreach (ImageListBoxItem it in listBox.Items) { if (it.Text.Contains("[" + update.getVersion() + update.getBaseType() + "]")) { item = it; break; } } return(item); }
private void C_BtnAdd_Click(object sender, System.EventArgs e) { int index = this.C_ListHorizontalColumns.SelectedIndex; HorizontalGridColumn hGridColumn = new HorizontalGridColumn(); hGridColumns.Add(hGridColumn); ImageListBoxItem item = new ImageListBoxItem(hGridColumn, 0); this.C_ListHorizontalColumns.Items.Insert(index + 1, item); this.C_ListHorizontalColumns.SelectedIndex = index + 1; }
private void RefreshImageList() { SelectedImageListItem = null; ImageListItems.Clear(); for (var i = 0; i < models.Images.NumImages; ++i) { var item = new ImageListBoxItem(models.Images.Images[i].Filename, models.Images.Images[i].OriginalFormat.ToString(), i, models.Images); ImageListItems.Add(item); } OnPropertyChanged(nameof(ImageListItems)); OnPropertyChanged(nameof(SelectedImageListItem)); }
public void LoadData() { this.dt_State = (new DIC_STATE()).GetList(); this.imgListState.Items.Clear(); foreach (DataRow row in this.dt_State.Rows) { ImageListBoxItem imageListBoxItem = new ImageListBoxItem() { ImageIndex = 0, Value = string.Concat("(", row["StateCode"].ToString(), ") - ", row["StateName"].ToString()) }; this.imgListState.Items.Add(imageListBoxItem); } }
private void C_BtnRemove_Click(object sender, System.EventArgs e) { if (this.C_ListSeries.Items.Count == 1) { return; } ImageListBoxItem selectedItem = this.C_ListSeries.SelectedItem as ImageListBoxItem; if (selectedItem != null && selectedItem.Value is Data.Series) { Setting.SeriesCollection.Remove(selectedItem.Value as Data.Series); this.C_ListSeries.Items.Remove(selectedItem); } }
public void Search(DataTable States, string Value) { this.imgListState.Items.Clear(); foreach (DataRow row in States.Rows) { if ((row["StateCode"].ToString().ToLower().Contains(Value.ToLower()) ? true : row["StateName"].ToString().ToLower().Contains(Value.ToLower()))) { ImageListBoxItem imageListBoxItem = new ImageListBoxItem() { ImageIndex = 0, Value = string.Concat("(", row["StateCode"].ToString(), ") - ", row["StateName"].ToString()) }; this.imgListState.Items.Add(imageListBoxItem); } } }
private string GetCode(ImageListBoxItem item) { string str; try { string str1 = item.Value.ToString(); char[] chrArray = new char[] { '(', ')' }; str = str1.Split(chrArray)[1]; } catch { str = ""; } return(str); }
public void AddRange(IEnumerable <ImageBox> images, Func <Sprite, string> textFunc, Func <Sprite, T> valueFunc) { foreach (var img in images) { img.Parent = this; img.Window = Window; var item = new ImageListBoxItem { Value = valueFunc(img.Sprite), Label = new Label(Window, this, Rectangle.Empty, textFunc(img.Sprite), ZIndex + 1), ImageBox = img, }; _items.Add(item); } IsDirty = true; }
private void C_BtnAdd_Click(object sender, System.EventArgs e) { int index = this.C_ListSeries.SelectedIndex; if (index >= 0) { Data.Series series = new Series(); Setting.SeriesCollection.Add(series); ImageListBoxItem item = new ImageListBoxItem(series, 0); this.C_ListSeries.Items.Insert(index + 1, item); this.C_ListSeries.SelectedIndex = index + 1; } }
private void FillList() { var infos = DecompressionHelper.DecompressItems( _sendInfo.FileContent ); itemsListView.Items.Clear(); if ( infos != null ) { foreach ( var info in infos ) { var item = new ImageListBoxItem( new Pair<string, DecompressedItemInfo>( info.FileName, info), 0); itemsListView.Items.Add( item ); } } UpdateUI(); }
private void ChangeGroupName() { int indexChange = listBoxControl1.SelectedIndex; DataTable dt = dsGroup.Tables[0]; DataRow dr = dt.Rows[indexChange]; if (UpdateGroup(DataOperation.Edit, dr[valueFieldGroup], frmGroup.TenNhom) > -1) { dr[displayFieldGroup] = frmGroup.TenNhom; ImageListBoxItem item = new ImageListBoxItem(frmGroup.TenNhom, 9); listBoxControl1.Items.Insert(indexChange, item); listBoxControl1.Items.RemoveAt(indexChange + 1); listBoxControl1.SelectedIndex = indexChange; } }
private void LogEvent(string EventDetails, string EventLogID, clsEventLogType.EventLogType Type) { int logIcon; switch (Type) { case clsEventLogType.EventLogType.Info: logIcon = 0; break; case clsEventLogType.EventLogType.Warning: logIcon = 1; break; case clsEventLogType.EventLogType.Error: logIcon = 2; break; default: logIcon = 0; break; } ImageListBoxItem item = new ImageListBoxItem(); item.Value = String.Format("[{0} {1}] ID: {2} Description: {3}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), EventLogID, EventDetails); item.ImageIndex = logIcon; lbDebugLog.Items.Insert(0, item); lbDebugLog.SelectedIndex = 0; }
private void showFavorites() { ImageListBoxItem i = new ImageListBoxItem("leifewfr",Image.FromFile("link.png")); imageListBox1.Add(i); }
private void listViewMain_MouseDoubleClick(object sender, MouseEventArgs e) { if (this.listViewMain.SelectedItems.Count != 0) { if (this.imageListBoxCart.Items.Count<3) { ImageListBoxItem item = new ImageListBoxItem(this.listViewMain.SelectedItems[0].Text, this.listViewMain.SelectedItems[0].ImageIndex); this.imageListBoxCart.Items.Add(item); Program.billingOder.addFruit(Program.fruitPool[this.listViewMain.SelectedItems[0].Index]); } else { MessageBox.Show("Out of bound (3 Fruits only).", "Print error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }