全自动超声波清洗机控制软件用户手册1/******************************************************//**用户设置类//******************************************************/usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usingSystem.Windows.Input;usingSystem.Windows.Media;usingSystem.Windows.Media.Imaging;usingSystem.Windows.Navigation;usingSystem.Windows.Shapes;usingSystem.IO;publicpartialclassUsersettings{///Representsagroupofpropertysettings.[TypeConverter(typeof(ExpandableObjectConverter))]publicclassXmlPropertySettingGroup{privateXmlPropertySettingCollectionpropertySettings;privateXmlSelectorCollectionselectors;privatestringbasedOn;///Getsorsetsthecollectionofproperties.[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]publicXmlPropertySettingCollectionPropertySettings{get{if(propertySettings==null){propertySettings=newXmlPropertySettingCollection();}returnpropertySettings;}//set{propertySettings=value;}}///Getsorsetsthecollectionofselectors.[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]publicXmlSelectorCollectionSelectors{get{if(selectors==null){selectors=newXmlSelectorCollection(1);}returnselectors;}//set{selectors=value;}}///Retrievesthestringrepresentationoftheinstance.///returns/returnspublicoverridestringToString(){returnPropertySettingGroup;}///Retrievethenameofthegroup.全自动超声波清洗机控制软件用户手册2publicstringGroupName{get{if(this.Selectors==null||this.Selectors.Count==0){returnInitialState;}if(Selectors[0]isXmlSelectorBase){XmlConditioncondition=((XmlSelectorBase)Selectors[0]).Condition;if(condition!=null){returncondition.BuildExpressionString();}else{returnInitialState;}}returnUnknownState;}}///Getsorsetsvalueindicatingthekeyofarepositoryitemwhichthisgroupisbasedon.[DefaultValue()]publicstringBasedOn{get{returnthis.basedOn;}set{this.basedOn=value;}}///DetermineswhethertheBasedOnpropertyshouldbeserialized.///returns/returns[EditorBrowsable(EditorBrowsableState.Never)]publicboolShouldSerializeBasedOn(){return!string.IsNullOrEmpty(this.basedOn);}publicPropertySettingGroupDeserialize(){PropertySettingGroupgroup=newPropertySettingGroup();group.BasedOn=this.basedOn;if(this.propertySettings!=null){for(intsettingIndex=0;settingIndexthis.PropertySettings.Count;settingIndex++){XmlPropertySettingxmlPropertySetting=this.PropertySettings[settingIndex];IPropertySettingsetting=xmlPropertySetting.Deserialize();group.PropertySettings.Add(setting);}}if(this.selectors!=null){for(intselectorIndex=0;selectorIndexthis.Selectors.Count;selectorIndex++){XmlElementSelectorxmlSelector=this.Selectors[selectorIndex];IElementSelectorselector=xmlSelector.Deserialize();group.Selectors.Add(selector);}}全自动超声波清洗机控制软件用户手册3returngroup;}}}}/******************************************************//**环境检测类//******************************************************/usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usingSystem.Windows.Input;usingSystem.Windows.Media;usingSystem.Windows.Media.Imaging;usingSystem.Windows.Navigation;usingSystem.Windows.Shapes;usingSystem.IO;publicpartialclassEnvironmentaltesting{///Atestworkitemthatiscompleteoncetheconditionisasserted.publicclassAsyncConditionalWorkItem:AsyncWorkItem{///Theconditionaldelegate.privateFuncboolconditionDelegate;///Constructanewconditionalworkitem.///paramname=conditionalDelegateConditionaldelegate./parampublicAsyncConditionalWorkItem(FuncboolconditionalDelegate):base(){this.conditionDelegate=conditionalDelegate;}///Invokethecondition,willcontinueinvokinguntil///theconditionisfalse.publicoverridevoidInvoke(){if(this.conditionDelegate()==true){this.IsComplete=true;}}}}}/******************************************************//**系统检测类//******************************************************/usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usingSystem.Windows.Input;usingSystem.Windows.Media;全自动超声波清洗机控制软件用户手册4usingSystem.Windows.Media.Imaging;usingSystem.Windows.Navigation;usingSystem.Windows.Shapes;usingSystem.IO;publicpartialclassDetectionsystem{///Holdsextensionmethodsforseecref=ICollection{T}/.publicstaticclassCollectionExtensions{///Addstheelementsfromthespecifiedcollection-paramrefname=items/totheendofthetargetparamrefname=collection/.///paramname=collectionThecollectionthatwillbeextended./param///paramname=itemsTheitemsthatwillbeadded./param///exceptioncref=ArgumentNullExceptionparamrefname=items/isnull/exceptionpublicstaticvoidAddRangeT(thisICollectionTcollection,IEnumerableTitems){if(items==null)thrownewArgumentNullException(items);items.ForEach(item=collection.Add(item));}///Addstheelementsfromthespecifiedcollection-paramrefname=i