Exemple #1
0
        private void EditIBScript()
        {
            IBScriptEditor newChild = new IBScriptEditor(prntForm.mod, prntForm); //add new child

            newChild.Text = prntForm.mod.moduleIBScriptsList[prntForm._selectedLbxIBScriptIndex];
            newChild.Show(prntForm.dockPanel1);  //as new form created so that corresponding tab and child form is active
            refreshListBoxIBScripts();
            newChild.filename = prntForm.mod.moduleIBScriptsList[prntForm._selectedLbxIBScriptIndex] + ".ibs";
            //try loading from default
            try
            {
                if (!File.Exists(prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\ibscript\\" + newChild.filename))
                {
                    newChild.LoadScriptDefault();
                }
                else
                {
                    newChild.LoadScript();
                }
            }
            catch
            { }

            if (!File.Exists(prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\ibscript\\" + newChild.filename))
            {
                newChild.SaveScript();
            }
        }
Exemple #2
0
        private void btnLoadAll_Click(object sender, EventArgs e)
        {
            try
            {
                string jobDir = "";
                jobDir = prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\ibscript";
                prntForm.mod.moduleIBScriptsList.Clear();
                foreach (string f in Directory.GetFiles(jobDir, "*.ibs"))
                {
                    string filename = Path.GetFileNameWithoutExtension(f);
                    prntForm.mod.moduleIBScriptsList.Add(filename);
                }

                //second routine for retrieving ibscripts from default folder and adding hem, too, if they do not alreday exist
                //Note: load and save actions for ibscripts will need to be reworked the same way
                try
                {
                    List <string> tempList = new List <string>();

                    jobDir = prntForm._mainDirectory + "\\default\\" + "NewModule" + "\\ibscript";

                    foreach (string f in Directory.GetFiles(jobDir, "*.ibs"))
                    {
                        string filename = Path.GetFileNameWithoutExtension(f);
                        tempList.Add(filename);
                    }

                    foreach (string sTemp in tempList)
                    {
                        if (!prntForm.mod.moduleIBScriptsList.Contains(sTemp))
                        {
                            prntForm.mod.moduleIBScriptsList.Add(sTemp);
                            //***************************************************
                            IBScriptEditor newChild = new IBScriptEditor(prntForm.mod, prntForm); //add new child
                            newChild.Text = prntForm.mod.moduleIBScriptsList[prntForm._selectedLbxIBScriptIndex];
                            newChild.Show(prntForm.dockPanel1);                                   //as new form created so that corresponding tab and child form is active
                            refreshListBoxIBScripts();
                            newChild.filename = prntForm.mod.moduleIBScriptsList[prntForm._selectedLbxIBScriptIndex] + ".ibs";
                            if (!File.Exists(prntForm._mainDirectory + "\\modules\\" + prntForm.mod.moduleName + "\\ibscript\\" + newChild.filename))
                            {
                                newChild.SaveScript();
                            }


                            //***************************************************
                        }
                    }
                }
                catch
                {
                }

                refreshListBoxIBScripts();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }