Developing a Portal application in C# - General Questions and Answers

I am wanting to develop a portal application in C# for Windows Mobile 6.0. I have installed the .net Compact Framework 3.5 on my device and have the necessary tools on the PC to develop for Windows Mobile. I am using Visual Studio 2005 to develop this application.
I am not a programmer, I have little experience with .net technologies but have for past assignments used VB.net to create small applications for assignments at uni.
I am now in my third and final year at uni and I decided to take on a project that is titled Human Computer Interaction of Mobile Devices. As part of my project I am required to produce an application, though designing various menu systems in itself will be quite a job, not to mention the documentation of it all.
The application I want to create now, is not necessarily part of my project, though it may influence me later on and should go some way to helping me. I have had the intentions of creating an application in Flash up to now.
Anyway, this application, its what I would call a portal. It has 4 tabs, Websites, Television, Radio and Programs. The Programs tab page has been designed much like the iPhone interface with either same or somewhat similar buttons. These buttons do not do anything at the moment.
I started the other week in designing an application in vb.net and run the debug exe as standalone on PC and linking to application that are on the PC will actually run when clicking on the picturebox as that is what I am using rather than buttons.
I put a Try Catch in and the error message comes up on the Mobile. If I take the Try Catch away then FileExceptionNotFound error message comes up and forces the program to close.
In C#, I have created much the same application, it does nothing whatsoever at the moment other than allowing me to flick from one tab to another. I am wanting to link pictureboxes in the programs tab to programs stored on the phone such as \Windows\Opera9.exe and \Windows\tmail.exe and so on.
I would like Radio Stations and Television channels to load up in a program specified in code if a default one does not start so I realise that I would need to call the link of the radio station (same with television channels) and then tell it to load up in specified program.
The other thing I am not sure about it how I would tell the phone to connect to the internet.
I didn't really want to be asking for help on here with this, as its probably not too difficult to create something like this, seeing as what some people (geniuses) on here have been able to develop. If nobody is able to help, then maybe pointing me in the right direction of some good reliable resources would be an idea. I have done much searching on Google etc for help with this and MSDN but my programming skills have never been up to much if I'm honest.
Any help would be much appreciated.

A few things then
For Visual Studio download and isntall the Windows Mobile SDK's (Version 6, standard and Pro).
Then when you create a new Mobile Device application you have everything you need. There should be a Toolbar in Visual Studio that allows you to select where your device will be run in Debug Mode (either the Emulator or on your device). This is the easiest way to debug your apps; also using MyMoblier will help.
Starting an App in C# is as easy as System.Diagnostics.Process.Start() method.
Connecting to the net is a little harder, I have written my own based on what I found using google. Basically it centers around 3 API calls:
Code:
[DllImport("CellCore.dll")]
static extern int ConnMgrEstablishConnectionSync(ConnMgrConnectionInfo connectionInfo, ref IntPtr connectionHandle, uint dwTimeout, ref ConnMgrStatus dwStatus);
[DllImport("CellCore.dll")]
static extern int ConnMgrMapURL(string url, ref Guid networkGuid, int passZero);
[DllImport("CellCore.dll")]
static extern int ConnMgrReleaseConnection(IntPtr connectionHandle, int cache);
Hope this helps
EDIT:
Also moved to Q&A to avoid upsetting them
Ta
Dave

Thanks for the advice. I have already downloaded Windows Mobile 6 SDK but I for some reason don't seem to be able to access the ROMS from WM6 inside of Visual Studio. I might be able work that issue out though. I will see how I get on with it and post back if I have any further problems.

Connecting to the internet.
I have found that the .net object WebRequest will open the connection if is not already open.
Stream ResponseStream = WebRequest.Create("yourURLgoesinhere").GetResponse().GetResponseStream() will return a stream to read to get the object.
If there is an active WiFi connection the phone will use it, or it will use an active GPRS connection, or fire up the default GPRS connection as a last resort.
The bottom line is - let the machine do all the hard work.

Related

[help] vb .net database development

hellooo,
i am looking for a good tutorial to help me get started developing a simple application which will run on a Windows CE 4.1 device and will connect via Wifi to a local sql server and return/store data.
I am a bit lost since i dont even know where to start, i.e. i need visual studio .net alone or another SDK or someting?
any pointers to a suitable tutorial will be much apreciated.
Not too sure what you need for CE4.1 but this is a good place to start
MSDN Windows Mobile
and here's one way for your DB I think
http://msdn.microsoft.com/mobility/...ry/en-us/dnppcgen/html/intro_winmobile_vb.asp
Haven't looked at the code but you can use either
1)SqlDataAdapter and SqlCommandBuilder to get the results into a DataTable
or
2)SqlDataReader
thanks kev, msdn should have enought info to get me started.
saw that tutorial on msdn but it wont do, since it connects to the sql server via web services or someting, i want to connect directly to the server and execute sql queries.
if you use an oleDBdaptor or sqladaptor it will be transparent for the
system that you are a pda and not a normal pc
wifi is transparent too it's all LAN
Just checkout the classes I mentioned they give examples: SqlDataReader SqlDataAdapter

Creating a WM Application - Where to start ?

I hope this is the right place to put this, if not, mods, feel free to remove and/or delete it. I've dabbled a bit with C before, but that's about the extent of my programming experience. I'd like to create a program that will parse the information from a website and display it... I don't imagine something like that would be hard to do, but I have no idea what tools I would even need to start writing a PPC application.
Kitco (a website that gives live quotes of precious metals) recently came out with an application for the iphone that neatly formats all this information:
http://www.kitco.com/images/banners/KitcoiPhone/iphone.html
I'd like to basically create a PPC version of this application.
Is this something that an individual with next to no experience could hope to achieve ? I'd have to create a GUI, initialize the internet, connect and retrieve a webpage and remove the relevent information before displaying it.
Any help would be greatly appreciated. I've always wanted to become more familiar with these sorts of things and figured this project would be a great way of learning it.
Thanks!
ThreadMoved
Next to no experience? I dont think so. You have to have a little under your belt first and the only way to achieve that is to start readin right here!
I'm also interested in the expert answers to this question.
My very non-expert understanding is as follows:
VS 2005 (microsoft visual studio) can create executables for WM devices using a SDK (low level) or .Net CF (medium level) interface. You want to use .Net CF (compact framework) because it is supposed to make things easier. I think you have to use C++ to use the SDK but you can use C++, C#, or Visual Basic and write to .NET CF.
VS 2005 is an IDE (integrated development environment). It contains features to edit, compile, and even test your program using simulator/debugger. I think there are some non-microsoft IDE's that can also generate Windows Mobile code -- there is a market for cross-platform environments (e.g. programmers write code using a special library instead of the windows SDK or .NET function and the same source code can be compiled to run on Blackberry, iPhone, S60, Windows Mobile, etc...)
Instead of writing to the phone hardware (or .NET abstraction) directly, you can write your application using Java. You would use some Java compatible IDE (like Eclipse, Jbuilder, or NetBeans) to create Java applets that you download to your phone. You'd have to install a Java VM (virtual machine) on your phone to run these applets. I think the downloadable games for phones are Java applets.
Disclaimer: I haven't worn my "programming cap" since 2001 and hopefully things have gotten simpler. In my previous life I designed operating systems for mainframe computers.

C++ GUI

Does somebody know where i can find any tutorials on GUI handling in c++ for windows mobile 6.1
My code is complete but i still have to code the interface, but i can't find anything on how to do this.
(made in vs 2008, c++ smart device application with SDK 6 pro)
Hy,
you can try mfc.
Greatz
mccoffein
yeah miniMFC is the other other wiciwigy interface for wm apart from .net
and it's slower then pure win32 where you have to build all guild in code by hand
but it's faster then .net
but why use mfc if its slower, i just need 1 input box 1 output box like a multi line textbox and a start button.
Just need 1 tutorial on how to do it, i messed around with the resources where i made a dialog but i can't do anything in the main window.
MFC is easier, as it provides classes for handling all this stuff, and it also wraps up the windows messages into convenient events to deal with.
If you want to do it the hard way, you will have to master the function CreateWindow() or CreateWindowEx()
Search for it in VS Help and make sure you select the CE version.
Buttons, textboxes, checkboxes, etc., are all child Windows, connected to/owned by, the main window of the application.
Search for 'Control Styles' to find what parameters to pass to to it, in order to create what you want.
Search VS help using 'Creating a Button' for some examples, and study them hard.
You will have to get to grips with all this before you can even start.
Aah well I have done my fair share of assembly guess i am lucky there.
I never knew that every item on a form was considered a window, however it does make sense if your looking around with spy++
I'll just check how fast it runs on MFC, because now it already takes 5 minutes to run in the worst case scenario (this however is inside the emulator).
Thanks for the information guys

running application in C on mobile phone with Android

Hello !
SUMMARY: How to run pocketsphinx_continuous on mobile phone with Android, and how to do it with simulator of mobile phone with Android. PocketSphinx can be downloaded for free here, for both Linux and Windows: http://cmusphinx.sourceforge.net/html/download.php .
Click to expand...
Click to collapse
------------------------------------------------------------------------------------------------------------
SHORT EXPLANATION
I'd like to create application for mobile phone and server such that:
1. User runs application on mobile phone with Android, this application uses PocketSphinx. It is Automatic Speech Recognition software for devices like mobile phones, written in C. Somebody told me that "Pocketsphinx is used successfully on Symbian with minimal effort". (However I think Android may be better choice). My knowledge about Android is limited but I know something about CMU Sphinx. Can you help me, please, to run this PocketSphinx on Android? I also need to find simulator of mobile phone with Android. I have already found Wireless Toolkit and I tried to use this emulator, however I think it doesn't allow to run simulation of mobile phones with Android. (By the way I am limited in my project to mobile phone of the price up to about 160 euro; which Android version would be best for my application?).
2. This application communicates with the user. The users speaks digits and some other words (dictionary is about fifteen words, I can create language and acoustic models, as well as formal grammar in CMU Sphinx, with the use of SphinxTrain). The application recognizes those digits.
3. Based on this talk, mobile phone sends information about results of recognition to the server. I can do it in Java for CLDC/MIDP with httpconnection, POST method on the mobile phone side and with Tomcat on server. I think this httpconnection must be possible not only in Java ME, but also in Android C. But this is thing which will bother me later, now I'd like to run pocketsphinx_continuous on Android and try to modify it according to my needs.
Summing up, what I'd like to know is how to run demo pocketsphinx_continuous on mobile phone with Android, and how to do it with simulator of mobile phone with Android. (I've got Wireless Toolkit but I think it is not capable of running Android). PocketSphinx can be downloaded for free here, for both Linux and Windows: http://cmusphinx.sourceforge.net/html/download.php . There are two ways of installing it in Ubuntu. First is to unpack it (it is tar.gz), enter its directory and type "./configure", "make", "sudo make install". The other, different, is written in README file, i.e. run autogen.sh, "./configure", "make clean all", "make test", "make install". The result should be, among many other files, javadoc in doc directory.
------------------------------------------------------------------------------------------------------------
LONG EXPLANATION
What is required to give me some advices is written above. So if you don't want / don't have time to read the whole text, just above explanation is enough. But let me say about other possible approaches which I try to do. Those are worse than what I explained above, but I also tried them.
CMU Sphinx contains SphinxTrain to create acoustic model. It has got some different recognizers (also called decoders), those are PocketSphinx, Sphinx4 and some other. PocketSphinx is written in C and is for devices like mobile phones. Sphinx4 is Java application for PCs because it requires better hardware. There is good tutorial about using SphinxTrain with Sphinx4. It is here: http://www.speech.cs.cmu.edu/sphinx/tutorial.html . There is no similar tutorial for PocketSphinx. However with some knowledge about Android and C it is possible to run it on Android. The other approach than PocketSphinx, is using this Sphinx4. However it requires connection between mobile phone and server, sending audio data from cellular phone to server. It can be done with Skype, but there is still problem on server side with redirecting sound from Skype to Sphinx4. So you see there are two different approaches. One is to run speech recognition on mobile phone with PocketSphinx and Android. The other is speech recognition on server with Sphinx4. There are some ways to follow this second option. One is Skype on both server and mobile phone. (But there is problem with redirecting speech from Skype to Sphinx4). The other is too expensive Digium card. The third one is IVR, but I still look for good open-source IVR software. All of those three ways of second option involve Sphinx4. It was much easier to create application with Sphinx4. It is for PCs, not embedded devices, because it requires better device, extensive floating point math and some other things. But it has much better documentation than PocketSphinx. But I want to use PocketSphinx because I don't need to pay to anybody for access to mobile internet in order to send data through internet for application like Skype. The access to internet is required only for short time to send little text data with httpconnection, POST method. This is why I'd like you to help me, please, with running pocketsphinx_continuous on simulator of PocketSphinx on mobile phone with Android. (By the way, I see I've got installed S60 Developer Tools -> 3rd Edition FP1 SDK -> MIDP -> Emulator).
Summing up in a list, those are in CMU Sphinx:
I. SphinxTrain, which I can use to create files needed for speech recognition
II. decoders which use speech input and some files which I create with SphinxTrain, to follow speech recognition (input speech + files from SphinxTrain = are used by decoder)
II-1. PocketSphinx, written in C, for devices like mobile phones
II-2. Sphinx3, written in C, for PCs, actually the best developed
II-3. Sphinx4, written in Java, for PCs, with the best documentation
II-4. Some other, older versions
Those are possible approaches of solving my task:
I. Speech recognition on mobile phone with PocketSphinx. This is much better way than [II].
Problems: 1. running PocketSphinx on mobile phone with Android. 2. simulating mobile phone with Android on PC. I also thought that maybe I should consider Meamo, what do you think about it? Or use things different than CMU Sphinx, e.g. Simon, HTK, Julius. I looked at those other ASR engines and I think PocketSphinx may be best choice.
II. Speech recognition on server with Sphinx4. There are some different ways of establishing voice connection between mobile phone and server.
II-1. ordinary call from mobile phone to server; server has got Digium card. Disadvantage: Digium card is expensive.
II-2. to use Skype on both mobile phone and server. Problem: redirecting of sound from Skype to Sphinx4 and vice versa.
II-3. can you think about any other ways? I found that Asterisk may be useful.
Greetings !
Summing up, what I'd like to know is how to run demo pocketsphinx_continuous on mobile phone with Android
Click to expand...
Click to collapse
First step would be to setup a toolchain and compile the prog for android
or statically linked with uClibc.
Then push it onto your device and test if it works as expected.
You can also push it onto the android emulator that comes with the sdk.
Just my 2 cents...
Thank you very much!
Can you give me any links to tutorials which can be useful for me?
By the way I know how to create my own application in Sphinx4 and I know how to run demo in PocketSphinx, but I've got some difficulties with creating my own application for PocketSphinx. So if you can have a look at PocketSphinx http://cmusphinx.sourceforge.net/html/download.php and tell me which files I need to have to create new project for PocketSphinx, I would be greatful. I mean that for Sphinx4 the only what I need to do is to enter S:\tutorial\sphinx4-1.0beta3-src\src\apps\edu\cmu\sphinx\demo\helloworld and create my own ...\demo\my_application, and inside it analogically to what is here ...\demo\helloworld. In the case of PocketSphinx, to run the application, I need to enter S:\tutorial\pocketsphinx\doc and run pocketsphinx_continuous. So I check what I've got in this file and I cannot see what files and where I need to have in order to create new project. I uploaded directory doc with pocketsphinx_continuous here: http://www.speedyshare.com/files/19429494/doc.7z
Greetings and thanks once more !
Rough outline: You'll need the Android SDK and NDK, both of which are available from http://developer.android.com/. The NDK will allow you to compile C code. You'll need to wrap the C core in a Java layer to make it accessible to the rest of the Android system. The SDK also includes an emulator, which I believe you've asked for if I understand you right.
I haven't actually attempted this, so that's about all the help I can be, but there is sample code included with the NDK that should get you started.
Thanks for your answer !
I check the google and see that NDK is term of Android, because I knew only SDK abbreviation. I assume NDK is especially for porting (like porting PocketSphinx for Android). So am I right that with this NDK I don't need to change code of PocketSphinx? I think it would be too easy .
There also other question which I've got. It is not strictly connected with Symbian but there wouldn't be any need for porting if I won't solve this problem. I've got my application in Sphinx4. There are also examplary appications for Sphinx4 and PocketSphinx. I can run demos from PocketSphinx (as explained in first post), as well as demos from Sphinx4. I can change source code of demos from Sphinx4 to perform my task. I'd like to do similar thing with PocketSphinx, but even if it should be easy task, I cannot do it. In Sphinx4 it is much simpler because all source files are in one directory. In PocketSphinx it is done in somehow different way. (http://cmusphinx.sourceforge.net/html/download.php). Without ability to move my application from Sphinx4 there is no need for me to port this PocketSphinx to Symbian.
Greetings !
johnyjj2 said:
I assume NDK is especially for porting (like porting PocketSphinx for Android). So am I right that with this NDK I don't need to change code of PocketSphinx? I think it would be too easy .
Click to expand...
Click to collapse
NDK is used to write software for Android devices that are compiled natively to the platform -- for now, this usually means ARM. Java as you probably realize is a bytecode intermediate language that the java virtual machine converts to native calls at runtime. This means that Java is generally platform independent whereas your C code is not.
JNI as used with the NDK is the Java Native Interface (or something to that effect). It allows you to call code that has been compiled for a specific processor from Java. This means that you could put heavily optimized super fast calculations in a native library and call them from your Java app.
It could also mean, that you've more or less written your entire application in some native code, and then you have written a java shim that has enough code to initiate and start your native software. Beware, there be dragons here.
The fact that you CAN do this, doesn't mean you SHOULD. There are a lot of benefits to using the android platform and specifically using the android way of writing applications. Concepts like views, activities, intents, etc., greatly simplify how an Android device interacts with other Android devices and provides a consistent and powerful framework.
For something like SCUMMVM, it is a game (platform) that is very linear in design; you are either actively playing it, or it is on pause. How other applications are running while using SCUMMVM is inconsequential. It sounds like you have very different requirements.
Thanks for answer!
Isn't that link (http://cmusphinx.svn.sourceforge.net/viewvc/cmusphinx?view=rev&revision=9470) simply trying to copy engine library to Symbian, without effect? Only enginge won't help, there is also need to write from zero code which will use this library. So it looks like there is still long way to have it working. Do I understand it properly?
Greetings!

[Q] Wanting to start creating homebrew applications.

Ok, so I have no experience of working with any type of coding of development except for Adobe Flash. I don't think that really counts though, nor help me here, but I want to start off by saying that I'm simply a 17 year old.
I want to start development of an app to edit the registry. For example, I got the idea for everytime you click a button on the app, it edits something on the registry. Of course, phones will have to be Interop-Unlocked (Which my Samsung Focus is).
So to get on topic, how may I start creating an app for Windows Phone to edit registry and etc.? As I said before, I really don't have much experience, but I would love to learn and help the community.
Thanks in advance.
Bump up....
Ok, basic first steps: do you have the WP7 SDK? You can get it for free, and you'll need it. It includes the tools to build and deploy apps (compilers and so forth).
The project you're talking about is a bit heavy for a first foray into app development, but you can give it a shot. One of the easier ways (for me, at least) to learn things is to look at what other people did, which in coding usually means looking at open source projects. There are a few open-source apps which access the registry.
For example, my MultiTaskToggle app (linked in my sig) works on Samsung and provides an example of how to read and write a specific registry value.
If you want to browse the registry at all, you'll need something different. This can be done, using COM to call native APIs. Look at the Homebrew library (used by the Webserver projects, among others) or WP7 Advanced Explorer (open source, code is on Codeplex). These types of project have two parts: managed (.NET code, typically in C#) that calls the COM interface, and native (C/C++, written using the Windows Mobile SDK) that implements the COM object.
You may want to do some research online to get started, either here on XDA-Devs (though I think most tutorials here assume at least basic knowledge) or elsewhere (even from MS directly) if you're really starting from scratch.

Categories

Resources