public async void Execute(object parameter) { IsWorking = true; UpdateCanExecute(); await Task.Run(() => ExecuteFunction.Invoke(parameter)); IsWorking = false; UpdateCanExecute(); }
private void Execute(ExecuteFunction function) { try { function(); } catch (Exception ex) { Log.Write(ex.Message + "\r\n" + ex.StackTrace, LogMode.Information); } }
public FunctionNode(string name, List <string> parameters, ExecuteFunction function) { this.name = name; this.parameters = parameters; this.function = function; this.native = true; this.value = "([native code])"; this.type = "function"; }
/// <summary> /// Starts the num-th attempt to load and unload. /// </summary> /// <param name="num">The number of the attempt.</param> /// <param name="execute">The execution function.</param> private static void Attempt(int num, ExecuteFunction execute) { execute(out var alcWeakRef); for (var i = 0; alcWeakRef.IsAlive && i < 10; i++) { GC.Collect(); GC.WaitForPendingFinalizers(); } Console.WriteLine($"Attempt #{num} successful: {!alcWeakRef.IsAlive}"); }
public Task <string> ExecuteRequestAsync(List <string> targets, List <BigInteger> values, List <byte[]> calldatas, byte[] descriptionHash) { var executeFunction = new ExecuteFunction(); executeFunction.Targets = targets; executeFunction.Values = values; executeFunction.Calldatas = calldatas; executeFunction.DescriptionHash = descriptionHash; return(ContractHandler.SendRequestAsync(executeFunction)); }
public Task <TransactionReceipt> ExecuteRequestAndWaitForReceiptAsync(List <string> targets, List <BigInteger> values, List <byte[]> calldatas, byte[] descriptionHash, CancellationTokenSource cancellationToken = null) { var executeFunction = new ExecuteFunction(); executeFunction.Targets = targets; executeFunction.Values = values; executeFunction.Calldatas = calldatas; executeFunction.DescriptionHash = descriptionHash; return(ContractHandler.SendRequestAndWaitForReceiptAsync(executeFunction, cancellationToken)); }
internal LoadGameScreen(String loadLoc, StartScreen sc = null) { func = null; this.sc = sc; if (!bInitialize) { Initialize(); } loadLocation = loadLoc; LoadFileTab.SetScroll(0f); GenerateTabs(); }
internal LoadGameScreen(String loadLoc, ExecuteFunction f) { func = f; this.sc = null; if (!bInitialize) { Initialize(); } loadLocation = loadLoc; LoadFileTab.SetScroll(0f); saveDatas.Add(new PlayerSaveData()); saveDatas.Last().timeIndex = long.MaxValue - 1; GenerateTabs(); }
private static void PostBuildCheck(IPostBuildReporter rep) { try { initInstructionsDictionary(); } catch (DuplicateCharacterException e) { rep.Error(e.Message, "enum instruction", e.Character.ToString()); return; } foreach (var instrKvp in _instructionTypes) { if (instrKvp.Value == NodeType.BlockHead) { try { BlockNode.Create(instrKvp.Key, _instructions[instrKvp.Key], 0, 0, null, null, false); } catch { rep.Error(@"Block instruction ""{0}"" is not processed.".Fmt(instrKvp), "blockNode createBlockNode", "default"); } } else if (instrKvp.Value == NodeType.FunctionExecutionNode) { try { ExecuteFunction.Create(_instructions[instrKvp.Key], 0, 0); } catch { rep.Error(@"Function execution instruction ""{0}"" is not processed.".Fmt(instrKvp), "executeFunction createFunctionExecutionNode", "default"); } } } }
public RegisterOperation() { _internalExecute = SetValue; }
/// <summary> /// See: private void RunCodeButton_Click(object sender, EventArgs e) /// </summary> public void ExecuteDelegate(Tuple <string, string, string> _credentials, ExecuteFunction f) { string PrivateKey = null; string hostname = _credentials.Item1; string login = _credentials.Item2; string password = _credentials.Item3; string pk_pwd = null; if (File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PuTTYStorm", "privatekeys.xml"))) { string[] groups = IsPasswordLess.GetGroupsForPwdLessHostname(containers_list, _credentials.Item1); // Check if group or su-group is part of private keys configuration setup if ((IsPasswordLess.IsGroupBetweenPrivateKeys(privatekeys, groups[0])) || (IsPasswordLess.IsGroupBetweenPrivateKeys(privatekeys, groups[1]))) { // Fetch private key and password for group PrivateKey = IsPasswordLess.GetOpenSSHPrivateKeyForGroup(privatekeys, groups[0]); pk_pwd = IsPasswordLess.GetOpenSSHPrivateKeyPassPhrase(privatekeys, groups[0]); // If private key and password is still null, then sub-group is part of its setup - fetch it! if (PrivateKey == null && pk_pwd == null) { Console.WriteLine("## Sub-group is part of pwdess login!"); PrivateKey = IsPasswordLess.GetOpenSSHPrivateKeyForGroup(privatekeys, groups[1]); pk_pwd = IsPasswordLess.GetOpenSSHPrivateKeyPassPhrase(privatekeys, groups[1]); } // If private key doesn't exists or is still null then something is wrong! Stop processing and return! if (!File.Exists(PrivateKey)) { if (PrivateKey == null || PrivateKey == "") { PrivateKey = "of OpenSSH type or its group"; } MessageBox.Show("You are going to use Kotarak passwordless login, " + Environment.NewLine + "however private key " + PrivateKey + " doesn't exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } password = null; } } // Priority Login if (ForceAccountCheckBox.Checked) { string force_username; string force_password; Control[] force_username_texbox = this.Controls.Find("LoginTextBox", true); Control[] force_password_texbox = this.Controls.Find("PasswordTextBox", true); force_username = force_username_texbox[0].Text; force_password = force_password_texbox[0].Text; login = force_username; password = force_password; PrivateKey = null; } f(dataGridView1, ReadValueFromControl(scintilla1), hostname, login, password, PrivateKey, pk_pwd); }
public void Execute(object parameter) { ExecuteFunction?.Invoke(parameter); }
public Task <TransactionReceipt> ExecuteRequestAndWaitForReceiptAsync(ExecuteFunction executeFunction, CancellationTokenSource cancellationToken = null) { return(ContractHandler.SendRequestAndWaitForReceiptAsync(executeFunction, cancellationToken)); }
public Task <string> ExecuteRequestAsync(ExecuteFunction executeFunction) { return(ContractHandler.SendRequestAsync(executeFunction)); }
public GLItem(ExecuteFunction executeCommand) { ExecuteCommand = executeCommand; }