private static System.Windows.Forms.Control GetControl(MP3File file, string ctrltype) { Mp3DataControl ctrl; if (ctrls.ContainsKey(ctrltype)) { ctrl = ctrls[ctrltype]; } else { switch (ctrltype) { case "Content-Type": ctrl = new ContentTypeEditor(); break; case "Text Information": ctrl = new TextInformationPanel(); break; default: return(null); } ctrls[ctrltype] = ctrl; } ctrl.File = file; return(ctrl); }
public async Task <IActionResult> DeleteEditor(ContentTypeEditor model) { SpeedWagonContent contentType = await this._speedWagon.ContentTypeService.Get(model.Name); this._speedWagon.ContentTypeService.DeleteEditor(contentType, model.Editor); this._speedWagon.ContentTypeService.Save(contentType, User.Identity.Name.MaskEmail()); return(RedirectToAction("Edit", new { url = model.Name })); }
public void MoveEditorDown(SpeedWagonContent contentType, string editor) { ContentTypeEditor[] editors = GetEditors(contentType); int index = Array.FindIndex(editors, row => row.Name == editor); if (index < editors.Length - 1) { ContentTypeEditor src = editors[index + 1]; ContentTypeEditor dst = editors[index]; editors[index + 1] = dst; editors[index] = src; } SetEditors(contentType, editors); }
public async Task <IActionResult> EditProperty(string name, string property) { SpeedWagonContent contentType = await this._speedWagon.ContentTypeService.Get(name); ContentTypeEditor[] properties = this._speedWagon.ContentTypeService.GetEditors(contentType); IEnumerable <SpeedWagonContent> editors = await this._speedWagon.EditorService.List(); ContentTypeEditor prop = properties.FirstOrDefault(x => x.Name == property); EditProperty model = new EditProperty(); model.ContentTypeName = contentType.Name; model.Property = prop; model.AvailableEditors = SelectListHelper.GetSelectList(editors); return(View("~/Views/SpeedWagon/ContentType/EditProperty.cshtml", model)); }
public void AddEditor(SpeedWagonContent contentType, ContentTypeEditor editor) { IList <ContentTypeEditor> editors; if (!contentType.Content.ContainsKey("Editors")) { editors = new List <ContentTypeEditor>(); contentType.Content.Add("Editors", editors); } else { editors = ((JArray)contentType.Content["Editors"]).ToObject <List <ContentTypeEditor> >(); } editors.Add(editor); contentType.Content["Editors"] = editors.ToArray(); }