Thursday, August 11, 2005
Most PPC apps use the SIP (see point 1 here). Now that resx files are compatible, many developers will try to share code at the windows forms level.
So rather than try to conditionally compile in or out the
So, add a new code file to your project (and share it in both projects) that has the following:
to
If you get any compile errors it means you were assigning
a) Review that design decision
b) If you stick with it, change the
Now in your desktop project, wherever you were going to code the following:
instead code:
So rather than try to conditionally compile in or out the
InputPanel do the following: in your desktop project only, simply add a file that provides stubs for the InputPanel class:namespace Microsoft.WindowsCE.Forms {
public class InputPanel {
public event EventHandler EnabledChanged;
private bool mDummy;
public bool Enabled {
get { return mDummy; }
set { mDummy = value;}
}
}
}Next hurdle will be changing the cursor. On the full framework, every control has a Cursor property and that is what you assign; on the compact framework, there is a single cursor which you access globally through Cursor.CurrentSo, add a new code file to your project (and share it in both projects) that has the following:
namespace YourNamespace {
public static class TheCursor {
public static void CursorCurrent(Control c, Cursor defaultOrWait) {
#if FULL_FRAME
if (c != null) {
c.Cursor = defaultOrWait;
}
#else
Cursor.Current = defaultOrWait;
#endif
}
}
}Now, through a global find and replace (which I usually advocate against), replace all occurrences of:Cursor.Current = Cursors.Default andCursor.Current = Cursors.WaitCursor to
TheCursor.CursorCurrent(this, Cursors.Default) andTheCursor.CursorCurrent(this, Cursors.WaitCursor) respectively.If you get any compile errors it means you were assigning
Cursor.Current from a method of a class that is not a control:a) Review that design decision
b) If you stick with it, change the
this to nullNow in your desktop project, wherever you were going to code the following:
someControlOrFormEtc.Current = Cursors.Default andsomeControlOrFormEtc.Current = Cursors.WaitCursor instead code:
TheCursor.CursorCurrent(someControlOrFormEtc, Cursors.Default) andTheCursor.CursorCurrent(someControlOrFormEtc, Cursors.WaitCursor) respectively.Labels: Mobile and Embedded
Copyright © Daniel Moth


