コード例 #1
0
        //----------------------------------------------------------
        public void Function_Dau_Vao()
        {
            try
            {
                List <string> file_name = doc.Title.Split('_').ToList();
                project_number = doc.ProjectInformation.Number;
                block          = doc.ProjectInformation.BuildingName;
                Class          = doc.ProjectInformation.LookupParameter("Class") == null ? "" : doc.ProjectInformation.LookupParameter("Class").AsString();
                if (string.IsNullOrEmpty(Class))
                {
                    MessageBox.Show("Share Parameter Class not found", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                if (file_name.Count() > 3)
                {
                    List <string> format = new List <string>();
                    if (project_number != file_name[0])
                    {
                        format.Add("Project Number");
                    }

                    if (block != file_name[1])
                    {
                        format.Add("Block");
                    }

                    if (Class != file_name[3])
                    {
                        format.Add("Class");
                    }

                    if (format.Count() == 0)
                    {
                        my_data_file = new ObservableCollection <data_file>();

                        folder.Text = @"C:\";

                        F_ElementByLevel.get_element_by_level(doc, level_list, level);
                        F_Folder.get_file_data(doc, my_data_file, folder, thong_tin_file);
                    }
                    else
                    {
                        MessageBox.Show(string.Format("Data is incorrect.\nPlease check {0} and try again!", string.Join(",", format)), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("File name is incorrect. Please check and try again!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
 //--------------------------------------------------------------------------------------------------------------------------------------------------------------
 private void Refresh(object sender, RoutedEventArgs e)
 {
     try
     {
         F_ElementByLevel.get_element_by_level(doc, level_list, level);
         F_Folder.get_file_data(doc, my_data_file, folder, thong_tin_file);
     }
     catch (Exception)
     {
     }
 }
コード例 #3
0
 //--------------------------------------------------------------------------------------------------------------------------------------------------------------
 private void Xoa_File(object sender, RoutedEventArgs e)
 {
     try
     {
         var result_message = MessageBox.Show("Bạn có chắc chắn muốn xóa!", "QUESTION", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (result_message == MessageBoxResult.Yes)
         {
             for (int i = 0; i < thong_tin_file.SelectedItems.Count; i++)
             {
                 data_file item = (data_file)thong_tin_file.SelectedItems[i];
                 File.Delete(item.path);
             }
             F_Folder.get_file_data(doc, my_data_file, folder, thong_tin_file);
         }
     }
     catch (Exception)
     {
     }
 }
コード例 #4
0
 //--------------------------------------------------------------------------------------------------------------------------------------------------------------
 private void Select_Folder(object sender, RoutedEventArgs e)
 {
     F_Folder.select_folder(doc, my_data_file, folder, thong_tin_file);
 }