コード例 #1
0
ファイル: TesterMain.xaml.cs プロジェクト: alpsxing/Testempo
        private void GlobalConfig_Add_Button_Click(object sender, RoutedEventArgs e)
        {
            ObservableCollection<string> ls = new ObservableCollection<string>();
            foreach (TestConfiguration tc in TestConfiguraionGlobalOc)
            {
                ls.Add(tc.ConfigKey);
            }

            OneLineEditor ole = new OneLineEditor("New Configuration Entry", "Key", userCompareList: ls);
            bool? bv = ole.ShowDialog();
            if (bv != true)
                return;
            string s = ole.UserContent.Trim();
            TestConfiguraionGlobalOc.Add(new TestConfiguration()
            {
                ConfigKey = s,
                ConfigValue = ""
            });

            SaveConfig();
        }
コード例 #2
0
ファイル: TesterMain.xaml.cs プロジェクト: alpsxing/Testempo
        private void GlobalConfig_Modify_Button_Click(object sender, RoutedEventArgs e)
        {
            if (dgGlobalCfg.Items.Count < 1)
                return;
            if (dgGlobalCfg.SelectedIndex < 0)
                return;

            TestConfiguration tc = TestConfiguraionGlobalOc[dgGlobalCfg.SelectedIndex];

            if (tc.ConfigKey == "Project Name" || tc.ConfigKey == "Sub Project Name")
            {
                if (DatabaseConnected == false)
                {
                    MessageBox.Show("Database is disconnected.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                else
                {
                    if (tc.ConfigKey == "Project Name")
                    {
                        if (ProjectOc == null || ProjectOc.Count < 1)
                        {
                            MessageBox.Show("Please create the project in the database first.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }

                        Tuple<string, string> ti = null;
                        foreach (Tuple<string, string> t in ProjectOc)
                        {
                            if (t.Item2 == tc.ConfigValue)
                            {
                                ti = t;
                                break;
                            }
                        }

                        OneLineSelector ols = new OneLineSelector("Select Project", "Project Name", ProjectOc, (string.IsNullOrWhiteSpace(tc.ConfigValue)) ? null : tc.ConfigValue);
                        bool? b = ols.ShowDialog();
                        if (b != true)
                            return;
                        tc.ConfigValue = ols.UserSelectContent;
                        _curProject = tc.ConfigValue;
                        ti = null;
                        foreach (Tuple<string, string> t in ProjectOc)
                        {
                            if (t.Item2 == tc.ConfigValue)
                            {
                                ti = t;
                                break;
                            }
                        }
                        _curPorjectDB = ti.Item1;

                        foreach (TestConfiguration tci in TestConfiguraionGlobalOc)
                        {
                            if (tci.ConfigKey == "Sub Project Name")
                            {
                                tci.ConfigValue = "";
                            }
                        }
                        _curSubProject = "";
                        _curSubProjectDB = "";
                    }
                    else
                    {
                        if (ProjectOc == null || ProjectOc.Count < 1)
                        {
                            MessageBox.Show("Please create the project in the database first.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }

                        if (string.IsNullOrWhiteSpace(_curProject))
                        {
                            MessageBox.Show("Please select the project first.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }

                        Tuple<string, string> ti = null;
                        foreach (Tuple<string, string> t in ProjectOc)
                        {
                            if (t.Item2 == _curProject)
                            {
                                ti = t;
                                break;
                            }
                        }

                        Tuple<string, ObservableCollection<Tuple<string, string>>> tii = null;
                        foreach (Tuple<string, ObservableCollection<Tuple<string, string>>> t in SubProjectOc)
                        {
                            if (t.Item1 == ti.Item1)
                            {
                                tii = t;
                                break;
                            }
                        }

                        if (tii == null || tii.Item2.Count < 1)
                        {
                            MessageBox.Show("Please create the sub project for the Project \"" + _curProject + "\"in the database first.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                            return;
                        }

                        OneLineSelector ols = new OneLineSelector("Select Sub Project", "Sub Project Name", tii.Item2, (string.IsNullOrWhiteSpace(tc.ConfigValue)) ? null : tc.ConfigValue);
                        bool? b = ols.ShowDialog();
                        if (b != true)
                            return;
                        tc.ConfigValue = ols.UserSelectContent;
                        _curSubProject = tc.ConfigValue;
                        ti = null;
                        foreach (Tuple<string, string> t in tii.Item2)
                        {
                            if (t.Item2 == _curSubProject)
                            {
                                ti = t;
                                break;
                            }
                        }
                        _curSubProjectDB = ti.Item1;
                    }
                }
            }
            else
            {
                List<string> ls = new List<string>();
                foreach (TestConfiguration tci in TestConfiguraionGlobalOc)
                {
                    ls.Add(tci.ConfigKey);
                }

                OneLineEditor ole = new OneLineEditor("Modify " + tc.ConfigKey, tc.ConfigKey, tc.ConfigValue);
                bool? bv = ole.ShowDialog();
                if (bv != true)
                    return;
                string s = ole.UserContent.Trim();
                tc.ConfigValue = s;
            }

            SaveConfig();
        }
コード例 #3
0
ファイル: TesterMain.xaml.cs プロジェクト: alpsxing/Testempo
        private void EditName_Click(object sender, RoutedEventArgs e)
        {
            TestGroupCase tgc = (TestGroupCase)lvGroupCase.SelectedItem;

            OneLineEditor ole = null;
            if (tgc.IsCase == true)
                ole = new OneLineEditor("Edit Group Name", "Group Name", tgc.GroupCaseName);
            else
                ole = new OneLineEditor("Edit Case Name", "Case Name", tgc.GroupCaseName);
            if (ole.ShowDialog() != true)
                return;

            tgc.GroupCaseName = ole.UserContent;
            if (tgc.IsCase == true)
                tgc.TestBaseInstance.TestName = ole.UserContent;

            CurrentDirtyFlag = true;
        }
コード例 #4
0
ファイル: TesterMain.xaml.cs プロジェクト: alpsxing/Testempo
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            OneLineEditor ole = new OneLineEditor("New Group", "Group Name");
            if (ole.ShowDialog() != true)
                return;

            int index = 0;
            string sc = "";
            while (true)
            {
                bool bFound = false;
                foreach (TestGroupCase tgct in TestColInstance.TestGroupCaseOc)
                {
                    sc = ole.UserContent + ((index == 0) ? "" : " (" + index.ToString() + ")");
                    if (string.Compare(sc, tgct.GroupCaseName) == 0)
                    {
                        bFound = true;
                        break;
                    }
                }
                if (bFound == true)
                    index++;
                else
                    break;
            }
            if (string.IsNullOrWhiteSpace(sc))
                sc = ole.UserContent;

            TestGroupCase tgc = new TestGroupCase(TestColInstance, null, sc, false, null, null);

            CurrentDirtyFlag = true;

            UpdateTotalTestCases();
        }
コード例 #5
0
        private void DestroyDatabase_Button_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Are you sure to destroy the whole database?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
                return;

            OneLineEditor ole = new OneLineEditor("Input Password", "Password");
            if (ole.ShowDialog() != true)
                return;

            if (ole.UserContent != "itester")
            {
                MessageBox.Show("Wrong password!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            InDatabaseTalking = true;
            spbTimer.IsIndeterminate = true;
            DBMsgOc.Clear();
            ReadyString = "Start destroying the database.";

            Thread th = new Thread(new ThreadStart(DestroyDatabaseThread));
            th.Start();
        }
コード例 #6
0
        private void SubProjectNew_Button_Click(object sender, RoutedEventArgs e)
        {
            if (cboxProject.Items.Count < 1 || cboxProject.SelectedIndex < 0)
            {
                MessageBox.Show("No selected project.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            Tuple<string, string> ti = null;
            foreach (Tuple<string, string> t in ProjectOc)
            {
                if (t.Item2 == cboxProject.Items[cboxProject.SelectedIndex].ToString())
                {
                    ti = t;
                    break;
                }
            }
            Tuple<string, ObservableCollection<Tuple<string, string>>> tii = null;
            foreach (Tuple<string, ObservableCollection<Tuple<string, string>>> t in SubProjectOc)
            {
                if (t.Item1 == ti.Item1)
                {
                    tii = t;
                    break;
                }
            }

            OneLineEditor ole = null;
            if(tii != null)
                ole = new OneLineEditor("New Sub Project", "Sub Project Name :", userCompareListTuple: tii.Item2, maxLength: 32);
            else
                ole = new OneLineEditor("New Sub Project", "Sub Project Name :", maxLength: 32);
            if (ole.ShowDialog() != true)
                return;

            InDatabaseTalking = true;
            spbTimer.IsIndeterminate = true;
            ReadyString = "Start creating the sub project : " + ole.UserContent;

            Thread th = new Thread(new ParameterizedThreadStart(SubProjectNewThread));
            th.Start(new Tuple<string, string, string, string>(ti.Item1, ti.Item2, ole.UserContentDB, ole.UserContent));
        }
コード例 #7
0
        private void ProjectNew_Button_Click(object sender, RoutedEventArgs e)
        {
            OneLineEditor ole = new OneLineEditor("New Project", "Project Name :", userCompareListTuple: ProjectOc, maxLength: 32);
            if (ole.ShowDialog() != true)
                return;

            InDatabaseTalking = true;
            spbTimer.IsIndeterminate = true;
            ReadyString = "Start creating the new project : " + ole.UserContent;

            Thread th = new Thread(new ParameterizedThreadStart(ProjectNewThread));
            th.Start(new Tuple<string, string>(ole.UserContentDB, ole.UserContent));
        }