当前位置: 首页>>代码示例>>C#>>正文


C# System.Collections.ObjectModel.Collection.Clear方法代码示例

本文整理汇总了C#中System.Collections.ObjectModel.Collection.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ObjectModel.Collection.Clear方法的具体用法?C# System.Collections.ObjectModel.Collection.Clear怎么用?C# System.Collections.ObjectModel.Collection.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.ObjectModel.Collection的用法示例。


在下文中一共展示了System.Collections.ObjectModel.Collection.Clear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: add_umk_Click

 private void add_umk_Click(object sender, EventArgs e)
 {
     win_add_umk window_umk = new win_add_umk();
     System.Collections.ObjectModel.Collection<string> return_lst = new System.Collections.ObjectModel.Collection<string>();
     System.Collections.ObjectModel.Collection<string> return_lst1 = new System.Collections.ObjectModel.Collection<string>();
     System.Collections.ObjectModel.Collection<string> return_lst2 = new System.Collections.ObjectModel.Collection<string>();
     cls_main main_func = new cls_main();
      window_umk.change_vars(umk_folder);
     window_umk.ShowDialog();
     //if (window_umk.selected_path != "")
     //{
         if (window_umk.selected_level == 2)
         {
             //if (if_cell_ISexists(2, window_umk.selected_path + "\\" + window_umk.selected_obj) != true)
             //{
                 string[] row1 = { window_umk.selected_obj, main_func.get_value_from_infofile(umk_folder + "\\" + window_umk.selected_path + "\\" + window_umk.selected_obj + "\\info.dat", "code"), window_umk.selected_path + "\\" + window_umk.selected_obj };
                 dg_prj_files.Rows.Add(row1);
             //}
         }
         else
         {
             if (window_umk.selected_level == 0)
             {
                 return_lst.Clear();
                 return_lst1.Clear();
                 return_lst = main_func.get_dir(umk_folder +  window_umk.selected_path + "\\" + window_umk.selected_obj);
                 if (return_lst.Count > 0)
                 {
                     for (int i = 0; i < return_lst.Count; i++)
                     {
                         return_lst1 = main_func.get_dir(umk_folder +  window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i]);
                         if (return_lst1.Count > 0)
                         {
                             for (int j = 0; j < return_lst1.Count; j++)
                             {
                                 //if (if_cell_ISexists(2,  window_umk.selected_obj + "\\" + return_lst[i] + "\\" + return_lst1[j]) != true)
                                 //{
                                     string[] row1 = { return_lst1[j], main_func.get_value_from_infofile(umk_folder + window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i] + "\\" + return_lst1[j] + "\\info.dat", "code"),  window_umk.selected_obj + "\\" + return_lst[i] + "\\" + return_lst1[j] };
                                     dg_prj_files.Rows.Add(row1);
                                 //}
                             }
                         }
                     }
                 }
             }
             else
             {
                 return_lst.Clear();
                 return_lst = main_func.get_dir(umk_folder + "\\" + window_umk.selected_path + "\\" + window_umk.selected_obj);
                 if (return_lst.Count > 0)
                 {
                     for (int i = 0; i < return_lst.Count; i++)
                     {
                         //if (if_cell_ISexists(2,  window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i]) != true)
                         //{
                             string[] row1 = { return_lst[i], main_func.get_value_from_infofile(umk_folder + "\\" + window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i] + "\\info.dat", "code"), window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i] };
                             dg_prj_files.Rows.Add(row1);
                         //}
                     }
                 }
             }
         }
     //}
     update_level_files(selected_level);
 }
开发者ID:developer88,项目名称:umk,代码行数:65,代码来源:win_plans.cs

示例2: update_level_files

 void update_level_files(int old_level)
 {
     System.Collections.ObjectModel.Collection<string> lst_to_delete= new System.Collections.ObjectModel.Collection<string>();
     //delete old values
     if (lst_all_umk.Count > 0)
     {
         lst_to_delete.Clear();
         foreach (string s_item in lst_all_umk)
         {
             string s_temp = Microsoft.VisualBasic.Strings.Right(s_item, 1);
             if (s_temp == old_level.ToString()) { lst_to_delete.Add(s_item); }
         }
         for (int i = 0; i < lst_to_delete.Count; i++)
         {
             lst_all_umk.Remove(lst_to_delete[i]);
         }
     }
     //add new values
     for (int i = 0; i < dg_prj_files.Rows.Count; i++)
     {
         string new_value = dg_prj_files.Rows[i].Cells[0].Value.ToString() + ";" + dg_prj_files.Rows[i].Cells[1].Value.ToString() + ";" + dg_prj_files.Rows[i].Cells[2].Value.ToString() + ";" + old_level.ToString();
         lst_all_umk.Add(new_value);
     }
 }
开发者ID:developer88,项目名称:umk,代码行数:24,代码来源:win_plans.cs

示例3: printToFileCheckBox_CheckedChanged

        private void printToFileCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            m_printMgr.IsPrintToFile = printToFileCheckBox.Checked;

            // Verify the relative controls is enable or not, according to the print to file
            // check box is checked or not.
            System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
                new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
            controlsToEnableOrNot.Add(copiesNumericUpDown);
            controlsToEnableOrNot.Add(numberofcoyiesLabel);
            m_printMgr.VerifyCopies(controlsToEnableOrNot);

            controlsToEnableOrNot.Clear();
            controlsToEnableOrNot.Add(printToFileNameLabel);
            controlsToEnableOrNot.Add(printToFileNameTextBox);
            controlsToEnableOrNot.Add(browseButton);
            m_printMgr.VerifyPrintToFileName(controlsToEnableOrNot);

            m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton);
        }
开发者ID:AMEE,项目名称:revit,代码行数:20,代码来源:PrintMgrForm.cs

示例4: PrintMgrForm_Load

        /// <summary>
        /// Initialize the UI data.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PrintMgrForm_Load(object sender, EventArgs e)
        {
            printerNameComboBox.DataSource = m_printMgr.InstalledPrinterNames;
            // the selectedValueChange event have to add event handler after
            // data source be set, or else the delegate method will be invoked meaningless.
            this.printerNameComboBox.SelectedValueChanged += new System.EventHandler(this.printerNameComboBox_SelectedValueChanged);
            printerNameComboBox.SelectedItem = m_printMgr.PrinterName;
            if (m_printMgr.VerifyPrintToFile(printToFileCheckBox))
            {
                printToFileCheckBox.Checked = m_printMgr.IsPrintToFile;
            }

            System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
                new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
            controlsToEnableOrNot.Add(copiesNumericUpDown);
            controlsToEnableOrNot.Add(numberofcoyiesLabel);
            m_printMgr.VerifyCopies(controlsToEnableOrNot);

            controlsToEnableOrNot.Clear();
            controlsToEnableOrNot.Add(printToFileNameLabel);
            controlsToEnableOrNot.Add(printToFileNameTextBox);
            controlsToEnableOrNot.Add(browseButton);
            m_printMgr.VerifyPrintToFileName(controlsToEnableOrNot);

            m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton);

            if (m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton))
            {
                singleFileRadioButton.Checked = m_printMgr.IsCombinedFile;
                separateFileRadioButton.Checked = !m_printMgr.IsCombinedFile;
            }

            if (!m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton)
                && m_printMgr.VerifyPrintToSeparateFile(separateFileRadioButton))
            {
                separateFileRadioButton.Checked = true;
            }
            this.singleFileRadioButton.CheckedChanged += new System.EventHandler(this.combineRadioButton_CheckedChanged);

            switch (m_printMgr.PrintRange)
            {
                case PrintRange.Current:
                    currentWindowRadioButton.Checked = true;
                    break;
                case PrintRange.Select:
                    selectedViewsRadioButton.Checked = true;
                    break;
                case PrintRange.Visible:
                    visiblePortionRadioButton.Checked = true;
                    break;
                default:
                    break;
            }
            this.currentWindowRadioButton.CheckedChanged += new System.EventHandler(this.currentWindowRadioButton_CheckedChanged);
            this.visiblePortionRadioButton.CheckedChanged += new System.EventHandler(this.visiblePortionRadioButton_CheckedChanged);
            this.selectedViewsRadioButton.CheckedChanged += new System.EventHandler(this.selectedViewsRadioButton_CheckedChanged);

            this.printToFileNameTextBox.Text = Environment.GetFolderPath(
                Environment.SpecialFolder.MyDocuments) + "\\" + m_printMgr.DocumentTitle;
            controlsToEnableOrNot.Clear();
            controlsToEnableOrNot.Add(selectedViewSheetSetLabel);
            controlsToEnableOrNot.Add(selectedViewSheetSetButton);
            if (m_printMgr.VerifySelectViewSheetSet(controlsToEnableOrNot))
            {
                this.selectedViewSheetSetLabel.Text = m_printMgr.SelectedViewSheetSetName;
            }

            orderCheckBox.Checked = m_printMgr.PrintOrderReverse;
            this.orderCheckBox.CheckedChanged += new System.EventHandler(this.orderCheckBox_CheckedChanged);

            if (m_printMgr.VerifyCollate(collateCheckBox))
            {
                collateCheckBox.Checked = m_printMgr.Collate;
            }
            this.collateCheckBox.CheckedChanged += new System.EventHandler(this.collateCheckBox_CheckedChanged);

            printSetupNameLabel.Text = m_printMgr.PrintSetupName;
        }
开发者ID:AMEE,项目名称:revit,代码行数:83,代码来源:PrintMgrForm.cs

示例5: printerNameComboBox_SelectedValueChanged

        private void printerNameComboBox_SelectedValueChanged(object sender, EventArgs e)
        {
            m_printMgr.PrinterName = printerNameComboBox.SelectedItem as string;

            // Verify the relative controls is enable or not, according to the printer changed.
            m_printMgr.VerifyPrintToFile(printToFileCheckBox);

            System.Collections.ObjectModel.Collection<System.Windows.Forms.Control> controlsToEnableOrNot =
                new System.Collections.ObjectModel.Collection<System.Windows.Forms.Control>();
            controlsToEnableOrNot.Add(copiesNumericUpDown);
            controlsToEnableOrNot.Add(numberofcoyiesLabel);
            m_printMgr.VerifyCopies(controlsToEnableOrNot);

            controlsToEnableOrNot.Clear();
            controlsToEnableOrNot.Add(printToFileNameLabel);
            controlsToEnableOrNot.Add(printToFileNameTextBox);
            controlsToEnableOrNot.Add(browseButton);

            if (!string.IsNullOrEmpty(printToFileNameTextBox.Text))
            {
                printToFileNameTextBox.Text = printToFileNameTextBox.Text.Remove(
                    printToFileNameTextBox.Text.LastIndexOf(".")) + m_printMgr.PostFix;
            }

            m_printMgr.VerifyPrintToFileName(controlsToEnableOrNot);

            m_printMgr.VerifyPrintToSingleFile(singleFileRadioButton);
            m_printMgr.VerifyPrintToSeparateFile(separateFileRadioButton);
        }
开发者ID:AMEE,项目名称:revit,代码行数:29,代码来源:PrintMgrForm.cs

示例6: backgroundStructurWorker_DoWork

        private void backgroundStructurWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
               {
               //start_create_structure();
               m_isStructurising = true;
               string temp_str = "";
               developers_components_lib.cls_filesystem filesys_func = new developers_components_lib.cls_filesystem();
               developers_components_lib.cls_converter convert_func = new developers_components_lib.cls_converter();
               cls_prj prj_func = new cls_prj();
               cls_main main_func = new cls_main();
               System.Collections.ObjectModel.Collection<string> db_files = new System.Collections.ObjectModel.Collection<string>();
               System.Collections.ObjectModel.Collection<string> db_temp_list = new System.Collections.ObjectModel.Collection<string>();
               System.Collections.ObjectModel.Collection<string> lst_files = new System.Collections.ObjectModel.Collection<string>();
               System.Collections.ObjectModel.Collection<string> lst_plan = new System.Collections.ObjectModel.Collection<string>();
               System.Collections.ObjectModel.Collection<string> lst_eplan_rows = new System.Collections.ObjectModel.Collection<string>();
               lst_plan = open_plan(s_plan_name);
               db_files.Clear();
               prj_func.create_prj_dir("distr", prj_open_name, true);
               string control_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\control\\index.htm");
               string control_row_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\control\\row_template.htm");
               string control_rows_str = "";
               string umk_row_year_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\row_year.htm");
               string umk_row_year_temp_str = "";
               string umk_rows_str = "";
               string umk_final_rows_str = "";
               string sub_umk_rows_str = "";
               string sub_umk_template_temp = "";
               string subumk_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\sub_umk.htm");
               string subumk_row_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\subumk_row_template.htm");
               string umk_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\index.htm");
               string umk_row_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\row_template.htm");
               //
               //copying system files
               //
               backgroundStructurWorker.ReportProgress(10);
               if (chk_service_enabled.Enabled == true & chk_service_enabled.Checked == true) { main_func.DirectoryCopy(appdir + "system\\service", appdir + "Projects\\" + prj_open_name + "\\distr\\SERVICE", true); }
               main_func.DirectoryCopy(appdir + "system\\umk", appdir + "Projects\\" + prj_open_name + "\\distr\\", true);
               //
               //copying UMK FILES
               //
               backgroundStructurWorker.ReportProgress(20);
               if (lst_plan.Count > 0)
               {
                   //create test
                   if ( s_control_type == "page")
                   {
                       main_func.DirectoryCopy(appdir + "Styles\\disk_styles\\" + disk_style + "\\control\\files", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\control\\", true);
                       control_template = control_template.Replace("{CAPTION}", txt_menu_control.Text);
                   }
                   //create education
                   if (s_edu_type == "page")
                   {
                       main_func.DirectoryCopy(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\files", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\", true);
                       umk_template = umk_template.Replace("{SPECIALIZATION}", txt_specialization.Text);
                       umk_template = umk_template.Replace("{all_years}", txt_total_year.Text);
                       //umk_template = umk_template.Replace("{SPECIALIZATION}", txt_specialization.Text);
                       //umk_template = umk_template.Replace("{SPECIALIZATION}", txt_specialization.Text);
                   }
                   main_func.clear_lst_to_file();
                   main_func.add_to_lst_to_file("version=" + shell_search_db_version);
                   string type = "";
                   int n = 0;
                   int Col = 0;
                   string umk_name = "";
                   backgroundStructurWorker.ReportProgress(30);
                   for (int h = 0; h < 7; h++)
                   {
                       Col = 0;
                       for (int i = 0; i < lst_plan.Count; i++)
                       {
                           string ss = lst_plan[i];
                           string[] plan_data = ss.Split(Convert.ToChar(";"));
                           if (plan_data[3] == h.ToString())
                           {
                               lst_files.Clear();
                               lst_files = main_func.get_files_indir(umk_folder + "\\" + plan_data[2]);
                               if (lst_files.Count > 0)
                               {
                                   if (Directory.Exists(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name))
                                   {
                                       umk_name = main_func.get_filename(plan_data[2]) + "_" + h.ToString() + i.ToString();
                                   }
                                   else
                                   {
                                       umk_name = main_func.get_filename(plan_data[2]);
                                   }
                                   Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name);
                                   if (s_control_type == "page") { Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\test"); }
                                   Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html");
                                   temp_str = umk_row_template;
                                   n++;
                                   int nt = i + 1;
                                   string cur_umk = umk_folder + "\\" + plan_data[2] + "\\info.dat";
                                   temp_str = temp_str.Replace("{n}", nt.ToString());
                                   temp_str = temp_str.Replace("{name}", plan_data[0]);
                                   temp_str = temp_str.Replace("{HOURS}", main_func.get_value_from_infofile(cur_umk, "hours"));
                                   temp_str = temp_str.Replace("{LINK}", umk_name + "/html/index.htm");
                                   temp_str = temp_str.Replace("{CODE}", plan_data[1]);
                                   sub_umk_template_temp = subumk_template;
//.........这里部分代码省略.........
开发者ID:developer88,项目名称:umk,代码行数:101,代码来源:MainForm.cs

示例7: add_umk_files_Click

 private void add_umk_files_Click(object sender, EventArgs e)
 {
     win_add_umk window_umk = new win_add_umk();
        System.Collections.ObjectModel.Collection<string> return_lst = new System.Collections.ObjectModel.Collection<string>();
        System.Collections.ObjectModel.Collection<string> return_lst1 = new System.Collections.ObjectModel.Collection<string>();
        System.Collections.ObjectModel.Collection<string> return_lst2 = new System.Collections.ObjectModel.Collection<string>();
        cls_main main_func = new cls_main();
        window_umk.change_vars(umk_folder);
        window_umk.ShowDialog();
        if (window_umk.selected_path != "")
        {
        /*if (window_umk.selected_level == 3)
        {
            string[] row1 = { window_umk.selected_obj, "файл", window_umk.selected_path + "\\" };
            dg_prj_files.Rows.Add(row1);
        }*/
        if (window_umk.selected_level == 2)
        {
            string[] row1 = { window_umk.selected_obj, "папка", window_umk.selected_path + "\\" };
            //dg_prj_files.Rows.Add(row1);
        }
        else
        {
            if (window_umk.selected_level == 0)
            {
                return_lst.Clear();
                return_lst1.Clear();
                return_lst = main_func.get_dir(window_umk.selected_path + "\\" + window_umk.selected_obj);
                if (return_lst.Count > 0)
                {
                    for (int i = 0; i < return_lst.Count; i++)
                    {
                        return_lst1 = main_func.get_dir(window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i]);
                        if (return_lst1.Count > 0)
                        {
                            for (int j = 0; j < return_lst1.Count; j++)
                            {
                                string[] row1 = { return_lst1[j], "папка", window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i] + "\\"};
                                //dg_prj_files.Rows.Add(row1);
                            }
                        }
                    }
                }
            }
            else
            {
                return_lst.Clear();
                return_lst = main_func.get_dir(window_umk.selected_path + "\\" + window_umk.selected_obj);
                if (return_lst.Count > 0)
                {
                    for (int i = 0; i < return_lst.Count; i++)
                    {
                        string[] row1 = { return_lst[i], "папка", window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" };
                        //dg_prj_files.Rows.Add(row1);
                    }
                }
            }
        }
        }
 }
开发者ID:developer88,项目名称:umk,代码行数:60,代码来源:MainForm.cs


注:本文中的System.Collections.ObjectModel.Collection.Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。