|
DaveyM69 wrote: The NumericUpDown is not an option.
Like heck it isn't. "Use the right tool for the right job." -- Scotty et al
Aaaanyway...
Perhaps a Dictionary<Keys,char> will do the trick.
But do you really need to know what character was pressed?
And I expect you know about .Handled and .SuppressKeyPress
|
|
|
|
|
Hi,
I have a base class called "UserInterfaceBase" and I'd like the user's programmer can create and plug their own interface.
Is there anyway to do it? Of course the project won't have a reference to the user "homemade" interface, so I think that's the problem I'm having.
Type tUI = Type.GetType(loader.InterfacePDV.InterfaceClass, false, true);
if (tUI == null)
tUI = Type.GetType("JRFW.Appl.CM10.CPDV.UI." +
loader.InterfacePDV.InterfaceClass, false, true);
if (tUI == null)
throw new TypeLoadException(loader.InterfacePDV.InterfaceClass);
PDVUI = (IPDV)Activator.CreateInstance(tUI);
It always throw the TypeLoadException exception.
Thanks,
Dirso
|
|
|
|
|
Sounds like you're trying to do plug-ins. Have you looked at System.AddIn in the latest .NET framework?
Life, family, faith: Give me a visit.
From my latest post: "We are Christian, resistance is futile. Your Jewish traits will be assimilated into the Church collective."
Judah Himango
|
|
|
|
|
Hi,
Thank you so much!!! It looks like nice and easy to use, but since I making a cross plataform software I have to be sure using namespaces implemented in mono framework too.
I just made a test and even if I add the references to the application project, it still throws the exception. I'm now using the type's FullName, and still no luck. Do I need to do anything else?
Thanks,
Dirso.
Updated Code:
Type tUI = Type.GetType(loader.InterfacePDV.InterfaceClass, false, true);
if (tUI == null)
throw new TypeLoadException(loader.InterfacePDV.InterfaceClass);
|
|
|
|
|
Then have you seen Mono.AddIns[^]?
If you're still set on doing it your own way, you'll need to start by calling Assembly.Load on the assembly built by the 3rd party.
|
|
|
|
|
|
Isn't there a list of languages somewhere in .net?? I know I have seen i somewhere but searches yield too many non related results. I just need to have a text box that will list a bunch of languages to store the language that the person filling the form speaks.
|
|
|
|
|
Make a list with the languages you already have, and let the users add other languages to your list if not displayed there.
|
|
|
|
|
I don't believe so. There's one in windows somewhere, it's the list of locales that you can choose. Not sure if you can access it in code tho.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
This will list all the cultures available if that's what you're after?
(Add using System.Globalization; to the top of the class)
CultureInfo[] supportedCultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
for (int i = 0; i < supportedCultures.Length; i++)
Console.WriteLine(supportedCultures[i].DisplayName);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Hello
VS 2008
The 2 users that have tried to run the application get this error.
"CATWinApp has encountered a problem and needs to close"
"An unhandled exception ('System.Runtime.InteropServices.COMException') occurred in CATWinApp.exe [2220]. Just-in-debugging this exception failed with the following error: No installed debugger has just-in-time dubugging enabled. In visual studio, just-in-debugging can be enabled from Tool/Options/Debugging/Just-in-time."
The users don't have any visual studio. Only the 2.0, 3.0, and 3.5 framework. Which is needed to run the application. They are only users so they don't have any development tools.
In my application I have a ActiveX control (COM), called "VaxSIPUserAgentOCX.ocx" I have registered this on my developer box using this: "regsvr32 VaxSIPUserAgentOCX.ocx".
The application run ok on my computer but no one elses.
In my references when I select them in the properties name in my application I have the following: AxInterop.VAXSIPUSERAGENTOCX and Interop.VAXSIPUSERAGENTOCXLib. In the properties I have local copy set to true.
I think the problem could be that is not registered on the users' computer. However, I am not sure how to register them. I have tried "regsvr32 VAXSIPUSERAGENTOCXLib" But comes up with "Entry point cannot be found".
Then I go to publish I click on Application Files and select Include (Auto) Requried for both AxInterop.VAXSIPUSERAGENTOCX and Interop.VAXSIPUSERAGENTOCXLib.
Could this ActiveX be causing the problem? And if what is the best method to solve this problem?
Many thanks for any advice,
Steve
|
|
|
|
|
I believe that the user's machines also need to have the COM OCX registered on their machines. From your message, it sounds like you have the Interops on their machines (which can not be registered), but it is not clear if the OCX is on their machines. If not, put the OCX on their machines and register the OCX and, hopefully, that will resolve the issue.
|
|
|
|
|
We've ran into some minor issues (fortunately nothing that can't be refactored) with a design for DAL and BLL in a project. We have a set of repository and service classes that deal with different domain model entities and so on.
We are looking to have a common (standardized) way of accessing those classes from client code. This is an ASP.NET web application. I was the first one to start the design and I instantiate my services as private static read only fields in each page whenever I need to use a particular service class' functionality, in example:
public partial class NewAsset : System.Web.UI.Page
{
private static readonly _catalogService = new CatalogService();
protected void Page_Load(object sender, EventArgs e)
{
Asset asset = _catalogService.FetchById(3);
}
}
The other developer created however a "master" class for the services and exposes them as public properties, so he has something like:
public class Service
{
private static CatalogService _catalogService;
public static CatalogService Catalog
{
get
{
_catalogService = _catalogService ?? new CatalogService();
return _catalogService;
}
}
}
Then in a page:
public partial class NewAsset : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Asset asset = Services.Catalog.FetchById(3);
}
}
My approach will create more objects, although there's always one per page. The second approach would always use a single object instance, but somehow I don't like how he used properties for that. The service classes are not singletons themselves, there's no real factory pattern (unless something like this with properties could be considered as one..), it seems weird but at the same time I can't tell for sure that it's bad. I know where he comes from, as he doesn't have to instantiate the single services in each page...
Do you think that one way is better than the other? If so, then why?
|
|
|
|
|
Pawel Krakowiak wrote: Do you think that one way is better than the other?
Yes, obviously.
Pawel Krakowiak wrote: If so, then why?
Don't know. It depends on what is going on in CatalogService and associated aspects of the ASP.NET environment.
led mike
|
|
|
|
|
led mike wrote: Yes, obviously.
Aw, it doesn't help.
led mike wrote: Don't know. It depends on what is going on in CatalogService and associated aspects of the ASP.NET environment
Service talks to a repository which retrieves and stores data in the database. Furthermore the service enforces business logic rules, sometimes of course it just passes the call to the repository if there's nothing specific to do. It may use some session state variables as well. I think it's a standard thing, some people may call it a CatalogManager.
|
|
|
|
|
Pawel Krakowiak wrote: Service talks to a repository which retrieves and stores data in the database.
So if that object will use a Database connection then hopefully it is designed to use connection pooling. If not it should be. That would be one primary concern and is therefore handled with connection pooling not within the scope of instancing the CatalogService objects.
Based on what you have posted it's possible that the idea of making CatalogService a singleton into the premature optimizations are the root of all evil [^]category.
Now that what the object does is somewhat known I will also comment that the singleton like code you originally posted does not appear to conform to best practices. Given there is no need to ensure a single instance the lack of correctness will likely not result in any problems.
led mike
|
|
|
|
|
I posted the same question to ASP.NET forums and someone said to be careful with the second approach (the "master" class) as this brings thread safety issues to the table. I think it may be a valid reason not to do this, but so far it's the only one I got.
As for the singleton part - nay, I wouldn't plan to turn the services into singletons, I personally don't see a need for this. It's just that second approach which looks to have only one instance per the whole application.
|
|
|
|
|
Pawel Krakowiak wrote: as this brings thread safety issues to the table.
Yes, that is what I was referring to in my last post
Pawel Krakowiak wrote: It's just that second approach which looks to have only one instance per the whole application.
Yes. It is a non standard approach which produces a Singleton like design.
If you are interested you can find a long discussion on Singleton on the c2.com site I linked to in my last post. You will find the thread safety issue being discussed there.
led mike
|
|
|
|
|
I am attempting to recreate the behavior that Outlook does when a new message comes in. I would like a popup (form) to be displayed as topmost however not to have focus.
I am using a windows form to manage a series of messages that arrive on the fly. When a new message arrives I use ThreadPool.QueueUserWorkItem() to queue the message for creation of a popup (a simple windows form that is stylized). I would like the popup to come to the front however not take focus from the user. I have attempted to use several Win32 API's including SetWindowPos, SetForegroundWindow, ShowWindow to solve this problem. I can get topmost or focus to work, but not in conjuction. Does anyone have experience with this that may be able to point me the right direction?
|
|
|
|
|
Member 3922930 wrote: I would like a popup (form) to be displayed as topmost however not to have focus.
Member 3922930 wrote: I have attempted to use several Win32 API's including SetWindowPos
Well setting form.Topmost to true works for me.
led mike
|
|
|
|
|
Just set the TopMost property to true .
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Topmost of course makes the form come to the foreground, however it also gives it focus. As stated I dont want the form to have focus. Similar to how outlook comes to the foreground, however it does not take focus away from where you are typing.
|
|
|
|
|
You might have to somehow remember what control you are at before you have the form come up. Use TopMost to get the form on top, then set the focus back to where you were.
Also, don't down vote people who are trying to help you. It'll just piss them off and be less inclined to helping you in the future.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
My aplogizes. I miss read it. I thought it was similar to other sites, asking if the answer was the correct one.
Im not sure if remembering where the user came from is something that can be reasonably done. I would just like to not take focus away. Even if I kept track of where the user came from (say IE webpage) I am not sure I would be able to put the cursor back in the exact box where they were.
It appears this is possible at some level as Outlook does it.
|
|
|
|
|
No worries. Think of the numbers as being like number of stars
Not sure if you already saw this, http://bytes.com/forum/thread448993.html[^], even though it is in VB6, it shouldn't be hard to implement in C#
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|