[C#/VB] System.Windows.Forms extensions for updating properties from other threads. - Off-topic

As developers, we all hate how our code looks like when using multi-threading, and usually, it's a real pain managing all the invoke methods. Even using anonymous methods, it never seemed to be the best way for me.
So, I decided creating a library, that manages everything for you. It checks if InvokeRequired, and if it is, it invokes itself automatically without writing a line of code.
I know, you'll say, we can write a method like this one for ourselves whenever we need it. Just carry on reading to see what's special in this one.
I've written it dynamically, taking in consideration the performance of the code. And it turned out pretty great, as fast as if you had written your own methods, but with cleaner coding.
The library adds an extension called SetProperty() to each control in System.Windows.Forms namespace.
Let's say we have a TextBox called txt, and we want to edit the property txt.Text in it to "Hello!", a normal invoke method would look like this:
Code:
private void UpdateText(){
if(txt.InvokeRequired){
txt.Invoke(delegate{UpdateText();});
}else{
txt.Text = "Hello!";
}
}
Referencing my library, you'll only need to write this:
Code:
txt.SetProperty(TextBoxProperties.Text, "Hello!");
Sounds pretty easy, doesn't it?
This works, for every single control out there. Even if you created a custom one, it will work for you.
A list of the properties of each control is shown as an enumeration with all the details you may need to know in its summary:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
A screenshot showing how the code looks like:
This will definitely avoid any issues you may have with cross thread exceptions, and even represent your code in a real neat way.
You can download it from here.
Please keep both DLL and XML files in the same directory after extracting.
Everything's set, you just have to Add reference to the library to your application, and enjoy!
Just use anyControl.SetProperty() method on the go.
I'll release a documentation later, but any feedback for the moment would be appreciated!
Thank you
Best regards,
ClaudeNegm

reserved

bump

Related

[APP][PC] HandleSpy - View whatever Handle, Class, Caption or Parent API under mouse

HandleSpy.exe (attached) --=[ If this is not so OT afterall, please mods edit/move it or trash-it ]=--
HandleSpy runs in a little movable window and is forced to run on top.
All programs run/exit without a problem while it runs!
HandleSpy shows a (would be) programmer or intellectual which API runs under the mouse;
Handle
Class
Caption
Parent
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
note0: Obtaind before CompuServe gave us their GUI and from which the OSI deployed www then win95 came with Explorer-IE-Explorer GUI
Test 4 every WinOS: goto my Computer cq Explorer (not IE) and remove c:\* (current drive path) and replace it with a known url Guess what? ... Bwhahahaa; internet access for Win7 Barebone Edition! And *oops* on most if not all WinOS..
-- Of course it is best to log in with a Guest account (created by you the Admin) with limited internet access to only download a nice browser like Opera or Firefox, while using this dangerous 'tweak'. *cough* Plus it comes in handy when IE broke down during an live update and refuses to work. But,.. it's not my recommendation for obvious reasons!
note1: Used since/on win95 ~ABC, Win98 ~SE and WinXP flawlessly!
note1b: not tested; Vista / Windows7 (please let me know so I can include it in this post after an edit TIA).
note2: A tool from my kitchen. Now a share here on forum.XDA-developers.com Please distribute, as its been freeware from day one. Though I never shared it B4
note3: HandleSpy is nice to use in combination with (tools more powerfull than) ResHacker.
note4: It has no network awareness and no polymorphic AI eighter Its WYSIWYG though.
Have fun,
Senax
Where is the installer?
It went into the void of C/P darkness and was temporarily lost, luckily it's beacon was working so I could retrieve it with a tractor beam. Attached now

[GAME] PopIt! - A free, open source game to learn from -R-5/16/2011-U-5/18/2011-V-1.1

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
PopIt!
The time has come to fight your greatest enemy: bubble wrap. The question is: how fast can you PopIt? You have 60 seconds to pop the whole table and set new records, but be careful: don't pop the same bubble twice or you will receive penalty!
This game was developed in 72 hours by two students, as part of an educational project. It is fully open source (as of version 1.0 right now). Don't expect anything big, this game doesn't want to be more than it really is: a way to waste some minutes of your time
<See screenshots attached>
Marketplace link: http://social.zune.net/redirect?type=phoneApp&id=c6c512a1-c17b-e011-986b-78e7d1fa76f8
Download sources: http://people.inf.elte.hu/kaasaai/jatekprog/popit/PopIt.zip
You can use all the code you find in the project for non-commercial purposes. More info
Windows version (requires XNA framework, but no emulator!): http://people.inf.elte.hu/kaasaai/jatekprog/popit/Release.zip
New in version 1.1:
New background (hold to restart text restored)
Unmute sound
Vibration support (we finally managed to get a WP7 device )
First, I believe it's a bubble wrap, not a "bubble warp"
Second, you should change the sound: it's a plastic bubbles not a typewriter
sensboston said:
First, I believe it's a bubble wrap, not a "bubble warp"
Second, you should change the sound: it's a plastic bubbles not a typewriter
Click to expand...
Click to collapse
Whoops, thanks for the tip... Corrected in the post, will correct in marketplace when we push out an update
As for the sounds, they were created by me and the current pop sound is the best sample I managed to record. If you have any sound that's public-domain, free, etc then I'm interested
I don't have time for that. Use google, u'll find a lot (no, a LOT! of public domain or low costs ($1-$2) sound effects. But just try to play 'em on handset first to be sure they are sounds realistic (I believe it's very important for games like yours).

TouchDevelop from Microsoft

I found this app in the market, which is kinda like visual studio but on your windows phone device
Contains tutorials and a lot of sample projects for beginners, have fun
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Script your phone! Write code for your phone, on your phone! TouchDevelop is a radically new software development environment on the Windows Phone, bringing the excitement of the first programmable personal computers to the phone.
the idea behind TouchDevelop
The way in which we interact with computing devices is changing: instead of keyboards, advanced touchscreens become more common; mobile devices are often equipped with more sensors, such as location information and acceleration, and are always connected to the cloud.
TouchDevelop is a new programming environment and language built around this new reality. Its typed, structured programming language is built around the idea of only using a touchscreen as the input device to author code. It has built-in primitives which make it easy to access the rich sensor data available on a mobile device. In our vision, the state of the program is automatically distributed between mobile clients and the cloud, with automatic synchronization of data and execution between clients and cloud, liberating the programmer from worrying (or even having to know) about the details.
Click to expand...
Click to collapse
Links:
http://research.microsoft.com/en-us/projects/touchdevelop/
https://www.touchdevelop.com
http://www.windowsphone.com/en-US/apps/fe08ccec-a360-e011-81d2-78e7d1fa76f8
I used this app , but founded not interesting...
Well I tried it.. you can do a a couple of stuff, but I don't think it is actually useful for developing qualitative Apps.
In my mind this Application is more useful for schools, where teachers want to show their students how easy it is to develop stuff, or "the new generation of Coding Editors"..
I mean sure, you can create some interesting apps and, if you put effort in it, might even useful Apps(!) but for me it looks like something you can play with when you are bored..
But it might be interesting for those who are new to WP7-programming or are new to programming at all..
But nice app anyway!
interesting apps...
but, i dont have any windows phone on me...

[APP] NookCalc

NookCalc is a basic, four function calculator designed from the ground up for the Nook Simple Touch. It is optimized for the e-ink display. I wrote this app. The top right page button acts as a dedicated clear button, in addition to the on screen clear button and clear option in the menu.
Screenshot:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
That looks nice, but 840 kB is way too big an .apk file for what this does.
It should be somewhere in the neighborhood of 10-20 kB.
You have included android.support.v4 and android.support.v7 when they are not used in the least.
You can delete those from your project.
Nice! It's good to see apps written for the nook.
The calculator looks nice and the e-ink optimization is great,
however, since I don't have anything to calculate just now I just did a bit of stress testing to find that:
a) there seems to be an int overflow on really large nubers, it either crashes or warps to negative.
b) I'm not sure what pressing '=' repeatedly is supposed to do (if anything at all) as it gives weird and inconsistent results.
c) it crashes on division by zero (I HAD to try that )
d) Also, to have a useful division function you really need to use floating point numbers.
It's a nice project, but needs some working on before being a useful calculator
Thanks for the feedback guys, I appreciate it. Renate NST I removed the android.support.v7 and it significantly reduced the size of the apk from 837KB to 60.4KB, a 776.6KB difference. I didn't see android.support.v4 in my project. I didn't add any support libraries myself, Android Studio seems to put the support library in new projects and there doesn't seem to be a way to make a new project without the support library.
sega dude said:
Thanks for the feedback guys, I appreciate it. Renate NST I removed the android.support.v7 and it significantly reduced the size of the apk from 837KB to 60.4KB, a 776.6KB difference. I didn't see android.support.v4 in my project. I didn't add any support libraries myself, Android Studio seems to put the support library in new projects and there doesn't seem to be a way to make a new project without the support library.
Click to expand...
Click to collapse
how do i close this program ?
Many thanks
I just rooted my nook touch and will try this app

[MOD] Build.prop faster optimizing apps after clearing Dalvic/Cache!!!!

This is for anyone, especially those that have way too many apps like myself and are flashaholics and tired of waiting 30+minutes for your apps to optimize after clearing Dalvic and Cache.
1. Download a build.prop editor.
I like using the one by JRUMMY , he is an excellent developer and programmer and has been doing it for a very long time.
https://play.google.com/store/apps/details?id=com.jrummy.apps.build.prop.editor
2. Open the app and make sure you are in /system/build.prop
3. Search for this key
dalvik.vm.dexopt-flags
4. If it is not there, add it.
5. Change the property value to this
v=n,o=v,m=y
6. Should look like this now
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
7. Save and reboot.
Now go and clear your dalvic/cache and reboot and you should see a significant difference in your optimizing apps screen.
This took me awhile to figure out and a good bit of research, so if it helps anyone please hit the thanks button.
ALSO
If anyone wants to implement this to their ROM, feel free to, I encourage it! !!
Thanks and I hope this helps with people that have many apps.
I have about 986 right now so using this mod I cut my optimizing apps screen down from over 30 minutes to almost 3 minutes now.
Very nice looking forward to try it thanks sir
No problem man it has really been bugging me because I have so many apps.
Works great. What is it doing differently that allows it to load the apps so much faster?
Sent from my SM-N910T using XDA Free mobile app
v=a means verify all,
v=f means verify full,
o=v means optimize verify,
v=n will turn off bytecode verification
u=n means do not optimize for unprocessor
m=y means register maps yes
Found this info here, kinda outdated, but works.
https://www.google.com/url?sa=t&sou..._o_o1nZ536Miwi7Tg&sig2=QqKSBckCgr7n96BCKiDoiw
Also, doing a search on google and a lot of research.

Categories

Resources