public IAsyncScript PromptForScript(IWin32Window owner, Rectangle bounds) { using (var dialog = new FilterSelect <string>()) { dialog.Message = "Select a script"; dialog.DataSource = _scripts.Keys; IAsyncScript script; if (dialog.ShowDialog(owner, bounds) == DialogResult.OK && TryGetNewScript(dialog.SelectedItem, out script)) { return(script); } } return(null); }
private void CategoryButton_Click(object sender, RoutedEventArgs e) { try { var category = default(string); using (var categoryDialog = new FilterSelect <string>()) { categoryDialog.DataSource = _categories; categoryDialog.Message = "Select a category"; if (categoryDialog.ShowDialog(System.Windows.Forms.Application.OpenForms[0]) == DialogResult.OK && categoryDialog.SelectedItem != null) { category = categoryDialog.SelectedItem; } } if (!string.IsNullOrEmpty(category)) { PromptName(category); } } catch (Exception ex) { Utils.HandleError(ex); } }
private void PromptName(string category) { switch (category.ToUpperInvariant()) { case "ITEMTYPE": using (var nameDialog = new FilterSelect <ItemType>()) { nameDialog.DataSource = _metadata.ItemTypes; nameDialog.DisplayMember = "Name"; nameDialog.Message = "Select an item type"; if (nameDialog.ShowDialog(System.Windows.Forms.Application.OpenForms[0]) == DialogResult.OK && nameDialog.SelectedItem != null) { TryNavigate(category, nameDialog.SelectedItem.Name); } } break; case "METHOD": using (var nameDialog = new FilterSelect <Method>()) { nameDialog.DataSource = _metadata.Methods; nameDialog.DisplayMember = "KeyedName"; nameDialog.Message = "Select a method"; if (nameDialog.ShowDialog(System.Windows.Forms.Application.OpenForms[0]) == DialogResult.OK && nameDialog.SelectedItem != null) { TryNavigate(category, nameDialog.SelectedItem.KeyedName); } } break; default: // "General", using (var nameDialog = new FilterSelect <string>()) { nameDialog.DataSource = _topics.Keys; nameDialog.Message = "Select a topic"; if (nameDialog.ShowDialog(System.Windows.Forms.Application.OpenForms[0]) == DialogResult.OK && nameDialog.SelectedItem != null) { TryNavigate(category, nameDialog.SelectedItem); } } break; } }
public IAsyncScript PromptForScript(IWin32Window owner, Rectangle bounds) { using (var dialog = new FilterSelect<string>()) { dialog.Message = "Select a script"; dialog.DataSource = _scripts.Keys; IAsyncScript script; if (dialog.ShowDialog(owner, bounds) == DialogResult.OK && TryGetNewScript(dialog.SelectedItem, out script)) { return script; } } return null; }
private void btnAddItemTypes_Click(object sender, EventArgs e) { try { using (var dialog = new FilterSelect<ItemReference>()) { dialog.DataSource = _availTypes; dialog.DisplayMember = "KeyedName"; dialog.Message = resources.Messages.ItemTypeSelect; if (dialog.ShowDialog(this) == DialogResult.OK && dialog.SelectedItem != null) { _selectedTypes.Add(dialog.SelectedItem); _availTypes.Remove(dialog.SelectedItem); } } } catch (Exception ex) { Utils.HandleError(ex); } }
private void btnItem_Click(object sender, EventArgs e) { try { using (var dialog = new FilterSelect<ItemReference>()) { EnsureItemTypes(); dialog.DataSource = _itemTypes; dialog.DisplayMember = "KeyedName"; dialog.Message = resources.Messages.ItemTypeSelect; if (dialog.ShowDialog(this, btnItem.RectangleToScreen(btnItem.Bounds)) == DialogResult.OK && dialog.SelectedItem != null) { _lastQuery = null; txtFind.Text = ""; _availableRefs.Clear(); var items = _conn.Apply("<Item type='@0' action='get' maxRecords='1000' orderBy='keyed_name' select='id,source_id,related_id' />", dialog.SelectedItem.KeyedName).Items(); if (items.Count() >= 1000) { _findAction = () => FindByItem(dialog.SelectedItem.KeyedName); _availableRefs.Add(_searchMessage); } else { ItemReference newRef; _findAction = DefaultFindAction; foreach (var result in items) { newRef = ItemReference.FromFullItem(result, true); if (!_selectedRefs.Contains(newRef)) _availableRefs.Add(newRef); } } EnsureResultsTab(); tbcSearch.SelectedTab = pgResults; txtFind.Focus(); } } } catch (Exception ex) { Utils.HandleError(ex); } }
private void btnDbPackage_Click(object sender, EventArgs e) { try { var items = _conn.Apply(@"<Item type='PackageDefinition' action='get' select='id' />").Items(); var refs = new List<ItemReference>(); foreach (var item in items) { refs.Add(ItemReference.FromFullItem(item, true)); } using (var dialog = new FilterSelect<ItemReference>()) { dialog.DataSource = refs; dialog.DisplayMember = "KeyedName"; dialog.Message = resources.Messages.PackageSelect; if (dialog.ShowDialog(this, btnDbPackage.RectangleToScreen(btnDbPackage.Bounds)) == DialogResult.OK && dialog.SelectedItem != null) { txtFind.Text = ""; _findAction = DefaultFindAction; items = _conn.Apply(@"<Item type='PackageElement' action='get' select='element_id,element_type,name' orderBy='element_type,name,element_id'> <source_id condition='in'>(select id from innovator.PACKAGEGROUP where SOURCE_ID = @0)</source_id> </Item>", dialog.SelectedItem.Unique).Items(); _availableRefs.Clear(); ItemReference newRef; foreach (var item in items) { newRef = new ItemReference() { Type = item.Property("element_type").AsString(""), Unique = item.Property("element_id").AsString(""), KeyedName = item.Property("name").AsString("") }; if (!_selectedRefs.Contains(newRef)) _selectedRefs.Add(newRef); } _existingScript = _existingScript ?? new InstallScript(); _existingScript.Title = dialog.SelectedItem.KeyedName; EnsureResultsTab(); tbcSearch.SelectedTab = pgResults; txtFind.Focus(); } } } catch (Exception ex) { Utils.HandleError(ex); } }
private void btnItem_Click(object sender, EventArgs e) { try { using (var dialog = new FilterSelect<ItemReference>()) { EnsureItemTypes(); dialog.DataSource = _itemTypes; dialog.DisplayMember = "KeyedName"; dialog.Message = resources.Messages.ItemTypeSelect; if (dialog.ShowDialog(this) == DialogResult.OK && dialog.SelectedItem != null) { _lastQuery = null; txtFind.Text = ""; _availableRefs.Clear(); var items = _conn.GetItems("ApplyAML", string.Format(Properties.Resources.Aml_ItemGet, dialog.SelectedItem.KeyedName, "")); if (items.Count() >= 1000) { _findAction = () => FindByItem(dialog.SelectedItem.KeyedName); _availableRefs.Add(_searchMessage); } else { ItemReference newRef; _findAction = DefaultFindAction; foreach (var result in items) { newRef = ItemReference.FromFullItem(result, true); if (!_selectedRefs.Contains(newRef)) _availableRefs.Add(newRef); } } EnsureResultsTab(); tbcSearch.SelectedTab = pgResults; txtFind.Focus(); } } } catch (Exception ex) { Utils.HandleError(ex); } }
private void btnDbPackage_Click(object sender, EventArgs e) { try { var items = _conn.GetItems("ApplyAML", Properties.Resources.Aml_Packages); var refs = new List<ItemReference>(); foreach (var item in items) { refs.Add(ItemReference.FromFullItem(item, true)); } using (var dialog = new FilterSelect<ItemReference>()) { dialog.DataSource = refs; dialog.DisplayMember = "KeyedName"; dialog.Message = resources.Messages.PackageSelect; if (dialog.ShowDialog(this) == DialogResult.OK && dialog.SelectedItem != null) { txtFind.Text = ""; _findAction = DefaultFindAction; items = _conn.GetItems("ApplyAML", string.Format(Properties.Resources.Aml_PackageElements, dialog.SelectedItem.Unique)); _availableRefs.Clear(); ItemReference newRef; foreach (var item in items) { newRef = new ItemReference() { Type = item.Element("element_type", ""), Unique = item.Element("element_id", ""), KeyedName = item.Element("name", "") }; if (!_selectedRefs.Contains(newRef)) _selectedRefs.Add(newRef); } _existingScript = _existingScript ?? new InstallScript(); _existingScript.Title = dialog.SelectedItem.KeyedName; EnsureResultsTab(); tbcSearch.SelectedTab = pgResults; txtFind.Focus(); } } } catch (Exception ex) { Utils.HandleError(ex); } }
private void mniLocale_Click(object sender, EventArgs e) { try { using (var dialog = new FilterSelect<string>()) { dialog.DataSource = CultureInfo.GetCultures(CultureTypes.SpecificCultures) .Select(c => c.Name).ToList(); dialog.Message = "Select a locale"; if (dialog.ShowDialog(this) == DialogResult.OK && dialog.SelectedItem != null) { _locale = dialog.SelectedItem; mniLocale.ShortcutKeyDisplayString = _locale; } } } catch (Exception ex) { Utils.HandleError(ex); } }
private void mniTimeZone_Click(object sender, EventArgs e) { try { using (var dialog = new FilterSelect<string>()) { dialog.DataSource = TimeZoneInfo.GetSystemTimeZones().Select(t => t.Id).ToList(); dialog.Message = "Select a time zone"; if (dialog.ShowDialog(this) == DialogResult.OK && dialog.SelectedItem != null) { _timeZone = dialog.SelectedItem; mniTimeZone.ShortcutKeyDisplayString = _timeZone; } } } catch (Exception ex) { Utils.HandleError(ex); } }
private void ChangeSoapAction(Control active) { if (_proxy == null) return; using (var dialog = new FilterSelect<string>()) { dialog.DataSource = _proxy.GetActions(); dialog.Message = "Select an action to perform"; if (dialog.ShowDialog(this, menuStrip.RectangleToScreen(btnSoapAction.Bounds)) == DialogResult.OK && dialog.SelectedItem != null) { this.SoapAction = dialog.SelectedItem; } } }
private void cboItemTypes_DropDown(object sender, EventArgs e) { try { if (cboItemTypes.Items.Count == _cache.ItemTypeCount) { cboItemTypes.DroppedDown = false; using (var dialog = new FilterSelect<ItemType>()) { dialog.DataSource = (IEnumerable<ItemType>)(cboItemTypes.DataSource); if (dialog.ShowDialog(this) == DialogResult.OK && dialog.SelectedItem != null) { cboItemTypes.SelectedItem = dialog.SelectedItem; } } } } catch (Exception ex) { Utils.HandleError(ex); } }