robotlegs

http://www.robotlegs.org/

Robotlegs is a pure AS3 micro-architecture (framework) with a light footprint and limited scope. Simply put, Robotlegs is there to help you wire your objects together. It provides the glue that your application needs to easily function in a decoupled way. Through the use of automated metadata based dependency injection Robotlegs removes boilerplate code in an application. By promoting loose coupling and avoiding the use of Singletons and statics in the framework Robotlegs can help you write code that is highlytestable.

运用依赖注入在MVC框架下,实现了依赖自动化,确实很方便。

中文教程:https://github.com/robotlegs/robotlegs-documentation/blob/master/best-practices-zh-cn.textile

Lc.exe已退出 代码为-1

问题描述:今天使用VS2010开发Jaguar,编译报错:"Lc.exe已退出 代码为-1 "

问题分析:在项目中增加了一个第三方组件,后来删除了,我的计算机上没有这个第三方组件,结果导致了LC.exe错误

问题解决
1、把项目文件夹下Properties文件夹下的licenses.licx文件删除,重新编译即可;
2、文本方式打开*.csproj文件,在文件中查找licenses.licx字样,删除对应节点。

注意:还有一种情况就是Properties文件夹下已经没有licenses.licx文件了,程序还是报这个错,这个时候你只需要重命名一个空的txt文件为licenses.licx再放入Properties文件夹,问题也可解决。

WPF中MediaElement的MediaOpened事件不触发

问题描述:今天做Jaguar。用的WPF框架,其中每个Page中有一个MediaElement,总是跳转不到第二个Page。但是在调试的时候加入断点,就可以。

问题分析
用断点查找,发现第二个Page的MediaElement的MediaOpened不触发导致的问题。
MediaElement的.xaml是这样定义的:
<MediaElement Name="mediaElement" Margin="0" MediaOpened="mediaElement_MediaOpened" MediaEnded="mediaElement_MediaEnded" LoadedBehavior="Manual" UnloadedBehavior="Manual" />
MediaElement的.xaml.cs是这样定义的:
mediaElement.Source = new Uri(source);
mediaElement.Stop();

把.xaml.cs改为:
mediaElement.pause();
无用。
把.xaml.cs改为:
mediaElement.play();
video倒是在后台播了,但是还是不触发MediaOpened。

随后查找资料:
MediaOpened: 当媒体流已被验证和打开且已读取文件头时发生。如果 AutoPlay 属性设置为 false,则当发生 MediaOpened 事件时,将暂停媒体。另外要注意: Position 属性在发生 MediaOpened 事件之前为 null。虽然 Position 是可设置的。但在引发 MediaOpened 事件之前,不应尝试设置 Position。包括不应在 XAML 中设置初始 Position 值。
把所有Opened之前的Position改掉,无用。
我彻底被打败了,只好跳过MediaOpened事件,直接把MediaElement加上去。