Click here to Skip to main content
15,921,959 members
Home / Discussions / C#
   

C#

 
QuestionHeisenbug in program without async, etc. Pin
Alexander Kindel5-Oct-17 6:47
Alexander Kindel5-Oct-17 6:47 
AnswerRe: Heisenbug in program without async, etc. Pin
harold aptroot5-Oct-17 10:42
harold aptroot5-Oct-17 10:42 
GeneralRe: Heisenbug in program without async, etc. Pin
Alexander Kindel5-Oct-17 11:28
Alexander Kindel5-Oct-17 11:28 
GeneralRe: Heisenbug in program without async, etc. Pin
harold aptroot5-Oct-17 12:32
harold aptroot5-Oct-17 12:32 
GeneralRe: Heisenbug in program without async, etc. Pin
Alexander Kindel5-Oct-17 12:50
Alexander Kindel5-Oct-17 12:50 
GeneralRe: Heisenbug in program without async, etc. Pin
harold aptroot5-Oct-17 23:17
harold aptroot5-Oct-17 23:17 
GeneralRe: Heisenbug in program without async, etc. Pin
Alexander Kindel5-Oct-17 22:22
Alexander Kindel5-Oct-17 22:22 
QuestionHelp with a Windows Form Application parser Pin
Member 134478105-Oct-17 4:59
Member 134478105-Oct-17 4:59 
QuestionRe: Help with a Windows Form Application parser Pin
Eddy Vluggen7-Oct-17 3:13
professionalEddy Vluggen7-Oct-17 3:13 
AnswerRe: Help with a Windows Form Application parser Pin
Member 134478109-Oct-17 6:43
Member 134478109-Oct-17 6:43 
GeneralRe: Help with a Windows Form Application parser Pin
Eddy Vluggen9-Oct-17 7:31
professionalEddy Vluggen9-Oct-17 7:31 
Questionhow to show sql server row wise data in column wise in dynamic table Pin
Member 127429835-Oct-17 1:08
Member 127429835-Oct-17 1:08 
AnswerRe: how to show sql server row wise data in column wise in dynamic table Pin
Richard MacCutchan5-Oct-17 1:14
mveRichard MacCutchan5-Oct-17 1:14 
QuestionAjax based filled DropDown Reset on Page Postback in Asp.Net Pin
khaqanbaloch4-Oct-17 18:33
professionalkhaqanbaloch4-Oct-17 18:33 
AnswerRe: Ajax based filled DropDown Reset on Page Postback in Asp.Net Pin
Richard MacCutchan4-Oct-17 22:37
mveRichard MacCutchan4-Oct-17 22:37 
QuestionJson login with authentification and getting the result in C# Pin
Member 113544104-Oct-17 17:15
Member 113544104-Oct-17 17:15 
AnswerRe: Json login with authentification and getting the result in C# Pin
Karthik_Mahalingam4-Oct-17 17:55
professionalKarthik_Mahalingam4-Oct-17 17:55 
GeneralRe: Json login with authentification and getting the result in C# Pin
Mycroft Holmes4-Oct-17 21:28
professionalMycroft Holmes4-Oct-17 21:28 
GeneralRe: Json login with authentification and getting the result in C# Pin
Karthik_Mahalingam4-Oct-17 21:39
professionalKarthik_Mahalingam4-Oct-17 21:39 
GeneralRe: Json login with authentification and getting the result in C# Pin
Richard MacCutchan4-Oct-17 22:30
mveRichard MacCutchan4-Oct-17 22:30 
QuestionRe: Json login with authentification and getting the result in C# Pin
Richard MacCutchan4-Oct-17 22:33
mveRichard MacCutchan4-Oct-17 22:33 
QuestionTrying to use a string to adb command line Pin
Cláudio Hideki4-Oct-17 14:42
Cláudio Hideki4-Oct-17 14:42 
Hello everyone, I kindly ask for an orientation in my code, which is done in C # with Android Debug Bridge (ADB) commands that run at a DOS prompt.

The command basically reads the serial number from my tablet and transfers it to a textBox. Until then, no problem. However I need to copy this serial number from this textBox and transfer it to a new ADB command in DOS to read the battery data. Below is the code for better understanding, the first block is to get the serial number and transfer it to textBox1:

C#
{
            System.Diagnostics.Process process = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.UseShellExecute = false;
            startInfo.RedirectStandardOutput = true;
            startInfo.FileName = "adb.exe";
            startInfo.Arguments = "get-serialno";
            process.StartInfo = startInfo;
            process.Start();
            string output1 = process.StandardOutput.ReadToEnd();
            textBox1.Text = output1;
            process.WaitForExit();
        }



And the second block is the code that will direct the commands to the serial number:

C#
startInfo.FileName = "adb.exe";
                startInfo.Arguments = "-s " + textBox1.Text + " shell dumpsys battery";
                process.StartInfo = startInfo;
                process.Start();
                string output = process.StandardOutput.ReadToEnd();
                richTextBox1.Text = output;
                process.WaitForExit();


But I can not get it to recognize the variable in the argument line. I've tried to concatenate, without success ... where am I going wrong? What I've already tried, in the searches I've done:

C#
startInfo.Arguments = String.Format(@"/c adb -s ""{0}"" shell dumpsys battery", output1);

startInfo.Arguments = "/c adb -s \"" + output1 + "\" shell dumpsys battery";

startInfo.Arguments = $@"/c adb -s ""{output1}"" shell dumpsys battery";



Thanks a lot! Big Grin | :-D
QuestionRe: Trying to use a string to adb command line Pin
Richard MacCutchan4-Oct-17 22:28
mveRichard MacCutchan4-Oct-17 22:28 
AnswerRe: Trying to use a string to adb command line Pin
Cláudio Hideki4-Oct-17 23:40
Cláudio Hideki4-Oct-17 23:40 
GeneralRe: Trying to use a string to adb command line Pin
Richard MacCutchan4-Oct-17 23:50
mveRichard MacCutchan4-Oct-17 23:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.