Ejemplo n.º 1
0
        private void UpdateList()
        {
            // build the html
            html_list.Text = Deployer.BuildHtmlTableForRules(Deployer.GetFullDeployRulesList);

            scrollPanel.ContentPanel.Height = html_list.Location.Y + html_list.Height;
            scrollPanel.OnResizedContentPanel();
        }
Ejemplo n.º 2
0
        public DoDeployPage()
        {
            InitializeComponent();

            // browse
            btBrowse.BackGrndImage  = ImageResources.SelectFile;
            btBrowse.ButtonPressed += BtBrowseOnButtonPressed;
            tooltip.SetToolTip(btBrowse, "Click to <b>select</b> a folder");

            // open
            btOpen.BackGrndImage  = ImageResources.OpenInExplorer;
            btOpen.ButtonPressed += BtOpenOnButtonPressed;
            tooltip.SetToolTip(btOpen, "Click to <b>open</b> this folder in the explorer");

            // historic
            btHistoric.BackGrndImage  = ImageResources.Historic;
            btHistoric.ButtonPressed += BtHistoricOnButtonPressed;
            tooltip.SetToolTip(btHistoric, "Click to <b>browse</b> the previous folders");
            if (string.IsNullOrEmpty(Config.Instance.CompileDirectoriesHistoric))
            {
                btHistoric.Visible = false;
            }

            tooltip.SetToolTip(toggleRecurs, "Toggle this option on to explore recursively the selected folder<br>Toggle off and you will only compile/deploy the files directly under the selected folder");
            tooltip.SetToolTip(toggleAutoUpdateSourceDir, "Automatically update the above directory when you switch environment<br>(it then takes the source directory of the environment)");
            tooltip.SetToolTip(toggleMono, "Toggle on to only use a single process when compiling during the deployment<br>Obviously, this will slow down the process by a lot!<br>The only reason to use this option is if you want to limit the number of connections made to your database during compilation...");
            tooltip.SetToolTip(toggleOnlyGenerateRcode, "Override the environment settings and only generated R-code during the deployement<br>(i.e. dont deploy debug-list or xref)");
            tooltip.SetToolTip(fl_nbProcess, "This parameter is used when compiling multiple files, it determines how many<br>Prowin processes can be started to handle compilation<br>The total number of processes started is actually multiplied by your number of cores<br><br>Be aware that as you increase the number or processes for the compilation, you<br>decrease the potential time of compilation but you also increase the number of connection<br>needed to your database (if you have one defined!)<br>You might have an error on certain processes that can't connect to the database<br>if you try to increase this number too much<br><br><i>This value can't be superior to 15</i>");

            // Open hook
            btOpenHook.BackGrndImage  = ImageResources.Edit;
            btOpenHook.ButtonPressed += (sender, args) => {
                if (!File.Exists(Config.FileDeploymentHook))
                {
                    Utils.FileWriteAllBytes(Config.FileDeploymentHook, DataResources.DeploymentHook);
                }
                Npp.OpenFile(Config.FileDeploymentHook);
            };

            // diretory from env
            btUndo.BackGrndImage  = ImageResources.UndoUserAction;
            btUndo.ButtonPressed += BtUndoOnButtonPressed;
            tooltip.SetToolTip(btUndo, "Click to <b>select</b> the base local path (your source directory)<br>for the current environment");

            // start
            btStart.BackGrndImage = ImageResources.Deploy;
            tooltip.SetToolTip(btStart, "Click to <b>start</b> deploying your application");
            btStart.ButtonPressed += BtStartOnButtonPressed;

            // cancel
            btCancel.BackGrndImage = ImageResources.Cancel;
            tooltip.SetToolTip(btCancel, "Click to <b>cancel</b> the current deployement");
            btCancel.ButtonPressed += BtCancelOnButtonPressed;
            btCancel.Visible        = false;

            // progress bar
            progressBar.Style      = ProgressStyle.Normal;
            progressBar.CenterText = CenterElement.Text;
            progressBar.Visible    = false;

            // report
            btReport.BackGrndImage  = ImageResources.Report;
            btReport.Visible        = false;
            btReport.ButtonPressed += BtReportOnButtonPressed;
            lbl_report.Visible      = false;
            lbl_report.LinkClicked += Utils.OpenPathClickHandler;

            // reset
            btReset.BackGrndImage = ImageResources.Default;
            tooltip.SetToolTip(btReset, "Click to reset the options to their default values");
            btReset.ButtonPressed += (sender, args) => { ResetFields(); };

            // help kink
            linkurl.Text = @"<img src='Help'><a href='" + Config.UrlHelpDeploy + @"'>Learn more about this feature?</a>";

            // switch link
            lblCurEnv.LinkClicked += (sender, args) => {
                AppliMenu.ShowEnvMenuAtCursor();
            };

            // save
            tooltip.SetToolTip(btSave, "Save the settings for the currently selected profile");
            btSave.BackGrndImage  = ImageResources.Save;
            btSave.ButtonPressed += (sender, args) => {
                if (string.IsNullOrEmpty(DeployProfile.Current.Name) && !ChooseName())
                {
                    return;
                }
                SetDataFromFields();
                SaveProfilesList();
            };

            // save as...
            tooltip.SetToolTip(btSaveAs, "Save the settings in a new profile that you will name");
            btSaveAs.BackGrndImage  = ImageResources.Save;
            btSaveAs.ButtonPressed += (sender, args) => {
                var _cur = DeployProfile.Current;
                DeployProfile.List.Add(new DeployProfile());
                DeployProfile.Current = DeployProfile.List.Last();
                if (ChooseName())
                {
                    SetDataFromFields();
                    SaveProfilesList();
                }
                else
                {
                    DeployProfile.List.RemoveAt(DeployProfile.List.Count - 1);
                    DeployProfile.Current = _cur;
                }
                btDelete.Visible = DeployProfile.List.Count > 1;
            };

            // delete
            tooltip.SetToolTip(btDelete, "Delete the current profile");
            btDelete.BackGrndImage  = ImageResources.Delete;
            btDelete.ButtonPressed += (sender, args) => {
                if (UserCommunication.Message("Do you really want to delete this profile?", MessageImg.MsgQuestion, "Delete", "Deployment profile", new List <string> {
                    "Yes", "Cancel"
                }) == 0)
                {
                    DeployProfile.List.Remove(DeployProfile.Current);
                    DeployProfile.Current = null;
                    SaveProfilesList();
                    SetFieldsFromData();
                    if (DeployProfile.List.Count == 1)
                    {
                        btDelete.Hide();
                    }
                }
            };

            // cb
            tooltip.SetToolTip(cbName, "Browse and select the available profiles, each profile hold deployment settings");
            cbName.SelectedIndexChanged += CbNameOnSelectedIndexChanged;

            // modify rules
            tooltip.SetToolTip(btRules, "Click to modify the rules");
            btRules.BackGrndImage  = ImageResources.Rules;
            btRules.ButtonPressed += (sender, args) => Deployer.EditRules();

            // view rules
            tooltip.SetToolTip(btRules, "Click to view the rules filtered for the current environment<br><i>The rules are also sorted!</i>");
            btSeeRules.BackGrndImage  = ImageResources.ViewFile;
            btSeeRules.ButtonPressed += (sender, args) => {
                UserCommunication.Message(Deployer.BuildHtmlTableForRules(ProEnvironment.Current.Deployer.DeployRules), MessageImg.MsgInfo, "List of deployment rules", "Sorted and filtered for the current environment");
            };

            DeployProfile.OnDeployProfilesUpdate += () => {
                UpdateCombo();
                SetFieldsFromData();
                btDelete.Visible = DeployProfile.List.Count > 1;
            };

            // subscribe
            ProEnvironment.OnEnvironmentChange   += OnShow;
            Deployer.OnDeployConfigurationUpdate += () => ProEnvironment.Current.Deployer.DeployRules = null;
            Deployer.OnDeployConfigurationUpdate += OnShow;

            // dynamically reorder the controls for a correct tab order on notepad++
            SetTabOrder.RemoveAndAddForTabOrder(scrollPanel);
        }