.Net Compact Framework programming is similar to that of .Net Full Framework. But as you work with it, you will face a lot of difficulties.
One of the difficulties i faced was in finding the pathname of a File or an Image. We can get the path using assembly. If a text file is included in the project,then we can obtain its path as follows:
string m_SourceImageFileName="test.txt"; String CodePath =System.Reflection.Assembly.GetExecutingAssembly().GetName ().CodeBase; CodePath = CodePath.Substring(0, CodePath.LastIndexOf(@"\")); m_SourceImageFileName =CodePath + @"\" + m_SourceImageFileName; reader1=File.OpenText(m_SourceImageFileName);
here a text file "test.txt" is included in the project.
Thread programming is possible in .Net Compact Framework but there is no Thread.suspend(),Thread.abort(). We have only Thread.Start(), ie once a thread is started, we cannot stop or abort it. It will have to be exited automatically. In emulator, thread programming rarely works.
Asynchronous network I/O worked fine but Asynchronous file I/O didt work. I had to depend on Synchronous file I/O. I tried it only in emulator.
You can import a file into the emulator either by including the file in the project or by network file sharing. In the first case, when the project is deployed, the file will be downloaded into the emulator or device. In the latter case, we can do it by sharing the file. After sharing, if you have only a single machine, you can test it by installing "Microsoft's Loop Host Adapter".
To Install "Loop Host Adapter", go to control panel, Add new hardware, Add a new Hardware Device,Network Adapters,Loop host Adapter. Once you install this, you can access shared files.
Before you view the shared files in emulator, go to "settings" in start menu in the emulator.(In "Microsoft Mobile Operating System", startmenu and task bar is on the top). In "settings", select "System" tab and tap "About". In that change the "Device ID" into a suitable name. Now Take "File Explorer" and click on the sharing button(button with a hand carrying a cylinder). Type your Computer Name and tap "connect". Enter your username and password. You can view your shared files.
To copy the files, press your left mouse button on the desired file for 5 seconds. You can see some "red spots" coming around your cursor. after 5 seconds, a copy/cut menu pops up. You can then change the directory and copy to the desired place.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|