WPF中Page类继承问题

Filed Under (.Net) by CouldHll on 09-03-2012

Tagged Under :

问题描述:今天做Jaguar的Kinect互动,发现C#中Page继承失败。

问题解决
在cs文件中修改StartPage继承ContentPage。报如下错误:
 “Jaguar.Page.StartPage”的分部声明一定不能指定不同的基类。
应该是XAML自动生成的StartPage.g.cs里的基类没有改变。那么随后修改xaml文件中映射的类。又报如下错误:
 “Jaguar.Page.ContentPage”不能是 XAML 文件的根,因为它是使用 XAML 定义的。
原来要被继承就必须是只有cs文件,而没有xaml文件的。所以只能保留cs文件。把所有xaml定义的转到cs代码上。
问题终于解决了。别看VS方便,其实问题特多。

C#事件不能直接继承问题

Filed Under (.Net) by CouldHll on 09-03-2012

Tagged Under :

问题描述:今天做Jaguar的Kinect互动,发现C#中事件一继承后就不能调用。

代码如下:
public class ContentPage : System.Windows.Controls.Page
{
public delegate void LoadCompletedHandle(object sender);
public event LoadCompletedHandle LoadCompleted;
}
public partial class StartPage : ContentPage
{
private void VideoPlayer_MediaOpened(object sender, RoutedEventArgs e)
{
if (LoadCompleted != null)
{
LoadCompleted(this);
}
}
}

报错如下:
错误 1 事件“Jaguar.Page.ContentPage.LoadCompleted”只能出现在 += 或 -= 的左边(从类型“Jaguar.Page.ContentPage”中使用时除外) C:\Users\CouldHll\Desktop\Jaguar\Jaguar\Page\StartPage.xaml.cs 48 17 Jaguar

问题分析
事件只能从声明它们的类中调用,派生类不能直接调用在基类声明的事件。

要处理基类的事件,通常通过在基类中为事件创建受保护虚方法(OnEventName)来实现。派生类可以重写基类的OnEventName方法,也可以直接调用基类的OnEventName方法,从而实现调用基类的事件。重写基类的OnEventName方法,派生类可以截获基类正在调用的事件,对这些事件执行它自己的处理。

问题解决

代码如下:
protected virtual void OnLoadCompleted(object sender)
{
if (LoadCompleted != null)
{
this.LoadCompleted(sender);
}
}
private void VideoPlayer_MediaOpened(object sender, RoutedEventArgs e)
{
OnLoadCompleted(this);
}

《cocos2d-x手机游戏开发》

Filed Under (Android, Book, iOS) by CouldHll on 16-02-2012

Tagged Under : ,

cocos2d-x确实有很多好处,比如跨平台等。王哲写得很好啊。

不过这本书的内容就不敢恭维了,完全是在冲页数。

lSiri

Filed Under (iOS) by CouldHll on 14-02-2012

Tagged Under :

最近有兴趣查了下Siri,发现其用的是nuance引擎识别语音,然后通过trueknowledge查询答案,再用nuance引擎播放语音。

最近有空花了3天时间做了一个,就是界面不太友好。

附上源代码:

lSiri (18)

 

参考资料:

http://www.trueknowledge.com/

http://www.nuance.com/

pocode

Filed Under (C++, iOS, Multi-touch, Technology) by CouldHll on 14-02-2012

Tagged Under : ,

http://www.pocode.org/

pocode is an open-source C++ library designed by Potion for the production of interactive media across multiple platforms.

pocode for OSX, iOS and Windows.

字体损坏导致系统里无法使用

Filed Under (AS3) by CouldHll on 06-02-2012

Tagged Under :

问题描述:昨天加班帮做Castrol研发体验中心工业屏,在Mac下导入字体,在Flash中怎么找怎么没有。

问题分析:又导入了几遍,重启也没有用。

问题解决:咨询Cailven,让PS里看看,字体也没有。最后重新下了字体文件,马上就好了。。。感谢Cailven

iGUI

Filed Under (Technology) by CouldHll on 28-01-2012

Tagged Under : ,

iGUI is a GUI system for Unity 3D engine.

http://avamstudios.com/

IN2AR

Filed Under (AS3, Augmented Reality) by CouldHll on 19-12-2011

Tagged Under : , ,

IN2AR is an Adobe Flash AS3 Library that allows you to detect images and estimate their pose using standard webcams/cameras. The pose information can be used to place 3D objects and/or videos onto the image and create wonderfull Augmented Reality applications, or to createunique games that can be controlled by movements of your image.

http://www.in2ar.com/

Sparrow

Filed Under (iOS) by CouldHll on 09-12-2011

Tagged Under : ,

Sparrow Framework – the Open Source Game Engine for iOS, inspired by the Flash API

http://www.sparrow-framework.org/

jquery.fadeout()在IE8下png图片透明问题

Filed Under (Javascript) by CouldHll on 06-12-2011

Tagged Under : ,

问题描述:AD杂志iPad版需要一个查看礼物的网站,有个效果是png带透明图片用jquery进行fade in和fade out。原本只需要在iPad上使用。结果客户说IE8运行的时候透明的不会呈现全黑。检查后发现Safari、Firefox、Chromx都正常浏览,唯独IE7、8会有问题。

问题分析:猜想是IE7、8对png的兼容问题。原因是:IE修改透明度,不是通过css属性,而是通过filter滤镜。在IE9,微软修复了此问题。但是此问题对于IE7、8是无解。

总结:IE实在是弱爆了。