|
I had a strong desire to get away from the mix and match, but I did not have the typeof(T) piece, I assumed you could just put the T in there and it did not work.
I tried Type.GetType(T) and T.GetType() to no avail. There are too many methods to find a type.
Regardless, thank you for the extensive help.
This is the final reslt:
public ICommand GoToECRsCommand { get { return new RelayCommand(() => GoTo<ECRsViewModel>(_claimId)); } }
private void GoTo<T>(int claimId) where T: WorkspaceViewModel
{
var workspace = _mainWindow.Workspaces.FirstOrDefault(vm => vm is T);
if (workspace == null)
{
workspace = (T)Activator.CreateInstance(typeof(T), new object[] { claimId });
_mainWindow.Workspaces.Add(workspace);
}
_mainWindow.SetActiveWorkspace(workspace);
}
Cheers, --EA
|
|
|
|
|
In my Goldlight[^] project, I have included a WorkspaceManager that might just be of help. Basically, any VM that needs to be treated as though it should be in a workspace inherits from WorkspaceViewModelBase (this provides things like the ability to close the particular workspace).
I then use this information to look the workspace up. Basically, the workspaces are maintained in an ObservableCollection and the UI binds to this.
It's all pretty simple to use. If you have any questions about the code, please feel free to ask.
|
|
|
|
|
I am using a Workspace viewModel right now that works as you have described. I can't recall where I got it, I think was an MSDN article from a year or two ago. Still, I will check out your framework is the workspace setup is a bit clunky, requiring a lot of defining throughout the project. Something more concise would be great.
Thanks for the heads up, I am always trying to find pieces like this.
Cheers, --EA
|
|
|
|
|
I just have to come back and say this framework is great. It is very feature rich. I am so deeply invested in the architecture right now (including MVVMLight) that I am apprehensive about switching over. There are a lot of tempting pieces though. This is definitely going to require some additional looking into.
|
|
|
|
|
Thanks. I wouldn't recommend switching over, Laurent did a really great job with MVVM Light - I mainly pulled it together to make it easy to combine MVVM with some of the things that you would typically use PRISM to do (as well as providing inbuilt support for theming). Please feel free to cannibalise it to your hearts content.
|
|
|
|
|
hi
I used the farsilibrary of code project but have error on my project,that namespace of Win does nor exist!
I add the dll of farsiLibrary and add FArsiLibrary.Win in my tools and drag the persiandatepicker on my form but when i want run my project it gets this error!I paste dll of all in my bin folder but nothin happen!
how can i solve it?
|
|
|
|
|
Ask this question in the forum at the bottom the article you got the library from.
You might also want to paste in the text of the error message you got. Just saying "it doesn't work" doesn't give enough information for anyone to help you.
|
|
|
|
|
Hi. I'm in need of recording video from a 4 channel DVR from .net C#. I've looked at EMGU a Opencv .net wrapper as well as the DirectShow .net library to do this. I've decided to give EMGU a go and is quite happy with it when using webcams. Now I want to use a 4 channel H.264 Usb DVR for the same purpose, but I don't know how to select a video channel on the DVR. When running the sample capture application of EMGU I only get a black screen. I have the same problem with DirectShow. It picks up the DVR as a DR 3101_3104 Video Capture device, but is also showing me the black screen.
Note that the camera is working fine, when I use "SuperDVR"(software that came included with the DVR).
I think there must be a way to specify the channel of which camera you want in both of these libraries, but I have no idea. Could someone shed some light on my problem please.
|
|
|
|
|
Does the DVR act as if it's a webcam? In other words, is what you are trying to achieve actually supported by the hardware? Can you play a DVD using the driver when you start a "webcam session" on MSN Messenger?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hi all,
I am developing a windows application in which when i enter a ip address and click on submit button i want to list the details of all the ports which are opened in that ip address.
So please can you suggest me how can i do it ?
Thanks in advance.
|
|
|
|
|
sarang_k wrote: So please can you suggest me how can i do it ?
Research what a port-scanner is, how they work, and try to write some code.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hey Guys,
Can any one suggest me how to create a NMAP application in c# ?
Thanks in advance.
|
|
|
|
|
sarang_k wrote: Can any one suggest me how to create a NMAP application in c# ?
Line by line.
What have you tried? Or are you just fishing for code?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
What does any of this have to do with using C# to identify whether or not a port is open?
|
|
|
|
|
Hello Guys,
i try to write an interactive Service which communicates with the Desktop.
The aim is to code a Service like Remote-Desktop.
I programmed an Application and it works great but now i wanna make a Service if the User isn't logged in or i i had to restart the computer.
This Article Create a system tray icon and a dialog for a Windows Service helped me to do this under Windows XP.
But if i try this Service on Windows 7 it doesn't work!
Have anybody an idea how i could do this?
The Service establishes a Network-Connection, makes Screenshots and send it to the Client. The Client can do User-Inputs which will be send to the Service and achieve on the machine.
|
|
|
|
|
The service and the UI-app need to be two distinct applications, with the service being GUI-less and the GUI being started when the user logs in.
I'd recommend TCP/IP communication to have those two communicate, using a listener in the Service and a client in the GUI-app. One of the benefits is that it allows for easy testing, it's easy to mock either side of the communication.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Ok but what is if no one is logged in?
Is it possible that the Service starts the Gui-Application even if you see only the Logon-Desktop without a logged in User?
I thought thats not possible...
|
|
|
|
|
1a3xxx wrote: I thought thats not possible...
Correct - no UI on the logon-desktop, out of security reasons.
A UI there wouldn't make any sense anyway; if there's no user, who would be looking at your (unsecured) message?
If you "must" display "something" there, your only alternative is a screensaver.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Yeah i don't need a UI.
But what i need is that the Application runs in the Background, makes Screenshots (which will be send to the host) and apply Userinputs (which were received from the host) ...
How does the Services of Remote-Desktop or TeamViewer works? They also works on Windows 7 and can apply Userinputs, Network-Connections und shows the Winlogon/Default Desktop... :-/
|
|
|
|
|
1a3xxx wrote: How does the Services of Remote-Desktop or TeamViewer works?
Not using screenshots, but using a specialized protocol. You might enjoy this article[^] that demonstrates how to RDP using C#.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Sorry but it don't help me really.
The activeX-Control of RDP don't work from XP to Win7 or from Win7 to XP.
Besides i wanna understand how the Services of TeamViewer/VNC and Remote-Desktop works on Win7 because i really want to programm my own remote-administration tool.
Or rather, i have finished the Tool but need also an Service
|
|
|
|
|
1a3xxx wrote: The activeX-Control of RDP don't work from XP to Win7 or from Win7 to XP.
Sounds logical; there are a lot of libraries that are bound to a specific OS.
1a3xxx wrote: Besides i wanna understand how the Services of TeamViewer/VNC and Remote-Desktop works on Win7 because i really want to programm my own remote-administration tool.
The alternative to using the ActiveX control that provides an RDP service, is to write your own.
1a3xxx wrote: Or rather, i have finished the Tool but need also an Service
You finished a screenshot-application. Remote access is a different beast.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
A service to capture screen shots isn't going to do you any good at all.
|
|
|
|