|
What is it supposed to do?
|
|
|
|
|
Essentially
Check a boolean variable that identifies if a application is told it is to startup.
If the boolean value is true then startup the application. If the boolean value is false skip and continue on to the next applicataion (essentially do nothing).
|
|
|
|
|
So essentially here is how I changed the code around...
I think I am correct in the logic.
Can you confirm?
for (int i = 0; i < NewServerVersionTableArray.Lengthl; i++ )
{
string MyAppLocation = NewServerVersionTableArray[i].AssistSuiteApplication.PAppLocWS;
string MyAppName = NewServerVersionTableArray[i].AssistSuiteApplication.FAppNameWS;
string MyMSAccessPath = PeerAssistLoader.Properties.Settings.Default.DefaultMSAccess;
if (File.Exists(MyMSAccessPath))
{
Process MyOpenApp = StandardProcedures.Convert_TrueFalse(NewServerVersionTableArray[i].AssistSuiteApplication.MasterApplication) ? Process.Start(MyMSAccessPath, MyAppLocation + "\\" + MyAppName) : null;
bool result = MyOpenApp == null ? StandardProcedures.ErrorLogWriter("Unable to Open the Application: " + MyMSAccessPath + " " + MyAppLocation + "\\" + MyAppName) : StandardProcedures.DebugLogWriter("Opened the Application: " + MyMSAccessPath + " " + MyAppLocation + "\\" + MyAppName);
bool result = MyOpenApp == null ? StandardProcedures.DebugLogWriter("Unable to Open the Application: " + MyMSAccessPath + " " + MyAppLocation + "\\" + MyAppName) : StandardProcedures.DebugLogWriter("Opened the Application: " + MyMSAccessPath + " " + MyAppLocation + "\\" + MyAppName);
}
}
|
|
|
|
|
Better yet would this be the correct way of doing this?
Process MyOpenApp = StandardProcedures.Convert_TrueFalse( NewServerVersionTableArray[i].AssistSuiteApplication.MasterApplication) ?
Process.Start(MyMSAccessPath, MyAppLocation + "\\" + MyAppName) : null
|
|
|
|
|
Pure Laziness.
int x = -1;
if(DynamicArray != null)
x = DynamicArray.Length;
Is shorter than
int x;
if(DynamicArray == null)
x = -1;
else
x = DynamicArray.Length;
When I started to reply, no-one had (at that point) explained what the ternary operator did, I wasn't trying to make a point that my OP was better or more accurate or anything, someone just beat me to the punch. If I had to implement the length property , and it needed to return -1 in the manner requested in the top post I'd actually do it like this:
public const int UninitializedLength = -1;
public int Length
{
get
{
if(DynamicArray == null)
return UninitializedLength;
return DynamicArray.Length;
}
}
|
|
|
|
|
Not true; Ian's answer above is more nearly the correct one. The value of x is not set until the expression has been evaluated, at which time it is set to the value of the 'true-value' or the 'false-value' as appropriate. Since true-value and false-value may also be expressions, even ternary expressions, only one of the values will ever be evaluated, as is the rule for all if/else expressions. Also in the expression
x = e ? true : false;
the type of x must have been previously declared, it is not inferred from the context.
|
|
|
|
|
x = DynamicArray == null ? -1 : DynamicArray.Length;
Let me see if I understand this somewhat...
could I use this in such a way... no i don't think so I think I might need to
What i was think was this...
<array not="" initilized="">
private void Procedure1(ref MyArray[] DynamicArray)
{
<array thru="" logic="" determined="" not="" to="" create="" array="">
dynamicarray.length = DynamicArray == null ? -1 : DynamicArray.Length;
}
if (dynamicarray.length = -1)
{
MessageBox.Show("No Array Created")
}
|
|
|
|
|
No, the length is read-only (and even if it weren't, it would probably have checked for the length to be >= 0)
PS: you don't need to ref an array unless you intend to replace the array entirely
|
|
|
|
|
Thanks you all have been a big help.
|
|
|
|
|
My Current work around is initialize the array at 1 length and leave all values null. Then the application just outputs a blank record. Or skips on the other filters.
|
|
|
|
|
Is there a reason you are using a [dynamic] array?
The List<T> should to provide pretty much everything need to get the job done.
That said, you should initialise the array with zero members to start with, otherwise you ar elikely to get a world of pain when other developers come to use your code.
modified on Friday, September 18, 2009 10:40 AM
|
|
|
|
|
That is what I did was initilize it to 0th to resolve the issue.
The reason for not using List<t> is I am still learning how to use the List<t>? functionality. I Only used the Dynamic array for the first 2 arrays in the applicaiton and the others I have been using ArrayLists which is way better in managing then Dynamic Arrays.
But List<t> I have not grasped yet. As I want to be able to place multiple sub members to each entry and I have not figured it out yet. Though I am experimenting with it. I agree it would be the best way to handle what I am doing but A) I did not know List<t> when the applicaiton began development, and B) I have to learn somewhere.
|
|
|
|
|
Learning and using the generic list is going to be much easier than coding a fully functional dynamic array by hand. If you are already using arrays much of the syntax is the similar!
|
|
|
|
|
Why not use a Generic List?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
The entire program has already be written I am just tweaking the buggs out. In the future programs I plan to use List. But I still have a few things to work out.
|
|
|
|
|
Hi
i have a simple window form with a listbox that plays a highlighted mp3, works great if i add the mp3 to the project bin, however when i try and put a path in for mp3 for example f:\mp3\song.mp3 it says it "cant play file "
if i put a copy of the mp3 (song.mp3) in the project bin but leave the path as f:\mp3\song.mp3 then it plays fine
so i'm guessing it is defaulting to the project bin to get filename, what am i missing?
code:
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
dsAudioPlayer1.FileName = Path.GetFileName(listBox1.SelectedItem.ToString ());
kenny
|
|
|
|
|
kennyhibs wrote: Path.GetFileName
First guess is that you are only getting the filename and not the full path to the file. Try Path.GetFullPath instead.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Thanks for that it was exactly what was wrong, i was trying to get the mp3 to play the filename but was taking out the full path to the file so it couldn't find it
kenny
|
|
|
|
|
Glad to help
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
GetFileName returns the name of the file: "song.mp3" - i.e. without the path. If you have this in the current directory (as in the case of the project directory) then it can find it. Give it the whole pathed file name and you should be fine. Try
if (File.Exists(listBox1.SelectedItem.ToString())
{
dsAudioPlayer1....
}
else
{
MessageBox.Show("Cannot find \"" + listBox1.SelectedItem.ToString() + "\"");
}
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi.
I have searched and searched and finally at the end of my tether!
My task is quite simple but I cannot find a solution. I would like to store various lists of Key Value pairs to use in my application as these may change in the future.
Can any one point me in the right direction?
The FoZ
|
|
|
|
|
Hi,
From the design point of view, get a list of all combo box from your applicatoin and save all values in database with combo name and values in one table. Later you can allow to change values by providing configuration screen to the user, that will update the this table.
|
|
|
|
|
Thanks for the reply. It is something that I have considered but it's one of those things where I would like to use the AppConfig file route as that means adding more tables to the already huge database (which is out of my control and will need permission for) and the data is very unlikely to change. It would be a nice hurdle to jump over in my project.
The FoZ
|
|
|
|
|
Hi,
It may be a stupid question But I want to know that is it possible to use IDTExtensibility interface in VSTO projects?
If YES,please give me an example..
Thanks
|
|
|
|
|
my application is windows based (C#.net)
i have two forms both containing a windows media player
i go to first form(Form 1) and start a file in media player now if i go to second form and start a file in media player there also , the media player in form 1 should stop
how will i achieve this??
i have tried all the methods but nothing have worked like
Test ts = new Test(); [First Form]
ts.axWindowsMediaPlayer1.Stop();
ts.axWindowsMediaPlayer1.settings.volume=0;
ts.axWindowsMediaPlayer1.Dispose();
ts.axWindowsMediaPlayer1.currentPlaylist.clear();
ts.axWindowsMediaPlayer1.close();[Error-com object that has been seperated from its underlying RCW cannot be used]
plzz help
|
|
|
|