Example #1
0
 public void AddControl(ControlCheckBox action)
 {
     AddControl(new CheckBox
     {
         Text         = _runner.ParseTemplate(action.Text),
         Checked      = true,
         Tag          = action,
         FlatStyle    = FlatStyle.System,
         Margin       = new Padding(6, 5, 3, 5),
         AutoSize     = true,
         AutoEllipsis = true
     });
 }
Example #2
0
        public void TestUserControlCheckboxInstallCheck()
        {
            Console.WriteLine("TestUserControlCheckboxInstallCheck");

            // a configuration with a checkbox control which has an installed check that disables it
            ConfigFile         configFile         = new ConfigFile();
            SetupConfiguration setupConfiguration = new SetupConfiguration();

            configFile.Children.Add(setupConfiguration);

            // a checkbox that changes are return value
            ControlCheckBox checkbox = new ControlCheckBox();

            checkbox.UncheckedValue = "3";
            checkbox.CheckedValue   = "4";
            checkbox.Checked        = true;
            checkbox.Id             = "checkbox1";
            setupConfiguration.Children.Add(checkbox);

            // an installed check that is always false
            InstalledCheckRegistry check = new InstalledCheckRegistry();

            check.path       = @"SOFTWARE\KeyDoesntExist";
            check.comparison = installcheckregistry_comparison.exists;
            checkbox.Children.Add(check);

            // command that depends on the value of checkbox1
            ComponentCmd cmd = new ComponentCmd();

            cmd.command          = "cmd.exe /C exit /b [checkbox1]5";
            cmd.required_install = true;
            setupConfiguration.Children.Add(cmd);

            // save config file
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");

            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);

            // execute dotNetInstaller, this checkbox is disabled, so all runs ignore checkbox1 value
            Assert.AreEqual(5, dotNetInstallerExeUtils.Run(configFilename));
            checkbox.Checked = false;
            configFile.SaveAs(configFilename);
            Assert.AreEqual(5, dotNetInstallerExeUtils.Run(configFilename));
            checkbox.Checked      = true;
            checkbox.CheckedValue = "0";
            configFile.SaveAs(configFilename);
            Assert.AreEqual(5, dotNetInstallerExeUtils.Run(configFilename));
            File.Delete(configFilename);
        }
Example #3
0
        public void TestUserControlCheckboxControlArgs()
        {
            Console.WriteLine("TestUserControlCheckboxControlArgs");

            // a configuration with a checkbox control
            ConfigFile         configFile         = new ConfigFile();
            SetupConfiguration setupConfiguration = new SetupConfiguration();

            configFile.Children.Add(setupConfiguration);

            // a checkbox that changes are return value
            ControlCheckBox checkbox = new ControlCheckBox();

            checkbox.UncheckedValue = "3";
            checkbox.CheckedValue   = "4";
            checkbox.Checked        = true;
            checkbox.Id             = "checkbox1";
            setupConfiguration.Children.Add(checkbox);
            ComponentCmd cmd = new ComponentCmd();

            cmd.command          = "cmd.exe /C exit /b [checkbox1]";
            cmd.required_install = true;
            setupConfiguration.Children.Add(cmd);

            // save config file
            string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml");

            Console.WriteLine("Writing '{0}'", configFilename);
            configFile.SaveAs(configFilename);

            // execute dotNetInstaller
            dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions();
            options.configFile = configFilename;

            // unchecked value
            options.args = "/controlArgs checkbox1:3";
            Assert.AreEqual(3, dotNetInstallerExeUtils.Run(options));

            // checked value
            options.args = "/controlArgs checkbox1:4";
            Assert.AreEqual(4, dotNetInstallerExeUtils.Run(options));

            // invalid value
            options.args = "/controlArgs checkbox1:5";
            Assert.AreEqual(-1, dotNetInstallerExeUtils.Run(options));
            File.Delete(configFilename);
        }
Example #4
0
 public override void ControlCheckBox(ControlCheckBox action)
 {
     _form.AddControlToPage(action);
 }