Esempio n. 1
0
        public static CompilerResults CreateConditionCode(Automation automation, string code)
        {
            var src = "using System;";
            src += Environment.NewLine + "using System.Windows.Forms;";
            src += Environment.NewLine + "using DirectorAPI;";
            src += Environment.NewLine + "namespace ConditionCode";
            src += Environment.NewLine + "{";
            src += Environment.NewLine + "    class Program";
            src += Environment.NewLine + "    {";
            src += Environment.NewLine + "        public bool TestValue(ref DirectorAPI.Automation automation)";
            src += Environment.NewLine + "        {";
            src += Environment.NewLine + code.Replace("\\","\\\\");
            src += Environment.NewLine + "        }";
            src += Environment.NewLine + "    }";
            src += Environment.NewLine + "}";

            var provider = CodeDomProvider.CreateProvider("CSharp");
            var prms = new CompilerParameters();
            prms.GenerateExecutable = false;
            prms.GenerateInMemory = true;

            prms.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location);
            prms.ReferencedAssemblies.Add("System.dll");
            prms.ReferencedAssemblies.Add("System.Windows.Forms.dll");

            return provider.CompileAssemblyFromSource(prms, src);
        }
Esempio n. 2
0
        private void OpenAutomationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmOpenAutomation frm = new frmOpenAutomation();
            DialogResult result = frm.ShowDialog();
            if (result == DialogResult.OK)
            {
                if (frm.id != Guid.Empty)
                {

                    _automation = new Automation(frm.id);
                    _automation.CurrentMode = Enumerations.Mode.Record;
                    RefreshScreen();
                }
            }
        }
Esempio n. 3
0
        private void NewAutomation()
        {
            frmNewAutomation frm = new frmNewAutomation();
            DialogResult result = frm.ShowDialog();

            if (result == DialogResult.OK)
            {
                _automation = new Automation(frm.automationname, frm.description);
                RefreshScreen();
            }
        }