示例#1
0
        private void CodeForm_Load(object sender, EventArgs e)
        {
            // Restore position from registry.
            RegistryKey twbstStudioRegKey = Registry.CurrentUser.OpenSubKey("Software\\Codecentrix\\OpenTwebst\\Studio");

            // If Twebst Studio registry key does not exist then create it.
            if (twbstStudioRegKey == null)
            {
                twbstStudioRegKey = Registry.CurrentUser.CreateSubKey("Software\\Codecentrix\\OpenTwebst\\Studio");
            }

            if (twbstStudioRegKey != null)
            {
                int top    = (int)twbstStudioRegKey.GetValue("codex", -1);
                int left   = (int)twbstStudioRegKey.GetValue("codey", -1);
                int height = (int)twbstStudioRegKey.GetValue("codeh", -1);
                int width  = (int)twbstStudioRegKey.GetValue("codew", -1);

                if ((top != -1) && (left != -1) && (height != -1) && (width != -1) &&
                     IsValidFormPosAndSize(top, left, height, width))
                {
                    this.Top = top;
                    this.Left = left;
                    this.Height = height;
                    this.Width = width;
                }
                else
                {
                    this.GoDefaultPosAndSize();
                }

                twbstStudioRegKey.Close();
            }
            else
            {
                this.GoDefaultPosAndSize();
            }

            // Create target language objects.
            BaseLanguageGenerator vbsLang    = new VbsGenerator();
            BaseLanguageGenerator jsLang     = new JsGenerator();
            BaseLanguageGenerator pythonLang = new PyGenerator();
            BaseLanguageGenerator watirEnv   = new WatirGenerator();
            BaseLanguageGenerator csLang     = new CSharpGenerator();
            BaseLanguageGenerator vbNetLang  = new VbNetGenerator();
            BaseLanguageGenerator vbaLang    = new VbaGenerator();

            // Populate language combo-box.
            this.codeToolStripLanguageCombo.Items.Add(vbsLang);
            this.codeToolStripLanguageCombo.Items.Add(jsLang);
            this.codeToolStripLanguageCombo.Items.Add(vbaLang);
            this.codeToolStripLanguageCombo.Items.Add(csLang);
            this.codeToolStripLanguageCombo.Items.Add(vbNetLang);
            this.codeToolStripLanguageCombo.Items.Add(pythonLang);
            this.codeToolStripLanguageCombo.Items.Add(watirEnv);

            // Initialize code generator.
            this.codeGen = new CodeGenerator(vbsLang);
            this.codeGen.NewStatement += OnNewStatement;
            this.codeGen.CodeChanged  += OnLanguageChanged;

            // Select a language in the combo-box.
            int defaultLanguage = GetRecorderSavedLanguage();
            if ((defaultLanguage < 0) || (defaultLanguage >= this.codeToolStripLanguageCombo.Items.Count))
            {
                defaultLanguage = 0;
            }

            this.codeToolStripLanguageCombo.SelectedIndex = defaultLanguage;

            this.codeToolStrip.ClickThrough = true;
            this.toolStripStatusProductLabel.Text = CoreWrapper.Instance.productName + " " + CoreWrapper.Instance.productVersion;
        }
示例#2
0
        private void CodeForm_Load(object sender, EventArgs e)
        {
            // Restore position from registry.
            RegistryKey twbstStudioRegKey = Registry.CurrentUser.OpenSubKey("Software\\Codecentrix\\OpenTwebst\\Studio");

            // If Twebst Studio registry key does not exist then create it.
            if (twbstStudioRegKey == null)
            {
                twbstStudioRegKey = Registry.CurrentUser.CreateSubKey("Software\\Codecentrix\\OpenTwebst\\Studio");
            }

            if (twbstStudioRegKey != null)
            {
                int top    = (int)twbstStudioRegKey.GetValue("codex", -1);
                int left   = (int)twbstStudioRegKey.GetValue("codey", -1);
                int height = (int)twbstStudioRegKey.GetValue("codeh", -1);
                int width  = (int)twbstStudioRegKey.GetValue("codew", -1);

                if ((top != -1) && (left != -1) && (height != -1) && (width != -1) &&
                    IsValidFormPosAndSize(top, left, height, width))
                {
                    this.Top    = top;
                    this.Left   = left;
                    this.Height = height;
                    this.Width  = width;
                }
                else
                {
                    this.GoDefaultPosAndSize();
                }

                twbstStudioRegKey.Close();
            }
            else
            {
                this.GoDefaultPosAndSize();
            }

            // Create target language objects.
            BaseLanguageGenerator vbsLang    = new VbsGenerator();
            BaseLanguageGenerator jsLang     = new JsGenerator();
            BaseLanguageGenerator pythonLang = new PyGenerator();
            BaseLanguageGenerator watirEnv   = new WatirGenerator();
            BaseLanguageGenerator csLang     = new CSharpGenerator();
            BaseLanguageGenerator vbNetLang  = new VbNetGenerator();
            BaseLanguageGenerator vbaLang    = new VbaGenerator();

            // Populate language combo-box.
            this.codeToolStripLanguageCombo.Items.Add(vbsLang);
            this.codeToolStripLanguageCombo.Items.Add(jsLang);
            this.codeToolStripLanguageCombo.Items.Add(vbaLang);
            this.codeToolStripLanguageCombo.Items.Add(csLang);
            this.codeToolStripLanguageCombo.Items.Add(vbNetLang);
            this.codeToolStripLanguageCombo.Items.Add(pythonLang);
            this.codeToolStripLanguageCombo.Items.Add(watirEnv);

            // Initialize code generator.
            this.codeGen = new CodeGenerator(vbsLang);
            this.codeGen.NewStatement += OnNewStatement;
            this.codeGen.CodeChanged  += OnLanguageChanged;

            // Select a language in the combo-box.
            int defaultLanguage = GetRecorderSavedLanguage();

            if ((defaultLanguage < 0) || (defaultLanguage >= this.codeToolStripLanguageCombo.Items.Count))
            {
                defaultLanguage = 0;
            }

            this.codeToolStripLanguageCombo.SelectedIndex = defaultLanguage;

            this.codeToolStrip.ClickThrough       = true;
            this.toolStripStatusProductLabel.Text = CoreWrapper.Instance.productName + " " + CoreWrapper.Instance.productVersion;
        }