How to translate this Windows Phone tutorial to a Windows tutorial? RRS feed

  • Question

  • I'm trying to learn the skills to program a to-do list and was excited to find this tutorial which builds almost exactly what I want to make as a starting point:

    How to create a basic local database app for Windows Phone 8

    Unfortunately for me, this is for Windows Phone, and I don't have a Windows Phone or a PC with hardware able to emulate one.  So, I'm stuck.

    What options do I have to do something similar in a non-phone Windows environment?  

    I've done a fair amount of reading and lessons with C# that covered functions and decision logic.  What I really need to learn now 1) is accepting and saving user inputs in a structured way, such as a custom class, and 2) displaying dynamic data back to the user, such as a to-do list does.  Any guidance or suggestions are appreciated.


    Sunday, February 1, 2015 6:27 AM


  • I used Telerik to convert all the code at that link to VB (Telerik can convert VB to C# also).

    Then I had to download Microsoft SQL Server Compact 3.5 Service Pack 2 for Windows Desktop and it extracts three files which you can extract to your desktop. The readme says if you're on x64 PC install both the x86 and x64 which I did. However a newer version of SQL Server Compact is available I believe but perhaps the connection string in the app is for 3.5. I don't really know other than before I downloaded and installed the above the app was crashing because it wanted the 3.5 edition for creating and accessing a database.

    The code always returns an exception of object not set to an instance (or something similar) when an Item is to be added (a task). Also I added a variable called "CountIt" thinking that a number had to be provided with the item being added. You will see that in one of the click events.

    Also all of the buttons are not being displayed in the designer window which I didn't look into. Only the add button, a listbox and a textbox are displayed. Maybe you can get assistance in resolving that in the WPF forum.

    However in the XAML in the designer window I did have to remove any code referencing static resources for Windows Phone. I did find various "mark up" files containing "dictionaries" (I opened them with notepad) in "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Design" (and some sub folders of it) and attempted to try to use those dictionaries with the app but don't know how to do that or if they would work anyhow. I was hoping doing that the static resource references could be made to work using the windows phone capabilities even though this is not a windows phone app.

    The app does create a database on my desktop with the connection string I finally used though.

    The project is on my onedrive at the below link. If you download and open it you should be able to copy all of the code out of the MainWindow.Xaml.Vb file and convert that to C# and the Application.Xaml.Vb file and convert that to C# and just copy the XAML from the main window in designer to a C# project.


    La vida loca

    Sunday, February 1, 2015 10:24 PM