<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nonocast</title>
	<atom:link href="http://nonocast.cn/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://nonocast.cn</link>
	<description>Digital Life</description>
	<lastBuildDate>Mon, 06 Sep 2010 04:02:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WPF中在指定位置播放PowerPoint</title>
		<link>http://nonocast.cn/?p=686</link>
		<comments>http://nonocast.cn/?p=686#comments</comments>
		<pubDate>Mon, 06 Sep 2010 03:55:18 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=686</guid>
		<description><![CDATA[1. Add Reference: Microsoft PowerPoint 12 Library
2. 声明对象
using Pwt = Microsoft.Office.Interop.PowerPoint;

private Pwt.Application app;
private Pwt.Presentation pres;

3. 调用
try {
	app = new Pwt.Application();
	app.SlideShowBegin += new Pwt.EApplication_SlideShowBeginEventHandler(app_SlideShowBegin);
	app.SlideShowEnd += new Pwt.EApplication_SlideShowEndEventHandler(app_SlideShowEnd);
	app.Visible = MsoTriState.msoTrue;
	app.WindowState = Pwt.PpWindowState.ppWindowMinimized;
	pres = app.Presentations.Open(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Agenda.ppt"), MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
	app.ActivePresentation.SlideShowSettings.Run();
	pres.SlideShowWindow.Left = 200;
	pres.SlideShowWindow.Top = 200;
	pres.SlideShowWindow.Width = 600;
	pres.SlideShowWindow.Height = 450;
} catch (Exception ex) {
	Trace.WriteLine(ex.ToString());
	Quit();
}

4. 清理

void app_SlideShowEnd(Pwt.Presentation Pres) {
	this.Dispatcher.BeginInvoke((Action)(() => {
		Quit();
	}));
}

private void [...]]]></description>
			<content:encoded><![CDATA[<p>1. Add Reference: Microsoft PowerPoint 12 Library<br />
2. 声明对象</p>
<pre class="brush:csharp">using Pwt = Microsoft.Office.Interop.PowerPoint;

private Pwt.Application app;
private Pwt.Presentation pres;
</pre>
<p>3. 调用</p>
<pre class="brush:csharp">try {
	app = new Pwt.Application();
	app.SlideShowBegin += new Pwt.EApplication_SlideShowBeginEventHandler(app_SlideShowBegin);
	app.SlideShowEnd += new Pwt.EApplication_SlideShowEndEventHandler(app_SlideShowEnd);
	app.Visible = MsoTriState.msoTrue;
	app.WindowState = Pwt.PpWindowState.ppWindowMinimized;
	pres = app.Presentations.Open(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Agenda.ppt"), MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
	app.ActivePresentation.SlideShowSettings.Run();
	pres.SlideShowWindow.Left = 200;
	pres.SlideShowWindow.Top = 200;
	pres.SlideShowWindow.Width = 600;
	pres.SlideShowWindow.Height = 450;
} catch (Exception ex) {
	Trace.WriteLine(ex.ToString());
	Quit();
}
</pre>
<p>4. 清理</p>
<pre class="brush:csharp">
void app_SlideShowEnd(Pwt.Presentation Pres) {
	this.Dispatcher.BeginInvoke((Action)(() => {
		Quit();
	}));
}

private void Quit() {
	try {
		pres.Close();
		app.Quit();
		GC.Collect();
	} catch (Exception ex) {
		Trace.WriteLine(ex.ToString());
	} finally {
		try { Process.GetProcessesByName("POWERPNT")[0].Kill(); } catch { }
	}
}
</pre>
<p>5. 下载source<br />
<a href="http://nonocast.cn/?attachment_id=692">PlayPwt.7z</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=686</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>acure</title>
		<link>http://nonocast.cn/?p=679</link>
		<comments>http://nonocast.cn/?p=679#comments</comments>
		<pubDate>Tue, 31 Aug 2010 05:37:47 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Digital Retail]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=679</guid>
		<description><![CDATA[
Reference from:  http://www.acure-fun.net/about/index.html
结合在Unilever看到的VR，目前可以感觉到Digital Retail的趋势。
如果数字化还只是专注于辅助性质的营销，像传统的Digital Signage显示广告的模式还是会因为成本等等等因素而被cut掉；要想坚挺，那么必须也不得不将数字化推向营销第一线，类似acure这样的vending machine真的拥有很大的想象空间。
]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-683" href="http://nonocast.cn/?attachment_id=683"><img class="alignnone size-full wp-image-683" title="acure2" src="http://nonocast.cn/wp-content/uploads/2010/08/acure2.png" alt="" width="600" height="303" /></a></p>
<p>Reference from:  <a href="http://www.acure-fun.net/about/index.html">http://www.acure-fun.net/about/index.html</a><br />
结合在Unilever看到的VR，目前可以感觉到Digital Retail的趋势。<br />
如果数字化还只是专注于辅助性质的营销，像传统的Digital Signage显示广告的模式还是会因为成本等等等因素而被cut掉；要想坚挺，那么必须也不得不将数字化推向营销第一线，类似acure这样的vending machine真的拥有很大的想象空间。</p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=679</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About Video in PowerPoint</title>
		<link>http://nonocast.cn/?p=677</link>
		<comments>http://nonocast.cn/?p=677#comments</comments>
		<pubDate>Mon, 23 Aug 2010 03:57:06 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=677</guid>
		<description><![CDATA[PowerPoint很容易在Slide中插入一个Video，但Video和Image不同的是，Video属于外部链接，不像Image会嵌到ppt(x)文件中。
换句话说，如果仅仅将ppt(x)文件给别人(usb-key或是mail)，那么别人是无法看到其中的Video的。
做了几个小的实验，发现如下现象:
1. ppt(x)中会记录Video的LocalPath，如果你将你电脑上的D:\videos\test.wmv放入这个ppt(x)，那么ppt(x)会记住这个路径。
2. 如果你把D:\videos\test.wmv删除，那么ppt(x)则无法播放这个Video。
3. 如果你把D:\videos\test.wmv剪切(cut)到ppt(x)所在目录，则又能播放。
4. 如果你把另外一个video以test.wmv的名字放到ppt(x)所在目录，并且把D:\videos\test.wmv删除，则ppt(x)播放替换的Video。
有点绕，其实就一句话，
当你给别人PowerPoint的时候，除了采用Publish CD的方式，同样可以将Video copy到ppt(x)同一目录下解决Video Link的问题。
]]></description>
			<content:encoded><![CDATA[<p>PowerPoint很容易在Slide中插入一个Video，但Video和Image不同的是，Video属于外部链接，不像Image会嵌到ppt(x)文件中。<br />
换句话说，如果仅仅将ppt(x)文件给别人(usb-key或是mail)，那么别人是无法看到其中的Video的。<br />
做了几个小的实验，发现如下现象:<br />
1. ppt(x)中会记录Video的LocalPath，如果你将你电脑上的D:\videos\test.wmv放入这个ppt(x)，那么ppt(x)会记住这个路径。<br />
2. 如果你把D:\videos\test.wmv删除，那么ppt(x)则无法播放这个Video。<br />
3. 如果你把D:\videos\test.wmv剪切(cut)到ppt(x)所在目录，则又能播放。<br />
4. 如果你把另外一个video以test.wmv的名字放到ppt(x)所在目录，并且把D:\videos\test.wmv删除，则ppt(x)播放替换的Video。</p>
<p>有点绕，其实就一句话，<br />
当你给别人PowerPoint的时候，除了采用Publish CD的方式，同样可以将Video copy到ppt(x)同一目录下解决Video Link的问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=677</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>看到这个我就很无语</title>
		<link>http://nonocast.cn/?p=670</link>
		<comments>http://nonocast.cn/?p=670#comments</comments>
		<pubDate>Fri, 20 Aug 2010 07:20:12 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=670</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-671" href="http://nonocast.cn/?attachment_id=671"><img class="alignnone size-medium wp-image-671" title="pics_wakamono94_1273130887" src="http://nonocast.cn/wp-content/uploads/2010/08/pics_wakamono94_1273130887-700x682.jpg" alt="" width="560" height="546" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=670</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Win32/Mouse/Keyboard Wrapper</title>
		<link>http://nonocast.cn/?p=665</link>
		<comments>http://nonocast.cn/?p=665#comments</comments>
		<pubDate>Fri, 20 Aug 2010 06:54:25 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=665</guid>
		<description><![CDATA[该有的都有了，包括了WM_*和参数Enum
Win32.cs
鼠标键盘模拟操作
Simulation.cs
鼠标键盘Hook
MouseKeyboardHook.dll
]]></description>
			<content:encoded><![CDATA[<p>该有的都有了，包括了WM_*和参数Enum<br />
<a href="http://nonocast.cn/?attachment_id=688">Win32.cs</a><br />
鼠标键盘模拟操作<br />
<a href="http://nonocast.cn/?attachment_id=689">Simulation.cs</a><br />
鼠标键盘Hook<br />
<a href="http://nonocast.cn/?attachment_id=668">MouseKeyboardHook.dll</a></p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=665</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto make a windows service application?</title>
		<link>http://nonocast.cn/?p=658</link>
		<comments>http://nonocast.cn/?p=658#comments</comments>
		<pubDate>Fri, 13 Aug 2010 17:52:06 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=658</guid>
		<description><![CDATA[通过VS2010创建Windows Service真的很简单，看图说话，

然后在OnStart和OnStop中填空即可，第二部是配置Service，通过在Service的Design视图右键Add Installer，然后打开Installer进行配置，如图，

Build后就生成了service的exe，这里提一下和非service exe的区别，
1. 不能F5直接运行，需要通过命令行安装到service中，如下:
  installutil YourService.exe
卸载service
  installutil /u YourService.exe
你可以通过bat来制作安装/卸载的script
2. ‘运行’中输入services.msc可以快速打开&#8217;服务&#8217;控制台
通过命令&#8217;net start YourService&#8217;启动你的service，反之&#8217;net stop YourService&#8217;来关闭。
3. 很多TX抱怨service会很隐晦，不方便调试之类的，童鞋，请使用微软牌日志，药到病除。
]]></description>
			<content:encoded><![CDATA[<p>通过VS2010创建Windows Service真的很简单，看图说话，<br />
<a rel="attachment wp-att-659" href="http://nonocast.cn/?attachment_id=659"><img class="size-medium wp-image-659 alignnone" title="windowservice" src="http://nonocast.cn/wp-content/uploads/2010/08/windowservice-700x486.jpg" alt="" width="700" height="486" /></a><br />
然后在OnStart和OnStop中填空即可，第二部是配置Service，通过在Service的Design视图右键Add Installer，然后打开Installer进行配置，如图，<br />
<a rel="attachment wp-att-660" href="http://nonocast.cn/?attachment_id=660"><img class="alignnone size-full wp-image-660" title="wsprop" src="http://nonocast.cn/wp-content/uploads/2010/08/wsprop.jpg" alt="" width="275" height="285" /></a><br />
Build后就生成了service的exe，这里提一下和非service exe的区别，<br />
1. 不能F5直接运行，需要通过命令行安装到service中，如下:<br />
  installutil YourService.exe<br />
卸载service<br />
  installutil /u YourService.exe<br />
你可以通过bat来制作安装/卸载的script<br />
2. ‘运行’中输入services.msc可以快速打开&#8217;服务&#8217;控制台<br />
通过命令&#8217;net start YourService&#8217;启动你的service，反之&#8217;net stop YourService&#8217;来关闭。<br />
3. 很多TX抱怨service会很隐晦，不方便调试之类的，童鞋，请使用<a href="http://nonocast.cn/?p=628">微软牌日志</a>，药到病除。</p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=658</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun Football</title>
		<link>http://nonocast.cn/?p=650</link>
		<comments>http://nonocast.cn/?p=650#comments</comments>
		<pubDate>Fri, 13 Aug 2010 14:08:47 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=650</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a rel="attachment wp-att-651" href="http://nonocast.cn/?attachment_id=651"><img class="size-medium wp-image-651 aligncenter" title="football" src="http://nonocast.cn/wp-content/uploads/2010/08/football-700x525.jpg" alt="" width="560" height="420" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=650</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>文件名排序</title>
		<link>http://nonocast.cn/?p=646</link>
		<comments>http://nonocast.cn/?p=646#comments</comments>
		<pubDate>Fri, 13 Aug 2010 09:49:42 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Tip]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=646</guid>
		<description><![CDATA[如果一个目录文件如下:

幻灯片1
幻灯片2
幻灯片3
幻灯片4
幻灯片10
幻灯片11
幻灯片12

在程序中当你需要枚举显示这些文件时，写下如下代码:

foreach (var each in Directory.GetFiles(@"c:\theFolder")) {
	Console.WriteLine(each);
}

显示结果不能说奇怪，只是说一定和你期望值有差距，如下

幻灯片1
幻灯片10
幻灯片11
幻灯片12
幻灯片2
幻灯片3
幻灯片4

怎么解决?竟然需要动用API, StrCmpLogicalW
增加Sort，如下

List files = new List(Directory.GetFiles(@"c:\theFolder"));
files.Sort(new StringLogicalComparer());
foreach (var each in files) {
	Console.WriteLine(each);
}

StringLogicalComparer代码如下:

public class StringLogicalComparer : IComparer {
	[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
	public static extern int StrCmpLogicalW(string x, string y);

	public int Compare(string x, string y) {
		return StrCmpLogicalW((string)x, (string)y);
	}
}

Everything is OK. Enjoy it.
]]></description>
			<content:encoded><![CDATA[<p>如果一个目录文件如下:</p>
<ul>
<li>幻灯片1</li>
<li>幻灯片2</li>
<li>幻灯片3</li>
<li>幻灯片4</li>
<li>幻灯片10</li>
<li>幻灯片11</li>
<li>幻灯片12</li>
</ul>
<p>在程序中当你需要枚举显示这些文件时，写下如下代码:</p>
<pre class="brush:csharp">
foreach (var each in Directory.GetFiles(@"c:\theFolder")) {
	Console.WriteLine(each);
}
</pre>
<p>显示结果不能说奇怪，只是说一定和你期望值有差距，如下</p>
<ul>
<li>幻灯片1</li>
<li>幻灯片10</li>
<li>幻灯片11</li>
<li>幻灯片12</li>
<li>幻灯片2</li>
<li>幻灯片3</li>
<li>幻灯片4</li>
</ul>
<p>怎么解决?竟然需要动用API, <a href="http://msdn.microsoft.com/en-us/library/bb759947%28VS.85%29.aspx">StrCmpLogicalW</a><br />
增加Sort，如下</p>
<pre class="brush:csharp">
List<string> files = new List<string>(Directory.GetFiles(@"c:\theFolder"));
files.Sort(new StringLogicalComparer());
foreach (var each in files) {
	Console.WriteLine(each);
}
</pre>
<p>StringLogicalComparer代码如下:</p>
<pre class="brush:csharp">
public class StringLogicalComparer : IComparer<string> {
	[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
	public static extern int StrCmpLogicalW(string x, string y);

	public int Compare(string x, string y) {
		return StrCmpLogicalW((string)x, (string)y);
	}
}
</pre>
<p>Everything is OK. Enjoy it.</p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=646</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preload Image</title>
		<link>http://nonocast.cn/?p=644</link>
		<comments>http://nonocast.cn/?p=644#comments</comments>
		<pubDate>Wed, 11 Aug 2010 13:41:23 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=644</guid>
		<description><![CDATA[BItmapImage默认情况下是不会进行Preload，之前google竟然也没有什么办法，本来考虑尝试一下thumbnail，隔天再想这个问题突然灵光一闪，Yes，MemoryStream。
]]></description>
			<content:encoded><![CDATA[<p>BItmapImage默认情况下是不会进行Preload，之前google竟然也没有什么办法，本来考虑尝试一下thumbnail，隔天再想这个问题突然灵光一闪，Yes，MemoryStream。</p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=644</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make a &#8216;MediaElement&#8217; loop?</title>
		<link>http://nonocast.cn/?p=642</link>
		<comments>http://nonocast.cn/?p=642#comments</comments>
		<pubDate>Thu, 05 Aug 2010 16:32:18 +0000</pubDate>
		<dc:creator>nonocast</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://nonocast.cn/?p=642</guid>
		<description><![CDATA[&#60;MediaElement x:Name=&#8221;video&#8221; MediaEnded=&#8221;video_MediaEnded&#8221; Stretch=&#8221;Fill&#8221; LoadedBehavior=&#8221;Manual&#8221; /&#62;
增加MediaEnded事件响应，事件响应代码如下:

private void video_MediaEnded(object sender, RoutedEventArgs e) {
	this.video.Position = TimeSpan.FromSeconds(0);
	this.video.Play();
}

关键是需要重置video的Position。
]]></description>
			<content:encoded><![CDATA[<p>&lt;MediaElement x:Name=&#8221;video&#8221; MediaEnded=&#8221;video_MediaEnded&#8221; Stretch=&#8221;Fill&#8221; LoadedBehavior=&#8221;Manual&#8221; /&gt;<br />
增加MediaEnded事件响应，事件响应代码如下:</p>
<pre class="brush:csharp">
private void video_MediaEnded(object sender, RoutedEventArgs e) {
	this.video.Position = TimeSpan.FromSeconds(0);
	this.video.Play();
}
</pre>
<p>关键是需要重置video的Position。</p>
]]></content:encoded>
			<wfw:commentRss>http://nonocast.cn/?feed=rss2&amp;p=642</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
