well.. it depends.. I wondered about running it in parallel too.
But I went against it.
In my case this is mobile phone code stuff. It mostly run sequentially. It just happen that some method are async....
As to the firing without lock... In fact you are right, I stupidly left a bug I knew about...
Juts because lock bothered me and the solution I had iin mind bother me too...
The solution I had in mind:
var eTasks = handler?.GetInvocationList()?.Cast<Func<Task>>()?.ToList();
if (eTask == null)
foreach (var t in eTask)
The null invocation parameter.... might take care of multithread access issues, I think....
I should have removed the command1 and command2, those were just additional ways of me trying the same thing. Sorry about that.
Error message is
- The term 'Import-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. - System.Management.Automation - at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke(IEnumerable input) at System.Management.Automation.RemotePipeline.Invoke(IEnumerable input) at System.Management.Automation.Runspaces.Pipeline.Invoke() at exchangePictureUpdater.exchangePictureUpdater.btnAddReplace_Click(Object sender, EventArgs e) - Void CoreInvoke[TOutput](System.Collections.IEnumerable, System.Management.Automation.PSDataCollection`1[TOutput], System.Management.Automation.PSInvocationSettings) |
Command command1 = new Command("set-adserversettings");
CommandParameter parameter1 = new CommandParameter("viewentireforest", true);
Command command2 = new Command("set-userphoto");
CommandParameter parameter2a = new CommandParameter("identity", tbxName.Text);
CommandParameter parameter2b = new CommandParameter("picturedata", displayedImage);
CommandParameter parameter2c = new CommandParameter("domaincontroller", "adfadfadf.com");
CommandParameter parameter2d = new CommandParameter("confirm", false);
Pipeline pipeline = runspacee.CreatePipeline();
Here is what I ended up doing, this allows me to create a script in a string with multiple commands, it processes 1 command at a time and then creates a runspace in c# and runs all of the powershell commands
privatestring runExchangeShellScript(string scriptText)
Runspace runspace = RunspaceFactory.CreateRunspace();
// open it
// create a pipeline and feed it the script text
Pipeline pipeline = runspace.CreatePipeline();
RunspaceInvoke runSpaceInvoker = new RunspaceInvoke(runspace);
// add an extra command to transform the script output objects into nicely formatted strings// remove this line to get the actual objects that the script returns. For example, the script// "Get-Process" returns a collection of System.Diagnostics.Process instances.//pipeline.Commands.Add("Out-String");// execute the script
Collection<PSObject> results = null;
results = pipeline.Invoke();
catch (Exception ex)
MessageBox.Show(ex.InnerException + " - " + ex.Message + " - " + ex.Source + " - " + ex.StackTrace + " - " + ex.TargetSite + " - " + ex.Data);
// close the runspace
// convert the script result into a single string
StringBuilder stringBuilder = new StringBuilder();
foreach (PSObject obj in results)
// return the results of the script that has// now been converted to textreturn stringBuilder.ToString();
Suppose you have two forms: frmMain and frmPopup, on frmMain has 1 button (the button) click open frmPopup, on frmPopup many (button), you click on the button any frmPopup button will transmit data by the delegate of copper frmMain frmPopup before closing time announced new open yes / no of MessageBox.Show. When your done click the close button again poup frmPopup then MessageBox.Show on frmPopup, frmPopup refused to play, until the click buttons yes/no of MessageBox.Show, click the button here as yes / no, then frmPopup and MessageBox. Show it to close. I want to play a new fat frmPopup MessageBox.Show done. Their code has the following structure:
If your message does not appear immediately, do not repost it again, and again, and again...
Your original post was sent to moderation by the automated spam detector, and it took a human (or in this case me) to decide to approve or reject it for publication. And to avoid giving you a severe kicking as a spammer, I had to let all of them through and then go clean up after you later. Which is a waste of my time!
If it doesn't post immediately, give it a few moments - we work as fast as we can, but we are all volunteers with other demands on our time.
I've deleted the three spare version of this...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
as you can see form below code i can get the file to parse but i want to load all the weapon file names form directory and list them all in the listbox then when i select a name it will load the weapon file into selected boxes
but im not sure how to do this i managed to get it to work with push of a button but i cant seem to get it to list weapon files into the listbox and then on a select it will run the code to load the selected weapon file and then display its values to text box then save it out. and here is the one example weapon file so its easy to understand what im trying to do.
lol yeah slipped my mind feel so stupid now ;( but how would i use that in the code i already have as in when i push a button it will load all the stuff into a listbox with the code you provided to me ? sorry im such a noob.
Interestingly, I couldn't find anything on this when I googled it. I have a ContextMenu with MenuItems and I want each MenuItem to have their own ContextMenu so I can both left and right click them. Trouble is, when I have code like this:
I already do do that. The point is for the MenuItem to have children AND it's own ContextMenu. Google Chrome's bookmarks bar is a perfect example and clearly the logic is different than what you're suggesting.
I see and need to have a look to Chrome's bookmarks.
I made also some tests with WPF and was not able to make a ContextMenu for a "parent" ContextMenu item. I found that also RightClick the parent menu item ends in OnClick, which seems again to be an exceptional behaviour only for menu items.
Starting to suspect Chrome might only be using one menu for each bookmark and the bar itself. It looks like they enable/disable certain items depending on what's clicked. So if it's just one of those things you can't do, I'm cool with that. Just have to rethink what I want to do.
Last Visit: 31-Dec-99 18:00 Last Update: 30-Jun-22 16:10