The Mouse Labyrinth - About xda-developers.com

Hello everybody,
I want to present a labyrinth game.
You are a mouse and you have to find the cheese in these complicated mazes which are filled with all kinds of traps.
I offer you an ingenious riddle to aid you in your quest to navigate the harsh mistress that is the Internet, in order to find our Facebook page; any information you need about this game can be found there.
x = https://
website = facebook
suffix = /pages/The-Mouse-Labyrinth/459901347388323
result = x + "www" + "." + website + "." + "com" + suffix
Hint: "+" represents a string concatenation operation

Related

Probelms with event handling and threads in CF3.5 on VB

HI!
I have a big problem with event handling in VS 2008. I'm writing a GPS program which determine the coordinates, attitude, speed etc. This is a part of a compass program. I'm using the Microsoft's GPS Intermediate Driver. I also use thread to the GPS reading from serial port to not interferre with the UI and the compass because the serial port reading is very slow and stops the compass' spinning for a second at every reading. I was ran through tons of forums and examples about the threads and event handling, but whenever I start the program and the event rises I get this error message:
NotSupportedException
Microsoft.AGL.Common.MISC.HandleArr(PAL_ERROR ar)
System.Windows.Forms.Control.get_Text()
System.Windows.Forms.Control.set_Text(String value)
O2Compass_VB.Form1._Lambda$__1(Object a0, LocationChangeEventArgs a1)
Microsoft.WindowsMobile.Samples.Location.GPS.WaitForGpsEvents()
The code is the next:
Code:
Imports Microsoft.WindowsMobile.Samples.Location
Imports System.Threading
Dim LatRef, LonRef As String
Dim WithEvents GPS As New Gps
'Start GPS readings
GPS.Open()
'Start thread
Dim GPSThread = New Thread(AddressOf GPSDataWriteOut)
GPSThread.Start()
Private Sub GPSDataWriteOut() Handles GPS.LocationChanged
If GPS.GetPosition.Latitude < 0 Then LatRef = "S" Else LatRef = "N"
If GPS.GetPosition.Longitude < 0 Then LonRef = "W" Else LonRef = "E"
If GPS.GetPosition.LatitudeValid Then LatTXT.Text = "Lattitude: " + GPS.GetPosition.Latitude.ToString("#0.0000000") + " " + LatRef
If GPS.GetPosition.LongitudeValid Then LongTXT.Text = "Longitude: " + GPS.GetPosition.Longitude.ToString("#0.0000000") + " " + LonRef
If GPS.GetPosition.SeaLevelAltitudeValid Then AltTXT.Text = "Altitude: " + GPS.GetPosition.SeaLevelAltitude.ToString + " m"
If GPS.GetPosition.SpeedValid Then SpeedTXT.Text = "Speed: " + GPS.GetPosition.Speed.ToString
If (GPS.GetPosition.SatelliteCountValid) And (GPS.GetPosition.SatellitesInViewCountValid) Then SatsTXT.Text = "Sattelites: " + GPS.GetPosition.SatelliteCount.ToString + " / " + GPS.GetPosition.SatellitesInViewCount.ToString
End Sub
And all of this works on the device emulator, but on the phone it's crash. When I'm put the writeouts in a timer it works but then I can't use thread.
Anyone can help me to fix this error? I though the code was right, but always came the same error. What am I doing wrong?
I managed to solve the problem.
The event handling is a different thread, no need to create one to it. And because it's a new working thread, it can't update the label's text of the main thread. So I just pass through the received datas to a variable in the main thread and write it out with a timer if the datas received.

Import Hi-Res Contacts

I wrote this utility to batch import hi-res contact photos (256x256 or whatever you want) to my contacts. The trick is to name the jpg files "firstname_lastname.jpg" so it will find a match.
I am not a programmer, so don't be too hard on me. I've learned a lot from xda-developers and just want to give a little back. Hope you like it.
contact_pictures.exe v1.0 (unzip and run it on your diamond, no cab, no install)
Source Code is shown below, NET CF on Visual Studio 2005 VB
' --- source code ---
' Joe Jones
' 6/16/10
Public Class Form1
Dim cnt As Integer
Dim AppSession As New Microsoft.WindowsMobile.PocketOutlook.OutlookSession
Dim myContacts As Microsoft.WindowsMobile.PocketOutlook.ContactCollection = AppSession.Contacts.Items
Dim session As Microsoft.WindowsMobile.PocketOutlook.OutlookSession = New Microsoft.WindowsMobile.PocketOutlook.OutlookSession()
Dim contacts As Microsoft.WindowsMobile.PocketOutlook.ContactCollection = session.Contacts.Items
Dim contact
Dim PathStr As String
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
cnt = 0
TextBox2.Text = Str(myContacts.Count)
TextBox4.Text = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
End Sub
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
' parse through contacts looking for file to update pictures
Dim FirstNm, LastNm As String
' set folder for pictures
PathStr = TextBox4.Text
While cnt < myContacts.Count
FirstNm = myContacts.Item(cnt).FirstName
LastNm = myContacts.Item(cnt).LastName
TextBox2.Text = Str(cnt)
TextBox3.Text = FirstNm
TextBox4.Text = LastNm
' check for matching contact info with picture filename "firstname_lastname.jpg"
If System.IO.File.Exists(PathStr + "/" + FirstNm + "_" + LastNm + ".jpg") Then
myContacts.Item(cnt).SetPicture(PathStr + "/" + FirstNm + "_" + LastNm + ".jpg")
End If
' increment counter
cnt = cnt + 1
End While
' end app
TextBox3.Text = ""
TextBox4.Text = "Done"
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Me.Close()
End Sub
End Class
jonzjos said:
I wrote this utility to batch import hi-res contact photos (256x256 or whatever you want) to my contacts. The trick is to name the jpg files "firstname_lastname.jpg" so it will find a match.
I am not a programmer, so don't be too hard on me. I've learned a lot from xda-developers and just want to give a little back. Hope you like it.
contact_pictures.exe v1.0 (unzip and run it on your diamond, no cab, no install)
Source Code is shown below, NET CF on Visual Studio 2005 VB
Click to expand...
Click to collapse
Great, I will test it out soon. Thanks.
Here is the source code as a project so anyone can make it better and recompile it.
Putting the exe and jpg files into the same folder is the easiest thing to do.

[SDK] XFControls - Advanced UI SDK [UPDATED w/ Sense UI Example!]

This is an Advanced UI SDK for developing finger-friendly Application UIs.
The reason for developing this SDK was mainly to learn about programming for Windows Mobile and the Compact Framework 3.5. I also developed this SDK because I could not find good UI controls that gave total display control to the programmer while taking care of all of the Physics, windowing, and frame buffering AND was open source.
Finally, this SDK was originally developed as part of the XDAFacebook application that I am currently developing.
I am releasing this SDK and its source so that people can have a good foundation to build finger-friendly Windows Mobile applications, and so that programmers starting off in the Windows Mobile world won't have to start from scratch when creating useful UI Controls.
Here are some of the features and uses of this SDK.
Features:
Fully customizable
Easily create custom UI Controls
Resolution independent
Full physics for rendering smooth scrolling
Uses:
Quickly create UI controls
Develop full UI SDKs
Learn basic UI programming for .net CF 3.5
I ask that if you use these controls, please provide feedback so that everyone can benefit!
Thank you and I hope you find these controls useful!
SDK Documentation
Even though the controls are easy to implement, they can seem intimidating at first. Here is an over-view of the core pieces to the SDK:
The IXFItem Interface:
Here are Properties of the interface
PHP:
XFPanelBase Parent { get; set; } // The item's List container
XFItemState State { get; set; } /* An Enum to describe the current item's state
This could include things like [B]Selected[/B] or [B]Normal[/B]*/
Bitmap Buffer { get; set; } // This is the item's cache buffer. Allows for speedy rendering
XFItemStyle Style { get; set; } // CSS like style object. Allows for easy customization
XFItemType ItemType { get; set; } /* Enum to label the type of the current object.
For example, [B]Clickable[/B] or [B]Display[/B] meaning the item won't change*/
The following are the methods that need to be implemented
PHP:
int GetHeight(); /* This returns the height of the item. This value is usually calulated
but in some instances is static. The value should be cached because this method
is called several times during the rendering process.*/
void ResetHeight(); // What ever needs to be done to reset the height cache
void ItemPaint(Graphics g, int x, int y); // Where the magic happens. More on this later
XFItemClickResult GetClickResult(); // An enum is return with what the action of clicking this item was.
The main part of the interface is the ItemPaint method. This method is called from the XFPanelList and passes a Graphics object created from the Buffer Bitmap of the Item. In this method, you do all of your graphics logic, drawing it with the supplied graphics object. The x and y are any offset numbers that should influence when the objects are based. Most of the time, these numbers will be 0, 0.
Because the programmer has total control over how the item is rendered, special care must be used when creating the items, to draw all the features with respect to the XFItemStyle object. This object usually is created in CTOR. An example of the XFItemStyle object being created in one of the SenseUI XFItem's CTORs:
PHP:
public SenseItem()
{
ItemType = XFItemType.Clickable;
Style = new XFItemStyle()
{
BoarderBottomColor = Color.FromArgb(189, 182, 189),
DashStyleBottom = System.Drawing.Drawing2D.DashStyle.Dash,
TextColor = Color.Black,
TextFont = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Regular),
SelectedTextFont = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Regular),
SecondaryTextFont = new Font(FontFamily.GenericSansSerif, 7, FontStyle.Regular),
SelectedSecondaryTextFont = new Font(FontFamily.GenericSansSerif, 7, FontStyle.Regular),
SecondaryTextColor = Color.FromArgb(57, 52, 57),
SelectedTextColor = Color.White,
SelectedBackgroundColor = Color.FromArgb(43, 36, 43),
SelectedSecondaryTextColor = Color.FromArgb(182, 178, 182),
Padding = 11,
PaddingBottom = 12,
PaddingLeft = 10,
PaddingRight = 16
};
}
You will also notice that the ItemType is also set here.
How you use the Style is a little more involved. In the ItemPaint, the programmer should base all of the features off of what is in the Style object. Here is an example of how the above Style object was used in the ItemPaint method:
PHP:
public void ItemPaint(Graphics g, int x, int y)
{
int width = Parent == null ? Screen.PrimaryScreen.WorkingArea.Width : Parent.Width;
XFControlUtils.DrawBoarders(Style, g, 0, 0, width, GetHeight());
int currX = Style.PaddingLeft;
int currY = Style.PaddingTop;
int mHeight = 0;
int sHeight = 0;
if (Icon != null)
currX += _iconSize + Style.PaddingLeft;
SizeF mText = new SizeF();
if (!string.IsNullOrEmpty(MainText))
{
mText = XFControlUtils.GetEllipsisStringMeasure(width - currX - Style.PaddingRight, MainText, Style.TextFont);
MainText = XFControlUtils.EllipsisWord(width - currX - Style.PaddingRight, MainText, Style.TextFont);
}
SizeF sText = new SizeF();
if (!string.IsNullOrEmpty(SecondaryText))
{
sText = XFControlUtils.GetEllipsisStringMeasure(width - currX - Style.PaddingRight, SecondaryText, Style.SecondaryTextFont);
SecondaryText = XFControlUtils.EllipsisWord(width - currX - Style.PaddingRight, SecondaryText, Style.SecondaryTextFont);
}
mHeight = (GetHeight() / 2) - ((int)mText.Height / 2);
if (!string.IsNullOrEmpty(SecondaryText))
{
mHeight = (GetHeight() / 2) - _textSpace - (int)mText.Height;
sHeight = (GetHeight() / 2) + _textSpace;
}
if (State == XFItemState.Selected)
{
XFControlUtils.DrawBackgroundSelected(Style, g, x, y, width, GetHeight());
if (!string.IsNullOrEmpty(MainText))
using (SolidBrush b = new SolidBrush(Style.SelectedTextColor))
g.DrawString(MainText, Style.SelectedTextFont, b, currX, mHeight);
if (!string.IsNullOrEmpty(SecondaryText))
using (SolidBrush b = new SolidBrush(Style.SelectedSecondaryTextColor))
g.DrawString(SecondaryText, Style.SelectedSecondaryTextFont, b, currX, sHeight);
}
else
{
if (!string.IsNullOrEmpty(MainText))
using (SolidBrush b = new SolidBrush(Style.TextColor))
g.DrawString(MainText, Style.TextFont, b, currX, mHeight);
if (!string.IsNullOrEmpty(SecondaryText))
using (SolidBrush b = new SolidBrush(Style.SecondaryTextColor))
g.DrawString(SecondaryText, Style.SecondaryTextFont, b, currX, sHeight);
}
if (Icon != null)
XFControlUtils.DrawAlphaFirstPix(g, Icon, Style.PaddingLeft, Style.PaddingTop);
}
That is as complex as it gets. Other than doing normal Event Handling for ClickReturns, this is all that is required to create beautiful UI Controls for your application.
I hope that this helps! Feel free to PM me or post a reply if you need further clarification.
Class List
Form Controls:
XFPanelContainer - The main control that interacts with the Form.
XFPanels:
XFPanelBase - Basic building block. Handles most of the generic functionality
XFPanelList - Can add IXFItem items.
XFPanelHeader - The top header bar for an XFPanelContainer
XFItems
IXFItem - Interface that all XFItems inherate
XFItemSimpleText - Simple item that displays text
XFItemBack - Special item that allows a panel to slide back
XFItemLoading - Item that allows for work to be down in the background.
XFControlUtils: Library of static, useful utilities for this SDK
DrawAlpha - Draws an image with a supplied Graphics object with a specific level of opacity
DrawAlphaFirstPix - Draws an image and renders all pixels that are the same color as pixel (1,1) are 100% transparent
DrawJustifiedString - draws a justified string
GetEllipsisStringMeasure - Takes a string and if it is more than the supplied width, clips the string and adds a trailing "..." at the end
EllipsisWord - same as the GetEllipsisStringMeasure, except it ellipsis at the words and not at the char level.
GetSizedString - Takes a string and adds "\n" so that the string wraps according to the supplied width
Many Others!
Sense UI Example
Here is a working example. I made this Sense UI example in about 3 hours 15 hours. It isn't complete but gives a good example of how to/why use this SDK. There are 3 screenshots of what this demo looks like.
I'll explain some of the pieces of code when I get some time later today.
The other great example of how to use this SDK is the XFAFacebook Application.
The source for this project is located @ http://code.google.com/p/xda-winmo-facebook/source/browse/#svn/trunk/XFSenseUI
There are a few screenshots of the XDAFacebook application included.
Finally, a quick start tutorial.
Start a new Smart Device project.
Add a reference to the XFControls.dll
Place the following lines of code in the Form1 constructor (after the InitializeComponent()
Code:
XFPanelContainer container = new XFPanelContainer();
container.Dock = DockStyle.Fill;
Controls.Add(container);
XFPanelList list = new XFPanelList();
container.SetMainPanel(list);
list.ShowScrollbar(true);
for (int i = 0; i < 50; i++)
{
list.Add("This is item " + i);
}
Run the project and you will get an output like the "SimpleText.png"
It's that easy!
UPDATE: I've added the XFSense to the Google Code page and have made some pretty extensive updates to it. I've added a few controls including sliders, toggles, checkboxes and radio buttons. It still isn't complete but I will be working to make it a full fledge Sense SDK.
Stay tuned!
Releases:
Initial Release - 9/1/10
When major updates occur, the DLLs will be posted here. The best thing to do is pull the source from the Google Code page and use that.
This will guarantee the freshes code will be used for your projects
Instructions:
Download and unzip the latest XFControls.zip from below.
Add the .dll as a reference.
Program!
The source can be found at: http://code.google.com/p/xda-winmo-facebook/source/browse/#svn/trunk/XDAFacebook/XFControls
List of downloads:
10/6/10 - Updated for speed and better scrolling! - XFControls 0.2.zip
9/1/10 - Initial upload - XFControls 0.1.zip
Other things I might have missed
Reserved Other
Sounds interesting! Definitely looking forward to some screenshots.
kliptik said:
Sounds interesting! Definitely looking forward to some screenshots.
Click to expand...
Click to collapse
Screenshots are up!
Only 3 downloads?! Hmmm.... I figured more people would be interested in a finger-friendly and open source UI SDK...
Is there something wrong with my posts? Are they too confusing?
Let me know what I can do to help! This has taken me a good deal of time to write and I would hope that it would be of use to someone else...
joe_coolish said:
Only 3 downloads?! Hmmm.... I figured more people would be interested in a finger-friendly and open source UI SDK...
Is there something wrong with my posts? Are they too confusing?
Let me know what I can do to help! This has taken me a good deal of time to write and I would hope that it would be of use to someone else...
Click to expand...
Click to collapse
Just DL'd a copy. I'm super swamped at the moment trying to get the next release of KD-Font out, but I'll try and check this out when I get a chance.
Thank you for your contribution!
I will definitely give this a test run at some point. Good work!
you have to add you own graphics to this sdk?
janneman22 said:
you have to add you own graphics to this sdk?
Click to expand...
Click to collapse
yes, this is a UI SDK. it is used to create user controls. The core code handles all the caching and physics, but the programmer must create the actual controls. including the graphics. look at the sense UI example to see how you can implement your own custom UI controls. like i said in the post, it only took about 3 hours to create those controls. most of which was spent creating graphics.
joe_coolish said:
yes, this is a UI SDK. it is used to create user controls. The core code handles all the caching and physics, but the programmer must create the actual controls. including the graphics. look at the sense UI example to see how you can implement your own custom UI controls. like i said in the post, it only took about 3 hours to create those controls. most of which was spent creating graphics.
Click to expand...
Click to collapse
oh right. but does it place controls in the toolbox, or have you to create the controls hard coded?
i could help you to make some grapics packages for this sdk
Ok, I've updated the binaries to be the latest and greatest. The scrolling is super smooth and things are starting to look pretty good!
I also will be updating the XFSense and I'll probably be extending it a little more because I plan on bringing it into the XDA Facebook app.
As always, let me know what you think!
EDIT: Oh, and to answer the question about adding objects to the toolbox, I have not added the OCX files (or whatever they are) so that they can be added to the tool box. But, after you've added the container and the panels, everything is logic after that, so adding the items to the toolbox really doesn't benefit too much.
As far as graphics, I would love help with graphics! Send me a PM and we'll talk!
joe_coolish said:
Here is a working example. I made this Sense UI example in about 3 hours. It isn't complete but gives a good example of how to/why use this SDK. There are 3 screenshots of what this demo looks like.
I'll explain some of the pieces of code when I get some time later today.
The other great example of how to use this SDK is the XFAFacebook Application.
The source for this project is located @ http://code.google.com/p/xda-winmo-facebook/source/browse/
There are a few screenshots of the XDAFacebook application included.
Finally, a quick start tutorial.
Start a new Smart Device project.
Add a reference to the XFControls.dll
Place the following lines of code in the Form1 constructor (after the InitializeComponent()
Code:
XFPanelContainer container = new XFPanelContainer();
container.Dock = DockStyle.Fill;
Controls.Add(container);
XFPanelList list = new XFPanelList();
container.SetMainPanel(list);
list.ShowScrollbar(true);
for (int i = 0; i < 50; i++)
{
list.Add("This is item " + i);
}
Run the project and you will get an output like the "SimpleText.png"
It's that easy!
Click to expand...
Click to collapse
Very nice control. I downloaded the sample (had problem with missing XFControl project but downloaded it from code.google).
Have a couple questions, how would i go about adding image to a child panel?
What I'm trying to so is have about 75 items on the main screen and each item will have sub-panel, when clicking on sub-panel I need to have label x2 and image.
Also when compiling the project I get error:
"Error 1 'XFControls.XFPanels.XFPanelHeader' does not contain a definition for 'BackgroundImage' and no extension method 'BackgroundImage' accepting a first argument of type 'XFControls.XFPanels.XFPanelHeader' could be found (are you missing a using directive or an assembly reference?) C:\downloads\C#\XFSenseUI\XFSenseUIDemo\Form1.cs 39 24 XFSenseUIDemo"
Alright, I'll post an example if I get some time in a bit. But as for the error, it is because the Core XFControls has been modified since the last time I updated this thread. You can download the freshes code from the google code page or use the attached DLL. I'd suggest the Google Code page, since it gets updated more frequently. But then you get all the XDAFacebook with it, so it can also be negative.
Basically to add an image to an XFItem to be added to the XFPanelList, you can either create your own item by inheriting from the IXFItem and doing all the image manipulation in the ItemDraw() method.
For an example of how to do that, look at the XFItemImageDisplay item in the XFControls.XFPanels.XFPanelItems namespace.
If you need something specific, let me know and I'll see if I can whip up an example
I'm new to C# and the compact framework so sample would be good...
Thanks
JarekG said:
I'm new to C# and the compact framework so sample would be good...
Thanks
Click to expand...
Click to collapse
Ok, could you describe how you want the control to look? Also, what you want to supply to the constructor? IE a path for an image, upper text, lower text, maybe even some style things. ETC

[.Net DLL] WMLocationInfo - Get your location via CellID/GPS the easy way!

[01/2/11] Update v2.1 - Downgraded .net to v2.0 - Should now work with VS2005!
[31/1/11] Update v2 - Now includes GPS Support!
[30/1/11] Update v1 - Initial Release - CellID Only!
I have created this DLL to allow developers to quickly and easily add support for locations. By using CellID and now GPS!
CellID: This way is done by getting looking at the Cell Towers your mobile is connected to.. and then by searching a database of Cell Locations you can work out an approximate location for your Device, Which is usually accurate within 50-100m!
GPS: I'm sure we all know what GPS is and how it works Instead of using the Cell Tower location to find your location, It takes the co-ordinates from the GPS to then query an online source to figure out your location, Which is as accurate as GPS can get! If you're outside and not blocked by many buildings it should be as accurate as <5m
To download see the attachments 'WMLocationInfo.rar' contains the DLL file only..
If you are unsure how to go about using this DLL, I have included a sample C# application with full source code, This will show you how to get location by both CellID and GPS
Please take note of the copyright info below, before downloading and using my DLL and/or Source Codes
Thanks,
-David!
Copyright © 2011 David Bell / DavidTiger All Rights Reserved.
All Source Code, Compiled exe and DLL files are the copyrighted works of David Bell/DavidTiger.
You may use/redistribute any included samples or files, but you MUST leave credits where due.
You may NOT include this DLL and/or use its function in any commercial products with an intend to make a profit without written permission first!
All compiled DLL/EXE which do not include a source code have been obfuscated
You also may NOT attempt to dissasemble or reverse engineer any compiled obfuscated distributables (exe/dll).
-Included Sample Project in post #1-
hi thanks for the dll file. this is my code in VB:
Code:
'Setup variables needed throughout the source
Dim lat As String, lon As String = ""
Dim street As String, town As String, county As String = ""
Dim cellid As String, lac As String, mcc As String, mnc As String = ""
Private Sub GetCellId()
'Retreive cell tower info from the DLL
Dim CellTowerInfo As WMCellInfo.CellIDInfo.RILCELLTOWERINFO = WMCellInfo.CellIDInfo.GetCellTowerInfo()
'Asign each variable with its cell data
cellid = CellTowerInfo.CellID.ToString()
lac = CellTowerInfo.LAC.ToString()
mcc = CellTowerInfo.MCC.ToString()
mnc = CellTowerInfo.MNC.ToString()
End Sub
Private Sub GetCoord()
'setup args with cellid data
Dim args As String() = {mcc, mnc, lac, cellid}
'call DLL to get coords and then split them.
Dim latlng As String() = WMCellInfo.CoordinateInfo.GetLatLng(args).Split("|"c)
'assign them to their variables.
lat = latlng(0).ToString()
lon = latlng(1).ToString()
End Sub
Private Sub GetLoc()
'Call DLL to find location, with lat, lon parameters.
WMCellInfo.LocationInfo.Getlocation(lat, lon)
'Assign them into their variables.
street = WMCellInfo.LocationInfo.locations(0)
town = WMCellInfo.LocationInfo.locations(1)
county = WMCellInfo.LocationInfo.locations(2)
End Sub
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
GetCellId()
Label1.Text = lac & vbCrLf & mcc & vbCrLf & mnc
End Sub
when i click on Menu_Item3, the app hangs. is there an error in my code?
Have you added "Imports WMCellInfo" at the very top of the code??
also
Added reference to the DLL??
other than that the code looks fine..
I'm not a developer, but... I think I'll have to thank you for a future software that will use your dll
Thanks
Update!!
Now includes everything you need for getting your location via CellID AND GPS!!
GPS Has slightly more code to be able to use it in your project but it is necessary to use GPS
I have included a C# sample of using the DLL to get the location with CellID and GPS
I will also include a VB code sample in the next few days as soon as I have time to write it
You'll find all this in the 1st post as soon as I upload it
-David
Hi david, i tried your sample code on my TD2 WM6.5 and it works. But when i use my own code:
Code:
Imports WMLocationInfo
Imports System
Imports System.IO
Imports System.Net
Imports System.Windows.Forms
Imports System.Text
Public Class Form1
'Setup variables needed throughout the source
Dim cellid As String, lac As String, mcc As String, mnc As String = Nothing
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
Application.Exit()
End Sub
Public Sub GetCellID()
'Retreive cell tower info from the DLL
Dim CellTowerInfo As WMLocationInfo.CellIDInfo.RILCELLTOWERINFO = WMLocationInfo.CellIDInfo.GetCellTowerInfo()
'Asign each variable with its cell data
cellid = CellTowerInfo.CellID.ToString()
lac = CellTowerInfo.LAC.ToString()
mcc = CellTowerInfo.MCC.ToString()
mnc = CellTowerInfo.MNC.ToString()
'Show the data on the form with labels or other controls...
Label1.Text = "CellID = " & cellid
Label2.Text = "LAC = " & lac
Label3.Text = "MCC = " & mcc
Label4.Text = "MNC = " & mnc
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GetCellID()
End Sub
End Class
it just hangs.
I just tested your code, copied and pasted without editing, added reference to the DLL and it works great :/
See my attached images to add reference to the DLL correctly, if you haven't already
I also attached the VB project I made with your code..
Hi David, i think i found the culprit. i'm coding using DotNetv2.0 instead of 3.5
How do i integrate 3.5 to my Visual Studio 2005?
oldsap said:
Hi David, i think i found the culprit. i'm coding using DotNetv2.0 instead of 3.5
How do i integrate 3.5 to my Visual Studio 2005?
Click to expand...
Click to collapse
You cant im afraid. 3.5 is only available to VS2008 and above.
I'll try compiling the dll under v2.0 tomorrow as it does work I used the same code for my app in vs2005 before upgrading to 2008 with .net 3.5.
I think its because the dll is built under 3.5 their is not backward compatable but building it under v2.0 means it should work for both v2.0 and v3.5
I'll try it in the morning and post back if it works, then update the dll if it does
cheers,
-David
DavidTiger said:
You cant im afraid. 3.5 is only available to VS2008 and above.
I'll try compiling the dll under v2.0 tomorrow as it does work I used the same code for my app in vs2005 before upgrading to 2008 with .net 3.5.
I think its because the dll is built under 3.5 their is not backward compatable but building it under v2.0 means it should work for both v2.0 and v3.5
I'll try it in the morning and post back if it works, then update the dll if it does
cheers,
-David
Click to expand...
Click to collapse
wow. thank you for your effort and time David.
-Updated post #1 with the dll using .net2.0, Should now work with VS2005 -
how do i get this on my phone?
This is only a DLL(Dynamc Link Library) of code which you can use to build your own program, using .netv2.0 and above with Visual Studio 2005-2008..
You can test the app I posted in post #1... Just copy the exe and dll from the bin/release folder and run it on your device..
Other than that you will have to write your own program to make use of this
An example is my 'Facebook Location' app I've posted
god this all goes over a common man head. need a simple xap file to make all this happen.
Cant open the sample project in VS2005.
Looking good though.
Yea, now I've downgraded the DLL I'll rewrite the VB and C# sample projects with 2005 anyone who uses 2008 it will update the project itself.
Gives the most compatibility, and use for people
DavidTiger said:
Yea, now I've downgraded the DLL I'll rewrite the VB and C# sample projects with 2005 anyone who uses 2008 it will update the project itself.
Gives the most compatibility, and use for people
Click to expand...
Click to collapse
Thanks, I could probably work through a VS2005 C# project but a VB one would be just ideal.
Just donated, have a beer or two on me. Would say whisky but the Irish stuff is better. LOL We have the best distillery 10 miles down the road.
Thanks! Can't say I've had many Irish whiskeys Jameson is about the only one I've tried. Oh and I had a glass or two of one my dad had, uhm Paddy I think it was called... 80 proof one
Mostly Scotch lol
I'll post up the VB one first, should be <30 minutes
If you get a chance try some Bushmills, best whiskey around.

[Q] PhoneGap and Ajax with database?

Hi all,
I recently finished learning how to create an APK using PhoneGap with code written using HTML5, CSS3 and Javascript.
Now, I would like to create a simple database app but I am not sure how to proceed. From what I learned about PhoneGap, everything can only be written in HTML5, CSS and Javascript coding. How do I get information from a database(flat-file or MySQL), display the data and edit it similar to how one would do using Ajax(I currently don't know how to code in ajax)? Is this possible with PhoneGap? How? Do I need a framework like JQuery Mobile to do this?
There would only be one page/view:
- displaying what is in the table
- and editing/adding new data to the table
Thank you.
using frameworks such as jquery mobile is a better option. u can use ajax calls to server to populate data. create a server side code that responds to ajax calls from app and fetch data from my sql and sends back the data either as json or xml
Falen said:
Hi all,
I recently finished learning how to create an APK using PhoneGap with code written using HTML5, CSS3 and Javascript.
Now, I would like to create a simple database app but I am not sure how to proceed. From what I learned about PhoneGap, everything can only be written in HTML5, CSS and Javascript coding. How do I get information from a database(flat-file or MySQL), display the data and edit it similar to how one would do using Ajax(I currently don't know how to code in ajax)? Is this possible with PhoneGap? How? Do I need a framework like JQuery Mobile to do this?
There would only be one page/view:
- displaying what is in the table
- and editing/adding new data to the table
Thank you.
Click to expand...
Click to collapse
If you just want your app to have a local database then HTML5 already does that for you. I've used this library in the past and had no problems with it at all...
http://html5sql.com/
I wrote an app that imported a CSV file into a database. It was a very basic app, written as proof of concept for a bigger project when I first started developing web apps for mobile. Here's a basic version of importing a CSV and using html5sql to create a table with it...
Code:
function createDatabase() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getFile("/sdcard/external_sd/temp/PRODUCTS.CSV", null, gotFileEntry, fail);
}
function gotFileEntry(fileEntry) {
fileEntry.file(gotFile, fail);
}
function gotFile(file){
readAsText(file);
}
function readAsText(file) {
var reader = new FileReader();
reader.onloadend = function(evt) {
var csv = evt.target.result;
var lines = csv.split("\n");
var i = 1;
html5sql.openDatabase("com.archer.testapp.db", "Test DB", _dbSize);
html5sql.process("DROP TABLE IF EXISTS products; " +
"CREATE TABLE IF NOT EXISTS products (linecode int, description varchar(255), barcode varchar(25), price int, stock int); ", function() {
function addRow() {
var line = lines[i].split(",");
var sql = "INSERT INTO products (linecode, description, barcode, price, stock) values (" +
line[0] + ", " +
"'" + line[2] + "', " +
"'" + line[1] + "', " +
line[6] + "," +
line[13] + ")";
html5sql.process(sql);
var pd = i / lines.length * 100;
$(".progress-bar").css("width", pd + "%");
i++;
if (i < lines.length) {
setTimeout(addRow, 2);
}
}
addRow();
}, function(error, failingQuery) {
alert("Error : " + error.message + "\r\n" + failingQuery);
});
};
reader.readAsText(file);
}
There's obviously stuff in there that won't be relevant and you'll need to change. Also I had a global variable, _dbSize, that was the initial size (in bytes) of the database, and there's some stuff in there about a progress bar. Use it or delete it - it won't affect the database being created.
Also, note the use of the addRow() function that calls itself. This was to enable the function to run asynchronously, which is needed if you want to be UI friendly (nothing will update whilst doing the import if you just import everything in one go).
However, since you mention AJAX then that may not be relevant. In which case you're just looking at API calls for whatever service is holding your database.
Hi friend ! If you're new to hybrid development, I highly recommend you to take a look at Ionic. It would help you on so many levels ! http://ionicframework.com/
About your issue, you can always define a REST API using your favorite backend (I know it can be done very easily with Laravel framework in PHP using MySQL DB). I prefer using Firebase ! https://www.firebase.com/
Firebase and Ionic framework based on AngularJS are such perfect match that half your code is already done before you knows it.
Happy coding !

Categories

Resources