Click here to Skip to main content
15,905,508 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: Trying to use a string to adb command line Pin
Bernhard Hiller4-Oct-17 23:31
Bernhard Hiller4-Oct-17 23:31 
GeneralRe: Trying to use a string to adb command line Pin
Cláudio Hideki4-Oct-17 23:45
Cláudio Hideki4-Oct-17 23:45 
GeneralRe: Trying to use a string to adb command line Pin
Bernhard Hiller5-Oct-17 21:14
Bernhard Hiller5-Oct-17 21:14 
Questioncreate a simple editor with intellisense Pin
Member 121289494-Oct-17 0:08
Member 121289494-Oct-17 0:08 
AnswerRe: create a simple editor with intellisense Pin
Eddy Vluggen4-Oct-17 0:17
professionalEddy Vluggen4-Oct-17 0:17 
QuestionRun List Of Tasks, Then Get All Results Pin
Kevin Marois2-Oct-17 12:51
professionalKevin Marois2-Oct-17 12:51 
AnswerRe: Run List Of Tasks, Then Get All Results Pin
Pete O'Hanlon2-Oct-17 20:09
mvePete O'Hanlon2-Oct-17 20:09 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Kevin Marois3-Oct-17 3:52
professionalKevin Marois3-Oct-17 3:52 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Richard Deeming3-Oct-17 4:31
mveRichard Deeming3-Oct-17 4:31 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Kevin Marois3-Oct-17 5:33
professionalKevin Marois3-Oct-17 5:33 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Richard Deeming3-Oct-17 6:21
mveRichard Deeming3-Oct-17 6:21 
GeneralRe: Run List Of Tasks, Then Get All Results Pin
Nathan Minier4-Oct-17 1:54
professionalNathan Minier4-Oct-17 1:54 
QuestionFind Insert Position In An ObservableCollection Pin
Kevin Marois2-Oct-17 6:54
professionalKevin Marois2-Oct-17 6:54 
AnswerRe: Find Insert Position In An ObservableCollection Pin
Dave Kreskowiak2-Oct-17 7:14
mveDave Kreskowiak2-Oct-17 7:14 

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.