2空调电流保护软件源代码概述.docx
《2空调电流保护软件源代码概述.docx》由会员分享,可在线阅读,更多相关《2空调电流保护软件源代码概述.docx(180页珍藏版)》请在冰点文库上搜索。
![2空调电流保护软件源代码概述.docx](https://file1.bingdoc.com/fileroot1/2023-5/5/392b7e65-1744-4131-b4a0-fc6aab71718d/392b7e65-1744-4131-b4a0-fc6aab71718d1.gif)
2空调电流保护软件源代码概述
/******************************************************
//**软件登录类
//******************************************************/
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;
publicpartialclassSoftwarelogin{
///ScaleBreaksExample
publicpartialclassForm1:
ExamplesForm
{
publicForm1()
{
InitializeComponent();
radChart1.Series.Clear();
ChartSeriescs=newChartSeries();
cs.Items.Add(newChartSeriesItem(5));
cs.Items.Add(newChartSeriesItem(50));
cs.Items.Add(newChartSeriesItem(500));
cs.Items.Add(newChartSeriesItem(5000));
radChart1.PlotArea.YAxis.ScaleBreaks.Enabled=true;
radChart1.PlotArea.YAxis.ScaleBreaks.MaxCount=2;
radChart1.Series.Add(cs);
radChart1.Update();
this.EnabledQSFButtons=QSFButtons.None;
}
}
}
}
/******************************************************
//**操作员身份确认类
//******************************************************/
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;
publicpartialclassOperatoridentityconfirmation{
///Staticclasswithmethodstohelpwithvalidation.
internalstaticclassValidationUtil
{
////#ifSILVERLIGHT
////
///////AddsanewValidationResulttothecollectionifanequivalentdoesnotexist.
////
///////ValidationResultstosearchthrough
///////ValidationResulttoadd
////publicstaticvoidAddIfNew(thisICollectioncollection,ValidationResultvalue)
////{
////if(!
collection.ContainsEqualValidationResult(value))
////{
////collection.Add(value);
////}
////}
////#endif
///Performsanactionandcatchesanynon-criticalexceptions.
///Actiontoperform.
publicstaticvoidCatchNonCriticalExceptions(Actionaction)
{
try
{
action();
}
catch(Exceptionexception)
{
if(IsCriticalException(exception))
{
throw;
}
//Catchanynon-criticalexceptions.
}
}
///CreatesanewBindingthatisashallowcopyofthesourceBinding.
///TheBindingtoclone.
///TheclonedBinding.
publicstaticBindingCloneBinding(Bindingsource)
{
Bindingclone=newBinding();
if(source==null)
{
returnclone;
}
clone.BindsDirectlyToSource=source.BindsDirectlyToSource;
clone.Converter=source.Converter;
clone.ConverterCulture=source.ConverterCulture;
clone.ConverterParameter=source.ConverterParameter;
clone.FallbackValue=source.FallbackValue;
clone.Mode=source.Mode;
clone.NotifyOnValidationError=source.NotifyOnValidationError;
clone.Path=source.Path;
clone.StringFormat=source.StringFormat;
clone.TargetNullValue=source.TargetNullValue;
clone.UpdateSourceTrigger=source.UpdateSourceTrigger;
clone.ValidatesOnExceptions=source.ValidatesOnExceptions;
clone.ValidatesOnDataErrors=source.ValidatesOnDataErrors;
#ifSILVERLIGHT
clone.ValidatesOnNotifyDataErrors=source.ValidatesOnNotifyDataErrors;
#endif
//Bindingkeepstrackofwhichofthethreesettersfor
//ElementName,RelativeSource,andSourcehavebeencalled.
//Callinganytwoofthesetters,evenifthevaluepassedinisnull,
//willraiseanexception.Forthatreason,wemustcheckfornull
//forthesepropertiestoensurethatweonlycallthesetterwhenweshould.
if(source.ElementName!
=null)
{
clone.ElementName=source.ElementName;
}
elseif(source.RelativeSource!
=null)
{
clone.RelativeSource=source.RelativeSource;
}
elseif(source.Source!
=null)
{
clone.Source=source.Source;
}
returnclone;
}
////#ifSILVERLIGHT
////
///////DetermineswhetherthecollectioncontainsanequivalentValidationResult
////
///////ValidationResultstosearchthrough
///////ValidationResulttosearchfor
///////
////publicstaticboolContainsEqualValidationResult(thisICollectioncollection,ValidationResulttarget)
////{
////return(collection.FindEqualValidationResult(target)!
=null);
////}
////
///////SearchesaValidationResultforthespecifiedtargetmembername.Ifthetargetisnull
///////orempty,thismethodwillreturntrueiftherearenomembernamesatall.
////
///////ValidationResulttosearch.
///////Membernametosearchfor.
///////Trueiffound.
////publicstaticboolContainsMemberName(thisValidationResultvalidationResult,stringtarget)
////{
////intmemberNameCount=0;
////foreach(stringmemberNameinvalidationResult.MemberNames)
////{
////if(string.Equals(target,memberName))
////{
////returntrue;
////}
////memberNameCount++;
////}
////return(memberNameCount==0&&string.IsNullOrEmpty(target));
////}
////
///////FindsanequivalentValidationResultifoneexists.
////
///////ValidationResultstosearchthrough.
///////ValidationResulttofind.
///////EqualValidationResultiffound,nullotherwise.
////publicstaticValidationResultFindEqualValidationResult(thisICollectioncollection,ValidationResulttarget)
////{
////foreach(ValidationResultoldValidationResultincollection)
////{
////if(oldValidationResult.ErrorMessage==target.ErrorMessage)
////{
////boolmovedOld=true;
////boolmovedTarget=true;
////IEnumeratoroldEnumerator=oldValidationResult.MemberNames.GetEnumerator();
////IEnumeratortargetEnumerator=target.MemberNames.GetEnumerator();
////while(movedOld&&movedTarget)
////{
////movedOld=oldEnumerator.MoveNext();
////movedTarget=targetEnumerator.MoveNext();
////if(!
movedOld&&!
movedTarget)
////{
////returnoldValidationResult;
////}
////if(movedOld!
=movedTarget||oldEnumerator.Current!
=targetEnumerator.Current)
////{
////break;
////}
////}
////}
////}
////returnnull;
////}
////#endif
///SearchesthroughallBindingsonthespecifiedelementandreturnsalistofBindingInfoobjects
///foreachBindingthatmatchesthespecifiedcriteria.
///FrameworkElementtosearch.
///OnlyreturnBindingswithacontextelementequaltothisobject.
///Iftrue,onlyreturnsTwoWayBindings.
///Iftrue,ignoreselementsnottypicallyusedforinput.
///Iftrue,onlyreturnsTwoWayBindings.
///TheBindingsearchwillskipalloftheseTypes.
///ListofBindingInfoforeveryBindingfound.
publicstaticListGetBindingInfo(thisFrameworkElementelement,objectdataItem,booltwoWayOnly,booluseBlockList,boolsearchChildren,paramsType[]excludedTypes)
{
ListbindingData=newList();
if(!
searchChildren)
{
if(excludedTypes!
=null)
{
foreach(TypeexcludedTypeinexcludedTypes)
{
if(excludedType!
=null&&excludedType.IsInstanceOfType(element))
{
returnbindingData;
}
}
}
returnelement.GetBindingInfoOfSingleElement(element.DataContext?
?
dataItem,dataItem,twoWayOnly,useBlockList);
}
Stackchildren=newStack();
Stack
children.Push(element);
dataContexts.Push(element.DataContext?
?
dataItem);
while(children.Count!
=0)
{
boolsearchChild=true;
DependencyObjectchild=children.Pop();
objectinheritedDataContext=dataContexts.Pop();
objectdataContext=inheritedDataContext;
//SkipthisparticularchildelementifitisoneoftheexcludedTypes
if(excludedTypes!
=null)
{
foreach(TypeexcludedTypeinexcludedTypes)
{
if(excludedType!
=null&&excludedType.IsInstanceOfType(child))
{
searchChild=false;
break;
}
}
}
//Addthebindingsofthechildelementandpushitschildrenontothestackofremainingelementstosearch
if(searchChild)
{
FrameworkElementchildElement=childasFrameworkElement;
if(childElement!
=null)
{
dataContext=childElement.DataContext?
?
inheritedDataContext;
bindingData.AddRange(childElement.GetBindingInfoOfSingleElement(inheritedDataContext,dataItem,twoWayOnly,useBlockList));
}
intchildrenCount=VisualTreeHelper.GetChildrenCount(child);
for(intchildIndex=0;childIndex{
children.Push(VisualTreeHelper.GetChild(child,childIndex));
dataContexts.Push(dataContext);
}
}
}
returnbindingData;
}
///Getsalistofthespecifie