Пример #1
0
    public static InputBox Show(IWin32Window window, string title, InputBoxItem item, InputBoxButtons buttons)
    {
        dialogForm dialog = new dialogForm(title, new InputBoxItem[] { item }, buttons);

        dialog.ShowDialog(window);
        return(new InputBox(dialog));
    }
Пример #2
0
    public static InputBox Show(string title, InputBoxItem item)
    {
        dialogForm dialog = new dialogForm(title, new InputBoxItem[] { item }, InputBoxButtons.OK);

        dialog.ShowDialog();
        return(new InputBox(dialog));
    }
Пример #3
0
    public static InputBox Show(IWin32Window window, string title, string[] labels, InputBoxButtons buttons)
    {
        InputBoxItem[] items = new InputBoxItem[labels.Length];
        for (int i = 0; i < labels.Length; i++)
        {
            items[i] = new InputBoxItem(labels[i]);
        }

        dialogForm dialog = new dialogForm(title, items, buttons);

        dialog.ShowDialog(window);
        return(new InputBox(dialog));
    }
Пример #4
0
        private void btnAddDevice_Click(object sender, EventArgs e)
        {
            string device     = null;
            string cameraName = null;
            string interfac   = cmbInterface.SelectedItem.ToString();

            if (lvDeviceConnected.SelectedItems.Count == 1)
            {
                device   = lvDeviceConnected.SelectedItems[0].SubItems[0].Text;
                interfac = lvDeviceConnected.SelectedItems[0].SubItems[1].Text;

                // Refresh the listview of the device in memory
                ;

                // Inputbox to get the name of the camera
                InputBoxItem[] items = new InputBoxItem[] { new InputBoxItem("Camera name", device) };
                InputBox       input = InputBox.Show("Enter camera name", items, InputBoxButtons.OKCancel);
                if (input.Result == InputBoxResult.OK)
                {
                    cameraName = input.Items["Camera name"];
                }
                else
                {
                    // if pressed cancel exit, don't create folder
                    return;
                }
                // Look if the camera exist in memory
                // if don't exist create camera and its default paramters
                CoreCV.DeviceManager.createCameraData(device, cameraName, interfac);

                // Refresh the listview of the device in memory again
                ;
                //lvDeviceConnected.Items[lvDeviceConnected.SelectedItems[0].Index].BackColor = Color.LightGray;
                lvDeviceConnected.Items[lvDeviceConnected.FindItemWithText(device).Index].BackColor = Color.LightGray;
            }
        }
Пример #5
0
        /// <summary>
        /// Start connection method
        /// В зависимости от переданного типа запускает нужный софт
        /// </summary>
        /// <param name="selectedNode">Current selected node from Tree View</param>
        public static void StartConnect(TreeNode selectedNode, XmlHelper xmlHelper)
        {
            Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? throw new InvalidOperationException();

            if (selectedNode?.Parent == null)
            {
                return;
            }

            _currentGroup  = selectedNode.Parent.Text;
            _currentServer = selectedNode.Text;

            ServerElement serverElement = XmlHelper.getServerByName(_currentGroup, _currentServer);

            if (serverElement == null)
            {
                return;
            }

            string plinkCommand = "";

            if (serverElement.Type == ConnectionType.Plink)
            {
                plinkCommand = XmlHelper.getServerParamByServerId(_currentGroup, _currentServer, "plinkCommand");

                if (plinkCommand == "")
                {
                    InputBoxItem[] items = new InputBoxItem[] {
                        new InputBoxItem("Command")
                    };

                    InputBox input = InputBox.Show("Enter new Plink command", items, InputBoxButtons.OKCancel);
                    if (input.Result == InputBoxResult.OK)
                    {
                        plinkCommand = input.Items["Command"];
                        XmlHelper.setServerParamByServerId(_currentGroup, _currentServer, "plinkCommand", input.Items["Command"]);
                    }
                    else
                    {
                        return;
                    }
                }
            }

            switch (serverElement.Type)
            {
            case ConnectionType.Rdp:     //RDP
                LaunchRdp(serverElement, xmlHelper);
                break;

            case ConnectionType.Vnc:     //VNC
                LaunchVnc(serverElement);
                break;

            case ConnectionType.Scp:     //WinSCP (SCP)
                LaunchWinScp("scp://", serverElement);
                break;

            case ConnectionType.Sftp:     //WinSCP (SFTP)
                LaunchWinScp("sftp://", serverElement);
                break;

            case ConnectionType.Ftp:     //WinSCP (FTP)
                LaunchWinScp("ftp://", serverElement);
                break;

            case ConnectionType.Telnet:
                LaunchTelnet(serverElement);
                break;

            case ConnectionType.Plink:
                LaunchPlink(serverElement, plinkCommand);
                break;

            case ConnectionType.AmmyAdmin:
                LaunchAmmyAdmin(serverElement, xmlHelper);
                break;

            case ConnectionType.RAdmin:
                LaunchRAdmin(serverElement, xmlHelper);
                break;

            case ConnectionType.TeamViewer:
                LaunchTeamViewer(serverElement, xmlHelper);
                break;

            default:
                LaunchPuTTy(serverElement);
                break;
            }
        }