public ActionResult Index(IContent currentContent) { //As the layout requires a page for title etc we "borrow" the start page var startPage = _contentLoader.Get <StartPage>(SiteDefinition.Current.StartPage); var model = new PreviewModel(startPage, currentContent); var supportedDisplayOptions = _displayOptions .Select(x => new { Tag = x.Tag, Name = x.Name, Supported = SupportsTag(currentContent, x.Tag) }) .ToList(); if (supportedDisplayOptions.Any(x => x.Supported)) { foreach (var displayOption in supportedDisplayOptions) { var contentArea = new ContentArea(); contentArea.Items.Add(new ContentAreaItem { ContentLink = currentContent.ContentLink }); var areaModel = new PreviewModel.PreviewArea { Supported = displayOption.Supported, AreaTag = displayOption.Tag, AreaName = displayOption.Name, ContentArea = contentArea }; model.Areas.Add(areaModel); } } return(View(model)); }
public ActionResult Index(IContent currentContent) { //As the layout requires a page for title etc we "borrow" the start page var startPage = _contentLoader.Get <StartPage>(SiteDefinition.Current.StartPage); var blockType = currentContent.GetType().BaseType?.Name; var uiDescriptors = currentContent.GetType().BaseType?.GetInterfaces(); if (uiDescriptors == null) { throw new ArgumentNullException(nameof(currentContent)); } var viewModel = new PreviewModel(startPage, currentContent); foreach (var uiDescriptor in uiDescriptors) { if (uiDescriptor == typeof(ITwoColumnWidth)) { viewModel.Areas.Add(NewPreviewArea($"{blockType} ({nameof(ITwoColumnWidth)})", nameof(ITwoColumnWidth), currentContent, "u-1/1 u-2/3-tablet")); } if (uiDescriptor == typeof(IOneColumnWidth)) { viewModel.Areas.Add(NewPreviewArea($"{blockType} ({nameof(IOneColumnWidth)})", nameof(IOneColumnWidth), currentContent, "u-1/1 u-1/3-tablet")); } } if (viewModel.Areas.Count == 0) { viewModel.Areas.Add(NewPreviewArea("Generic Preview", "", currentContent)); } return(View(viewModel)); }
public ActionResult Index(IContent currentContent) { var startPage = _contentLoader.Get <StartPage>(SiteDefinition.Current.StartPage); var model = new PreviewModel(startPage, currentContent); var supportedDisplayOptions = _displayOptions .Select(x => new { Tag = x.Tag, Name = x.Name, Supported = SupportsTag(currentContent, x.Tag) }); if (supportedDisplayOptions.Any(x => x.Supported) == false) { return(View(model)); } ContentArea contentArea; PreviewModel.PreviewArea areaModel; foreach (var option in supportedDisplayOptions) { contentArea = new ContentArea(); contentArea.Items.Add(new ContentAreaItem { ContentLink = currentContent.ContentLink }); areaModel = new PreviewModel.PreviewArea { Supported = option.Supported, AreaTag = option.Tag, AreaName = option.Name, ContentArea = contentArea }; model.Areas.Add(areaModel); } return(View(model)); }
void PagePreviewEventHandler(Guid pageGID) { if (pageGID == Guid.Empty) { return; } PreviewModel pre = ServiceLocator.Current.GetInstance <PreviewModel>(); if (_document == null) { return; } IPage CurrentPage = _document.Pages.GetPage(pageGID); if (CurrentPage == null) { return; } if (CurrentPage.IsOpened == true) { PreCanvas = pre.PreviviewCanvas; } else { PreCanvas = pre.PreviviewBox; } }
// Draws Placeholder Model #if UNITY_EDITOR void OnDrawGizmos() { // Build Shader if (!mat) { Shader shader = Shader.Find("Hidden/Internal-Colored"); mat = new Material(shader); mat.hideFlags = HideFlags.HideAndDontSave; } if (showPlaceholder) { // Check for mesh Change if (!previewMesh || lastPreviewModel != previewModel) { LoadMesh(); } mat.color = previewColor; if (!Application.isPlaying && previewMesh != null) { mat.SetPass(0); Graphics.DrawMeshNow(previewMesh, Matrix4x4.TRS(transform.position, transform.rotation * Quaternion.Euler(-90, 180, 0), new Vector3(0.88f, 0.88f, 0.88f))); } lastPreviewModel = previewModel; } }
public HttpResponseMessage GetPreviewMarkup([FromBody] JObject item, int parentId) { // Get parent to container node //TODO: Convert IContent if no published content? var parent = UmbracoContext.ContentCache.GetById(parentId); // Convert item var content = InnerContentHelper.ConvertInnerContentToPublishedContent(item, parent); // Construct preview model var model = new PreviewModel { Page = parent, Item = content }; // Render view var markup = ViewHelper.RenderPartial(content.DocumentTypeAlias, model, new[] { "~/Views/Partials/Stack/{0}.cshtml", "~/Views/Partials/Stack/Default.cshtml", }); // Return response var response = new HttpResponseMessage { Content = new StringContent(markup ?? "") }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return(response); }
public ActionResult Preview(Guid id) { var service = getservicebyimportid(id); var helper = CC.Web.Models.Import.ClientReports.ClientReportImportFactory.GetByReportingTypeId(service.ReportingMethodId, this.Permissions); var model = new PreviewModel() { Id = id, DeleteAll = false, Columns = helper.PreviewDataColumns(), IsValid = true, Finished = !System.IO.File.Exists(FileName(id)) }; if (model.Finished) { model.IsValid = helper.IsValid(id); } if (!model.IsValid) { ModelState.AddModelError(string.Empty, "One or more rows contains data that can not be imported."); } return(View(model)); }
// // GET: /Home/ public ActionResult Index(PreviewModel data) { var model = new Models.PreviewModel() { FormWidth = 600 }; String src = null; if (!String.IsNullOrEmpty(data.FilePath)) { src = System.IO.File.ReadAllText(data.FilePath); } else if (Request.Files.Count == 1) { var sr = new StreamReader(Request.Files[0].InputStream); src = sr.ReadToEnd(); data.FilePath = Request.Files[0].FileName; model.IsUpload = true; } if (src != null) { var dc = new DynamicCompiler { BinPath = HttpRuntime.BinDirectory }; model.FilePath = data.FilePath; var code = dc.Compile(src); model.InlineJsCode = new HtmlString(code); } return(View(model)); }
public HttpResponseMessage GetPreviewMarkup([FromBody] JObject item, int pageId) { var page = default(IPublishedContent); // If the page is new, then the ID will be zero if (pageId > 0) { // TODO: Review. Previewing multiple blocks on the same page will make subsequent calls to the ContentService. Is it cacheable? [LK:2018-12-12] // Get page container node, otherwise it's unpublished then fake PublishedContent (by IContent object) page = UmbracoContext.ContentCache.GetById(pageId) ?? new UnpublishedContent(pageId, Services); // Ensure PublishedContentRequest exists, just in case there are any RTE Macros to render if (UmbracoContext.PublishedContentRequest == null) { var pageUrl = page.UrlAbsolute(); // If the page is unpublished, then the URL will be empty or a hash '#'. // Use the current request as a fallback, as we need to give the PublishedContentRequest a URI. if (string.IsNullOrEmpty(pageUrl) || pageUrl.Equals("#")) { pageUrl = string.Concat(Request.RequestUri.GetLeftPart(UriPartial.Authority), "/#", pageId); } #pragma warning disable CS0618 // Type or member is obsolete var pcr = new PublishedContentRequest(new Uri(pageUrl), UmbracoContext.RoutingContext); #pragma warning restore CS0618 // Type or member is obsolete UmbracoContext.PublishedContentRequest = pcr; UmbracoContext.PublishedContentRequest.PublishedContent = page; UmbracoContext.PublishedContentRequest.Prepare(); } } // TODO: Review. The values in `item` are the "editor values", whereas for prevalue-based editors, the converter is expecting the "database value". [LK:2018-12-12] // Convert item var content = InnerContentHelper.ConvertInnerContentToPublishedContent(item, page); // Construct preview model var model = new PreviewModel { Page = page, Item = content }; // Render view var markup = ViewHelper.RenderPartial(content.DocumentTypeAlias, model); // Return response var response = new HttpResponseMessage { Content = new StringContent(markup ?? string.Empty) }; response.Content.Headers.ContentType = new MediaTypeHeaderValue(MediaTypeNames.Text.Html); return(response); }
public ActionResult GamePreview(int gameid) { PreviewModel pro = new PreviewModel(); Project data = database.Projects.Where(m => m.ID.Equals(gameid)).FirstOrDefault(); List <Image> images = database.Images.Where(p => p.ProjectId.Equals(gameid)).ToList(); pro.proj = data; pro.images = images; return(View(pro)); }
public ActionResult Preview(string name) { var files = CodeHelper.GetFileNames(PashaConstants.ImagesPath); PreviewModel previewModel = new PreviewModel() { Name = name, Count = files.Count.ToString(), Number = files.IndexOf(name).ToString() }; return(View(previewModel)); }
public async Task <SendResult> PreviewMatial(PreviewModel model) { Senparc.Weixin.MP.GroupMessageType previewType = Senparc.Weixin.MP.GroupMessageType.mpnews; if (model.MessageType == MpMessageType.mpnews.ToString()) { previewType = Senparc.Weixin.MP.GroupMessageType.mpnews; } if (model.MessageType == MpMessageType.mpmultinews.ToString()) { previewType = Senparc.Weixin.MP.GroupMessageType.mpnews; } if (model.MessageType == MpMessageType.text.ToString()) { previewType = Senparc.Weixin.MP.GroupMessageType.text; } if (model.MessageType == MpMessageType.video.ToString()) { previewType = Senparc.Weixin.MP.GroupMessageType.video; } if (model.MessageType == MpMessageType.voice.ToString()) { previewType = Senparc.Weixin.MP.GroupMessageType.video; } if (model.MessageType == MpMessageType.image.ToString()) { previewType = Senparc.Weixin.MP.GroupMessageType.image; } var account = await _mpAccountAppService.Get(new Abp.Application.Services.Dto.EntityDto <int> { Id = model.MpID }); var access_token = Senparc.Weixin.MP.Containers.AccessTokenContainer.TryGetAccessToken(account.AppId, account.AppSecret); SendResult result = null; try { result = GroupMessageApi.SendGroupMessagePreview(access_token, previewType, model.MediaID, model.OpenID, wxName: model.WxAccount); } catch { try { access_token = Senparc.Weixin.MP.Containers.AccessTokenContainer.TryGetAccessToken(account.AppId, account.AppSecret, true); result = GroupMessageApi.SendGroupMessagePreview(access_token, previewType, model.MediaID, model.OpenID, wxName: model.WxAccount); } catch (Exception e) { throw new UserFriendlyException(e.Message); } } return(result); }
void LinkClicked() { if (PreviewModel.ReportName != "Reports.InvoiceReport") { return; } PreviewModel.Clear(); PreviewModel.ReportName = "Reports.OrderReport"; PreviewModel.CreateDocument(); LinkText = ""; }
private void initLocalItems() { _subtitleItems = new SubtitleItems(); PreviewModelData = new PreviewModel(); SubtitleItemData = new SubtitleItem(); PreviewModelData.PlayImage = "play"; PreviewModelData.DragCompleted = true; PreviewModelData.PropertyChanged += previewModelDataPropertyChanged; SubtitleItemData.PropertyChanged += subtitleItemDataPropertyChanged; SubtitleItemData.CaretIndex = 1; }
/// <summary> /// 获取简历预览信息 /// </summary> /// <param name="ResumeId">简历ID</param> public PreviewModel GetPreviewInfo(string ResumeId) { try { PreviewModel model = repository.GetPreviewInfo(db, ResumeId); return(model); } catch (Exception ex) { return(null); } }
/// <summary> /// 获取简历预览信息 /// </summary> /// <param name="accountId">用户ID</param> public PreviewModel GetPreviewInfoByAccountId(string accountId) { try { PreviewModel model = repository.GetPreviewInfoByAccountId(db, accountId); return(model); } catch (Exception ex) { return(null); } }
public ActionResult GetPreviewString([FromBody] PreviewModel templateStr) { m_log.Info("Calling GetPreview"); try { var previewtxt = m_textTeplateService.GetPreview(templateStr.SMSTextTemplate, templateStr.isPathRequired, m_user.HospitalId); return(Ok(previewtxt)); } catch (Exception ex) { var error = "Failed to generate preview"; m_log.ErrorException(error, ex); throw; } }
public ActionResult Index(IContent currentContent) { //As the layout requires a page for title etc we "borrow" the start page var startPage = _contentLoader.Get <HomePage>(ContentReference.StartPage); var model = new PreviewModel(startPage, currentContent); var supportedDisplayOptions = _displayOptions .Select(x => new { x.Tag, x.Name, Supported = SupportsTag(currentContent, x.Tag) }).ToList(); if (!supportedDisplayOptions.Any(x => x.Supported)) { return(new ViewResult { ViewName = "~/Features/Preview/Views/Index.cshtml", ViewData = { Model = model } }); } foreach (var displayOption in supportedDisplayOptions) { var contentArea = new ContentArea(); contentArea.Items.Add(new ContentAreaItem { ContentLink = currentContent.ContentLink }); var areaModel = new PreviewModel.PreviewArea { Supported = displayOption.Supported, AreaTag = displayOption.Tag, AreaName = displayOption.Name, ContentArea = contentArea }; model.Areas.Add(areaModel); } return(new ViewResult { ViewName = "~/Features/Preview/Views/Index.cshtml", ViewData = new ViewDataDictionary <PreviewModel>(ViewData, model) }); }
public PreviewScene(RenderContext rc, ConstructedMeshInfo previewItem) { _rc = rc; ResourceFactory factory = rc.ResourceFactory; _fb = factory.CreateFramebuffer(Width, Height); _projection = factory.CreateConstantBuffer(ShaderConstantType.Matrix4x4); UpdateProjectionData(); _view = factory.CreateConstantBuffer(ShaderConstantType.Matrix4x4); _view.SetData(Matrix4x4.CreateLookAt(Vector3.UnitZ * 7f + Vector3.UnitY * 1.5f, Vector3.Zero, Vector3.UnitY)); _lightProjection = factory.CreateConstantBuffer(ShaderConstantType.Matrix4x4); _lightProjection.SetData(Matrix4x4.CreateOrthographicOffCenter(-18, 18, -18, 18, -10, 60f)); _lightView = factory.CreateConstantBuffer(ShaderConstantType.Matrix4x4); _lightView.SetData(Matrix4x4.CreateLookAt(-_lightDirection * 20f, Vector3.Zero, Vector3.UnitY)); _lightInfo = factory.CreateConstantBuffer(ShaderConstantType.Float4); _lightInfo.SetData(new Vector4(_lightDirection, 1)); _standardPipelineStage = new StandardPipelineStage(rc, "Standard", _fb); _shadowMapStage = new ShadowMapStage(rc, "ShadowMap_Preview"); _stages = new PipelineStage[] { _shadowMapStage, _standardPipelineStage, }; SceneBuffers.Add("ProjectionMatrix", _projection); SceneBuffers.Add("ViewMatrix", _view); SceneBuffers.Add("LightProjMatrix", _lightProjection); SceneBuffers.Add("LightViewMatrix", _lightView); SceneBuffers.Add("LightInfo", _lightInfo); _floor = CreatePreviewModel(PlaneModel.Vertices, PlaneModel.Indices); _floor.WorldMatrix.Data = Matrix4x4.CreateScale(10f, 1f, 10f); _previewItem = CreatePreviewModel(previewItem.Vertices, previewItem.Indices); _previewItem.WorldMatrix.Data = Matrix4x4.CreateTranslation(0, 1.5f, 0); _visiblityManager = new FlatListVisibilityManager(); _visiblityManager.AddRenderItem(_floor); _visiblityManager.AddRenderItem(_previewItem); }
internal RestPreview(RestDiscordClient client, PreviewModel model) : base(client) { GuildId = model.Id; Guild = RestFetchable.Create(this, (@this, options) => @this.Client.GetGuildAsync(@this.GuildId, options)); Name = model.Name; Description = model.Description; IconHash = model.Icon; SplashHash = model.Splash; DiscoverySplashHash = model.DiscoverySplash; Features = model.Features.ReadOnly(); // TODO: fetchable tying Emojis = model.Emojis.ToReadOnlyDictionary((x, _) => new Snowflake(x.Id.Value), (x, @this) => new RestGuildEmoji(@this.Client, @this.GuildId, x), this); ApproximateOnlineMemberCount = model.ApproximatePresenceCount; ApproximateMemberCount = model.ApproximateMemberCount; }
public ActionResult Import(PreviewModel model) { Service service = getservicebyimportid(model.Id.Value); var subreport = GetSubReportByImportId(model.Id.Value); var reportingMethodId = service.ReportingMethodId; var importHelper = CC.Web.Models.Import.ClientReports.ClientReportImportFactory.GetByReportingTypeId(reportingMethodId, this.Permissions); importHelper.Import(model.Id.Value); if (reportingMethodId == (int)CC.Data.Service.ReportingMethods.SoupKitchens) { return(RedirectToAction("Calendar", "SubReports", new { Id = subreport.Id })); } return(RedirectToAction("Details", "SubReports", new { Id = subreport.Id })); }
public async Task InitializeContent(PreviewModel model) { DoLongWork(); try { byte[] data = await RawNotification.DotNetCoreBL.RNAdapter.GetNotificationContentAsync(model.NotificationId, model.NotificationAccessKey); RawNotification.SharedLibs.JSONObjectSerializer <string> serializer = new RawNotification.SharedLibs.JSONObjectSerializer <string>(); Content = serializer.BytesToObject(data); } catch (Exception ex) { await new MessageDialog(ex.Message).ShowAsync(); } finally { FinishDoLongWork(); } }
/// <summary> /// Instantiate the preview model and change the current spawn viewer mode in the ModeManager. /// </summary> private IEnumerator createPreviewModelCoroutine() { // do nothing if model spawn controller is already in removing/add state if (InputManager.Instance.ModelSpawn_Controller.Operating == true) { yield break; } if (PreviewModel == null) { yield break; } m_SpawnedModel = Instantiate(PreviewModel, Vector3.zero, PreviewModel.transform.rotation); m_SpawnedModel.gameObject.name = PreviewModel.gameObject.name; InputManager.Instance.ModelSpawn_Controller.Operating = true; yield return(null); InputManager.Instance.Selector_Tool.CurrentPreviewModel = m_SpawnedModel; }
protected void PreviewModel_PreviewClick(object sender, PreviewClickEventArgs e) { int orderId; if (!int.TryParse(e.ElementTag, out orderId)) { return; } LinkText = "Go Back"; PreviewModel.ReportName = "Reports.InvoiceReport"; PreviewModel.IsDocumentMapVisible = false; PreviewModel.Clear(); PreviewModel.Parameters["OrderId"].Value = orderId; PreviewModel.CreateDocument(); }
public ActionResult Preview(string find) { if (!_orchardServices.Authorizer.Authorize(Permissions.AccessFindReplace, T("Unable to access Find/Replace"))) { return(new HttpUnauthorizedResult()); } var contentItems = _findReplaceService.GetContentItems(find).OrderBy(x => x.As <ITitleAspect>().Title); var model = new PreviewModel { Find = find, ContentItems = contentItems, Display = Shape.List() }; model.Display.AddRange(contentItems.Select(ci => _contentManager.BuildDisplay(ci, "SummaryAdmin"))); return(View(model)); }
public async Task <PreviewModel> GetPreviewFromUrl(string url) { try { OpenGraph openGraph = await OpenGraph.ParseUrlAsync(url); var preview = new PreviewModel() { Title = openGraph.Title, Image = openGraph.Image.AbsoluteUri, Url = openGraph.Url, Type = openGraph.Type }; return(preview); } catch { return(null); } }
public ActionResult Index(IContent currentContent) { //As the layout requires a page for title etc we "borrow" the start page var startPage = _contentLoader.Get <StartPage>(SiteDefinition.Current.StartPage); var model = new PreviewModel(startPage, currentContent); var contentArea = new ContentArea(); contentArea.Items.Add(new ContentAreaItem { ContentLink = currentContent.ContentLink }); var areaModel = new PreviewModel.PreviewArea { ContentArea = contentArea, Supported = true }; model.Areas.Add(areaModel); return(View(model)); }
public JsonResult Status(Guid id) { string filename = FileName(id); bool fileExists = System.IO.File.Exists(filename); var model = new PreviewModel() { Id = id, Finished = !fileExists, }; if (model.Finished) { var service = getservicebyimportid(id); var helper = CC.Web.Models.Import.ClientReports.ClientReportImportFactory.GetByReportingTypeId(service.ReportingMethodId, this.Permissions); model.IsValid = helper.IsValid(id); } return(this.MyJsonResult(model, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> Preview(int?id) { if (id == null) { return(NotFound()); } var layerRecord = await ConfigContext.Layers .Include(l => l.Service) .FirstOrDefaultAsync(m => m.Id == id); if (layerRecord == null) { return(NotFound()); } PreviewModel previewModel = new PreviewModel() { LayerId = id.Value }; return(View(previewModel)); }
private List <PreviewModel> GetUserPreviewDetails() { RegBL bl = new RegBL(); List <PreviewModel> users = new List <PreviewModel>(); PreviewModel user = null; List <PreviewDetailsModel> modelUsers = bl.PrintPreviewDetails(); foreach (PreviewDetailsModel item in modelUsers) { user = new PreviewModel(); user.S_Id = item.S_Id; user.Des_Id = item.Des_Id; user.Departure_Time = item.Departure_Time; user.Arrival_Time = item.Arrival_Time; user.Passenger = item.Passenger; user.Booked_Date = item.Booked_Date; user.Fare = item.Fare; users.Add(user); } return(users); }