Exemple #1
0
 public static DialogResult Show()
 {
     if (me == null)
     {
         me = new FormConfigEditor();
     }
     return(me.ShowDialog());
 }
Exemple #2
0
 public static void AddItem(params object[] values)
 {
     if (me == null)
     {
         me = new FormConfigEditor();
     }
     me.dataGridViewConfigList.Rows.Add(values);
 }
Exemple #3
0
 public static void SetConfigText(TestCase SelectedTestCase, String configPath)
 {
     if (me == null)
     {
         me = new FormConfigEditor();
     }
     me.tcSelected = SelectedTestCase;
     me.Text       = me.title + " - " + Path.GetFileName(configPath);
     me.showConfigContent(configPath);
 }
Exemple #4
0
        private void quickEdit()
        {
            DataGridViewRowCollection drc = FormConfigEditor.GetItems();

            if (drc != null)
            {
                foreach (DataGridViewRow row in drc)
                {
                    DataGridViewCell cellKey   = row.Cells["ColumnElement"];
                    DataGridViewCell cellValue = row.Cells["ColumnValue"];
                    if (cellKey != null && cellKey.Value != null && cellKey.Value.ToString().Length > 0 &&
                        cellValue != null && cellValue.Value != null && cellValue.Value.ToString().Length > 0)
                    {
                        searchAndReplace(cellKey.Value.ToString(), cellValue.Value.ToString());
                    }
                }
            }
        }
Exemple #5
0
        private void loadDefaultSettings()
        {
            XElement xeDefaultSettings = null;

            try
            {
                xeDefaultSettings = XElement.Load(DefaultSettingsPath);
                #region DefaultPlatform
                XElement xeDefaultPlatform = xeDefaultSettings.Element("Common").Element("DefaultPlatform");
                if (xeDefaultPlatform != null && xeDefaultPlatform.Value != null)
                {
                    platform = xeDefaultPlatform.Value;
                    switch (xeDefaultPlatform.Value.ToLower())
                    {
                    case "android":
                        cmbPlatform.SelectedIndex = 1;
                        break;

                    case "ce":
                        cmbPlatform.SelectedIndex = 0;
                        break;
                    }
                }
                #endregion DefaultPlatform

                #region TRS reader
                XElement xeInstall = xeDefaultSettings.Element("Install");
                XElement xePlatform = xeInstall.ElementByAttribute("Platform", "name", platform);
                XElement xeAttachmentSourceFolder = null, xeAttachmentDestinationFolder = null;
                if (xePlatform != null)
                {
                    //TestPlan default folder
                    String testPlanDefaultFolder = xePlatform.Element("TestPlanFolder").Value;
                    #region ConfigSourceFolder
                    try
                    {
                        XElement xeConfigSourceFolder = xePlatform.Element("ConfigSourceFolder");
                        FormToolSettings.TRS_ConfigSourceFolder = xeConfigSourceFolder.Value;
                    }
                    catch
                    {
                        FormToolSettings.TRS_ConfigSourceFolder = "";
                        //Fail to load settings item ,just ignore and read next one.
                    }
                    #endregion ConfigSourceFolder
                    #region ProfileApplication
                    try
                    {
                        XElement xeProfilePath = xePlatform.Element("ProfilePath");
                        FormToolSettings.ProfileApplication_Path = xeProfilePath.Value;
                    }
                    catch
                    {
                        FormToolSettings.ProfileApplication_Path = "";
                        //Fail to load settings item ,just ignore and read next one.
                    }
                    #endregion ProfileApplication
                    #region Filter keyword
                    try
                    {
                        XElement xeFilterKeyword = xePlatform.Element("FilterKeyword");
                        FormToolSettings.KeywordFilterEnable = xeFilterKeyword.Attribute("enable").Value.ToLower().Equals("true");
                        FormToolSettings.KeywordFilter_Text  = xeFilterKeyword.Value;
                    }
                    catch
                    {
                        FormToolSettings.KeywordFilter_Text = "";
                        //Fail to load settings item ,just ignore and read next one.
                    }
                    #endregion Filter keyword
                    #region TestResultFilter
                    try
                    {
                        XElement xeTestResultFilter = xePlatform.Element("TestResultFilter");
                        int      filter             = Convert.ToInt32(xeTestResultFilter.Value);
                        FormToolSettings.TestResultFilter = filter;
                    }
                    catch
                    {
                        FormToolSettings.TestResultFilter = 0x11111;
                        //Fail to load settings item ,just ignore and read next one.
                    }
                    #endregion TestResultFilter
                    #region AttachmentSourceFolder
                    try
                    {
                        xeAttachmentSourceFolder = xePlatform.Element("AttachmentSource");
                        FormToolSettings.TRS_AttachmentSourceFolder = xeAttachmentSourceFolder.Value;
                    }
                    catch
                    {
                        FormToolSettings.TRS_AttachmentSourceFolder = "";
                        //Fail to load settings item ,just ignore and read next one.
                    }
                    #endregion AttachmentSourceFolder
                    #region AttachmentDestinationFolder
                    try
                    {
                        xeAttachmentDestinationFolder = xePlatform.Element("AttachmentDestination");
                        FormToolSettings.TRS_AttachmentDestinationFolder = xeAttachmentDestinationFolder.Value;
                    }
                    catch
                    {
                        FormToolSettings.TRS_AttachmentDestinationFolder = "";
                        //Fail to load settings item ,just ignore and read next one.
                    }
                    #endregion AttachmentDestinationFolder
                    #region QuickEditor Items
                    FormConfigEditor.ClearItems();
                    XElement xeQuickEditor = xePlatform.Element("QuickEditor");
                    foreach (XElement xeItem in xeQuickEditor.Elements())
                    {
                        try
                        {
                            String key   = xeItem.Attribute("keyword").Value;
                            String value = xeItem.Value;
                            FormConfigEditor.AddItem(key, value);
                        }
                        catch
                        {
                            //Fail to load settings item ,just ignore and read next one.
                        }
                    }
                    #endregion QuickEditor Items                }
                    #endregion TRS reader

                    #region Pre-condition Setup
                    #region Pre_ConditioScriptFolder
                    try
                    {
                        XElement xeScriptFolder = xeDefaultSettings.Element("Initial").Element("ScriptFolder");
                        if (xeScriptFolder != null && xeScriptFolder.Value != null)
                        {
                            FormToolSettings.Pre_ConditionScriptFolder = xeScriptFolder.Value;
                        }
                    }
                    catch
                    {
                        //Fail to load settings item ,just ignore and read next one.
                    }
                    #endregion Pre_ConditioScriptFolder
                    #endregion Pre-condition Setup

                    #region Test Result
                    try
                    {
                        XElement xeTestResult = xeDefaultSettings.Element("Result");
                        #region LogFolder
                        XElement xeLogFolder = xeTestResult.Element("LogFolder");
                        if (xeLogFolder.Value != null)
                        {
                            FormToolSettings.LogFolder = xeLogFolder.Value;
                        }
                        #endregion LogFolder
                        #region Max Log Interval
                        XElement xeMaxLogInterval = xeTestResult.Element("MaxLogInterval");
                        if (xeMaxLogInterval.Value != null)
                        {
                            FormToolSettings.MaxLogInterval = Convert.ToInt32(xeMaxLogInterval.Value);
                        }
                        #endregion Max Log Interval
                    }
                    catch
                    {
                        //Fail to load settings item ,just ignore and read next one.
                    }
                    #endregion Test Result
                }
            }
            catch
            {
                //Fail to load settings item ,just ignore.
            }
        }