|
What is _directoryFilterList? Looks like a list of lists, maybe you need a 'sub' foreach.
Another thought, are you perhaps, modifying the enumerated list?
|
|
|
|
|
Hi,
_directoryFilterList is a linq table Table<DirectoryBlockingList>
I'm actually just looking at a sub foreach now ...
I'm not changing the enumerated list, that is remaining as is and i'm changing the directory listing ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I've just tried the sub foreach thing and that's not working either ... it only ever executes the Predicate once, it complete ignores the foreach ...
I'm seriously confused ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I have it working more reliably now that I've split the method like this:
private static void FilterDirectoryList()
{
Table<DirectoryBlockingList> _directoryFilterList = _context.GetTable<DirectoryBlockingList>();
foreach (DirectoryBlockingList _blockdir in _directoryFilterList)
{
_filterString = _blockdir.DirectoryName;
RemoveRecords();
}
}
private static void RemoveRecords()
{
Debug.WriteLine(_filterString);
_directoryList.RemoveAll(new Predicate<string>(delegate(string s)
{
return string.Compare(s, 0, _filterString, 0, _filterString.Length) == 0;
}));
}
However, I have now found out that my foreach loop using the linq Table<> hangs on the last item and never completes ... could this be related to the fact that it is a static class??
EDIT: Its all fine ... I've been caught out by the immediate window. When running the application in debug mode all worked as expected.
Jammer
Going where everyone here has gone before!
My Blog
modified on Sunday, June 8, 2008 8:39 AM
|
|
|
|
|
Sometime LINQ2SQL gets tricky, glad you sorted it out
|
|
|
|
|
I need to create an windows application that uses a database. This will be implemented on a server. Can someone tell me please if i need to add any changes to the code since it will be on a server environment.
I'm still a rookie on this subject.
Thanks
|
|
|
|
|
jonhbt,
I don't think anyone can tell you whether or not your code needs to be changed without seeing it.
It shouldn't need to be changed, as a server is just another PC, so if it runs on a desktop, then there should be no reason it wouldn't work on the server. UNLESS, you only have certain permissions/.net version limitations on the server of course...
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Thanks very much for your help. I only want to create the application for 2 computers connected to another server. This is the structure of the interface.
|
|
|
|
|
Could you define what do you mean by a "server"? Different OS / special hardware / lock-down system?
|
|
|
|
|
Hi there.
I'm new on C# . I want to know when we have to use delegate in C#.
Of course except Eevents.
Thanks in advance.
Sorry for my English. I'm a freshman .
|
|
|
|
|
You can use delegates for heaps of things, they are just function pointers.
I used them quite often when multithreading. Events are where they seem to be most commonly used though.
|
|
|
|
|
Thanks Mark.
Sorry for my English. I'm a freshman .
|
|
|
|
|
|
1) u can use a delegate if u want an object to have several method with same signature (ie, a family of Methods) but with different algorithm and u can select between these method dynamically using a delegate. Something like...
delegate double BinaryOperation(double a, double b)
BinaryOperation binaryOperation;
private double Add(double a, double b)
{
return a + b;
}
private double divide(double a, double b)
{
return a / b;
}
public static void BinaryOperationsButton_click(sender object, EventArgs e)
{
if(object is btnAdd)
binaryOperation = new BinaryOperation(Add);
else if(object is btnDivide)
binaryOperation = new BinaryOperation(Divide);
binayOperation.BeginInvoke(operand1,operand2,null,null);
}
|
|
|
|
|
I've seen similar examples but I still can't see the point.
What's wrong with this code:
{
if (sender.name == "btnAdd")
{
double result = Add(operand1, operand2);
}
if (sender.name == "btnDivide")
{
double result = divide(operand1, operand2);
}
}
for me makes reading and understanding simpler.
So, I am not using delegates, and worrying i'm missing something
Rob
|
|
|
|
|
the previous example did not do its job even though it show the delegates asynchronous ability.
Something assignable gives you the flexibility and scalability.
just look at this situation;
delegate void CipherInvoker(byte[] array);
CipherInvoker cipher;
public void ChooseCipher()
{
if(option == "RSACipher")
cipher = new CipherInvoker(RSACipher);
else if(option == "DESCipher")
cipher = new CipherInvoker(DESCipher);
CipherFile("blah", cipher);
}
public void CipherFile(string filname, CipherInvoker cipher)
{
// blah blah
cipher();
//blah blah
}
lets assume that , you found out new efficient and secure way of ciphering or u want to implement ciphering with a another alogorithm;
then u can implement it and u can use it without altering unnecessary places
u may change like
public void ChooseCipher()
{
if(option == "RSACipher")
cipher = new CipherInvoker(RSACipher);
else if(option == "DESCipher")
cipher = new CipherInvoker(DESCipher);
else if(option == "MyCipher")
cipher = new CipherInvoker(MyCipher);
CipherFile("blah" ,cipher);
}
|
|
|
|
|
I have an application and I am going to deploy it without making an EXE. J’t copy the release folder and run it. Are there any wrong of that or any disadvantage?
|
|
|
|
|
What do you mean without an EXE? The Release folder will contain an exe if the project type was console or winform application.
|
|
|
|
|
yes i did a mistake writting that..Ok t'me is that same we deploy the release folder and makeing an installation file..
Any disadvantage deploying release folder?
|
|
|
|
|
If you have a simple application that doesn't need work done before first run it's OK. You can just xcopy the directory.
If you have a more complex application you may be needing a setup program created. The setup application lets users choose components, location, language, etc for the application (i.e. the work that has to be done before the first run).
|
|
|
|
|
Hi folks,
Hope I am not posting a dead horse here. My search-fu is weak with this topic. Very little relevant info from google or cp searches.
Here is the scenario.
I am building 2 projects. One is an admin module for a database that will install sql server and configure a connection string and dump it into and encrypted file. The admin will then copy this file to the location of the setup files for the user module. When the users/admin installs the user module, I would like to read the connection string from the file located in the setup location, which could be local or on a network share or anywhere else accessible.
How can I get the location of the setup.exe file that the user started at runtime. I am using VS2005 Pro, C#, .Net 2.0. I am not using clickonce, I have created a setup project and installer class with onafterinstall event handler.
Forgot to mention this is a Windows Vista/XP desktop application not a web app.
I have looked at the Context[parameter] object, System.Reflection namespace, System.Environment, Application Object and am not getting it.
I would really appreciate any help you can give. I will probably feel really stupid when the answer hits.
Thanks much
Dave
modified on Sunday, June 8, 2008 3:16 AM
|
|
|
|
|
Hi!
IIRC there's no built-in way to access this information from inside a deferred custom action (that's what your OnAfterInstall event is).
So you'll have to pass all the information you need in your CA inside the CustomActionData property.
hth...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
mav,
Thanks much, I was beating this thing around for hours and couldn't figure out what was going on. You led me right to the information I needed to clear it up. For anyone interested, the installer properties are not available to the deferred custom actions. If you need to access these properties you have to pass them to the deferred custom action in the CustomActionData property then you can retrieve the information through the Context object. The following articles were also helpful (which i wouldn't have found without your help mav ).
http://msdn.microsoft.com/en-us/library/9cdb5eda.aspx[^]
and
http://msdn.microsoft.com/en-us/library/aa370905(VS.85).aspx[^]
Thanks again for the big assist!
Dave
|
|
|
|
|
Glad I could help.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
How can I connect to a scanner from my application and scan and save file in .jpg format? Can any 1 help?
|
|
|
|