public MediaController(IRepositoryFactory factory, ApplicationPath appPath, Icons icons) { this.factory = factory; this.icons = icons; ServerUploadFolder = appPath.Resources; ServerTempFolder = appPath.Temp; }
public FileDownloadController(ApplicationPath appPath) { this.appPath = appPath; FileProvider = new FileProvider(); }
public PlayerServiceController(IRepositoryFactory factory,ApplicationPath appPath) { this.factory = factory; this.appPath = appPath; }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void Execute(object sender, EventArgs e) { Launcher.Launch(ApplicationPath.ScreenKeyboard()); }
public ReportContainer(string filename, DataSet dataset) { InitializeComponent(); this.reportName = ApplicationPath.GetFullPath(@"Views\Reports\" + filename); data = dataset; }
public Stream GetDefaultStatesStream() { return(File.OpenRead(ApplicationPath.GetDataFile("default_states.xml"))); }
public Stream GetStatsXmlStream() { return(File.OpenRead(ApplicationPath.GetDataFile("stats.xml"))); }
private ApplicationPath GetKnowledgeArticleApplicationPath(OrganizationServiceContext context, Entity article) { article.AssertEntityName("knowledgearticle"); var number = article.GetAttributeValue <string>("articlepublicnumber"); if (string.IsNullOrEmpty(number)) { return(null); } var httpContext = HttpContext.Current; if (httpContext == null) { return(null); } var httpContextWrapper = new HttpContextWrapper(HttpContext.Current); var routeData = RouteTable.Routes.GetRouteData(httpContextWrapper); if (routeData == null) { return(null); } var urlHelper = new UrlHelper(new RequestContext(httpContextWrapper, routeData)); var languageLocaleCode = article.Contains("language_locale.code") ? article.GetAttributeValue <AliasedValue>("language_locale.code").Value as string : null; if (string.IsNullOrWhiteSpace(languageLocaleCode)) { var localeid = article.GetAttributeValue <EntityReference>("languagelocaleid"); if (localeid != null) { var locale = context.CreateQuery("languagelocale").FirstOrDefault(lang => lang.GetAttributeValue <Guid>("languagelocaleid") == localeid.Id); if (locale != null) { languageLocaleCode = locale.GetAttributeValue <string>("code"); } } } // If multi-language is enabled, return URL using in approriate multi-language URL format. var contextLanguageInfo = HttpContext.Current.GetContextLanguageInfo(); string url = string.Empty; if (contextLanguageInfo.IsCrmMultiLanguageEnabled && ContextLanguageInfo.DisplayLanguageCodeInUrl) { var actionUrl = urlHelper.Action("Article", "Article", new { number = number, area = "KnowledgeManagement" }); // if actionUrl is null, ex: deactivated root page. if (actionUrl == null) { return(null); } url = string.Format("{0}{1}", httpContext.Request.Url.GetLeftPart(UriPartial.Authority), actionUrl); url = contextLanguageInfo.FormatUrlWithLanguage(false, languageLocaleCode, new Uri(url)); } else { url = urlHelper.Action("Article", "Article", new { number = number, lang = languageLocaleCode, area = "KnowledgeManagement" }); } return(url == null ? null : ApplicationPath.FromAbsolutePath(url)); }
private ApplicationPath GetIdeaApplicationPath(OrganizationServiceContext context, Entity idea) { idea.AssertEntityName("adx_idea"); var httpContext = HttpContext.Current; if (httpContext == null) { return(null); } var partialUrl = idea.GetAttributeValue <string>("adx_partialurl"); if (string.IsNullOrEmpty(partialUrl)) { return(null); } var ideaForumEntityReference = idea.GetAttributeValue <EntityReference>("adx_ideaforumid"); if (ideaForumEntityReference == null) { return(null); } var forum = context.CreateQuery("adx_ideaforum").FirstOrDefault(e => e.GetAttributeValue <EntityReference>("adx_ideaforumid").Id == ideaForumEntityReference.Id); if (forum == null) { return(null); } var forumPartialUrl = forum.GetAttributeValue <string>("adx_partialurl"); if (string.IsNullOrEmpty(forumPartialUrl)) { return(null); } var httpContextWrapper = new HttpContextWrapper(HttpContext.Current); var routeData = RouteTable.Routes.GetRouteData(httpContextWrapper); if (routeData == null) { return(null); } var urlHelper = new UrlHelper(new RequestContext(httpContextWrapper, routeData)); // If multi-language is enabled, return URL using in approriate multi-language URL format. var contextLanguageInfo = HttpContext.Current.GetContextLanguageInfo(); string url = string.Empty; if (contextLanguageInfo.IsCrmMultiLanguageEnabled && ContextLanguageInfo.DisplayLanguageCodeInUrl) { url = string.Format("{0}{1}", httpContext.Request.Url.GetLeftPart(UriPartial.Authority), urlHelper.Action("Ideas", "Ideas", new { ideaForumPartialUrl = forumPartialUrl, ideaPartialUrl = partialUrl, area = "Ideas" })); url = contextLanguageInfo.FormatUrlWithLanguage(false, contextLanguageInfo.ContextLanguage.Code, new Uri(url)); } else { url = urlHelper.Action("Ideas", "Ideas", new { ideaForumPartialUrl = forumPartialUrl, ideaPartialUrl = partialUrl, area = "Ideas" }); } return(url == null ? null : ApplicationPath.FromAbsolutePath(url)); }
public override ApplicationPath GetApplicationPath(OrganizationServiceContext context, Entity entity) { if (context == null) { throw new ArgumentNullException("context"); } if (entity == null) { return(null); } if (entity.LogicalName == "adx_communityforumpost") { var thread = entity.GetRelatedEntity(context, "adx_communityforumthread_communityforumpost".ToRelationship()); if (thread != null) { return(GetForumPostApplicationPath(context, entity, thread)); } } if (entity.LogicalName == "adx_blogpostcomment") { var post = entity.GetRelatedEntity(context, "adx_blogpost_blogpostcomment".ToRelationship()); if (post != null) { return(GetBlogPostCommentApplicationPath(context, entity, post)); } } if (entity.LogicalName == "adx_shortcut") { return(GetShortcutApplicationPath(context, entity)); } if (entity.LogicalName == "adx_ideaforum") { return(GetIdeaForumApplicationPath(context, entity)); } if (entity.LogicalName == "adx_idea") { return(GetIdeaApplicationPath(context, entity)); } if (entity.LogicalName == "adx_issue") { return(GetIssueApplicationPath(context, entity)); } if (entity.LogicalName == "incident") { return(GetIncidentApplicationPath(context, entity)); } if (entity.LogicalName == "kbarticle") { return(GetKbArticleApplicationPath(context, entity)); } if (entity.LogicalName == "knowledgearticle") { return(GetKnowledgeArticleApplicationPath(context, entity)); } if (entity.LogicalName == "category") { return(GetCategoryApplicationPath(context, entity)); } // We want new behaviour for adx_webpages -- paths for this entity will now have a trailing slash ('/'). if (entity.LogicalName == "adx_webpage") { var path = base.GetApplicationPath(context, entity); // If the path is an external URL (it shouldn't be, but just in case), return the original path untouched. if (path.ExternalUrl != null) { return(path); } // If the path does not already have a trailing slash (it shouldn't), append one. return(path.AppRelativePath.EndsWith("/") ? path : ApplicationPath.FromAppRelativePath("{0}/".FormatWith(path.AppRelativePath))); } // Support adx_webfiles with a parent adx_blogpost, instead of adx_webpage. if (entity.LogicalName == "adx_webfile" && entity.GetAttributeValue <EntityReference>("adx_blogpostid") != null) { var post = entity.GetRelatedEntity(context, "adx_blogpost_webfile".ToRelationship()); if (post != null) { var postPath = GetApplicationPath(context, post); var filePartialUrl = entity.GetAttributeValue <string>("adx_partialurl"); if (postPath != null && filePartialUrl != null) { return(ApplicationPath.FromAppRelativePath("{0}/{1}".FormatWith(postPath.AppRelativePath.TrimEnd('/'), filePartialUrl))); } } } var lookup = new Dictionary <string, Tuple <string[], Relationship, string, string, bool> > { { "adx_communityforumthread", new Tuple <string[], Relationship, string, string, bool>( new [] { "adx_communityforumthreadid" }, "adx_communityforum_communityforumthread".ToRelationship(), "adx_communityforum", null, false) }, { "adx_communityforum", new Tuple <string[], Relationship, string, string, bool>( new [] { "adx_partialurl" }, "adx_webpage_communityforum".ToRelationship(), "adx_webpage", "Forums", false) }, { "adx_event", new Tuple <string[], Relationship, string, string, bool>( new [] { "adx_partialurl" }, "adx_webpage_event".ToRelationship(), "adx_webpage", "Events", false) }, { "adx_survey", new Tuple <string[], Relationship, string, string, bool>( new [] { "adx_partialurl" }, "adx_webpage_survey".ToRelationship(), "adx_webpage", "Surveys", false) }, { "adx_blog", new Tuple <string[], Relationship, string, string, bool>( new [] { "adx_partialurl" }, "adx_webpage_blog".ToRelationship(), "adx_webpage", null, true) }, { "adx_blogpost", new Tuple <string[], Relationship, string, string, bool>( new [] { "adx_partialurl", "adx_blogpostid" }, "adx_blog_blogpost".ToRelationship(), "adx_blog", null, true) }, }; Tuple <string[], Relationship, string, string, bool> urlData; if (lookup.TryGetValue(entity.LogicalName, out urlData)) { var partialUrlLogicalName = urlData.Item1.FirstOrDefault(logicalName => { var partialUrlValue = entity.GetAttributeValue(logicalName); return(partialUrlValue != null && !string.IsNullOrWhiteSpace(partialUrlValue.ToString())); }); if (partialUrlLogicalName == null) { return(null); } var relationship = urlData.Item2; var siteMarker = urlData.Item4; var addTrailingSlash = urlData.Item5; var websiteRelativeUrl = GetApplicationPath(context, entity, partialUrlLogicalName, relationship, GetApplicationPath, siteMarker); if (websiteRelativeUrl != null) { if (addTrailingSlash && websiteRelativeUrl.PartialPath != null && !websiteRelativeUrl.PartialPath.EndsWith("/")) { websiteRelativeUrl = ApplicationPath.FromPartialPath("{0}/".FormatWith(websiteRelativeUrl.PartialPath)); } var website = WebsiteProvider.GetWebsite(context, entity); var path = WebsitePathUtility.ToAbsolute(website, websiteRelativeUrl.PartialPath); return(ApplicationPath.FromPartialPath(path)); } } return(base.GetApplicationPath(context, entity)); }
private void btn_relaod_Click(object sender, EventArgs e) { _providerVisualizer.ClearProviders(); _providerVisualizer.LoadFrom(ApplicationPath.PathTo("libs")); }