Chainfire Turns Your Bootanimation into a Logging Center

Having a nice boot animation certainly adds a little bit of aesthetic polish to your … more

Android TV Launcher Pushed to Google Play

Over the past decade, the tech universe has seen two drastic and widely contrasting changes with … more

Cyngn, OnePlus, Micromax – The Legal Battle

Recently, a battle has been waging in India over the rights to distribute the commercial … more

Lean Mean Battery Power Saving App Review

We talk a lot about battery topics here at XDA TV. We talk about everything from Power Banks to USB … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP joe_coolish

3rd November 2010, 04:13 PM   |  #31  
OP Recognized Developer
Flag American Fork
Thanks Meter: 229
 
753 posts
Join Date:Joined: Mar 2010
Donate to Me
More
Quote:
Originally Posted by JarekG

I fugure out how to add this, one problem that I'm having is to load the images.
When I pass image location, the image is not loading.
This line of code always has 0 for all options:
_imgRec = this.GetImageRec(ImageUri);

It looks like the GetImageRec can't return the actual size of the image...not sure why..I try different ways. The only way I didn't try is to load from resources.

Sorry it has taken me this long to reply.

The GetImageRec takes the ImageUri and does the following:
  • Takes the calling object and gets its assembly information
  • appends .Resources.<ImageUri value> to the retrieved assembly's namespace
  • calls myAssembly.GetManifestResourceStream(<string from process above>) and gets that image's rectangle

So, check the calling object's NameSpace and see if there is a Resources folder at the first level, then check to see if that URI is in that folder.

Alternatively, you could output the image to the local device in a folder called Resources that is located in the same directory as the executable

let me know if there is anything else i can help you with
3rd November 2010, 04:50 PM   |  #32  
Senior Member
Flag Belfast
Thanks Meter: 33
 
549 posts
Join Date:Joined: Apr 2008
More
Quote:
Originally Posted by joe_coolish

The code is my original work, but I did get ideas for implementation from various places on the internet (mainly math and physics sites believe it or not). I haven't seen the scrolling panel from the link you provided and I haven't downloaded the code to see what it does. The process might be similar, but I did not base my code off of it.

Feel free to browse the code and see if it works for your target devices. So far I haven't found a (touch screen) device on which the SDK doesn't work.

I'm also available to answer any questions for you

Let me know what you think!

The link to the source is in the 3rd post, or right here
http://code.google.com/p/xda-winmo-f...source/browse/

Nice work! Had a glance through the source. Looks very neat. I'm not very good with bitmap memory management in .NET CF - but I think you should be disposing of the background Bitmaps in the XFPanelBase literally as soon as you're done with them? Maybe not.

This looks like a great base SDK. I don't have the time to rewrite the basic stuff (e.g. A text input control) but I'm sure someone will create some great controls from this.
3rd November 2010, 05:08 PM   |  #33  
OP Recognized Developer
Flag American Fork
Thanks Meter: 229
 
753 posts
Join Date:Joined: Mar 2010
Donate to Me
More
Quote:
Originally Posted by Blade0rz

Nice work! Had a glance through the source. Looks very neat. I'm not very good with bitmap memory management in .NET CF - but I think you should be disposing of the background Bitmaps in the XFPanelBase literally as soon as you're done with them? Maybe not.

This looks like a great base SDK. I don't have the time to rewrite the basic stuff (e.g. A text input control) but I'm sure someone will create some great controls from this.

Thank you!

The reason I don't dispose of the background bitmaps is because I use them as a cache. They get disposed when the panel is disposed, but while the panel is actively used, the background bitmaps are constantly in use.

This is because the double buffer is the fastest refresh technique on our phones and if you are constantly creating and disposing the bitmap, that creates more overhead than just keeping it in memory and manipulating the bitmap.

The bitmaps are also cached in the IXFItem. This is because the cost in time to render the image in the first place is pretty expensive. but rendering the cached image is super cheap. this allows for the really smooth scrolling and animation effects.
4th November 2010, 12:38 PM   |  #34  
meltwater's Avatar
Recognized Developer
Thanks Meter: 325
 
2,066 posts
Join Date:Joined: Jan 2009
Quote:
Originally Posted by joe_coolish

Thank you!

The reason I don't dispose of the background bitmaps is because I use them as a cache. They get disposed when the panel is disposed, but while the panel is actively used, the background bitmaps are constantly in use.

This is because the double buffer is the fastest refresh technique on our phones and if you are constantly creating and disposing the bitmap, that creates more overhead than just keeping it in memory and manipulating the bitmap.

The bitmaps are also cached in the IXFItem. This is because the cost in time to render the image in the first place is pretty expensive. but rendering the cached image is super cheap. this allows for the really smooth scrolling and animation effects.

Can I just download your .net knowledge instead of the code!

There is such a steep learning curve when you have to step off the standard control path (which with compact framework, is quite often). Fingers crossed they've done a better job with Silverlight.

Will have a test of it today.
4th November 2010, 01:58 PM   |  #35  
Senior Member
Thanks Meter: 10
 
134 posts
Join Date:Joined: Feb 2008
More
Quote:
Originally Posted by joe_coolish

Sorry it has taken me this long to reply.

The GetImageRec takes the ImageUri and does the following:

  • Takes the calling object and gets its assembly information
  • appends .Resources.<ImageUri value> to the retrieved assembly's namespace
  • calls myAssembly.GetManifestResourceStream(<string from process above>) and gets that image's rectangle

So, check the calling object's NameSpace and see if there is a Resources folder at the first level, then check to see if that URI is in that folder.

Alternatively, you could output the image to the local device in a folder called Resources that is located in the same directory as the executable

let me know if there is anything else i can help you with

I don't think that will work. Correct me if I'm wrong but if I save the files to Resources folder they also have to be set as Embedded Resource in order for the GetManifestResourceStream to get them. But if I save them on the fly, they will only be set as Content.
13th November 2010, 01:24 AM   |  #36  
Account currently disabled
Flag Chicago iL
Thanks Meter: 0
 
183 posts
Join Date:Joined: Oct 2010
Donate to Me
More
I am implementing it into my application as soon I research on this.
13th November 2010, 02:32 AM   |  #37  
OP Recognized Developer
Flag American Fork
Thanks Meter: 229
 
753 posts
Join Date:Joined: Mar 2010
Donate to Me
More
Quote:
Originally Posted by JarekG

I don't think that will work. Correct me if I'm wrong but if I save the files to Resources folder they also have to be set as Embedded Resource in order for the GetManifestResourceStream to get them. But if I save them on the fly, they will only be set as Content.

Whoa, I totally didn't see this comment! I should be more on top of things

If you save it directly to a folder called "Resources" then it can be loaded on the fly. Also, you can take a look at how I implemented Icons for my XDAFacebook App to see how I'm handling images downloaded from the internet.

Either way, you can load the images how ever you want and just render them in the ItemDraw() method of the IXFItem. If the image is added after the initial loading of the image, you need to clear the buffer for it to be drawn. This is accomplished by doing the following:

if(Buffer != null)
Buffer.Dispose();
Buffer = null;

That way the next time the item is drawn, the buffer is redrawn as well.

Quote:
Originally Posted by Sherri1023

I am implementing it into my application as soon I research on this.

Sweet! Glad to help in any way I can
18th January 2011, 11:07 PM   |  #38  
Retired Recognized Developer
Thanks Meter: 66
 
600 posts
Join Date:Joined: May 2008
More
Thumbs up
Thanks for sharing Joe,

this SDK could indeed get handy in the future for a project I have.
19th January 2011, 01:36 AM   |  #39  
OP Recognized Developer
Flag American Fork
Thanks Meter: 229
 
753 posts
Join Date:Joined: Mar 2010
Donate to Me
More
Quote:
Originally Posted by tilleke

Thanks for sharing Joe,

this SDK could indeed get handy in the future for a project I have.

Sweet! The SDK in this thread is pretty old. PM me for a newer one if you'd like!
The Following User Says Thank You to joe_coolish For This Useful Post: [ View ]
10th March 2012, 04:49 PM   |  #40  
needle2k's Avatar
Member
Thanks Meter: 2
 
64 posts
Join Date:Joined: Feb 2009
More
Hi,

is there a way to add an own Icon to SenseItem / SenseMoreItems infront of text and center the text ?
since i only get them from Resource, also how can i add transparency to
XFPanelContainer() -> show form backgroundImage , im new to c# so a lttle help would be appreciated


thx

needle
Last edited by needle2k; 10th March 2012 at 04:54 PM.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes