public async Task <ActionResult> Create([Bind(Include = "IdReflexion,Titulo,Text,UrlVideo,UrlImagen,Fecha,Sacerdote")] Reflexion reflexion) { if (ModelState.IsValid) { if (reflexion.UrlImagen == null) { string urlVideo = reflexion.UrlVideo; var uri = new Uri(urlVideo); var query = HttpUtility.ParseQueryString(uri.Query); var videoId = string.Empty; if (query.AllKeys.Contains("v")) { videoId = query["v"]; } else { videoId = uri.Segments.Last(); } String urlImagen = "https://img.youtube.com/vi/" + videoId + "/0.jpg"; reflexion.UrlImagen = urlImagen; } db.Reflexions.Add(reflexion); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(reflexion)); }
private static IConfigFileFormatStrategy GetConfigStrategyIndex(string format) { List <Type> configFileFormatStrategies = Reflexion.GetTypesImplementing <IConfigFileFormatStrategy>(); int configStrategyIndex = ListFinder.FindIndexFromRegex(configFileFormatStrategies, string.Format(@"{0}.*", format)); return((IConfigFileFormatStrategy)Reflexion.InstanciateFromType(configFileFormatStrategies[configStrategyIndex])); }
public async Task <ActionResult> DeleteConfirmed(int id) { Reflexion reflexion = await db.Reflexions.FindAsync(id); db.Reflexions.Remove(reflexion); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
private void PopulateListeners() { foreach (IEventListener eventListener in Reflexion.GetInstancesImplementing <IEventListener>()) { for (int i = 0; i < eventListener.ListenedEvents().Length; i++) { Register(eventListener.ListenedEvents()[i], eventListener); } } }
public static IConfigFileFormatStrategy GetFileFormatStrategyFromFileNames(List <string> fileNames) { List <Type> configFileFormatStrategies = Reflexion.GetTypesImplementing <IConfigFileFormatStrategy>(); int elementIdx = ExtensionPicker.GetHigherPriorityExtenstionIndex(configFileFormatStrategies); string selectedFormat = GameContainer.configManager.loadedConfig.Config.ExtensionsPriority[elementIdx].ToUpper(); return(GetConfigStrategyIndex(selectedFormat)); }
public async Task <IHttpActionResult> GetReflexion(int id) { Reflexion reflexion = await db.Reflexions.FindAsync(id); if (reflexion == null) { return(NotFound()); } return(Ok(reflexion)); }
public void CheckBallCollisionDirection_HorizontalCollision() { Reflexion reflexion = new Reflexion(); Transform actorTransform = new GameObject().GetComponent <Transform>(); actorTransform.right = new Vector3(1f, 1f, 0f); Vector3 expectedDirection = new Vector3(1f, -1f, 0f).normalized; reflexion.ChangeDirection(actorTransform, Vector3.up); Assert.That(Vector3.Distance(actorTransform.right, expectedDirection), Is.LessThan(0.0001f)); }
// GET: Reflexions/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Reflexion reflexion = await db.Reflexions.FindAsync(id); if (reflexion == null) { return(HttpNotFound()); } return(View(reflexion)); }
public DetailViewModel(Reflexion reflexion) { Reflexion = reflexion; }
/// <summary> /// Private method that will scan all asemblies specified to perform auto-wiring of dependencies. /// </summary> /// <param name="assemblies"> An arry of ssemblies to scan and load dependency resolutions automatically ("auto-wire" feature). </param> private static void ScanAssemblies(Assembly[] assemblies) { Type[] assemblyTypes; MethodInfo[] methodInfos; DependencyRegistrationAttribute dependencyRegistrationAttribute; Action dependencyRegistrationMethod; if ((object)assemblies != null) { foreach (Assembly assembly in assemblies) { dependencyRegistrationAttribute = Reflexion.GetOneAttribute <DependencyRegistrationAttribute>(assembly); if ((object)dependencyRegistrationAttribute == null) { continue; } assemblyTypes = assembly.GetTypes(); if ((object)assemblyTypes != null) { foreach (Type assemblyType in assemblyTypes) { dependencyRegistrationAttribute = Reflexion.GetOneAttribute <DependencyRegistrationAttribute>(assemblyType); if ((object)dependencyRegistrationAttribute == null) { continue; } if (!assemblyType.IsPublic) { continue; } methodInfos = assemblyType.GetMethods(BindingFlags.Public | BindingFlags.Static); if ((object)methodInfos != null) { foreach (MethodInfo methodInfo in methodInfos) { dependencyRegistrationAttribute = Reflexion.GetOneAttribute <DependencyRegistrationAttribute>(methodInfo); if ((object)dependencyRegistrationAttribute == null) { continue; } if (!methodInfo.IsStatic) { continue; } if (!methodInfo.IsPublic) { continue; } dependencyRegistrationMethod = (Action)(Delegate.CreateDelegate(typeof(Action), methodInfo, false)); if ((object)dependencyRegistrationMethod == null) { continue; } dependencyRegistrationMethod(); } } } } } } }
protected override void Awake() { base.Awake(); reflexionScript = new Reflexion(); }