Monday, March 24, 2008

FYP 傳檔部份 FYP Convertion Part



FYP的Upload Video File部份
因怕用戶的格式不乎
就引申出Conversion的步驟
之前的實戰部份就只是在一個C# Window Form中建做
但在WPF的情形下,Process的EventHandler所叫喚的Function入面的物件
會出現一個Exception

InvalidOperationException was unhandled:
The calling thread cannot access this object because a different thread owns it.


這個時候,就要用Dispatcher.
在英文網站上看,係用於管理在等候的工作事項for一些特定的Thread.
辦法如下:

1.加 namespacing
using System.Windows.Threading; // Dispatcher,DispatcherPriority

2.用這個包住該物件
this.Dispatcher.BeginInvoke(
DispatcherPriority.Normal,
(DispatcherOperationCallback)delegate(object arg){
// HANDLED ON UI THREAD

this.outputTextBox.Text += e.Data + "\r\n";
return null;
},null);


除此之外,在WPF也用了OpenFileDialog作選擇Video File去Upload
到此地步,問題就出現了.
上載Video的部份可以係用
WebClient上載or用FTP上載
WebClient的問題係FileSize的即使set左,
但通常就只可用於上載圖.
用FTP上載而引申出來的問題就較多.
要為求有安全性及上載到user各自的空間
就要在新增用戶的地方加入增建FTP Account.
但Window IIS的FTP就要用API才可新建,
而Linux的就可用Command去新增.
故此,OS就是一個問題.
其二,就係連接時間的問題,
當File的Size大,相對所要用的時間就較多,
故要set定user所有的空間大小.
而且File也要較小,才可以快速用於Streaming Server作Streaming Video.
這些問題都要放完Easter假之後快速辦好才可行!!!

[Kirupa - Using the Open File Dialog Window]
http://www.kirupa.com/net/using_open_file_dialog_pg1.htm

[Thou Shalt Not Break the Golden Rule of Windows Multithreading. Or, Why the Dispatcher Rocks]
http://blogs.msdn.com/wpfsdk/archive/2007/01/30/thou-shalt-not-break-the-golden-rule-of-windows-multithreading-or-why-the-dispatcher-rocks.aspx

0 回覆 comments:

 
Copyright ©2008-2009 SiriusResource. SiriusResource is Powered by Blogger