private ToolStripMenuItem MapToToolStripMenuItem(QuickLaunchItem item) { var handlerInfo = _quickLaunchApi.GetHandlerInfo(item.Handler); var image = _images[handlerInfo.HandlerKey]; return(new ToolStripMenuItem(item.DisplayName, image, (s, e) => _quickLaunchApi.Handle(item))); }
public bool Handle(QuickLaunchItem item) { if (_handlers.TryGetValue(item.Handler, out var handler)) { return(handler.Handle(item)); } throw new Exception($"Could not find handler for type '{item.Handler}'"); }
public void AddItem(QuickLaunchItem item) { item.Id = item.Id ?? Guid.NewGuid(); if (_storage.items.Any(i => i.Id == item.Id)) { throw new Exception("Duplicate id"); } _storage.items.Add(item); }
private void buttonOK_Click(object sender, EventArgs e) { Item = new QuickLaunchItem(); Item.DisplayName = textBoxDisplayName.Text; Item.Group = textBoxGroup.Text; Item.Handler = ((ComboBoxItem)comboBoxType.SelectedItem).Value.HandlerKey; Item.URI = textBoxResource.Text; this.DialogResult = DialogResult.OK; }
public override bool Handle(QuickLaunchItem item) { var startInfo = new ProcessStartInfo { FileName = cmdPath, WorkingDirectory = item.URI }; Process.Start(startInfo); return(true); }
public void UpdateItem(QuickLaunchItem item) { var _item = _storage.items.FirstOrDefault(i => i.Id == item.Id); if (item == null) { throw new Exception("Id doesn't exist"); } _storage.items.Remove(_item); _storage.items.Add(item); }
public abstract bool Handle(QuickLaunchItem item);
public override bool Handle(QuickLaunchItem item) { Process.Start(item.URI); return(true); }
public bool Validate(QuickLaunchItem item) { return(!string.IsNullOrWhiteSpace(item.DisplayName) && !string.IsNullOrWhiteSpace(item.URI) && !string.IsNullOrWhiteSpace(item.Handler)); }
public void AddItem(QuickLaunchItem item) { _repo.AddItem(item); }