Esempio n. 1
0
        public void AddComponentTwice()
        {
            var List = new ComponentList();

            List.Add <Transform>();
            List.Add <Transform>();
        }
Esempio n. 2
0
    static void Main(string[] args)
    {
        ComponentList <Component> MasterList = new ComponentList <Component>();

        MasterList.Add(new ComponentA());
        MasterList.Add(new ComponentB());
        for (int i = 0; i < MasterList.Count; i++)
        {
            if (MasterList[i] is ComponentA)
            {
            }
        }
    }
Esempio n. 3
0
        public void AddObject(GameObject go)
        {
            if (go == null)
            {
                throw new BeyondException("GameObject is null");
            }

            if (GroupObject == null)
            {
                throw new BeyondException("GroupObject is null");
            }

            BeyondComponent bc = go.GetComponent <BeyondComponent>();

            if (bc == null)
            {
                throw new BeyondException("No Beyond Component attached to GameObject");
            }

            // Set BC's group position
            Vector3Int groupPosition = Vector3Int.RoundToInt(Utility.RotateAroundPoint(go.transform.position - Position, Vector3.zero, Rotation));

            //TO DO : check if this position is already occupied, which is tricky since some objects (like walls or cables) can co-exist in the same cell
            bc.SetGroupPosition(this, groupPosition);
            go.transform.SetParent(GroupObject.transform);
            ComponentList.Add(bc);
        }
Esempio n. 4
0
        public void AddComponent(Component component)
        {
            AddComponentGroup(component.GroupName);

            ComponentList.Add(component);
            UpdateFilteredLists();
        }
Esempio n. 5
0
        public void AddComponent()
        {
            var List      = new ComponentList();
            var Transform = List.Add <Transform>();

            Assert.IsNotNull(Transform);
        }
Esempio n. 6
0
        //Sets the current Component list we're watching in the main view
        //This function is my best work ever Martin Nielsen Fig
        public void SetComponentList(ObservableCollection <Component> list)
        {
            ComponentList.Clear();
            if (true == UniqeChecked)
            {
                ObservableCollection <Component> distictlist;
                distictlist = new ObservableCollection <Component>(list.DistinctBy(x => x.ComponentName));

                foreach (var component in distictlist)
                {
                    ComponentList.Add(component);
                }
                FirstDataGrid  = "Visible";
                SecondDataGrid = "Collapsed";
                ComponetAmountValue();
                LoansAmountValue();
            }
            else
            {
                foreach (var component in list)
                {
                    ComponentList.Add(component);
                }
                FirstDataGrid  = "Collapsed";
                SecondDataGrid = "Visible";
            }
        }
Esempio n. 7
0
 private void RegisterComponents()
 {
     ComponentList.Add(new ComponentModel {
         ModelDisplayName = "Sequential Search", RelativePageLink = "/ac_SequentialSearch"
     });
     ComponentList.Add(new ComponentModel {
         ModelDisplayName = "Binary Search", RelativePageLink = "/ac_BinarySearch"
     });
 }
Esempio n. 8
0
 public void AddComponent(IShipDockComponent component)
 {
     if ((component != default) && !HasComponent(component.ID))
     {
         int id = component.SetEntitas(this);
         ComponentList.Add(component.ID);
         mBindedToComponentIDs.Add(id);
     }
 }
Esempio n. 9
0
        public void GetComponent()
        {
            var List         = new ComponentList();
            var Transform    = List.Add <Transform>();
            var GetTransform = List.Get <Transform>();

            Assert.IsNotNull(GetTransform);
            Assert.AreEqual(Transform, GetTransform);
        }
Esempio n. 10
0
        /// <summary>
        /// 获取方法包中的所有性质
        /// </summary>
        /// <returns></returns>
        public ComponentList GetComponents()
        {
            ComponentList clst = new ComponentList();

            if (this._comp != null)
            {
                clst.Add(this._comp);
            }
            return(clst);
        }
Esempio n. 11
0
 /// <summary>
 /// Register a component
 /// </summary>
 /// <param name="component">Component to be registered.</param>
 public void RegisterComponent(IComponent component)
 {
     lock (ComponentsLock) {
         if (!ComponentList.Any(x => x.Id == component.Id))
         {
             ComponentList.Add(component);
             ComponentRegistered?.Invoke(this, component);
         }
     }
 }
Esempio n. 12
0
        public void RemoveComponent()
        {
            var List      = new ComponentList();
            var Transform = List.Add <Transform>();

            List.Remove <Transform>();
            var GetTransform = List.Get <Transform>();

            Assert.IsNull(GetTransform);
        }
Esempio n. 13
0
        public object Predict(spec s, out ComponentList c)
        {
            loadModel();
            c = null;
            var ftype        = (FileExtensionEnum)this.type;
            var tempfullName = Path.Combine(HttpContext.Current.Server.MapPath("~/"), this.path);

            switch (ftype)
            {
            case FileExtensionEnum.Allmethods:
                var r1 = this._mBind.Predict(s.Spec);
                c = r1.GetPredictComp();
                return(r1);

            case FileExtensionEnum.PLSBind:
                var r2 = this._mPLS.Predict(s.Spec);
                c = new ComponentList();
                var clst = r2.Select(d => d.Comp);
                foreach (var csub in clst)
                {
                    c.Add(csub);
                }
                return(r2);

            case FileExtensionEnum.IdLib:
                var r3 = this._mId.Predict(s.Spec);
                c = r3.Components;
                return(r3);

            case FileExtensionEnum.FitLib:
                var r4 = this._mFitting.Predict(s.Spec);
                c = r4.FitSpec.Components;
                return(r4);

            case FileExtensionEnum.PLS1:
            case FileExtensionEnum.PLSANN:
                var r5 = this._mPLS1.Predict(s.Spec);
                c = new ComponentList();
                c.Add(r5.Comp);
                return(r5);

            case FileExtensionEnum.ItgBind:
                var r6 = this._itgSub.Predict(s.Spec);
                c = new ComponentList();
                foreach (var csub in r6)
                {
                    c.Add(csub.Comp);
                }
                return(r6);

            default:
                break;
            }
            return(null);
        }
Esempio n. 14
0
        public static ComponentList CreateBlockComponentList(IEnumerable <XDesign_DesignBlock> xDesignBlocks)
        {
            var result = new ComponentList();

            foreach (var blockData in xDesignBlocks)
            {
                result.Add(CreateBlockComponent(blockData));
            }

            return(result);
        }
Esempio n. 15
0
        public void Remove_NoCommit_ComponentStillAccessible()
        {
            var target = new ComponentList(new TestEntity());

            target.Add <Test1Component>();
            target.CommitChanges();
            target.Remove <Test1Component>();

            var result = target.Get <Test1Component>();

            Assert.IsNotNull(result);
        }
Esempio n. 16
0
        public void Add_ByType_ComponentAddedAsPending()
        {
            var target = new ComponentList(new TestEntity());

            target.Add <Test1Component>();

            var withPending    = target.Get <Test1Component>();
            var withoutPending = target.Get <Test1Component>(false);

            Assert.IsNotNull(withPending);
            Assert.IsNull(withoutPending);
        }
Esempio n. 17
0
        public void CommitChanges_WithPendingComponent_ComponentAddedToRealList()
        {
            var target = new ComponentList(new TestEntity());

            target.Add <Test1Component>();
            target.CommitChanges();

            var withPending    = target.Get <Test1Component>();
            var withoutPending = target.Get <Test1Component>(false);

            Assert.IsNotNull(withPending);
            Assert.IsNotNull(withoutPending);
        }
Esempio n. 18
0
        public async Task <IActionResult> Delete([FromHeader] string nameComponent)
        {
            var    noError = false;
            string backUpComponentCode;

            try
            {
                backUpComponentCode = await ComponentList.Delete($"{nameComponent}.cs");
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }

            try
            {
                noError = await ComponentList.ReloadActions();
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
            finally
            {
                if (!noError)
                {
                    await ComponentList.Add(backUpComponentCode, $"{nameComponent}.cs");
                }
            }
            ModuleGovernor.AllowBuild();
            if (noError)
            {
                await DeleteComponentFromDataBase(nameComponent);

                return(Ok("Пользовательский компонент успешно удалён"));
            }
            return(BadRequest("Не удалось удалить компонент. Возможно его используют другие компоненты"));
        }
Esempio n. 19
0
        public Component EnsureComponent(int position)
        {
            if (position < 1)
            {
                throw new HL7Exception($"Invalid components index ({position} < 1)");
            }

            if (position > ComponentList.Count)
            {
                ComponentList.Add(new Component(this.Encoding), position);
            }

            return(ComponentList[position - 1]);
        }
Esempio n. 20
0
        public void Deserialize()
        {
            var List = new ComponentList();

            List.Add <CustomComponent>();

            var Bytes        = STACK.State.Serialization.SaveState(List);
            var Deserialized = STACK.State.Serialization.LoadState <ComponentList>(Bytes);

            foreach (var ComponentList in GetComponentTypeLists(Deserialized))
            {
                Assert.AreEqual(1, ComponentList.Count);
            }
        }
Esempio n. 21
0
        public override ComponentList <PSMComponent> GetInterpretedComponents()
        {
            ComponentList <PSMComponent> list = new ComponentList <PSMComponent>();

            foreach (PSMSchema schema in Project.LatestVersion.PSMSchemas)
            {
                foreach (PSMClass c in schema.PSMClasses)
                {
                    if (c.Interpretation == this)
                    {
                        list.Add(c);
                    }
                }
            }
            return(list);
        }
Esempio n. 22
0
        /// <summary>
        /// 获取方法包中的所有性质
        /// </summary>
        /// <returns></returns>
        public ComponentList GetComponents()
        {
            ComponentList clst = new ComponentList();

            if (this.SubModels != null)
            {
                foreach (var m in this.SubModels)
                {
                    if (!clst.Contains(m.Comp.Name))
                    {
                        clst.Add(m.Comp);
                    }
                }
            }
            return(clst);
        }
Esempio n. 23
0
        // 図から必要な要素を取得し、リストを作成する
        internal void LoadDeployDiagramObjectsInformation(EA.Repository Repository)
        {
            // ノードの配置に関するモデルの作成,親をたどることにより必要な情報を入手
            // 配置図の要素を環境、デバイス、ノード、コンポーネントのリストに格納
            EA.Diagram diagram = Repository.GetCurrentDiagram();
            var        TmpCommunicationList = new List <Communication>();

            for (short i = 0; i < diagram.DiagramObjects.Count; i++)
            {
                DiagramObject diagramObject = diagram.DiagramObjects.GetAt(i);
                Element       element       = Repository.GetElementByID(diagramObject.ElementID);
                var           ConnectorList = new List <Connector>();
                var           xdoc          = element.Notes.ToXDocument();
                switch (element.MetaType)
                {
                case "ExecutionEnvironment":
                    ExecutionEnvironmentList.Add(new ExecutionEnvironment(element.Name, element.ElementID, element.ParentID, xdoc));
                    break;

                case "Device":
                    // デバイスが保持している接続を取得
                    for (short j = 0; j < element.Connectors.Count; j++)
                    {
                        Connector connector = element.Connectors.GetAt(j);
                        ConnectorList.Add(connector);
                        TmpCommunicationList.Add(new Communication(connector.Name, connector.ConnectorID, connector.DiagramID, connector.Notes.ToXDocument()));
                    }

                    DeviceList.Add(new Device(element.Name, element.ElementID, element.ParentID, xdoc, element.Stereotype, ConnectorList));
                    break;

                case "Node":
                    NodeList.Add(new Node(element.Name, element.ElementID, element.ParentID, xdoc));
                    break;

                case "Component":
                    ComponentList.Add(new Component(element.Name, element.ElementID, element.ParentID, xdoc));
                    break;
                }
            }

            TmpCommunicationList.GroupBy(communication => communication.Name)
            .Select(x => x.FirstOrDefault())
            .ToList()
            .ForEach(Communication => CommunicationList.Add(Communication));
        }
Esempio n. 24
0
        /// <summary>
        /// 获取预测出来的性质
        /// </summary>
        /// <returns></returns>
        public ComponentList GetPredictComp(int num = 5, int numOfId = 5)
        {
            ComponentList c;

            switch (this.MethodType)
            {
            case PredictMethod.Fitting:
                var r1 = this.GetResult <FittingResult>();
                c = r1.FitSpec.Components;
                break;

            case PredictMethod.Identify:
                var r2 = this.GetResult <IdentifyResult>();
                r2 = IdentifyModel.GetPredictValue(r2, num, numOfId);
                c  = r2.Components;
                break;

            case PredictMethod.PLSBind:
                var r3 = this.GetResult <List <PLS1Result> >();
                c = new ComponentList();
                foreach (var cc in r3.Select(d => d.Comp))
                {
                    c.Add(cc);
                }
                break;

            case PredictMethod.Integrate:
                var r4 = this.GetResult <List <IntegrateResultItem> >();
                c = new ComponentList();
                foreach (var i in r4)
                {
                    var cc = i.Comp;
                    if (i.ConfidenceOutter < 90)
                    {
                        cc.State = i.ConfidenceOutter > 80 ? ComponentStatu.Blue : ComponentStatu.Red;
                    }
                    c.Add(cc);
                }
                break;

            default:
                c = null;
                break;
            }
            return(c);
        }
Esempio n. 25
0
        public void ComponentNoInterfaces()
        {
            var List = new ComponentList();

            List.Add <Transform>();

            foreach (var ComponentList in GetComponentTypeLists(List))
            {
                Assert.AreEqual(0, ComponentList.Count);
            }

            List.Remove <Transform>();

            foreach (var ComponentList in GetComponentTypeLists(List))
            {
                Assert.AreEqual(0, ComponentList.Count);
            }
        }
Esempio n. 26
0
        public void ComponentInterfaces()
        {
            var List = new ComponentList();

            List.Add <CustomComponent>();

            foreach (var ComponentList in GetComponentTypeLists(List))
            {
                Assert.AreEqual(1, ComponentList.Count);
            }

            List.Remove <CustomComponent>();

            foreach (var ComponentList in GetComponentTypeLists(List))
            {
                Assert.AreEqual(0, ComponentList.Count);
            }
        }
Esempio n. 27
0
    public ComponentList <string, string> GetComponents()
    {
        try
        {
            IClient    client    = DXP.GlobalVars.Client;
            IWorkspace workSpace = client.GetDXPWorkspace() as IWorkspace;
            IProject   project   = workSpace.DM_FocusedProject();
            if (project.DM_NeedsCompile())
            {
                project.DM_Compile();
            }

            ComponentList <string, string> Output = new ComponentList <string, string>();

            IDocument document       = project.DM_DocumentFlattened();
            int       componentCount = document.DM_ComponentCount();

            pbProgress.Maximum = componentCount;
            pbProgress.Value   = 0;
            UpdateLabel("Getting Comp List");

            for (int i = 0; i < componentCount; i++)
            {//TODO: what to do when multiple keys
                IComponent component = document.DM_Components(i);
                if (!Output.ContainsKey(component.DM_PhysicalDesignator()))
                {
                    Output.Add(component.DM_PhysicalDesignator(), component.DM_NexusDeviceId());
                }
                pbProgress.Value++;
                UpdateLabel("Getting Comp List");
            }

            return(Output);
        }
        catch (Exception ex)
        {
            ErrorMail.LogError("Error in " + System.Reflection.MethodBase.GetCurrentMethod().Name + ".", ex);
            return(null);
        }
    }
Esempio n. 28
0
 public void AddComponentToList(byte index, string name)
 {
     ComponentList.Add(new Component(index, name));
 }
Esempio n. 29
0
        //
        // Apply unsaved changes, returns true if new settings are all applied correctly,
        // otherwise returns false.
        //
        private bool apply()
        {
            if(!hasUnsavedChanges())
            {
                return true; // Nothing to do.
            }

            try
            {
                if(editingIncludeDir())
                {
                    endEditIncludeDir(true);
                }

                //
                // This must be the first setting to be updated, as other settings cannot be
                // updated if the add-in is disabled.
                //
                if(chkEnableBuilder.Checked && !Util.isSliceBuilderEnabled(_project))
                {
                    Util.addBuilderToProject(_project, iceComponents());
                    _initialized = false;
                    load();
                    _initialized = true;
                    // There aren't other changes at this point, we have just enabled the add-in.
                    return true;
                }

                bool development = Util.developmentMode(_project);
                ComponentList components = new ComponentList();
                if(chkGlacier2.Checked != Util.hasDotNetReference(_project, "Glacier2"))
                {
                    componentChanged("Glacier2", chkGlacier2.Checked, development);
                    if(!chkGlacier2.Checked)
                    {
                        components.Add("Glacier2");
                    }
                }
                if(chkIceBox.Checked != Util.hasDotNetReference(_project, "IceBox"))
                {
                    componentChanged("IceBox", chkIceBox.Checked, development);
                    if(!chkIceBox.Checked)
                    {
                        components.Add("IceBox");
                    }
                }
                if(chkIceGrid.Checked != Util.hasDotNetReference(_project, "IceGrid"))
                {
                    componentChanged("IceGrid", chkIceGrid.Checked, development);
                    if(!chkIceGrid.Checked)
                    {
                        components.Add("IceGrid");
                    }
                }
                if(chkIcePatch2.Checked != Util.hasDotNetReference(_project, "IcePatch2"))
                {
                    componentChanged("IcePatch2", chkIcePatch2.Checked, development);
                    if(!chkIcePatch2.Checked)
                    {
                        components.Add("IcePatch2");
                    }
                }
                if(!_compactFramework)
                {
                    if(chkIceSSL.Checked != Util.hasDotNetReference(_project, "IceSSL"))
                    {
                        componentChanged("IceSSL", chkIceSSL.Checked, development);
                        if(!chkGlacier2.Checked)
                        {
                            components.Add("IceSSL");
                        }
                    }
                }
                if(chkIceStorm.Checked != Util.hasDotNetReference(_project, "IceStorm"))
                {
                    componentChanged("IceStorm", chkIceStorm.Checked, development);
                    if(!chkGlacier2.Checked)
                    {
                        components.Add("IceStorm");
                    }
                }

                //
                // This must be the last setting to be updated, as we want to update
                // all other settings and that isn't possible if the builder is disabled.
                //
                if(!chkEnableBuilder.Checked && Util.isSliceBuilderEnabled(_project))
                {
                    Util.removeBuilderFromProject(_project,  components);
                    _initialized = false;
                    load();
                    _initialized = true;
                }

                return true;
            }
            finally
            {
                needSave(); // Call needSave to update apply button status
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 获取方法包中的所有性质
        /// </summary>
        /// <returns></returns>
        public ComponentList GetComponents()
        {
            ComponentList clst = new ComponentList();

            if (this.IdModels != null && this.IdModels.Count > 0)
            {
                foreach (var m in this.IdModels)
                {
                    if (m.SpecLib != null && m.SpecLib.FirstOrDefault() != null)
                    {
                        foreach (var c in m.SpecLib.FirstOrDefault().Components)
                        {
                            if (!clst.Contains(c.Name))
                            {
                                clst.Add(c);
                            }
                        }
                    }
                }
            }

            if (this.FitModels != null && this.FitModels.Count > 0)
            {
                foreach (var m in this.FitModels)
                {
                    if (m.SpecLib != null && m.SpecLib.FirstOrDefault() != null)
                    {
                        foreach (var c in m.SpecLib.FirstOrDefault().Components)
                        {
                            if (!clst.Contains(c.Name))
                            {
                                clst.Add(c);
                            }
                        }
                    }
                }
            }

            if (this.PLS != null && this.PLS.SubModels != null)
            {
                foreach (var m in this.PLS.SubModels)
                {
                    if (!clst.Contains(m.Comp.Name))
                    {
                        clst.Add(m.Comp);
                    }
                }
            }

            if (this.Itg != null)
            {
                foreach (var c in this.Itg.Comps)
                {
                    if (!clst.Contains(c.Name))
                    {
                        clst.Add(c);
                    }
                }
            }
            return(clst);
            //return clst.Count == 0 ? null : clst;
        }
        private ComponentList iceComponents()
        {
            ComponentList components = new ComponentList();

            if(chkGlacier2.Checked)
            {
                components.Add("Glacier2");
            }
            if(chkIceBox.Checked)
            {
                components.Add("IceBox");
            }
            if(chkIceGrid.Checked)
            {
                components.Add("IceGrid");
            }
            if(chkIcePatch2.Checked)
            {
                components.Add("IcePatch2");
            }
            if(!_compactFramework)
            {
                if(chkIceSSL.Checked)
                {
                    components.Add("IceSSL");
                }
            }
            if(chkIceStorm.Checked)
            {
                components.Add("IceStorm");
            }
            return components;
        }
Esempio n. 32
0
        //
        // Apply unsaved changes, returns true if new settings are all applied correctly,
        // otherwise returns false.
        //
        private bool apply()
        {
            if(!hasUnsavedChanges())
            {
                return true; // Nothing to do.
            }

            try
            {
                if(editingIncludeDir())
                {
                    endEditIncludeDir(true);
                }

                //
                // This must be the first setting to be updated, as other settings cannot be
                // updated if the add-in is disabled.
                //
                bool enabling = false;
                if(chkEnableBuilder.Checked && !Util.isSliceBuilderEnabled(_project))
                {
                    Util.addBuilderToProject(_project, iceComponents());
                    _changed = true;
                    _initialized = false;
                    loadComponents();
                    _initialized = true;
                    enabling = true;
                }

                bool changed = false;
                if(!outputDirView.apply(ref changed))
                {
                    return false;
                }

                if(changed)
                {
                    _changed = true;
                }

                if(chkIcePrefix.Checked != Util.getProjectPropertyAsBool(_project, Util.PropertyIcePrefix))
                {
                    Util.setProjectProperty(_project, Util.PropertyIcePrefix, chkIcePrefix.Checked.ToString());
                    _changed = true;
                }

                if(chkStreaming.Checked != Util.getProjectPropertyAsBool(_project, Util.PropertyIceStreaming))
                {
                    Util.setProjectProperty(_project, Util.PropertyIceStreaming, chkStreaming.Checked.ToString());
                    _changed = true;
                }

                if(chkChecksum.Checked != Util.getProjectPropertyAsBool(_project, Util.PropertyIceChecksum))
                {
                    Util.setProjectProperty(_project, Util.PropertyIceChecksum, chkChecksum.Checked.ToString());
                    _changed = true;
                }

                if(comboBoxVerboseLevel.SelectedIndex != Util.getVerboseLevel(_project))
                {
                    Util.setProjectProperty(_project, Util.PropertyVerboseLevel,
                                            comboBoxVerboseLevel.SelectedIndex.ToString(CultureInfo.InvariantCulture));
                    _changed = true;
                }

                changed = false;
                if(!extraCompilerOptions.apply(ref changed))
                {
                    return false;
                }
                if(changed)
                {
                    _changed = true;
                }

                if(includePathView.apply())
                {
                    _changed = true;
                }

                if(!txtDllExportSymbol.Text.Equals(Util.getProjectProperty(_project, Util.PropertyIceDllExport),
                                                   StringComparison.CurrentCulture))
                {
                    Util.setProjectProperty(_project, Util.PropertyIceDllExport, txtDllExportSymbol.Text);
                    _changed = true;
                }

                ComponentList components = new ComponentList();
                if(!enabling)
                {

                    if(chkFreeze.Checked != Util.hasIceCppLib(_project, "Freeze"))
                    {
                        componentChanged("Freeze", chkFreeze.Checked);
                        if(!chkFreeze.Checked)
                        {
                            components.Add("Freeze");
                        }
                    }
                    if(chkGlacier2.Checked != Util.hasIceCppLib(_project, "Glacier2"))
                    {
                        componentChanged("Glacier2", chkGlacier2.Checked);
                        if(!chkGlacier2.Checked)
                        {
                            components.Add("Glacier2");
                        }
                    }
                    if(chkIceBox.Checked != Util.hasIceCppLib(_project, "IceBox"))
                    {
                        componentChanged("IceBox", chkIceBox.Checked);
                        if(!chkIceBox.Checked)
                        {
                            components.Add("IceBox");
                        }
                    }
                    if(chkIceGrid.Checked != Util.hasIceCppLib(_project, "IceGrid"))
                    {
                        componentChanged("IceGrid", chkIceGrid.Checked);
                        if(!chkIceGrid.Checked)
                        {
                            components.Add("IceGrid");
                        }
                    }
                    if(chkIcePatch2.Checked != Util.hasIceCppLib(_project, "IcePatch2"))
                    {
                        componentChanged("IcePatch2", chkIcePatch2.Checked);
                        if(!chkIcePatch2.Checked)
                        {
                            components.Add("IcePatch2");
                        }
                    }
                    if(chkIceSSL.Checked != Util.hasIceCppLib(_project, "IceSSL"))
                    {
                        componentChanged("IceSSL", chkIceSSL.Checked);
                        if(!chkIceSSL.Checked)
                        {
                            components.Add("IceSSL");
                        }
                    }
                    if(chkIceStorm.Checked != Util.hasIceCppLib(_project, "IceStorm"))
                    {
                        componentChanged("IceStorm", chkIceStorm.Checked);
                        if(!chkIceStorm.Checked)
                        {
                            components.Add("IceStorm");
                        }
                    }
                }

                //
                // This must be the last setting to be updated, as we want to update
                // all other settings and that isn't possible if the builder is disabled.
                //
                if(!chkEnableBuilder.Checked && Util.isSliceBuilderEnabled(_project))
                {
                    Util.removeBuilderFromProject(_project, components);
                    _initialized = false;
                    load();
                    _initialized = true;
                    _changed = true;
                }

                return true;
            }
            finally
            {
                needSave(); // Call needSave to update apply button status
            }
        }
Esempio n. 33
0
        public IntegratePropertyResult Predict(Spectrum spec, bool needFilter = true)
        {
            IntegratePropertyResult result = new IntegratePropertyResult()
            {
                FitRate    = this.FitRate,
                IDRate     = this.IDRate,
                PLS1Rate   = this.PLS1Rate,
                PLSANNRate = this.PLSANNRate,
                Comp       = this._comp.Clone()
            };

            if (this._comp == null)//性质为空,则返回NULL
            {
                return(null);
            }


            if (this._pls1 != null && this._pls1.Comp.Name == this._comp.Name)
            {
                result.PLS1Result = this._pls1.Predict(spec, needFilter);
            }
            if (this._plsann != null && this._plsann.Comp.Name == this._comp.Name)
            {
                result.PLSANNResult = this._plsann.Predict(spec, needFilter);
            }

            //识别
            if (this._identify != null && this._identify.Count > 0)
            {
                foreach (var i in this._identify)
                {
                    if (i.SpecLib.Components.Contains(this._comp.Name))
                    {
                        result.IDResult = BindModel.CombineIdResult(result.IDResult, i.Predict(spec, needFilter));
                    }
                }
                //过滤其它性质
                ComponentList clst = new ComponentList();
                foreach (var c in result.IDResult.Components)
                {
                    if (c.Name == this._comp.Name)
                    {
                        clst.Add(c.Clone());
                        break;
                    }
                }
                foreach (var s in result.IDResult.Items)
                {
                    var c = s.Spec.Components[this._comp.Name].Clone();
                    s.Spec.Components = new ComponentList();
                    s.Spec.Components.Add(c);
                }
                result.IDResult.Components = clst;
            }

            //拟合
            if (this._fittings != null && this._fittings.Count > 0)
            {
                var fitmodel = Serialize.DeepClone <FittingModel>(this._fittings.First());
                for (int i = 1; i < this._fittings.Count; i++)
                {
                    if (this._fittings[i].SpecLib.Components.Contains(this._comp.Name))
                    {
                        fitmodel.SpecLib.Merger(this._fittings[i].SpecLib);
                    }
                }
                result.FitResult = fitmodel.Predict(spec, needFilter);
                //过滤其它性质
                ComponentList clst = new ComponentList();
                foreach (var c in result.FitResult.FitSpec.Components)
                {
                    if (c.Name == this._comp.Name)
                    {
                        clst.Add(c.Clone());
                        break;
                    }
                }
                result.FitResult.FitSpec.Components = clst;

                foreach (var s in result.FitResult.Specs)
                {
                    var c = s.Spec.Components[this._comp.Name].Clone();
                    s.Spec.Components = new ComponentList();
                    s.Spec.Components.Add(c);
                }
            }


            return(result);
        }
Esempio n. 34
0
 private ComponentList iceComponents()
 {
     ComponentList components = new ComponentList();
     if(chkFreeze.Checked)
     {
         components.Add("Freeze");
     }
     if(chkGlacier2.Checked)
     {
         components.Add("Glacier2");
     }
     if(chkIceBox.Checked)
     {
         components.Add("IceBox");
     }
     if(chkIceGrid.Checked)
     {
         components.Add("IceGrid");
     }
     if(chkIcePatch2.Checked)
     {
         components.Add("IcePatch2");
     }
     if(chkIceSSL.Checked)
     {
         components.Add("IceSSL");
     }
     if(chkIceStorm.Checked)
     {
         components.Add("IceStorm");
     }
     return components;
 }
Esempio n. 35
0
        private void chkEnableBuilder_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if(editingIncludeDir())
                {
                    endEditIncludeDir(true);
                }
                if(_initialized)
                {
                    _initialized = false;
                    setEnabled(chkEnableBuilder.Checked);
                    ComponentList components;
                    if(chkEnableBuilder.Checked)
                    {
                        //
                        // Enable the components that were previously enabled if any.
                        //
                        components =
                            new ComponentList(Util.getProjectProperty(_project, Util.PropertyIceComponents));

                        //
                        // If there isn't a previous set of componets, we enable the default components.
                        //
                        if(components.Count == 0)
                        {
                            components.Add("Ice");
                            components.Add("IceUtil");
                        }
                        for(int i = 0; i < components.Count; ++i)
                        {
                            checkComponent(components[i], true);
                        }
                    }
                    else
                    {
                        components = iceComponents();
                    }

                    //
                    // Enable / Disable the given set of components
                    //
                    for(int i = 0; i < components.Count; ++i)
                    {
                        checkComponent(components[i], chkEnableBuilder.Checked);
                    }

                    chkEnableBuilder.Enabled = true;
                    _initialized = true;
                    needSave();
                }
                Cursor = Cursors.Default;
            }
            catch(Exception ex)
            {
                Cursor = Cursors.Default;
                Util.unexpectedExceptionWarning(ex);
                throw;
            }
        }