|
Create a wrapper class in a CLI project (C++.NET) and you should be able to access the C++ class from the .NET class. The advantage of this is that you keep your C++ project as is and you can debug both heaps easily. In this mode the unmanaged and managed heaps run within the same process without marshaling. I hope this helps.
|
|
|
|
|
Hi, I'm using an application that generates groups and assign users in active directory to manage a series of folders. i don't know much about AD and so I would like to know if someone can tell me the road. The point is that I have to manage permissions for read-only, full control ... do not know if I have to give to the groups or folders, plus I have no idea how to make it... would appreciate some help, thanks ....
|
|
|
|
|
allstarmisho wrote: I have no idea how to make it
Start by researching, then find some code-snippets and try to combine what you have. The Scripting Center[^] on MSDN has some nice examples on manipulating the AD.
Good luck
I are Troll
|
|
|
|
|
Hi,
One of the column type in my datagridview is datagridviewImage column. it has "recyclebin" image. If I'm try to edit the row, recyclebin image will be changed to edit image.
The problem is, how to know which row is having edit image and which row is having recyclebin image.
I used the below statement to compare, but its not working.
if (dgvIdentifiers["Recycle", e.RowIndex].Value == Resources.recycle)
Note:recycle is the image, resided in Resources
|
|
|
|
|
There are two ways that I have managed to do this.
1) Have a hidden DataGridViewTextBoxColumn , I call it imageHint where I store a string either the path of the image or something like, in your example, "recycle" or "edit". Then any time an image is assigned, assign the appropriate string to imageHint
2) The same principle but use the Tag property of the cell. If you are not familiar with Tag , search MSDN there are loads of examples of how to use it.
Hope this helps.
Good luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I used Tag property of cell. It helped me. Thanks alot..
|
|
|
|
|
Good to know!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
Am need to overwrite the Assemblyinfo.cs file.
ex: [assembly: AssemblyVersion("1.0.0.0")]
needs to be upadted to [assembly: AssemblyVersion("4.0.0.0")]
Instead of manuallly updating i need to update it from code.
The below code reads the version number.
But i need to update it in Assmeblyinfo.cs file,can you help me to update thro code?
using system.reflection;
Version v1 = new Version("4.0.0.0");
Console.WriteLine(" New Version {0}.", v1);
Thanks,
Arul
|
|
|
|
|
Hi Arul,
Reflection does not seem to be the best way to do this. I suggest that you should search all AssemblyInfo.cs files in a specified folder (using DirectoryInfo-class). Open each file (with a StreamReader) and read the file content. Then use a regular expression (Regex-namespace) to find the "AssemblyVersion"-string and replace the version with '4.0.0.0' or whatever number you want to set. Then write the content to the file (to overwrite) by using a StreamWriter.
After that you can build your assembly with the new version number.
Let me know if you need more details on the point where you stuck.
Regards
Sebastian
|
|
|
|
|
Hi Sebastian,
Thanks for your faster response. I tried using DirectorInfo-class. But it says duplicate assembly info files.It would be great if you could chip out with code too.
Also can this be done using cmd prompt.?
Thanks,
Arul
|
|
|
|
|
If you download my MoXAML PowerToys addin source code (follow the link in my sig), you will find plenty of code in there for reading and navigating VS projects - once you've got that in place, it's a simple case of just opening and reading the appropriate file - then looking for the relevant line of code.
|
|
|
|
|
Here's mine[^], there are others.
|
|
|
|
|
I am using a composition of some different code samples to try to work with a WPF (MVVM) application. I started with Josh Smith's multiple view workspace model as below (pertinent snippet)
#region workspaces
public ObservableCollection<WorkspaceViewModel> Workspaces
{
get
{
if (_workspaces == null)
{
_workspaces = new ObservableCollection<WorkspaceViewModel>();
_workspaces.CollectionChanged += OnWorkspacesChanged;
}
return _workspaces;
}
}
private void OnWorkspacesChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.NewItems != null && e.NewItems.Count != 0)
foreach (WorkspaceViewModel workspace in e.NewItems)
workspace.RequestClose += OnWorkspaceRequestClose;
if (e.OldItems != null && e.OldItems.Count != 0)
foreach (WorkspaceViewModel workspace in e.OldItems)
workspace.RequestClose -= OnWorkspaceRequestClose;
}
private void OnWorkspaceRequestClose(Object sender, EventArgs e)
{
var workspace = sender as WorkspaceViewModel;
if (workspace != null)
{
workspace.Dispose();
Workspaces.Remove(workspace);
}
}
#endregion
#region private helpers
private void DisplayAllFoo()
{
var workspace =
Workspaces.FirstOrDefault(vm => vm is AllFooViewModel)
as AllFooViewModel;
if (workspace == null)
{
workspace = new AllFooViewModel();
Workspaces.Add(workspace);
}
SetActiveWorkspace(workspace);
}
private static void DisplayFoo()
{
}
public void SetActiveWorkspace(WorkspaceViewModel workspace)
{
Debug.Assert(Workspaces.Contains(workspace));
var collectionView = CollectionViewSource.GetDefaultView(Workspaces);
if (collectionView != null)
collectionView.MoveCurrentTo(workspace);
}
#endregion
So it is easy enough to work with that, XAML code produces a list of commands which point to the voids above. I wanted to use a treeview navigation structure so I could categorize my navigation commands into categories. I used Josh Smith's (PS Thanks Josh Smith!) WPF MVVM Treeview to make a viewmodel for my categories and navigation items and everything is good there. My issue is this, the navigation commands for each navigation item are on the NavigationCommand viewModel, while the workspace and setactive workspace commands are on the mainWindowViewModel. How do I make this work? How can I call the SetActiveWorkSpace command from my NavCommand viewModel?
Sorry for the mess, --EA
P.S. I do lack a lot of fundamental understanding of WPF, just trying to get a foothold in it.
|
|
|
|
|
I don't know whether I get your requirement correctly but try this,
Create a static instance in the MainWindowViewModel and use MainWindowViewModel.Instance.MethodName() for accessing the method.
|
|
|
|
|
A common way to do this is to use something like a mediator (or the Messenger class in Laurent Bugnion's excellent MVVMLight framework). Basically you register a listener for each command in the MainWindowViewModel and then raise the appropriate command in the NavigationCommand VM - the listener will then react to it.
|
|
|
|
|
I think my fundamental problem is that I am not sure how to work with one viewmodel from another. Here is the breakdown.
Mainwindow has a data context of Main Window View Model. The command to add and set active workspace resides on this view model.
On the mainwindow there is a custom user control treeview that has a data context of navigationcategory view model. Within the treeview each bottom level node is a hyperlink. The binding for each command for each hyperlink is bound to the navigationcommand view model.
With that said, the command on the navigation control view model needs to do something to add a new workspace and change the active work space on the main window view model.
So the question is, what does the command look like on the navigation command view model to tell the main window view model to add a new workspace (based on whatever item is chosen on the treeview)
|
|
|
|
|
Solving this is easy if you have a workspace manager class (which would be a static instance) - then you simply call a method on this manager class to add a window to the workspace that belongs to the appropriate type.
|
|
|
|
|
i want to use usb port for video receiving. could not find on how to communicate via usb port. every where its mentioned for serial ports under the heading of usb port.
|
|
|
|
|
That's because the "S" in U"S"B stands for "Serial" - as in Universal Serial Bus.
Just treat it as a normal serial port and you'll be fine.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Are you sure?!? The "S" is "S"ATA stands for Serial too, but I really doubt that you can access a SATA Hard-Drive using the API for the RS-232...
|
|
|
|
|
You sure about that? I'm not.
You've got the right idea, just the wrong letter.
The keyword is BUS, not serial. USB is an expansion BUS, not unlike the PCI slots on your motherboard.
|
|
|
|
|
USB and serial ports are completely different: when you access a serial port and read/write on it, you are handling the raw data that are transmitted/received. When dealing with an USB device, you need a device driver that do that job for you. What you need is to identify an API that lets you manage the device, abstracting from the kind of hardware connection used.
To handle video streams you can try the DirectShow (Windows)[^]
|
|
|
|
|
Hello,
i'm writing a WCF Application and need to know, which IPAddress/Port i use to communicate with the WCF-Service. I don't want to know on which Port i'm connected on the Server (RemoteEndpointMessageProperty), i want to know which IP/Port my network card uses to connect to the Server.
I hope you can help me.
Thank you
|
|
|
|
|
Assuming you are using a DuplexClientBase<> derived class, you can use client.Endpoint.Address where client is an instance of the derived class.
|
|
|
|
|
Hello,
thank you. But i use the DuplexChannelFactory and there i have a client.Endpoint.Address, but i get back the Address from the service. So what to do now?
Thank you
|
|
|
|