Wednesday, August 13, 2008

Windows Mobile makes a powerful business tool,   however in an application where we just want our users to use the application for their job and not start playing Bubble Breaker we need to protect our application to stop them quitting or messing with settings.

I do this in a number of ways,  firstly I password protect any vital settings away so they cannot be changed by our end user fiddling, i.e

image Notice the password box and the bottom, which is required before any changes can be made.

I use something I have coined called Protected Mode.  I store a value in the registry that sets whether my application needs to be locked down or not.   Once again this is set on or off in the password protected settings form as shown above.

I password protect the quitting of the application as shown below.

image Protected mode stopping our user quitting our application without entering a password.

Having this protected mode switch allows deployment of the same application to both power users who need the full functionality of their phone et.    or to users who simply need the device to run one application.

If our application is running in protected mode,  I hide the standard form titles to prevent the user launching other applications.   I use my own user control to achieve this -

image  

Very simply this control is just a text-box control placed on a user control object.   I call the following in the Load object of any of my forms.

if (Settings.Protected) Core.FormTitle(this);

This checking that we are in protected mode changes the forms title bar.    Here's the code to-do this -

public static void FormTitle(Form form)
       {
           form.ControlBox = false;
           form.MaximizeBox = false;
           form.MinimizeBox = false;

           form.FormBorderStyle = FormBorderStyle.None;
           form.WindowState = FormWindowState.Maximized;

           if (form.Text == "")
           {
               return;

           }

           int taskbarHeight = Screen.PrimaryScreen.Bounds.Height - Screen.PrimaryScreen.WorkingArea.Height;
           System.Windows.Forms.Control.ControlCollection c = form.Controls;
           form.SuspendLayout();

           foreach (Control conts in c)
           {
               conts.Top += taskbarHeight;
           }
           Controls.TitleBar t = new Controls.TitleBar();
           t.Width = Screen.PrimaryScreen.WorkingArea.Width;
           t.Height = taskbarHeight;
           t.Top = 0;
           t.Text = form.Text;
           form.Controls.Add(t);

           form.ResumeLayout();

       }

So its not  perfect but this deters users from being able to run other programs or change settings without requiring other tools.    It has made my warehouse and field service applications less error prone and keeps the devices deployed and running for longer.   This has to be a good thing...

 

Wednesday, August 13, 2008 1:42:03 PM UTC  #    Comments [1]  | 
Sunday, August 10, 2008

Just noticed brand new CTP release of Microsoft Robotics Developer Studio.

 

image

Time to crack out those stepper motors...

http://msdn.microsoft.com/en-us/robotics/cc470038.aspx

Sunday, August 10, 2008 11:10:12 AM UTC  #    Comments [0]  | 
Thursday, August 07, 2008

Finally a nice 64 bit of SQL compact is with us.

Steve Lasker of MS has all the information here -

http://blogs.msdn.com/stevelasker/archive/2008/08/07/sql-server-compact-3-5-sp1-released.aspx

Thursday, August 07, 2008 2:33:37 PM UTC  #    Comments [0]  | 

When you absolutely have to see what's going on on your PC  got get yourself a copy of Process Explorer.

This tool just saved my bacon, helping identify memory leaks.

Free download here -

http://technet.microsoft.com/en-gb/sysinternals/bb896653.aspx

Thursday, August 07, 2008 6:08:56 AM UTC  #    Comments [0]  | 
Tuesday, August 05, 2008

So this happened to me today.

We were making some changes to a deployed mobile warehouse solution and I needed to roll out some updates.

No problem, I thought just download a new CAB installer to the server,  set the version number of the software higher on the server and let my life saving auto update mechanism do the work (search my blog for details)

Oh dear.     Little did I know that the devices had all been setup using Active-Sync and they had an Internet proxy set, which was not appropriate for automatically downloading the updates.   As we all know (yes you do) Active-Sync has this lovely habit of setting the device proxy to that of the desktop PC you are using.

Doh.

So moral of the story remember that in .Net Compact framework if you do something like -

request = (HttpWebRequest)HttpWebRequest.Create(this.url);

It will use the proxy setting of the connection you are using.

I'm looking at writing something that will go set the appropriate registry keys to disable the proxy, but I'm a bit scared :-)

Tuesday, August 05, 2008 7:32:27 PM UTC  #    Comments [0]  | 
Sunday, July 27, 2008

Joe Hewitt, has produced a really simple set of javascript and css files to build a web-based iPhone style template.

photo

I’ve taken the liberty to turn these into a ASP.NET component.      I’ve also adapted Joe’s work so that I can load an RSS feed using AJAX.

Joe’s done a great job.     You can get the original templates here -

http://www.iphoneatlas.com/2007/07/06/the-iphone-web-app-navigation-template

Or to see my implementation look at

www.binaryrefinery.com/i

If you view source you’ll notice that all the files you need are as follows -

default.aspx
iPhoneArrow.png
iPhoneBackButton.png
iPhoneButton.png
iPhoneGoButton.png
iphonenav.css
iphonenav.js
iphonenavajax.js
iphonethumb.png
iPhoneToolbar.png
loading.gif
pinstripes.png

 

To make things simple,   I’ve put these into a ZIP which you can get from here -

www.binaryrefinery.com/i/template.zip

 

Technorati Tags: ,,
Sunday, July 27, 2008 7:11:35 AM UTC  #    Comments [3]  | 
Saturday, July 26, 2008

So of late, I’ve been building lots of mobile applications that work by calling web-services.   I’ve found myself time and time again passing the same parameters to each web-service function.

This was getting a bit boring,  so I decided it was time to try and take the pain out of this repetitive process.   

I’ve decided to now pass a standard class filled with useful parameters each time I make a web-service call.

 

So take the call to Login  I now do the following -

lr = ra.Login(OURUSERID, Elements.BuildIn());

Now this doesn’t look that unusual, passing in the userid, we want to authenticate.

Elements.BuildIn(),  is where all the action is at.   This ensures we pass in a whole bunch of useful information and is as follows -

 

public static WSIn BuildIn()
      {
          WSIn ret = new WSIn();
          ret.BluetoothOn = Elements.BlueToothEnabled;
          ret.Company = Settings.Company;
          ret.Printer = Settings.Printer;
          ret.Profile = Core.AppSetting("profilename");
          ret.SoftwareVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
          ret.User = Globals.Instance.UserID;
          ret.AppName = Core.AppSetting("AppName");
          ret.Location = Settings.Location;
          return ret;
      }

 

I do this for each call,   so we always get passed to the web-service  that location of the user,  their company ,  the software version, whether they are using a Bluetooth printer etc.

This saves a tonne of time.

Saturday, July 26, 2008 1:41:32 PM UTC  #    Comments [0]  | 
Monday, July 21, 2008

I came across this nifty bit of code that will work out location from IP address.    In May I talked about adding Meta tags to your website to allow this facility.

See

http://www.binaryrefinery.com/main/PermaLink,guid,0afcf545-5412-4815-8129-4f44108b7c43.aspx

 

You can see how it works here -

http://msdn.microsoft.com/en-us/library/aa907670.aspx

 

Try it for yourself here -

http://maps.live.com/WiFiIPService/locate.ashx

 

I’m not 100% convinced its using the meta tags described above,  but it seems to be working for me.

Monday, July 21, 2008 10:55:49 AM UTC  #    Comments [0]  | 
Saturday, July 19, 2008

Just back from seeing Disney Pixar’s Wall-E.   Time I thought to go make one out of Lego…

I have some stiff competition…

http://gizmodo.com/5020266/wall+e-animator-tops-everyone-who-ever-wanted-to-make-a-lego-wall+e

Saturday, July 19, 2008 8:58:46 PM UTC  #    Comments [0]  | 

Theme design by Jelle Druyts

Pick a theme: