Example #1
0
 /// <summary>
 /// when changing env letter
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cbSuffix_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (_switchingMode || Config.Instance.EnvSuffix.Equals(cbSuffix.SelectedItem.ToString()))
     {
         return;
     }
     ProEnvironment.SetCurrent(null, cbSuffix.SelectedItem.ToString(), null);
     ToggleMode(ViewMode.Select);
 }
Example #2
0
 /// <summary>
 /// when changing database
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cbDatabase_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (_switchingMode || Config.Instance.EnvDatabase.Equals(cbDatabase.SelectedItem.ToString()))
     {
         return;
     }
     ProEnvironment.SetCurrent(null, null, cbDatabase.SelectedItem.ToString());
     textbox1.Text = ProEnvironment.Current.GetPfPath();
 }
Example #3
0
 /// <summary>
 /// when changing env letter
 /// </summary>
 /// <param name="sender"></param>
 private void cbSuffix_SelectedIndexChanged(YamuiComboBox sender)
 {
     if (Config.Instance.EnvSuffix.Equals(cbSuffix.SelectedItem.ToString()))
     {
         return;
     }
     ProEnvironment.SetCurrent(null, cbSuffix.SelectedItem.ToString(), null);
     ToggleMode(ViewMode.Select);
 }
Example #4
0
 /// <summary>
 /// when changing database
 /// </summary>
 /// <param name="sender"></param>
 private void cbDatabase_SelectedIndexChanged(YamuiComboBox sender)
 {
     if (ProEnvironment.Current.GetCurrentDb().Equals(cbDatabase.SelectedItem.ToString()))
     {
         return;
     }
     ProEnvironment.SetCurrent(null, null, cbDatabase.SelectedItem.ToString());
     textbox1.Text = ProEnvironment.Current.GetPfPath();
     ProEnvironment.SaveList();
 }
Example #5
0
        /// <summary>
        /// Called when an environement is modified/add or simply switched,
        /// rebuilds the environment menu
        /// </summary>
        private void RebuildSwitchEnvMenu()
        {
            _envMenuList = new List <YamuiMenuItem>();

            foreach (var env in ProEnvironment.GetList)
            {
                var name         = env.Name;
                var suffix       = env.Suffix;
                var existingItem = _envMenuList.FirstOrDefault(item => item.ItemName.Equals(env.Name));
                // add a new suffix item
                if (existingItem != null)
                {
                    var newSub = new YamuiMenuItem()
                    {
                        ItemName            = env.Suffix,
                        ItemImage           = ImageResources.EnvSuffix,
                        OnClic              = () => ProEnvironment.SetCurrent(name, suffix, null),
                        IsSelectedByDefault = name.Equals(Config.Instance.EnvName) && suffix.Equals(Config.Instance.EnvSuffix)
                    };
                    if (existingItem.Children != null)
                    {
                        existingItem.Children.Add(newSub);
                    }
                    else
                    {
                        // also add the first sub item..
                        var firstItemSuffix = ((string)existingItem.Data) ?? "";
                        existingItem.Children = new List <YamuiMenuItem> {
                            new YamuiMenuItem {
                                ItemName            = firstItemSuffix,
                                ItemImage           = ImageResources.EnvSuffix,
                                OnClic              = () => ProEnvironment.SetCurrent(name, firstItemSuffix, null),
                                IsSelectedByDefault = name.Equals(Config.Instance.EnvName) && firstItemSuffix.Equals(Config.Instance.EnvSuffix)
                            },
                            newSub
                        };
                    }
                    existingItem.SubText = existingItem.Children.Count.ToString();
                }
                else
                {
                    // add a new env item
                    _envMenuList.Add(new YamuiMenuItem()
                    {
                        ItemName            = env.Name,
                        ItemImage           = ImageResources.EnvName,
                        OnClic              = () => ProEnvironment.SetCurrent(name, suffix, null),
                        Data                = env.Suffix,
                        IsSelectedByDefault = name.Equals(Config.Instance.EnvName)
                    });
                }
            }

            _envMenu.Children = _envMenuList;
        }
Example #6
0
        private bool Save() {
            switch (_currentMode) {
                case ViewMode.Delete:
                    ProEnvironment.DeleteCurrent();
                    break;
                    
                case ViewMode.Add:
                case ViewMode.Edit:
                case ViewMode.Copy:
                    // mandatory fields
                    foreach (var box in new List<YamuiTextBox> {flName}.Where(box => string.IsNullOrWhiteSpace(box.Text))) {
                        BlinkTextBox(box, ThemeManager.Current.GenericErrorColor);
                        return false;
                    }

                    var newEnv = new ProEnvironment.ProEnvironmentObject {
                        Name = flName.Text,
                        Suffix = flSuffix.Text,
                        Label = flLabel.Text,
                        ExtraPf = flExtraPf.Text,
                        DatabaseExtractCandoTblType = flCanDoTblType.Text,
                        DatabaseExtractCandoTblName = flCanDoTblName.Text,
                        DatabaseAliasList = flListAliases.Text,
                        IniPath = textbox2.Text,
                        ExtraProPath = flExtraProPath.Text,
                        BaseLocalPath = textbox3.Text,
                        BaseCompilationPath = textbox4.Text,
                        ProwinPath = textbox5.Text,
                        LogFilePath = textbox6.Text,
                        PreExecutionProgram = textbox7.Text,
                        PostExecutionProgram = textbox8.Text,
                        CmdLineParameters = flCmdLine.Text,
                        DbConnectionInfo = _currentMode == ViewMode.Add ? new Dictionary<string, string>() : new Dictionary<string, string>(ProEnvironment.Current.DbConnectionInfo),
                        CompileLocally = tgCompLocally.Checked
                    };

                    if (_currentMode != ViewMode.Edit && (ProEnvironment.GetList.Exists(env => env.Name.EqualsCi(newEnv.Name) && env.Suffix.EqualsCi(newEnv.Suffix)))) {
                        // name + suffix must be unique!
                        BlinkTextBox(flName, ThemeManager.Current.GenericErrorColor);
                        BlinkTextBox(flSuffix, ThemeManager.Current.GenericErrorColor);
                        return false;
                    }

                    ProEnvironment.Modify((_currentMode == ViewMode.Edit) ? ProEnvironment.Current : null, newEnv);
                    break;
            }

            ProEnvironment.SaveList();
            return true;
        }
Example #7
0
 /// <summary>
 /// Hard copy
 /// </summary>
 public Deployer(ProEnvironment.ProEnvironmentObject proEnv, Deployer deployer)
 {
     ProEnv = proEnv;
     _deployRulesList = deployer.DeployRules;
 }
Example #8
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Deployer(ProEnvironment.ProEnvironmentObject proEnv)
        {
            ProEnv = proEnv;

            // we need to filter/sort the list of computation path when it changes
            OnDeployConfigurationUpdate += () => _deployRulesList = null;
        }
Example #9
0
 private void TgCompWithLstOnButtonPressed(object sender, EventArgs eventArgs)
 {
     ProEnvironment.Current.CompileWithListing = tgCompWithLst.Checked;
     ProEnvironment.SaveList();
 }
Example #10
0
 private void TgCompLocallyOnCheckedChanged(object sender, EventArgs eventArgs)
 {
     ProEnvironment.Current.CompileLocally = tgCompLocally.Checked;
     ProEnvironment.SaveList();
 }