public void Accept_and_retrieve_a_valid_name() { var sn = new SystemName("mySingleInput"); var x = new SingleInput(sn); Check.That(x.SystemName.Value).IsEqualTo("mySingleInput"); }
private void Start() { SingleInput i = GetComponent <SingleInput>(); i.onDoublePress += Jump; i.onSinglePress += SwitchDirection; }
private void Start() { myRigidBody = GetComponent <Rigidbody>(); SingleInput si = GetComponent <SingleInput>(); si.onSinglePress += Jump; si.onLongPress += DropObstacle; }
static void Main(string[] args) { var robotSpider = SingleInput.InputVals(); StringBuilder cmdRecord = new StringBuilder(string.Empty); while (true) { Console.WriteLine("Type in command or a list of commands using L R F (X to exit)"); string cmds = Console.ReadLine(); if (cmds.Contains("X", StringComparison.InvariantCultureIgnoreCase)) { break; } foreach (var cmd in cmds) { cmdRecord.Append(cmd); if (cmd == 'F' || cmd == 'f') { var res = robotSpider.RobotSpiderState.Move(robotSpider.FieldX, robotSpider.FieldY); Console.WriteLine($"Current position: {robotSpider.RobotSpiderState.CurrentX},{robotSpider.RobotSpiderState.CurrentY} {robotSpider.RobotSpiderState.CurrentDirection.ToString()}"); if (!res) { Console.WriteLine($"BEEP BOOP: hit the wall at command {cmdRecord.ToString()}. Spider reset. Try another set of commands."); robotSpider.RobotSpiderState.Reset(); cmdRecord = new StringBuilder(string.Empty); Console.WriteLine($"Current position: {robotSpider.RobotSpiderState.CurrentX},{robotSpider.RobotSpiderState.CurrentY} {robotSpider.RobotSpiderState.CurrentDirection.ToString()}"); break; } } else { robotSpider.RobotSpiderState.ChangeDirection(cmd); } } } Console.WriteLine("Terminating..."); Console.ReadLine(); }
private void DocumentPush() { // TO DO nothing to push tip if (ActiveCanvas.Document == null) { return; } try { string docPath = ActiveCanvas.Document.FilePath; using (var repo = new Repository(getWorkDir(docPath))) { GH_SettingsServer sserver = new GH_SettingsServer("ggit"); if (repo.Network.Remotes["origin"] == null) { MessageBox.Show("Remote origin is not exist, create a repository remotely, something like github, and paste the url into next window form."); SingleInput inputer = new SingleInput(); inputer.Text = "Remote Url"; inputer.singleLabel.Text = "Remote Url"; inputer.ConfirmEvent += (sender, content) => { repo.Network.Remotes.Add("origin", content); inputer.Close(); }; inputer.ShowDialog(); return; } Remote remote = repo.Network.Remotes["origin"]; string token = sserver.GetValue("AccessToken", ""); if (token == "") { DialogResult choose = MessageBox.Show("Do you want to set a Personal Access Token to avoid input username and password for each push ?", "Access Token didn't exist", MessageBoxButtons.YesNoCancel); if (choose == DialogResult.OK) { MessageBox.Show("Remote origin is not exist, create a repository remotely, something like github, and paste the url into next window form."); SingleInput inputer = new SingleInput(); inputer.Text = "Access Token"; inputer.singleLabel.Text = "Token"; inputer.ConfirmEvent += (sender, accessToken) => { sserver.SetValue("AccessToken", accessToken); inputer.Close(); }; inputer.ShowDialog(); } else if (choose == DialogResult.No) { DoubleInput loginForm = new DoubleInput(); loginForm.Text = "Git login"; loginForm.label1.Text = "Username"; loginForm.input2.PasswordChar = '*'; loginForm.label2.Text = "Passowrd"; loginForm.ConfirmEvent += (sd, username, password) => { if (username == "") { MessageBox.Show("Username can't be empty."); return; } if (password == "") { MessageBox.Show("E-mail can't be empty."); return; } PushOptions options1 = new PushOptions(); options1.CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials { // TO DO Set AccessToken From Username = username, Password = password }; repo.Network.Push(remote, @"refs/heads/master", options1); loginForm.Close(); }; loginForm.ShowDialog(); } return; } PushOptions options = new PushOptions(); options.CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials { // TO DO Set AccessToken From Username = token, Password = string.Empty }; repo.Network.Push(remote, @"refs/heads/master", options); DocumentEditor.SetStatusBarEvent(new GH_RuntimeMessage("Push done !")); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }