Пример #1
0
        private void buttonTest_Click(object sender, RoutedEventArgs e)
        {
            var program = this.textBoxProgram.Text.Trim();
            var args    = this.textBoxArgs.Text.Trim();

            if (string.IsNullOrEmpty(program))
            {
                MessageBox.Show(string.Format(Wsapm.Resources.Wsapm.AddProcessToStartWindow_NoInfoError, Environment.NewLine), Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (string.IsNullOrEmpty(args))
            {
                args = null;
            }

            var pStart = new ProgramStart(program, args);

            try
            {
                var psi = new ProcessStartInfo();
                psi.FileName  = pStart.FileName;
                psi.Arguments = pStart.Args;
                Process.Start(psi);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format(Wsapm.Resources.Wsapm.AddProcessToStartWindow_ErrorStartProgramTest, Environment.NewLine, pStart.FileName + " " + pStart.Args, ex.Message), Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #2
0
        private ProgramStart EditStartProgramsAfterWake(ProgramStart selectedItem)
        {
            var psList = new List <ProgramStart>(this.dataGridStartProgramsAfterWake.Items.Count);

            for (int i = 0; i < this.dataGridStartProgramsAfterWake.Items.Count; i++)
            {
                psList.Add((ProgramStart)this.dataGridStartProgramsAfterWake.Items[i]);
            }

            var addForm = new AddProcessToStartWindow(selectedItem, psList.ToArray());
            var result  = addForm.ShowDialog();

            if (result != true)
            {
                return(null);
            }

            var p = addForm.GetProgramStart();

            if (p == null)
            {
                return(null);
            }

            return(p);
        }
Пример #3
0
 public AddProcessToStartWindow(ProgramStart programToEdit, ProgramStart[] allProgramsToStart)
     : this(allProgramsToStart)
 {
     this.Title = Wsapm.Resources.Wsapm.AddProcessToStartWindow_TitleEdit;
     this.editProgramToStartCopy = programToEdit.Copy();
     this.textBoxProgram.Text    = programToEdit.FileName;
     this.textBoxArgs.Text       = programToEdit.Args;
 }
Пример #4
0
    // Start is called before the first frame update
    void Start()
    {
        clueHud = GameObject.Find("ClueHUD").GetComponent <ClueHUD>();

        // Load editor node prefabs from Resources
        if (nodePrefabs == null)
        {
            nodePrefabs = new Dictionary <string, KeyValuePair <string, GameObject> >();
            nodePrefabs.Add("AssignValue", new KeyValuePair <string, GameObject>("Set variable: Assigns a value to a variable. The variable is created if it doesn't exist.", Resources.Load("Prefabs/ProgramEditor/Nodes/Operations/AssignValue") as GameObject));
            nodePrefabs.Add("CreateList", new KeyValuePair <string, GameObject>("Create List: Initialises a named list with a specific size.", Resources.Load("Prefabs/ProgramEditor/Nodes/Operations/CreateList") as GameObject));
            nodePrefabs.Add("FunctionCallBase", new KeyValuePair <string, GameObject>("Function call: Triggers the specified function. Can pass parameters.", Resources.Load("Prefabs/ProgramEditor/Nodes/Operations/FunctionCall") as GameObject));

            nodePrefabs.Add("LogicalBlock", new KeyValuePair <string, GameObject>("If Statement: Runs a block of code if a condition is met.", Resources.Load("Prefabs/ProgramEditor/Nodes/IfStatement") as GameObject));
            nodePrefabs.Add("ElseBlock", new KeyValuePair <string, GameObject>("Else: Runs a block of code if its linked If Statement condition is not met. Must appear after an If Statement.", Resources.Load("Prefabs/ProgramEditor/Nodes/ElseBlock") as GameObject));

            nodePrefabs.Add("WhileLoop", new KeyValuePair <string, GameObject>("While loop: Repeats a block of code as long as condition is met.", Resources.Load("Prefabs/ProgramEditor/Nodes/WhileLoop") as GameObject));

            nodePrefabs.Add("Break", new KeyValuePair <string, GameObject>("Break: Terminates execution of the loop early and moves to the node after it.", Resources.Load("Prefabs/ProgramEditor/Nodes/Break") as GameObject));
            nodePrefabs.Add("Continue", new KeyValuePair <string, GameObject>("Continue: Moves to the next iteration of the loop without waiting for the current one to finish.", Resources.Load("Prefabs/ProgramEditor/Nodes/Continue") as GameObject));
        }

        if (!lineCanvas)
        {
            lineCanvas = transform.Find("LineCanvas").GetComponent <Canvas>();
        }

        if (!lineMaterial)
        {
            lineMaterial = Resources.Load("Materials/LineMaterial") as Material;
        }

        if (!programStart)
        {
            programStart = elementContainer.GetComponentInChildren <ProgramStart>();
        }

        if (!programEnd)
        {
            programEnd = elementContainer.GetComponentInChildren <ProgramEnd>();
        }

        // linkingPreviewNode is used to visualise the node connections when the user is still selecting the second node to link to
        linkingPreviewNode = new GameObject("previewNode", new Type[] { typeof(RectTransform), typeof(EditorDraggableNode) });
        linkingPreviewNode.transform.parent = elementContainer.transform;
        linkingPreviewNode.GetComponent <EditorDraggableNode>().allowDrag            = false;
        linkingPreviewNode.GetComponent <EditorDraggableNode>().isArithmeticOperator = false;

        if (!enableEditorOnStartup)
        {
            DisableEditor();
        }
    }
Пример #5
0
 public SystemService(ProgramStart programStart)
 {
     InitializeComponent();
     _programStart = programStart;
 }
Пример #6
0
        private void buttonOK_Click(object sender, RoutedEventArgs e)
        {
            var program = this.textBoxProgram.Text.Trim();
            var args    = this.textBoxArgs.Text.Trim();

            if (string.IsNullOrEmpty(program))
            {
                MessageBox.Show(string.Format(Wsapm.Resources.Wsapm.AddProcessToStartWindow_NoInfoError, Environment.NewLine), Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (!File.Exists(program))
            {
                if (!FileTools.ExecutableFileExistsInEnvironmentVariablePaths(program))
                {
                    var result = MessageBox.Show(string.Format(Wsapm.Resources.Wsapm.AddProcessToStartWindow_ProgramDoesNotExistWarning, program, Environment.NewLine), Wsapm.Resources.Wsapm.General_MessageBoxTitle, MessageBoxButton.YesNo, MessageBoxImage.Warning);

                    if (result == MessageBoxResult.No)
                    {
                        return;
                    }
                }
            }

            if (string.IsNullOrEmpty(args))
            {
                args = null;
            }

            ProgramStart ps = new ProgramStart(program, args);

            // Avoid to add a element twice.
            if (this.editProgramToStartCopy == null)
            {
                // Add new mode.
                if (this.allProgramsToStart != null)
                {
                    for (int i = 0; i < this.allProgramsToStart.Length; i++)
                    {
                        if (this.allProgramsToStart[i] == ps)
                        {
                            MessageBox.Show(String.Format(Wsapm.Resources.Wsapm.AddProcessToStartWindow_ProcessAlreadyAdded, ps.ToString()), Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }
                    }
                }
            }
            else
            {
                // Edit mode.
                if (ps == this.editProgramToStartCopy)
                {
                    // Element was not changed.
                    this.DialogResult = false;
                    this.Close();
                    return;
                }
                else
                {
                    // Element was changed.
                    if (this.allProgramsToStart != null)
                    {
                        for (int i = 0; i < this.allProgramsToStart.Length; i++)
                        {
                            if (this.allProgramsToStart[i] == ps)
                            {
                                MessageBox.Show(String.Format(Wsapm.Resources.Wsapm.AddProcessToStartWindow_ProcessAlreadyAdded, ps.ToString()), Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                                return;
                            }
                        }
                    }
                }
            }

            this.programStart = new ProgramStart(program, args);
            this.DialogResult = true;
            this.Close();
        }
Пример #7
0
        public void Set()
        {
            flowLayoutPanel1.Controls.Clear();
            var xmlDoc = new XmlDocument();

            xmlDoc.Load(@"C:\mookseong\config.xml");
            var nodeList = xmlDoc.SelectNodes("/Root/Data");

            if (nodeList == null)
            {
                return;
            }
            foreach (XmlNode xmlNode in nodeList)
            {
                switch (xmlNode.Attributes?["Type"].Value)
                {
                case "Program":
                    var programStart = new ProgramStart();
                    flowLayoutPanel1.Controls.Add(programStart);
                    programStart.button1.Enabled = false;
                    break;

                case "Shutdown":
                    var shutdown = new Shutdown();
                    flowLayoutPanel1.Controls.Add(shutdown);
                    shutdown.textBox1.Enabled = false;
                    break;

                case "Delay":
                    var deleay = new Deleay();
                    flowLayoutPanel1.Controls.Add(deleay);
                    deleay.TEXT.Text    = xmlNode.InnerText;
                    deleay.TEXT.Enabled = false;
                    break;

                case "Volume":
                    var volume = new Volume();
                    flowLayoutPanel1.Controls.Add(volume);
                    volume.textBox1.Text    = xmlNode.InnerText;
                    volume.textBox1.Enabled = false;
                    break;

                case "Ip":
                    var ip = new TextControl();
                    flowLayoutPanel1.Controls.Add(ip);
                    ip.Text1.Text = @"IP주소 불러와서 표시하기";
                    break;

                case "Date":
                    var date = new TextControl();
                    flowLayoutPanel1.Controls.Add(date);
                    date.Text1.Text = @"날자와 시간 표시";
                    break;

                case "Today":
                    var today = new TextControl();
                    flowLayoutPanel1.Controls.Add(today);
                    today.Text1.Text = @"IP주소 불러와서 표시하기";
                    break;

                case "Copy":
                    var fileControl = new FileControl();
                    flowLayoutPanel1.Controls.Add(fileControl);
                    fileControl.button1.Enabled = false;
                    fileControl.button2.Enabled = false;
                    break;
                }
            }
        }
Пример #8
0
 public Tetris()
 {
     ProgramStart p = new ProgramStart();
 }