public Task <ModalResult> ShowAsync(string title, RenderComponent component, ModalOptions modalOptions = null) { modalModel = new ModalModel(component, title, modalOptions); modals.Push(modalModel); OnChanged?.Invoke(); return(modalModel.Task); }
public MenugroupViewModel() { ModalModel = new ModalModel(); PageModel = new PageModel(); PdfModel = new PdfModel(); ExtLinkModel = new ExtLinkModel(); }
public Task <ModalResult> ShowAsync <TComponent>(string title, RenderComponent <TComponent> component, ModalOptions modalOptions = null) where TComponent : IComponent { modalModel = new ModalModel(component.Contents, title, modalOptions); modals.Push(modalModel); OnChanged?.Invoke(); return(modalModel.Task); }
/// <summary> /// A method for disposing the modal. /// </summary> /// <returns>An instance of <see cref="Task"/>.</returns> public async Task DisposeAsync() { ModalModel = null; // Remove the instance of the model. await OnCloseAsync.Invoke(); // Invoke the on close method. OnSubmitAsync = null; // Remove the instance when submitting a modal. }
public void Close(ModalResult modalResult) { if (modals.Any()) { ModalModel modalToClose = modals.Pop(); modalToClose.TaskSource.SetResult(modalResult); } OnChanged?.Invoke(); }
public static ModalModel ModalModel <T>(this IHtmlHelper <T> helper) { ModalModel model = helper.GetViewData <ModalModel>(); if (model == null) { model = new ModalModel { IsModal = true, UseSearch = true, ModalId = "" }; helper.SetViewData(model); } return(model); }
void Awake() { Application.runInBackground = true; //setup audio samplerate = AudioSettings.outputSampleRate; //Debug.Log("sample rate: " + samplerate); //find mesh mf = gameObject.GetComponent<MeshFilter> (); mesh = mf.mesh; //find rigidbody rb = gameObject.GetComponent<Rigidbody>(); rb.collisionDetectionMode = CollisionDetectionMode.Continuous; // important thing to write about - what about these modes makes them preferable? rb.interpolation = RigidbodyInterpolation.Extrapolate; // see above //find collider reference coll = gameObject.GetComponent<Collider>(); //instantiate modal model //if (ShapeDependent) { // modalModel = new ModalModel (mesh); //} else { modalDataFileName = "./Assets/RObU/resonanceModels/" + modalDataFileName; modalModel = new ModalModel (modalDataFileName); //frequency driven by the transform scale frequencyScale = 1/ ((transform.localScale.x + transform.localScale.y + transform.localScale.z)/3); //} //error handling if(numPartials > modalModel.activeFreqs) { Debug.LogError(gameObject.name+": desired number of modes exceeds available, clamped at "+ modalModel.activeFreqs); numPartials = modalModel.activeFreqs; } }
public ActionResult Index(MenugroupViewModel model, int?menutype, List <string> menugroups) { ViewBag.PageEdit = true; ViewBag.Class = "admin"; ViewBag.MenugroupPanelActive = "active"; int pagelistId = 0; int pdfId = 0; int elinkId = 0; int modalId = 0; int pageId = Convert.ToInt32(System.Web.HttpContext.Current.Request.Form["PageId"]); int menuId = Convert.ToInt32(System.Web.HttpContext.Current.Request.Form["menuid"]); int parentId = Convert.ToInt32(System.Web.HttpContext.Current.Request.Form["menuparent"]); int isExternal = Convert.ToInt32(System.Web.HttpContext.Current.Request.Form["ExLink"]); HttpPostedFileBase fileImg = Request.Files["fileImg"]; HttpPostedFileBase filePdf = Request.Files["filePdf"]; model.PageModel.Maintext = null; if (Request.Form["PageListId"] != "") { pagelistId = Convert.ToInt32(System.Web.HttpContext.Current.Request.Form["PageListId"]); } if (Request.Form["PdfId"] != "") { pdfId = Convert.ToInt32(System.Web.HttpContext.Current.Request.Form["PdfId"]); } if (Request.Form["ElinkId"] != "") { elinkId = Convert.ToInt32(System.Web.HttpContext.Current.Request.Form["ElinkId"]); } if (Request.Form["ModalId"] != "") { modalId = Convert.ToInt32(System.Web.HttpContext.Current.Request.Form["ModalId"]); } if (fileImg != null) { model.PageModel.Img = ConvertToBytes(fileImg); model.PdfModel.Img = ConvertToBytes(fileImg); model.ExtLinkModel.Img = ConvertToBytes(fileImg); } else { model.PageModel.Img = null; model.PdfModel.Img = null; model.ExtLinkModel.Img = null; } if (filePdf != null) { var PdfFile = filePdf; var PdfFileItem = Regex.Replace(PdfFile.FileName, " ", "-"); var fileName = System.IO.Path.GetFileName(PdfFileItem); var path = System.IO.Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Content/PdfFiles/"), fileName); PdfFile.SaveAs(path); model.PdfModel.FileName = PdfFileItem; } else { model.PdfModel.FileName = null; } switch (menutype) { case 30: if (menugroups[0] != null) { string v = menugroups[0].ToString(); string[] values = v.Split(','); for (int mi = 0; mi < values.Length; mi++) { string vi = values[mi]; string[] valueItems = vi.Split('-'); //var test = new Menugroup //{ // Name = valueItems[0], // IsParent = 0, // ParentId = null, // Type = 4, // ModalId = null //}; //db.Menugroups.Add(test); //var MenuItemUpdate = db.Menugroups.Find(Convert.ToInt32(valueItems[0])); //if (TryUpdateModel(MenuItemUpdate, "", new string[] { "ParentId", "Order"})) ; //db.Entry(MenuItemUpdate).State = EntityState.Modified; } } break; case 27: HttpPostedFileBase SSubModalFileImg = Request.Files["ModalFileImg"]; var createssubmodal = new ModalModel { Title = model.ModalModel.Title, Summary = model.ModalModel.Summary, Maintext = model.ModalModel.Maintext, NavbarId = menuId, Img = ConvertToBytes(SSubModalFileImg), }; var ssubmenumodalitem = new Menugroup { Name = model.ModalModel.Title, IsParent = 0, ParentId = parentId, Type = 4, ModalId = modalId }; db.Menugroups.Add(ssubmenumodalitem); db.Modals.Add(createssubmodal); break; case 26: HttpPostedFileBase SubModalFileImg = Request.Files["ModalFileImg"]; var createsubmodal = new ModalModel { Title = model.ModalModel.Title, Summary = model.ModalModel.Summary, Maintext = model.ModalModel.Maintext, NavbarId = menuId, Img = ConvertToBytes(SubModalFileImg), }; var submenumodalitem = new Menugroup { Name = model.ModalModel.Title, IsParent = 0, ParentId = parentId, Type = 4, ModalId = modalId }; db.Menugroups.Add(submenumodalitem); db.Modals.Add(createsubmodal); break; case 25: HttpPostedFileBase ModalFileImg = Request.Files["ModalFileImg"]; var createmodal = new ModalModel { Title = model.ModalModel.Title, Summary = model.ModalModel.Summary, Maintext = model.ModalModel.Maintext, NavbarId = menuId, Img = ConvertToBytes(ModalFileImg), }; var parentmenumodalitem = new Menugroup { Name = model.ModalModel.Title, IsParent = 1, Type = 4, ModalId = modalId }; db.Menugroups.Add(parentmenumodalitem); db.Modals.Add(createmodal); break; case 24: var editMenuSss = db.Menugroups.Find(menuId); editMenuSss.Name = Request["menuname"]; if (TryUpdateModel(editMenuSss, "", new string[] { "Name" })) { ; } db.Entry(editMenuSss).State = EntityState.Modified; break; case 21: var editMenuSs = db.Menugroups.Find(menuId); editMenuSs.Name = Request["menuname"]; if (TryUpdateModel(editMenuSs, "", new string[] { "Name" })) { ; } db.Entry(editMenuSs).State = EntityState.Modified; break; case 18: var editMenuS = db.Menugroups.Find(menuId); editMenuS.Name = Request["menuname"]; if (TryUpdateModel(editMenuS, "", new string[] { "Name" })) { ; } db.Entry(editMenuS).State = EntityState.Modified; break; case 15: var editMenuParent = db.Menugroups.Find(menuId); editMenuParent.Name = Request["menuname"]; if (TryUpdateModel(editMenuParent, "", new string[] { "Name" })) { ; } db.Entry(editMenuParent).State = EntityState.Modified; break; case 8: HttpPostedFileBase SubLinkFileImg = Request.Files["LinkFileImg"]; var sublinkitem = new ExtLinkModel { Title = model.ExtLinkModel.Title, UrlLink = model.ExtLinkModel.UrlLink, Created = model.ExtLinkModel.Created, Img = ConvertToBytes(SubLinkFileImg), IsExternal = model.ExtLinkModel.IsExternal, NavbarId = menuId }; var submenulinkitem = new Menugroup { Name = model.ExtLinkModel.Title, IsParent = 0, ParentId = parentId, Type = 3, ExtlinkId = elinkId }; db.Menugroups.Add(submenulinkitem); db.Extlinks.Add(sublinkitem); break; case 7: var subpdfitem = new PdfModel { Title = model.PdfModel.Title, Summary = model.PdfModel.Summary, Created = model.PdfModel.Created, Img = model.PdfModel.Img, FileName = model.PdfModel.FileName, IsExternal = model.PdfModel.IsExternal, NavbarId = menuId, ExLink = model.PdfModel.ExLink }; var submenupdfitem = new Menugroup { Name = model.PdfModel.Title, IsParent = 0, ParentId = parentId, Type = 2, PdfId = pdfId }; db.Menugroups.Add(submenupdfitem); db.Pdfs.Add(subpdfitem); break; case 6: var subpageitem = new PageModel { Title = model.PageModel.Title, Summary = model.PageModel.Summary, Maintext = model.PageModel.Maintext, Created = model.PageModel.Created, MetaDescription = model.PageModel.MetaDescription, MetaKeywords = model.PageModel.MetaKeywords, Publish = model.PageModel.Publish, AuthorId = model.PageModel.AuthorId, ImageId = model.PageModel.ImageId, NavbarId = model.PageModel.NavbarId, SidenavId = menuId, Img = model.PageModel.Img, SubContent = Request["subcontent"], PageUrl = model.PageModel.PageUrl, menuitems = model.PageModel.menuitems }; var submenuitem = new Menugroup { Name = model.PageModel.Title, IsParent = 0, ParentId = parentId, Type = 1, PageId = pageId }; db.Menugroups.Add(submenuitem); db.Pages.Add(subpageitem); break; case 5: HttpPostedFileBase LinkFileImg = Request.Files["LinkFileImg"]; var createlink = new ExtLinkModel { Title = model.ExtLinkModel.Title, UrlLink = model.ExtLinkModel.UrlLink, Created = model.ExtLinkModel.Created, Img = ConvertToBytes(LinkFileImg), IsExternal = model.ExtLinkModel.IsExternal }; var parentmenulinkitem = new Menugroup { Name = model.ExtLinkModel.Title, IsParent = 1, Type = 3, ExtlinkId = elinkId }; db.Menugroups.Add(parentmenulinkitem); db.Extlinks.Add(createlink); break; case 4: var createpdf = new PdfModel { Title = model.PdfModel.Title, Summary = model.PdfModel.Summary, Created = model.PdfModel.Created, Img = model.PdfModel.Img, FileName = model.PdfModel.FileName, IsExternal = model.PdfModel.IsExternal, ExLink = model.PdfModel.ExLink }; var parentmenupdfitem = new Menugroup { Name = model.PdfModel.Title, IsParent = 1, Type = 2, PdfId = pdfId }; db.Menugroups.Add(parentmenupdfitem); db.Pdfs.Add(createpdf); break; case 3: var createpage = new PageModel { Title = model.PageModel.Title, Summary = model.PageModel.Summary, Maintext = model.PageModel.Maintext, Created = model.PageModel.Created, MetaDescription = model.PageModel.MetaDescription, MetaKeywords = model.PageModel.MetaKeywords, Publish = model.PageModel.Publish, AuthorId = model.PageModel.AuthorId, ImageId = model.PageModel.ImageId, NavbarId = model.PageModel.NavbarId, SidenavId = menuId, Img = model.PageModel.Img, SubContent = Request["subcontent"], PageUrl = model.PageModel.PageUrl, menuitems = model.PageModel.menuitems }; var parentmenuitem = new Menugroup { Name = model.PageModel.Title, IsParent = 1, Type = 1, PageId = pageId }; db.Menugroups.Add(parentmenuitem); db.Pages.Add(createpage); break; case 2: var firstchild = new Menugroup { Name = model.Name, IsParent = 0, ParentId = parentId, Type = 1, PageId = pagelistId }; db.Menugroups.Add(firstchild); break; case 1: var parent = new Menugroup { Name = model.Name, IsParent = 1, Type = 1, PageId = pagelistId }; db.Menugroups.Add(parent); break; default: var parentmenu = new Menugroup { Name = model.Name, IsParent = 1, Type = 1, PageId = pageId }; db.Menugroups.Add(parentmenu); break; } int i = db.SaveChanges(); if (i == 1) { return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
/// <summary> /// A method to create a modal. /// </summary> /// <param name="modalModel">A instance of <see cref="ModalModel"/>.</param> /// <returns>An instance of <see cref="Task"/>.</returns> public async Task CreateAsync(ModalModel modalModel) { ModalModel = modalModel; await OnOpenAsync.Invoke(); }