public Bim360Project(Bim360Project tocopyproject)
 {
     this.ProjectName = tocopyproject.ProjectName;
     this.ProjectType = tocopyproject.ProjectType;
     // init arrays
     Plans        = new Folder();
     ProjectFiles = new Folder();
     Plans.Clone(tocopyproject.Plans);
     ProjectFiles.Clone(tocopyproject.ProjectFiles);
 }
        static void Main(string[] args)
        {
            var project1 = new Bim360Project("MyProject01")
            {
                ProjectType = ProjectTypeEnum.Office
            };


            project1.Plans.Add(new Folder("Level1"));
            project1.ProjectFiles.Add(new Folder("Level1"));
            project1.ProjectFiles[0].Subfolders.Add(new Folder("Level1"));

            Console.WriteLine(project1);
        }
        private void MenuItem_ProjectDuplicate(object sender, RoutedEventArgs e)
        {
            //Get the clicked MenuItem
            var menuItem = (MenuItem)sender;
            //Get the ContextMenu to which the menuItem belongs
            var contextMenu = (ContextMenu)menuItem.Parent;
            //Find the placementTarget
            var item = (DataGrid)contextMenu.PlacementTarget;
            //Copy Itme
            var toduplicate = (Bim360Project)item.SelectedCells[0].Item;

            if (toduplicate == null)
            {
                return;
            }
            var toadd = new Bim360Project(toduplicate);

            projects.Add(toadd);
            ProjectsView.Items.Refresh();
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GetTemplate_OnClick(object sender, RoutedEventArgs e)
        {
            var progress = new updates_upload();

            progress.Show();

            //Updates
            progress.pgb.Value             = 10;
            progress.ProgressLabel.Content = "Build Connection";
            // ProgressBar "refresh"
            CallDispatch(progress);

            string[] input = new string[] { "-c", ClientId, "-s", ClientSecret, "-a", BimId,
                                            "-h", AdminMail, "-f", " .\\sample", "-t", ",",
                                            "-z", ",", "-e", "UTF-8", "-d", "yyyy-MM-dd" };

            AppOptions options = AppOptions.Parse(input);

            // options.AccountRegion = "EU";
            options.AdminRole = "Project Manager";

            ProjectWorkflow projectProcess = new ProjectWorkflow(options);
            FolderWorkflow  folderProcess  = new FolderWorkflow(options);

            System.Threading.Thread.Sleep(1000);
            // load all existing projects from the BIM360 environment
            List <BimProject> projects = projectProcess.GetAllProjects();

            //Updates
            progress.pgb.Value             = 30;
            progress.ProgressLabel.Content = "Download Project";
            // ProgressBar "refresh"
            CallDispatch(progress);

            BimProject currentProject = null;

            // get project from bim360
            try
            {
                currentProject = projects.Find(x => x.name == TextBoxTemplate.Text.Trim());
            }
            catch (Exception)
            {
                statusbar.Text = "No Project with the name:" + TextBoxTemplate.Text.Trim() + " found!";
                return;
            }
            if (currentProject == null)
            {
                return;
            }

            var nestedfolders = folderProcess.CustomGetFolderStructure(currentProject);

            foreach (var iterfolder in nestedfolders)
            {
            }

            progress.pgb.Value             = 50;
            progress.ProgressLabel.Content = "Converte to local Project 0/2";
            // ProgressBar "refresh"
            CallDispatch(progress);


            var newproject = new Bim360Project(TextBoxTemplate.Text.Trim());

            newproject.ProjectType = Selection.SelectProjectType(currentProject.project_type);
            var roots = new List <Folder>();

            //hier rekursive alle ordner finden
            foreach (var iterfolder in nestedfolders)
            {
                roots.Add(getNestedFolder(iterfolder));
                progress.pgb.Value             = 70;
                progress.ProgressLabel.Content = "Converte to local Project 1/2";
                // ProgressBar "refresh"
                CallDispatch(progress);
            }
            //here hardcoded plan and projectfiles need to be changed in the furtuer if  ACC comes
            if (roots[0].Name == "Plans")
            {
                newproject.Plans        = roots[0];
                newproject.ProjectFiles = roots[1];
            }
            else
            {
                newproject.Plans        = roots[1];
                newproject.ProjectFiles = roots[0];
            }

            AccProjectConfig.ProjectsView.ItemsSource = AccProjectConfig.projects;
            AccProjectConfig.projects.Add(newproject);
            AccProjectConfig.ProjectsView.Items.Refresh();
            progress.Close();
            statusbar.Text = "Import successful";
        }