async void submitRemoteButton_Click(object sender, EventArgs e)
		{
			if (String.IsNullOrEmpty (instructionRemoteName_value.Text)) {
				await DisplayAlert ("Validation Error", "Remote name are required", "Re-try");
			}else{

				waitRemoteDialog.Show ();
				string remoteButtonNmae = instructionRemoteName_value.Text;
				if(instructionRemoteName_value.Text.Contains(" ")){					
					remoteButtonNmae = instructionRemoteName_value.Text;
					remoteButtonNmae = remoteButtonNmae.Replace(" ", "_");
				}
				RemoteData rd = new RemoteData();
				foreach (var data in await App.Database.Get_flag_Login())
				{
					rd.remote_username = data.username;
					break;
				}
				var item = (Db_allnode)BindingContext;
				rd.ID = 0;
				rd.node_addr = item.node_addr;
				rd.remote_button_name = remoteButtonNmae;//Add_Remote_Single_Page.instructionRemoteName_value.Text;
				rd.remote_code = "single";
				rd.node_command = "add_button_remote";
				string jsonCommandaddRemoteButton = JsonConvert.SerializeObject(rd, Formatting.Indented);
				System.Diagnostics.Debug.WriteLine ("{0}",jsonCommandaddRemoteButton);
				await LoginPage.ws_client.SendAsync (jsonCommandaddRemoteButton);


				/**Device.BeginInvokeOnMainThread (() => {
					//Add_Remote_Single_Page.addRemotePageLayout.Children.Add (Add_Remote_Single_Page.plsWaitText);
					Add_Remote_Single_Page.plsWaitText.TextColor = Color.Default;
					Add_Remote_Single_Page.plsWaitText.Text = "Push remote command";
					Add_Remote_Single_Page.AddRemoteIndicator.IsRunning = true;
					Add_Remote_Single_Page.addRemoteSubmitButton.IsEnabled = false;
				});**/
			}

		}
Example #2
-1
		async void OnRename(object sender, EventArgs e)
		{
			var mi = ((MenuItem)sender);
			var remote = (RemoteData)mi.BindingContext;

			var result = await UserDialogs.Instance.PromptAsync(new PromptConfig {
				Title = "Rename",
				Text = remote.remote_button_name,
				IsCancellable = true,
				Placeholder = "Type new name"

			});

			if(!result.Text.Equals(remote.new_button_name)){

				waitRemoteDialog = UserDialogs.Instance.Loading("Renaming...",null,null,false,MaskType.Gradient);
				waitRemoteDialog.Show ();

				var newName = result.Text;
				RemoteData itemRemote =  new RemoteData();
				itemRemote.remote_button_name = remote.remote_button_name;
				itemRemote.node_command = "ir_remote_rename";
				itemRemote.new_button_name = newName;
				itemRemote.node_addr = remote.node_addr;
				itemRemote.remote_username = remote.remote_username;
				string jsonCommandaddRemoteButton = JsonConvert.SerializeObject(itemRemote, Formatting.Indented);
				System.Diagnostics.Debug.WriteLine ("{0}",jsonCommandaddRemoteButton);
				await LoginPage.ws_client.SendAsync (jsonCommandaddRemoteButton);

			}

			System.Diagnostics.Debug.WriteLine("RenameRemote_Clicked");
		}