Exemplo n.º 1
0
        private void btnEditSystemVariable_Click(object sender, EventArgs e)
        {
            editVariable variableEditorWindow = new editVariable();
            variableEditorWindow.tbVariableName.Text = lwSystemVariables.SelectedItems[0].SubItems[0].Text;
            string[] fvalues = lwSystemVariables.SelectedItems[0].SubItems[1].Text.Split(';');
            foreach (string str in fvalues)
            {
                variableEditorWindow.lwValueList.Items.Add(str);
            }

            variableEditorWindow.NewOrEdit = editVariable.operationType.noeEdit;
            variableEditorWindow.variableSender = Envared.editVariable.variableType.systemVariable;
            variableEditorWindow.ShowDialog();

            if (variableEditorWindow.DialogResult == DialogResult.OK)
            {
                string exname = new string(lwSystemVariables.SelectedItems[0].Text.ToCharArray());
                lwSystemVariables.SelectedItems[0].Text = variableEditorWindow.tbVariableName.Text;
                lwSystemVariables.SelectedItems[0].SubItems[1].Text = variableEditorWindow.lwValueListToValue();
                System.Environment.SetEnvironmentVariable(exname, "", EnvironmentVariableTarget.Machine);
                System.Environment.SetEnvironmentVariable(variableEditorWindow.tbVariableName.Text, variableEditorWindow.lwValueListToValue(), EnvironmentVariableTarget.Machine);

            }
            else
            {

            }
        }
Exemplo n.º 2
0
        private void btnNewVariable_Click(object sender, EventArgs e)
        {
            //Before Show
            editVariable variableEditorWindow = new editVariable();

            variableEditorWindow.tbVariableName.Text = "New Variable";

            variableEditorWindow.NewOrEdit = editVariable.operationType.noeEdit;
            variableEditorWindow.variableSender = editVariable.variableType.userVariable;
            variableEditorWindow.ShowDialog();

            if (variableEditorWindow.DialogResult == DialogResult.OK)
            {
                //lwUserVariables.Items.Add(variableEditorWindow.tbVariableName.Text).SubItems.Add(variableEditorWindow.lwValueListToValue());
                //System.Environment.SetEnvironmentVariable(variableEditorWindow.tbVariableName.Text, variableEditorWindow.lwValueListToValue(), EnvironmentVariableTarget.User);
                DataRow newVariableRow = dataSet1.Tables[1].NewRow();

                newVariableRow[1] = ((DataRowView)bindingSourceProfiles.Current).Row.ItemArray[0];
                newVariableRow[2] = variableEditorWindow.tbVariableName.Text;
                newVariableRow[3] = variableEditorWindow.lwValueListToValue();

                dataSet1.Tables[1].Rows.Add(newVariableRow);

                relationProfileVariableBindingSource.MoveLast();
            }
            else
            {
            }
        }
Exemplo n.º 3
0
        private void btnEditVariable_Click(object sender, EventArgs e)
        {
            editVariable variableEditorWindow = new editVariable();
            variableEditorWindow.tbVariableName.Text = ((DataRowView)relationProfileVariableBindingSource.Current).Row.ItemArray[2].ToString();
            string[] fvalues = ((DataRowView)relationProfileVariableBindingSource.Current).Row.ItemArray[3].ToString().Split(';');
            foreach (string str in fvalues)
            {
                variableEditorWindow.lwValueList.Items.Add(str);
            }

            variableEditorWindow.NewOrEdit = editVariable.operationType.noeEdit;
            variableEditorWindow.variableSender = Envared.editVariable.variableType.userVariable;
            variableEditorWindow.ShowDialog();

            if (variableEditorWindow.DialogResult == DialogResult.OK)
            {
                dataGridView1.SelectedRows[0].Cells[0].Value = variableEditorWindow.tbVariableName.Text;
                dataGridView1.SelectedRows[0].Cells[1].Value = variableEditorWindow.lwValueListToValue();

            }
            else
            {

            }
        }
Exemplo n.º 4
0
        private void btnNewUserVariable_Click(object sender, EventArgs e)
        {
            //Before Show
            editVariable variableEditorWindow = new editVariable();

            variableEditorWindow.tbVariableName.Text = "New Variable";

            variableEditorWindow.NewOrEdit = editVariable.operationType.noeNew;
            variableEditorWindow.variableSender = editVariable.variableType.userVariable;
            variableEditorWindow.ShowDialog();

            if (variableEditorWindow.DialogResult == DialogResult.OK)
            {
                lwUserVariables.Items.Add(variableEditorWindow.tbVariableName.Text).SubItems.Add(variableEditorWindow.lwValueListToValue());
                System.Environment.SetEnvironmentVariable(variableEditorWindow.tbVariableName.Text, variableEditorWindow.lwValueListToValue(), EnvironmentVariableTarget.User);
            }
            else
            {

            }
        }