Help - Search - Members - Calendar
Full Version: DSPanelUtils Library For .NET Developers
Desktop Sidebar Forums > Customizations > Panel Development & Requests
Pages: 1, 2
GoMa
Dec. 25, 2005 -
Future Thoughts

- Common plugin templates. Almost all panels update periodically. The solution - AbstractUpdatingPanel (inherits from AbstractConfigurablePanel).
- I started making a panel IDE for SharpDevelop "Corsavy" (the .NET 2 beta version). It is mostly for script panels, dunno why I'm posting this here. LOL. Basically I implement a SecondaryDisplayBinding for all the plugin files (dsskin, dscanvas), and treat dsplugin as project files (I have to see how I plug the project file in SD). A BackendBinding (or whatever they call it now) will allow running DS and debugging the panel.

Please post ideas for the panel IDE, more plugin abstract classes, and other ideas as to how this library's development can be continued.
Unfortunately (? laugh.gif) my programming time this year is near zero, so don't expect it to develop as quickly as it has started.

Sept. 11, 2005 -
Version 1.3.1 released.

Fixes update checker problems and integrates KeithI's UpdateChecker into the library.
Fixes numerous PanelProperties issues.
There's more (some features too) but I don't remember and don't have time. rolleyes.gif
Library and source in the attached package.

June 21, 2005 -
Version 1.3 released.

Overhauled PanelProperties - easier to plug in property types and use custom attributes with them. Public properties on the class remained mainly backwards compatible.
Introduced PropertiesDialog, the default Panel Properties dialog that will take care of everything for you. No need to implement IPanelProperties. Includes About tab that supports links and implements backup/restore settings.
Fixed bug where HandleError would throw when called before AbstractPanel::Create (thanks KeithI!).

June 7, 2005 -
Version 1.2 released. Integrated PanelUpdateCheck (slightly modified). Thanks a lot KeithI! There are still some problems with the update checker implementation (shows the message too many times when there's an update available).
Alert functionality integrated too (no need to implement IAlert, use AbstractPanel::ShowAlert).
At this point I'm pretty confident this can be used in "production" panels (used in MailNotifier 2.0).
Details and new sample panel code tomorrow.

April 20, 2005 -
I decided to release the pre-alpha assembly and code so people will be able to help me test it and improve it, by ideas or by contributing code.
The code is released under the zlib/libpng license (license text is also in AssemblyInfo.cs).
Tested under Windows XP SP2, DS 1.05 build 90.

Basically, to start a new panel you just add DSPanelUtils.dll as a reference to the project. Then, add a DSPLUGIN file and a Plugin class like in every other panel (for VS.NET users it's easier to use the wizard). Then make a new Panel class which inherits from AbstractPanel (or AbstractConfigurablePanel if you want panel properties). Now override all the abstract members (you must) and you're ready to go. smile.gif
A sample with panel properties and context menu is also attached (it's necessary to download the library too and set up the references in the project in order to compile).
Please note that eventually the Plugin file shouldn't even have to call RegisterPanel, this will be specified in the DSPLUGIN in an <info> node, but it's not working currently.

Please ask any questions regarding this library in this thread.

I'd recommend, for now, not to invest time making "real" panels using this library.

April 11, 2005 -
Just to let you know... and keep you expecting.
I'm developing a library which is supposed to do all the "hard" work for .NET panel developers - like loading/saving settings, displaying Panel Properties, handling context menu - it'll all (hopefully) be taken from the DSPLUGIN, like in ScriptPanel. The ultimate goal is to have an AbstractPanel abstract class which will save a lot of time - of course, the needed methods can be overriden by the inheriting class.
I'll release this library's code.
I'm not going to be home in the next 3 days, and the 3 days after the weekend as well. Hopefully I'll be able to put something together during the weekend.
Hope it'll work out, because I think it could work great and save us (me!) a lot of work in coding the panels.
yyy
That's interasting - maybe you can give more details: how does it work ? What exactly does it do ?
eitaneko
I think he's just making a wrapper class for all of the .NET features of a panel. Therefore, you'd make an AbstractPanel and it would come bundled with all the support for details window, context menu, properties etc, already built in. If you want it to do anything useful, you have to pretty much override what you need. But if you don't want to use something, it will use the default values.
Essentially, it doesn't DO anything (unless you tell it to) and it does a little bit of the work for you (includes all the functions and headers you need to have a working panel). As far as I can tell, it will just be a template for a working panel with many features that you can customize for each individual panel.

I may be wrong, as GoMa certainly hasn't said anything to me about it. I'm not sure what he means regarding the DSPLUGIN file. Also, will it have support for translations and skins?
yyy
Oh, ok = thanks for te explanation. That's what I was thinking. I like warppers smile.gif Good tool for beginners.
eitaneko
No problem smile.gif I hope I got it right.
KeithI
GoMa - you're welcome to include my "check-for-new-version" code in your library if you wish. I haven't had time to update it with the regular expression yet but I will do if you're going to use it.

Nice one fun_08.gif

I have now completed the changes to the update checker.
GoMa
Hi, I'm back. wink.gif
eitanko - you got it right. It's just a pretty wrapper to default functionality. About the DSPLUGIN things - The default (virtual) implementation of Save and InitializeSettings, for example, will save and load settings specified in the properties node in the dsplugin, like in scriptpanels (look at Azureus panel for example for properties). Maybe even a default properties dialog will be made, but that's later perhaps.
eitaneko
You can save settings to the dsplugin file?
GoMa
Well not easily (and you shouldn't do it anyway). That's not what I said though - the DSPLUGIN file will specify the properties and their type (i.e. updateInterval - int, displayCounter - bool). The panel will save properties in the settings file, like always.
eitaneko
Oh. So what is the point of having that information there at all?
GoMa
So you won't have to code everything - i.e. get rid of class fields for settings (there'll be a hashtable for that), not have to take care of saving/loading settings, etc.
Don't worry. You'll know everything when I'll release it. wink.gif
eitaneko
I have faith in you GoMa. smile.gif Are you going to include KiethI's update module?
GoMa
Definitely.
KeithI
QUOTE(GoMa @ Apr 15 2005, 06:07 PM)
Definitely.
*


Excellent fun_08.gif. I'll sit back and wait for the royalties to pour in laugh.gif wink.gif common014.gif
GoMa
The properties management part of the library is mostly done (doesn't handle default values and doesn't support multiple <properties> nodes yet). It uses the scriptpanel's format, for example (taken from the Azureus panel):
CODE
<properties>
   <property name="pathToFile" type="string" default="" />
   <property name="updateIntervalSeconds" type="string" default="10" />
   <property name="showVersion" type="string" default="yes" />
   <property name="showDownSpeed" type="string" default="yes" />
   <property name="showUpSpeed" type="string" default="yes" />
   <property name="showTorrents" type="string" default="yes" />
</properties>

In the panel (that inherits from AbstractConfigurablePanel) you will be able to access the properties' value like the following:
CODE
properties["updateIntervalSeconds"] = 120;

And:
CODE
SetTimer((int)properties["updateIntervalSeconds"])

Properties will be saved and loaded automatically (from the .settings file) by the abstract base class.

Context menu handling is getting there. It also uses the format that DS already uses (in basicpanel.dsplugin, for example - search for the "menus" node).

I intend to wrap all the sdk controls with .NET classes that conform with the .NET standard conventions (i.e. events instead of ***Parent interfaces, roperties instead of Get***/Set***). These will also offer designer support - this is the first stage of the development of a panel devenv extension for #develop (the next stage is xml schema for dscanvas language and serialization to dscanvas).

I'm doing it all slowly, one step at a time, and hopefully at the end it will be a huge timesaver and the perfect development tool. biggrin.gif
KeithI
It all sounds good to me clap.gif. Excellent work fun_08.gif. I particularly like the ease of use of the properties.
eitaneko
For some reason, I'm not seeing why the properties in DSPLUGIN file is useful. Do you think you can explain it to me?
Prism
You won't have to save and load the settings yourself - the wrapper class will do it for you.
eitaneko
But if you can't write to the DSPLUGIN, then how can it save automatically?
Prism
Using the regular settings file?
eitaneko
So you can use the DSPLUGIN file for defaults, but you use the main settings file to save custom, and the wrapper will load from the settings file if it exists, otherwise, use the default for the DSPLUGIN?>
Prism
As far as I understand this, yep.
esolu
QUOTE(GoMa @ Apr 15 2005, 11:00 AM)
So you won't have to code everything - i.e. get rid of class fields for settings (there'll be a hashtable for that), not have to take care of saving/loading settings, etc.
Don't worry. You'll know everything when I'll release it. wink.gif
*



Wow great Idea GoMa!!! flowers.gif signs007.gif fun_08.gif

That will make things so much easier for new developers. That was the hardest part when I was gettings started.

I hope I get back to developing DS Panels soon.... I miss it mad.gif
GoMa
I already have a working sample with a context menu and strongly-typed settings that are automatically saved between sessions (currently only int/string properties tested but other types should work).
PanelUpdateCheck integration is the next short-term step.
Do you think I should release the source now so some suggestions could start pouring in or should I wait till it's more mature? (And if yes, is the Source Code thread the right place?)
yyy
Release it now - I'm curious biggrin.gif I think you should create it's own thread. Maybe in the SDK Doc. forum.
GoMa
Pre-alpha code and assembly released. See first post.
yyy
Works fine fun_08.gif clap.gif Nice work wink.gif
GoMa
Thanks yyy.
Not much interest in this now I guess... wink.gif
Prism
If I were a .NET developer, I'd be much more enthusiastic, I guess. smile.gif
eitaneko
Sorry GoMa. Haven't had a chance to look at it with Passover coming and all.
KeithI
I'm very keen on this - and I'll take a good look at it once I finish installing my super-duper new machine biggrin.gif
yyy
What new machine ? You mean you got a new computer ?

Sorry for the OT.
Prism
Well, he surely doesn't mean he got a new coffee machine... biggrin.gif
yyy
If so, congratulations KeithI flowers.gif Give us some more specs if you can laugh.gif
GoMa
QUOTE
Sorry GoMa. Haven't had a chance to look at it with Passover coming and all.

Oh I wasn't blaming anyone. Sorry if it sounded like this. smile.gif
eitaneko
It's OK. I checked it out a little yesterday. Looks good. Haven't had a chance to go in depth, but way to go!
GoMa
I've integrated KeithI's PanelUpdateCheck code (slightly modified) into the DSPanelUtils library. It is working pretty well:
- The version is taken from the "info" node in the dsplugin, and so is the panel's url in the ExEx.
- In AbstractPanel, it checks for update every time the panel is launched (this is easily removed in a derived panel by overriding CreateUpdateChecker and returning null).
- In AbstractConfigurablePanel - if a "checkForUpdates" (type="bool") property is NOT defined in the dsplugin, or it equals false, all update checking is disabled. If the "checkForUpdates" property equals true, but a "checkForUpdatesInterval" (type="integer", hours) property is NOT defined in the dsplugin or is less than or equal to zero, the behavior is just like in an AbstractPanel-derived panel (see above). If both "checkForUpdates" is true AND "checkForUpdatesInterval" is greater than zero, updates are checked for in the specified interval (and the Don't Ask Me Again check box is displayed, value saved).

This version will be released pretty soon, along with a new version of the Mail Notifier panel + source which will be derived from AbstractConfigurablePanel.
I know it's complicated, but the point is only I need to understand it. You only need to use it. wink.gif
GoMa
Released version 1.2. See first post. MailNotifier source tomorrow.
mattisking
This looks interesting... I'll take a look!
GoMa
I posted the Mail Notifier source code, which is based on v1.2 of the DSPanelUtils library, in the Source Code thread.
I think this panel is a great example of this library, and demonstrates a large part of its functionality. It contains properties (including custom properties), commands, a context menu, is built as a Windows Forms UserControl.
Take a good look in the DSPLUGIN file, and please don't hesitate to ask any questions.

Future plans:
- Fix UpdateChecker bugs.
- Implement a default PropertyDialog, which will eliminate the need to implement a form for every panel (ability to use custom PropertyHandlers).
- Implement control classes (eliminate need for I****Parent).
- Implement Skin Overrides.
- Implement toolbars (pretty low priority).
- Make VS.NET and SharpDevelop wizards.
- Eliminate need to implement ICommandTarget.
- Ability to use canvases? (Think of an approach.)
GoMa
Status update (NOT YET RELEASED):
Panel properties practically overhauled, only internally - external APIs for use of panels are almost backwards-compatible (except PropertySerializer/PropertyDeserializer, which have a better alternative), just better. This has been done as a preparation for the Properties Dialog.
The Panel Properties API is now more rubost allowing for custom property types be implemented easily, including properties that have to get their default values programatically (e.g. mailClientPath and mailClientArguments properties in MailNotifier). Additionally, Enum types are now very easy, just add an enumType attribute to the property declaration (if it's not from your assembly, use a fully qualified type and assembly name. If it is, the short type name will do), and EnumPropertyTypeHandler will do the rest. biggrin.gif
As a sidenote, I've posted a Panel Properties guide for script panel developers in the SDK Docs forum. The property declaration format DSPanelUtils uses is almost identical.

If anyone is interested in this RIGHT NOW I can post the code however it's better to wait for the PropertiesDialog implementation, it's going to be sweeeet.
Also, I haven't said this yet - if anyone wants to join my efforts, you're certainly welcome! smile.gif

Any thoughts? (You don't have to, I'm doing this mainly for myself. tongue.gif)
Prism
It could be nice, actually. I might wanna improve my C# this summer. smile.gif
mattisking
Hey Goma... Care if I port it to VB.NET? I'll send it back to you for posting.
KeithI
QUOTE(mattisking @ Jun 13 2005, 03:23 PM)
Hey Goma... Care if I port it to VB.NET? I'll send it back to you for posting.
*


Can't you just use the c# DLL as it stands from VB.NET?
GoMa
Yep, Keith is right. Also, the library constantly changes, so that's going to be some work.
However, if you really want, I won't stop you. biggrin.gif
KeithI
Oh by the way GoMa - I was looking at this at the weekend with your Mail Notifier panel. It all seems OK to me, but the MailNotifier source code doesn't include the PropertiesDlg.cs file - which would be useful as an example of using properties.
mattisking
Yeah I could... but I was thinking of creating a new solution wizard based on this. Ah, who knows. I'm moving away from VB.NET in my personal projects anyway so the C# stuff is fine.
GoMa
QUOTE
Yeah I could... but I was thinking of creating a new solution wizard based on this. Ah, who knows. I'm moving away from VB.NET in my personal projects anyway so the C# stuff is fine.

Yes I was also going to make a wizard. Still no need to convert the whole lib to VB.NET - just include the assembly as a reference, and make a basic starting class.
QUOTE
Oh by the way GoMa - I was looking at this at the weekend with your Mail Notifier panel. It all seems OK to me, but the MailNotifier source code doesn't include the PropertiesDlg.cs file - which would be useful as an example of using properties.

Oops. Thanks for notifying me about this. It's now fixed.
GoMa
Status update:
  • PropertiesDialog is working. I can just tell you that I LOVE it. biggrin.gif
    Organizes properties in categories (tabs).
    Fully translatable.
    Resizable with automatic layouting.
    "Cached" for better startup time after first time (lazy loading).
    Implements cool About tab - with link support (like the forum's syntax. I worked hard for those so they better be used...).
    Allows for custom PropertyDisplayers if you want things different than normal.
    Built-in PropertyDisplayers:
    - TextBox for string.
    - NumericUpDown for integer/real.
    - CheckBox for bool.
    - ComboBox for enum (this was tough, but I needed it for MailNotifier wink.gif).
  • Added property type - password (PasswordPropertyHandler). It is encrypted/decrypted by default using the DPAPI (only Win2k and up, sorry about that). Also displayed as asterisks in the PropertiesDialog.
  • Panel caption now translated, and as opposed to built-in panels, is automatically re-translated when the language is changed.
The version will be released this weekend, or probably more like mid next week, along with its-, and Mail Notifier's- updated sources.
Prism
Makes me want to move to .NET developing...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.