示例#1
0
        void Update(object devin)
        {
            using (LockingStep oLS = new LockingStep())
            { // ... доступ к данным P8 ...
                SelectionSet Set            = new SelectionSet();
                Project      CurrentProject = Set.GetCurrentProject(true);
                projectname = CurrentProject.ProjectFullName;
                StorableObject[]  storableObjects = Set.Selection;
                List <Page>       Lpage           = Set.GetSelectedPages().ToList();
                DMObjectsFinder   dmObjectsFinder = new DMObjectsFinder(CurrentProject);
                List <Function3D> place3d;
                //place3d = dmObjectsFinder.GetFunctions3D(null).ToList();
                List <Function> place;
                //place = dmObjectsFinder.GetFunctions(null).ToList();
                List <Terminal> ltermlist;
                functype        devl = new functype();
                ((List <functype>)devin).Clear();
                int  id        = 0;
                int  id3d      = 0;
                bool placefind = false;
                progressBar1.Value   = 0;
                progressBar1.Maximum = Lpage.Count;

                for (int i = 0; i < Lpage.Count; i++)
                {
                    Type ltp = Lpage[i].GetType();
                    if (ltp.Name == "Page")
                    {
                        place = Lpage[i].Functions.ToList();
                        FunctionsFilter oterfilt = new FunctionsFilter();
                        oterfilt.Page = Lpage[i];
                        ltermlist     = dmObjectsFinder.GetTerminals(oterfilt).ToList();
                        //MessageBox.Show(ltermlist.Count.ToString());
                        for (int j = 0; j < place.Count; j++)
                        {
                            id += 1;
                            if (place[j].IsMainFunction != true)
                            {
                                continue;
                            }                                                  //// Проверяем является ли функция главной
                            //if (place[j].Properties.DESIGNATION_LOCATION.ToString() != listBox1.SelectedItem.ToString()) { continue; }
                            Functions3DFilter      f3d = new Functions3DFilter();
                            Function3DPropertyList oFunction3DPropertyList = new Function3DPropertyList();
                            oFunction3DPropertyList.DESIGNATION_LOCATION = place[j].Properties.DESIGNATION_LOCATION;
                            f3d.SetFilteredPropertyList(oFunction3DPropertyList);
                            place3d   = dmObjectsFinder.GetFunctions3D(f3d).ToList();
                            id3d     += place3d.Count;
                            placefind = false;
                            for (int l = 0; l < place3d.Count; l++)
                            {
                                //MessageBox.Show("F"+ place[j].ObjectIdentifier.ToString()+"F3D "+ place3d[l].ObjectIdentifier+"\n"+ place[j].Name+" "+place3d[l].Name);

                                if (place[j].Properties.FUNC_IDENTDEVICETAGWITHOUTSTRUCTURES == place3d[l].Properties.FUNC_IDENTDEVICETAGWITHOUTSTRUCTURES)
                                {
                                    placefind = true;
                                    break;
                                }
                            }
                            if (placefind == false)
                            {
                                devl.Name        = place[j].Name;
                                devl.Page        = Lpage[i].Name;
                                devl.Designation = place[j].Properties.DESIGNATION_LOCATION;
                                ((List <functype>)devin).Add(devl);
                            }
                        }

                        for (int t = 0; t < ltermlist.Count; t++)
                        {
                            if (ltermlist[t].IsMainTerminal != true)
                            {
                                continue;
                            }                                                      //// Проверяем является ли функция главной
                            //if (place[j].Properties.DESIGNATION_LOCATION.ToString() != listBox1.SelectedItem.ToString()) { continue; }
                            Functions3DFilter      f3d = new Functions3DFilter();
                            Function3DPropertyList oFunction3DPropertyList = new Function3DPropertyList();
                            oFunction3DPropertyList.DESIGNATION_LOCATION = ltermlist[t].Properties.DESIGNATION_LOCATION;
                            f3d.SetFilteredPropertyList(oFunction3DPropertyList);
                            place3d = dmObjectsFinder.GetFunctions3D(f3d).ToList();
                            id3d   += place3d.Count;
                            // MessageBox.Show(ltermlist[t].Name.ToString());
                            placefind = false;
                            for (int l = 0; l < place3d.Count; l++)
                            {
                                if (ltermlist[t].Name.ToString() == place3d[l].Name.ToString())
                                {
                                    placefind = true;
                                    break;
                                }
                            }
                            if (placefind == false)
                            {
                                devl.Name        = ltermlist[t].Name;
                                devl.Page        = Lpage[i].Name;
                                devl.Designation = ltermlist[t].Properties.DESIGNATION_LOCATION;
                                ((List <functype>)devin).Add(devl);
                            }
                        }
                    }
                    progressBar1.Value += 1;
                }
                label4.Text = id.ToString();
                label7.Text = id3d.ToString();
            }
        }