private void DeleteExecute(object parameter) { FileTabItem item = parameter as FileTabItem; int index = _tabItems.IndexOf(item); int selectedIndex = FileTab.SelectedIndex; if (index > -1 && index < _tabItems.Count) { if (item.Changed == true) { string message = (string)Application.Current.Resources["m_Unsaved_Changes"]; MessageBoxResult result = MessageBox.Show(message, "Unsaved changes", MessageBoxButton.YesNo); if (result != MessageBoxResult.Yes) { return; } } if (_tabItems.Count == 1) { AddNewTab(); } if (index == selectedIndex) { FileTab.SelectedIndex = 0; } _tabItems.RemoveAt(index); } }
private void AddNewTab() { FileTabItem tab = new FileTabItem(); _tabItems.Add(tab); FileTab.SelectedIndex = _tabItems.Count - 1; }
private void SaveCommandCanExecute(object sender, CanExecuteRoutedEventArgs e) { if (FileTab == null) { e.CanExecute = false; return; } FileTabItem item = FileTab.SelectedItem as FileTabItem; //e.CanExecute = item.Changed; e.CanExecute = true; }
internal void RunEquationGenerationDAE(MainWindow window) { FileTabItem tab = null; Dispatcher.Invoke(() => { tab = window.FileTab.SelectedItem as FileTabItem; }); if (tab == null) { return; } List <ErrorMessage> errorList = new List <ErrorMessage>(); Dispatcher.Invoke(() => { window.FileTab.Focus(); window.StatusText = "Генерация уравнений"; }); //Thread.Sleep(4000); //Test of UI List <string> outputList = new List <string>(); try { string text = ""; window.Dispatcher.Invoke(() => { text = tab.Document.Text; }); PowerModel.MainInterpreter.EquationGenerationDAE(text, ref errorList, ref outputList); } catch (Exception exc) { Dispatcher.Invoke(() => { window.OutputText += exc.Message; window.OutputText += "\n"; window.OutputText += exc.StackTrace; }); return; } Dispatcher.Invoke(() => { foreach (ErrorMessage error in errorList) { window.errors.Add(error); } foreach (var output in outputList) { window.OutputText += output; window.OutputText += "\n"; } window.StatusText = "Готово"; } ); return; }
private void SaveAsCommand() { FileTabItem item = FileTab.SelectedItem as FileTabItem; SaveFileDialog dialog = new SaveFileDialog(); if (!dialog.ShowDialog().Value) { return; } string path = dialog.FileName; string filename = dialog.SafeFileName; if (SaveFile(path, item.Document.Text)) { item.FilePath = path; item.Filename = filename; item.Changed = false; } }
private void SaveCommandExecuted(object sender, ExecutedRoutedEventArgs e) { FileTabItem item = FileTab.SelectedItem as FileTabItem; string path = item.FilePath; string filename = item.Filename; if (item.FilePath == null) { SaveFileDialog dialog = new SaveFileDialog(); if (!dialog.ShowDialog().Value) { return; } path = dialog.FileName; filename = dialog.SafeFileName; } if (SaveFile(path, item.Document.Text)) { item.FilePath = path; item.Filename = filename; item.Changed = false; } }
private void OpenCommandExecuted(object sender, ExecutedRoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Multiselect = false; if (!dialog.ShowDialog().Value) { return; } try { string content = LoadFile(dialog.FileName); //System.Diagnostics.Debug.Write(dialog.FileName+"\n"+dialog.SafeFileName); FileTabItem tab = new FileTabItem(dialog.SafeFileName, dialog.FileName, content); _tabItems.Add(tab); FileTab.SelectedIndex = _tabItems.Count - 1; } catch (Exception) { return; } }
public TextControl(FileTabItem parent, OpenedFile fileDef) { m_eventLock = new Public.EventLock(); if (s_mapKeyWordsGroup == null) { s_mapKeyWordsGroup = new Dictionary<SolidColorBrush, List<string>> { { new SolidColorBrush(System.Windows.Media.Color.FromArgb(0xFF, 0x4E, 0xC9, 0xB0)), new List<string> { } }, { #region 关键字 new SolidColorBrush(System.Windows.Media.Color.FromArgb(0xFF, 0x56, 0x9C, 0xD6)), new List<string> { "String ", "int ", "bool ", "double ", "float ", "long ", "short ", "if", "else", "do", "while", "for", "switch", "case", "default", "break", "continue", "goto", "struct", "class", "function", "sizeof", "static", "call" } #endregion }, { //Netbeans中查找引用后,在VS中正则替换“.*registerFunc\(id,[ ]*"([0-9a-z_]*)".*”为“"$1(",”。然后,“\n([a-z]+)”变为“\n//$1”。 new SolidColorBrush(System.Windows.Media.Color.FromArgb(0xFF, 0xFF, 0x80, 0x00)), new List<string> { #region 函数名 //DsBoloUI //BoloScriptUtil.cpp "parseInt(", "parseIntBackward(", "replaceInt(", "replaceIntBackward(", "replaceString(", "replaceWString(", "lowcase(", "checkFullwidthChar(", "convertFullwidthChar(", "getUrlArg(", //BoloUISceneLib.cpp "getName(", "clear(", "get(", "set(", "getAuction(", "setAuction(", "clearAuction(", "getPointerX(", "getPointerY(", "getPointerId(", "getCurSceneName(", "setScenePosition(", "getScreenW(", "getScreenH(", "loadUIData(", "getAfkTime(", "getAfkTimeSeconds(", "onSceneEvent(", "setMaskUiDrawMode(", "enableCheckUiCanmoveRole(", "rename(", "getNameWithID(", "setNameWithID(", "setSceneVisible(", "setSceneVisibleForce(", "getSceneVisible(", "setVisible(", "setVisible_alpha(", "setVisibleWithID(", "setVisibleWithID_alpha(", "setVisibleWithID_checkCondition(", "setParentVisibleWithID(", "getVisible(", "getVisibleWithID(", "getOnDrawWithID(", "getVisibleWithID_conditionSet(", "getSetVisible(", "getSetVisibleWithID(", "setFocus(", "setFocusWithID(", "getFocus(", "getFocusWithID(", "setCanFocus(", "setCanFocusWithID(", "getCanFocus(", "getCanFocusWithID(", "setEnable(", "setEnableWithID(", "setEnableWithID_checkCondition(", "getEnable(", "getEnableWithID(", "getEnableWithID_conditionSet(", "getShowMovied(", "getShowMoviedWithID(", "getText(", "getTextWithID(", "setText(", "setTextWithID(", "setTextJustWithID(", "getSkin(", "getSkinWithID(", "setSkin(", "setSkinWithID(", "setPosition(", "setPositionWithID(", "setPositionWithScreenPosition(", "setScreenPosition(", "setScreenPositionWithID(", "getX(", "getY(", "getXWithID(", "getYWithID(", "getx(", "gety(", "getxWithID(", "getyWithID(", "getDx(", "getDy(", "getDxWithID(", "getDyWithID(", "getInitDx(", "getInitDy(", "getInitDxWithID(", "getInitDyWithID(", "getDrawX(", "getDrawY(", "getDrawXWithID(", "getDrawYWithID(", "getInitDrawX(", "getInitDrawY(", "getInitDrawXWithID(", "getInitDrawYWithID(", "getID(", "setCountdownPresetTimestringWithID(", "copyAndAddTo(", "copyAndAddTo_alpha(", "copyAndAddToWithID(", "copyAndAddToBrotherWithID(", "copyAndAddToWithID_alpha(", "copyAndInsertToWithID(", "copyAndAddToAnotherScene(", "setHeight(", "setWidth(", "getHeight(", "getWidth(", "getHeightWithID(", "getWidthWithID(", "setScale(", "setScaleWithID(", "setUIScript(", "setControlScript(", "setControlScriptWithID(", "runControlScript(", "runControlScriptWithID(", "showMessage(", "onEvent_onClick(", "onEvent_onClick_WithID(", "onEvent_onClick_WithID_curScene(", "onEvent(", "onEvent_WithID(", "getParentName(", "getParentIDWithID(", "getParentNameWithID(", "setApperance(", "setApperanceWithID(", "setCurApperanceScale(", "setCurSkinImgGrayLevelWithID(", "setTextAlphaWithID(", "setDraggedPanelWithID(", "isExistControl(", "isExistControlWithID(", "getControlState(", "getControlStateWithID(", "setControlState(", "setControlStateWithID(", "setControlDataWithID(", "getControlDataWithID(", "addControlDataWithID(", "removeControlDataWithID(", "moveScrollTopWithID(", "moveScrollBottomWithID(", "enableZoomAnimation(", "enableZoomAnimationWithID(", "setZoomAnimationAnchorWithID(", "setAngle(", "setAllSkinAngleWithIDAndApType(", "setAllSkinAngleWithIDAndApTypeAndApId(", "setStopFrameIndex(", "getStopFrameIndex(", "setEnableClipArea(", "enableRotateAnimationWithID(", "enableMoveAnimationWithID(", "enableZoomAnimationListWithID(", "clearAnimationEffectWithID(", "getAnimationActiveWithID(", "getZoomAnimationScalexWithID(", "setRememberScrollPos(", "setRememberScrollPosWithID(", "setAnchor(", "setAnchorWithID(", "setAnchorSelf(", "setAnchorSelfWithID(", "getExpectVisibleWithID(", "setColorWithID(", "updateSkinWithXml(", "getUiNeedResourceList(", "loadImportXml(", "removeImportXml(", "removeUiImportXml(", "removeImportXmlWithId(", "removeAllImportXml(", "setControlCsvDataWithID(", "getControlCsvDataWithID(", "createBoloUISkin(", "moveControlScrollLen(", "moveControlScrollLenWithID(", "getTextLenWithID(", "clearAddControl(", "clearAddControlWithID(", "clearAddControlWithBrotherID(", "getControlIndex(", "setControlIndex(", "getControlIndexWithID(", "getControlIDWithIndex(", "getControlIDWithIndexById(", "getVControlIDWithIndex(", "getVControlIDWithIndexById(", "getAddControlIDWithIndex(", "getAddControlIDWithIndexByID(", "getCheckOnID(", "getCheckOnIDWithID(", "removeControlWithID(", "removeControl(", "getControlsSize(", "getVControlsSize(", "getAddControlsSize(", "getVControlsSizeWithID(", "getControlsSizeWithID(", "getAddControlsSizeWithID(", "getRadioOnselect(", "getRadioOnselectWithID(", "setControlScrollDecaySpeed(", "setControlScrollDecaySpeedWithID(", "setSkinGrayLevelWithID(", "getControlIDByWindowIDWithIndex(", "getVControlIDByWindowIDWithIndex(", "getControlTypeWithID(", "checkAllUIExceptName(", "checkAllUIExceptNamelist(", "setCurrentValue(", "setCurrentValueWithID(", "setChangeSpeedWithID(", "setChangeRateWithID(", "setShowValueWithID(", "getCurrentValueWithID(", "getCurrentValue(", "getShowValue(", "getShowValueWithID(", "setShowValue(", "setChangeSpeed(", "getChangeSpeed(", "setChangeRate(", "getChangeRate(", "getProgressMax(", "getProgressMin(", "setProgressMax(", "setProgressMin(", "setProgressDecaySpeed(", "setProgressDecay(", "getProgressDecaySpeed(", "getProgressDecay(", "setProgressPreGrowth(", "getProgressPreGrowth(", "getProgressBufferValue(", "setProgressBufferPercent(", "setProgressDecayAdd(", "checkValueStep(", "checkValueStepWithID(", "getTabSelectIndex(", "getTabSelectIndexWithID(", "getTabSelectIndexWithID_atControls(", "setTabSelectIndex(", "setTabSelectIndexNoEvent(", "setTabSelectIndexWithID(", "setTabSelectIndexWithID_atControls(", "setTabSelectIndexWithIDNoEvent(", "getTabControlIndexText(", "getTabVcontrolSize(", "enTabBlink(", "enTabBlinkWithID(", "setTabBlink(", "setTabBlinkWithID(", "getTabSelectName(", "getTabSelectID(", "getTabInfo(", "getTabInfoWithID(", "setTabPack(", "setTabPackWithID(", "getTabPack(", "getTabPackWithID(", "getTabSelectedWithID(", "isSelect(", "isSelectWithID(", "getRadioSelectWithID(", "setRadioSelect(", "setRadioSelectWithID(", "setRadioOnSelect(", "setRadioOnSelectWithID(", "setRadioSelectWithID_onEvent(", "getCheckSelect(", "getCheckSelectWithID(", "setCheckSelect(", "setCheckSelectWithID(", "getHandScale(", "getDraggedX(", "getDraggedY(", "getDraggedXlen(", "getDraggedYlen(", "getPanelDdx(", "getPanelDdy(", "setPanelControlAtMiddle(", "getSkillButtonCDWithID(", "setSkillButtonCDWithID(", "getSkillButtonLeftCDWithID(", "setSkillButtonLeftCDWithID(", "setSkillButtonStartCDWithID(", "getSkillButtonColdDownWithID(", "cancleCD(", "cancleCDWithID(", "setCD(", "startCD(", "getListSelectIndex(", "getListSelectIndexWithID(", "setListSelectIndex(", "getListSelectID(", "getListSelectedID(", "getListSelectedIDWithID(", "getListVcontrolSize(", "getListVcontrolSizeWithID(", "getListAddcontrolSizeWithID(", "getListCheckOnID(", "getListVControlIDWithIndex(", "getListVControlIDWithIndexWithID(", "getListControlIDWithIDWithIndex(", "getListAddControlIDWithIndex(", "setListVscrollBottom(", "setListVscrollBottomForce(", "setListVscrollTop(", "getListControlsMax(", "setListControlAtMiddle(", "setListSelectBaseIDWithID(", "setRichVscrollBottom(", "setRichVscrollBottomForce(", "setRichVscrollTop(", "setRichConvertFace(", "setRichConvertFaceWithID(", "setRichReadonly(", "setRichTips(", "setRichTipsWithID(", "getRichTipsWithID(", "setRichInputFocus(", "getRichInputFocus(", "setRichShowInput(", "getRichClickAreas(", "getRichClickAreasWithID(", "setRichBeforeSkins(", "setRichBeforeSkinsWithID(", "setRichFocus(", "setRichFocusWithID(", "getDraggedPanel_srcName(", "getDraggedPanel_srcID(", "setDraggedPanelDraggedCheckOri(", "setDraggedPanelDraggedCheckOriWithID(", "getIsCopyExist(", "setCopyVisibleWithID(", "getCopyDrawXWithID(", "getCopyDrawYWithID(", "enButtonBlink(", "enButtonBlinkWithID(", "isButtonBlinkWithID(", "enButtonCountClickWithID(", "setButtonBlink(", "setButtonBlinkWithID(", "setButtonBlinkTimeWithID(", "getButtonBlinkTimeWithID(", "setButtonBlinkTextWithID(", "getButtonBlinkTextWithID(", "getButtonCountClickWithID(", "setButtonCountClickWithID(", "setCountdownTime(", "setCountdownTimeWithID(", "getCountdownTimeWithID(", "setCountdownStart(", "setCountdownStartWithID(", "setCountdownType(", "setCountdownTypeWithID(", "setCountdownTimestring(", "setCountdownRateWithID(", "setTurntableResult(", "setTurntableResultWithID(", "setTurntableRun(", "setTurntableRunWithID(", "getTurntableOnrunning(", "setVirtualPadBlinkWithID(", "setVirtualPadType(", "getVirtualPadType(", "setLabelScrollcountType(", "setLabelScrollTime(", "setLabelDefaultMsgTime(", "setLabelTextscrollBeginX(", "setLabelScrollTimeMax(", "setLabelNextUiEvent(", "setPagepanelTurnEnable(", "setPagepanelTurnEnableWithID(", "setPagepanelStopIndex(", "setPagepanelStopIndexWithID(", "setPagepanelStopIDWithID(", "getPagepanelStopIndex(", "getPagepanelStopIndexWithID(", "addItem(", "getItem(", "setOnkeySelectWithID(", "setOnkeySelectWithName(", "getKeyCurnodeExist(", //BoloXML.cpp "loadFile(", "loadFileWithResName(", "clear(", "next(", "getName(", "getText(", "getAttributeValue(", "endOfFile(", "getDepth(", "isTagStart(", "isTextStart(", "endOfFile(", "nextTag(", "nextStartTagName(", "readNextTagWithName(", //MOBASprite //SpriteScriptManager.cpp "roleUseSkillWithIndex(", "roleCancelSkillWithIndex(", "roleMoveToPosition(", "getRoleSkillIsDurationSkill(", "getRoleSkillIsInstantSkill(", "roleShowSkillRange(", "createSprite(", "getModelHeight(", "setSpriteScale(", "setSpriteMaterial(", "setSpriteMaterialHeightLight(", "deleteSprite(", "initSpriteBloodBar(", "getMonsterBloodType(", "createParticleAtPos(", "createParticleAtPosWithLoop(", "createParticleAtPosWithLoopAndCreateInfo(", "createParticleAtPosWithLoopAndCreatorID(", "createParticleWithSprite(", "createParticleWithSpriteBind(", "createParticleWithSpriteBindAndLoop(", "createParticleWithSpriteBindAndLoopAndDeathType(", "createParticleWithSpriteBindAndLastTime(", "isParticlePlaying(", "setParticleRotateEuler(", "setParticleText(", "setParticleStringBoardFont(", "removeParticle(", "stopParticle(", "playParticle(", "removeAllBindParticle(", "setAllBindParticleVisible(", "removeBindParticleWithName(", "setParticleVisible(", "setParticleScale(", "setPlaneMeshParticleScale(", "setSpritePosition(", "hideModelGroupWithIndex(", "setModelGroupColorWithIndex(", "getSpritePosition(", "getSpriteInitTime(", "setSpriteState(", "clearSpriteState(", "setSpriteAngle(", "getSpriteAngle(", "getSpriteTurnSpeed(", "setSpriteTurnSpeed(", "enableSpriteTowerActive(", "isCheckTowerAttackRingType(", "setTurnMaxTime(", "setBrokenHp(", "getSpriteHeight(", "getSpriteModelName(", "getSpriteIdsWithPrototype(", "getPrototypeWithID(", "getSpriteState(", "isSpriteDeath(", "isSpriteMoving(", "getSpriteVisible(", "setSpriteVisible(", "setSpriteHeroBornDelay(", "setSpriteHeroBornInterval(", "updateSpriteHeroBornDelay(", "getSpriteIsInScreen(", "clearAllSprite(", "setCameraLookAtToRole(", "setCameraLookAtToSprite(", "setCameraLookAtToPos(", "setCameraLookAtToMiniMapPos(", "enableCameraFollowToRole(", "setCameraFollowToRole(", "setCameraFollowToSprite(", "getCameraFollowToSprite(", "setCameraFollowPosOffset(", "getCameraBornPos(", "setCameraLightEnable(", "getRoleId(", "getSpriteCampIndex(", "getSpriteName(", "getRoleCampIndex(", "getHeroSkillLen(", "reduceSkillCd(", "getHeroSkillWithIndex(", "getHeroAttributeLen(", "getHeroAttributeWithIndex(", "getHeroTalentLen(", "getHeroTalentWithIndex(", "getHeroLevelWithId(", "getHeroIsBelongRoleWithID(", "getBelongRoleWithID(", "getHeroStarWithID(", "getCareerIndexWithID(", "getSpriteHp(", "getRoleHpMp(", "enableFreezeHeight(", "setServerTempModelAnimationMap(", "checkSpriteExist(", "setAction(", "setActionList(", "transMapPosToScreenPos(", "transScreenPosToMapPosInCameraHeight(", "transScreenPosToMapPosWithPara(", "isEnemy(", "isHero(", "isTower(", "isEliteMonster(", "isNormalMonster(", "isNpc(", "isRole(", "setFocusHero(", "addSpriteSign(", "setSpriteBindEntity(", "addSpriteInf(", "addProgressPanel(", "setSpriteUIInitScaleParam(", "setSpriteSmallBloodBar(", "addGainPanel(", "addBattleSpriteFunc(", "setScreendis2mapdisRate(", "enableMergeStatic(", "zoomCamera(", "changeCameraTransform(", "getCameraWorldPos(", "setCameraWorldPos(", "rotateCamera(", "rotateCameraEuler(", "rotateCameraAxis(", "rotateCameraAxisTmp(", "pitchCamera(", "turnCamera(", "pitchCameraAxis(", "yawCameraAxis(", "rollCameraAxis(", "setCameraFov(", "setCameraExposure(", "getCameraExposure(", "setWhiteBalance(", "getWhiteBalance(", "setCameraDistanceLimit(", "setCameraRotateLimit(", "setCameraDistance(", "getCameraDistance(", "getCameraEyePosition(", "getCameraViewPosition(", "setCameraPosition(", "setCameraEyePosition(", "setCameraAngle(", "setMainCameraVisible(", "setSpriteControlIsLock(", "setCameraCanRespondMultipoint(", "setSamplingWithWorld(", "resetCamera(", "moveCamera(", "getMapArea(", "getMapRangeAndStep(", "checkCameraAreaLimit(", "getCameraAxisRotateEuler(", "getCameraAxisRotate(", "getCameraRotateEuler(", "setCameraAxisRotationEuler(", "setCameraEyeRotationEuler(", "setCameraAxisPos(", "getCameraAxisRotation(", "getCameraRotation(", "setCameraTargetSprite(", "getCameraYAngle(", "setCameraFarClip(", "setCameraNearClip(", "setResetCheckTime(", "setResetToRole(", "setCameraFollowType(", "getCameraFollowType(", "setEnableLightShadow(", "getEnableLightShadow(", "enablePrefabMeshShadow(", "setCameraMinNearClip(", "setCameraNearClipParam(", "setCameraShadowMapRange(", "getCameraShadowMapRange(", "setMiniMapVisible(", "setMiniMapPosition(", "setMiniMapSize(", "playReplay(", "pauseReplay(", "continueReplay(", "switchReplayPlay(", "stopReplay(", "destoryReplay(", "isReplayEnd(", "getReplayRate(", "getCurReplayVer(", "setReplayRate(", "setCurCampIndex(", "getCurCampIndex(", "setWarFogEnable(", "getWarFogEnable(", "setWarFogColor(", "setMapVisibleCampList(", "getMapVisibleCampList(", "getTimeStable(", "getTime(", "getDeltaTime(", "getBaseCampRoleId(", "getBaseCampRoleName(", "getBaseCampCupCount(", "getBaseCampRoleLv(", "getBaseCampRoleExp(", "getBaseCampRoleHeadSkin(", "initSound(", "getSoundListenerPos(", "setSoundListenerPos(", "setBGMVolume(", "playSound(", "playSoundWithVolume(", "playBigSound(", "stopSound(", "stopAllSound(", "stopBigSound(", "playSoundEffect(", "playSpriteSoundEffect(", "stopSoundEffect(", "setMusicEnable(", "setMusicEffectEnable(", "setEffectVolume(", "getEffectVolume(", "stopBigSound_unLoad(", "getSoundLenMs(", "setVoiceVolume(", "getVoiceVolume(", "setBackgroundSoundVolume(", "getBackgroundSoundVolume(", "setZoomScale(", "setMapEntityVisible(", "yawMapEntity(", "setMapEntityLock(", "setMapEntityGray(", "setMapEntityLightVisible(", "setMapEntityPlay(", "setSkyPosition(", "getSkyPosition(", "getMapEntityIsPlaying(", "playEnterHomeAnimation(", "setFog(", "getMeshDateAnimationPlayTimes(", "getQuat(", "getQuatToTarget(", "clickScreenCallBack(", "stopRoleMove(", "clearBeginInputEvent(", "setCameraBornDis(", "setSignZoomInitValue(", "setCameraInitZoomDis(", "setCameraInitZoomRange(", "setSpriteControlIsCheckLimit(", "setIsCanDrag(", "setIsLockDrag(", "setIsLockClick(", "setIsLockScroll(", "setTarget(", "getTargetId(", "setSkillCreateStyle(", "shakeScreen(", "clearShake(", "getFaceAngle(", //SpeedSharkBenchmark //GLMain.cpp "testParticle(", "testScene(", "test2d(", "testMathlib(", "testStlib(", "testSum(", "backToHome(", "testMathShow(", "testStdShow(", "testTwoDShow(", "saveScore(", "sceneView(", "showConnList(", "connRemoteNode(", "deleteRemoteNode(", "editRemoteNode(", "addIPInfo(", "addConfirm(", "cancel(", "editConfirm(", "closeConnect(", "setPath(", "deletePath(", "moveUp(", "moveDown(", "addPath(", "editPath(", "clearPath(", "cancelDownload(", "viewScore(", "showScoreDetails(", "deleteScoreDetails(", "clearParticles(", "setCount(", "saveCount(", "backDefault(", "floatDrag(", "enableShadow(", "enableLight(", "setSpeed(", "sceneShow(", "renderLevelSet(", "selectQuality(", //SpeedSharkFramework //ResDownloadLib.cpp "reset(", "getPolicy(", "runHelper(", "perRunDownload(", "getDownloadSize(", "runDownload(", "getShowString(", "getNetSpeed(", "getCurDownFileName(", "getCurDownFileProg(", "getDownloadProg(", #endregion } }, { #region 运算符 new SolidColorBrush(Colors.White), new List<string> { // ([!@#$%^&*-=+,./;'\<>?:"|\(\)\[\]{}]) "$1", "+", "-", "*", "/", "=", "%", "&", "|", "!", "^", ";", ",", ".", ":", "?", "'", "\"", "<", ">", "(", ")", "[", "]", "{", "}", "\\", "@", "#", "$", } #endregion }, }; } m_isCheckChange = false; InitializeComponent(); m_parent = parent; m_openedFile = fileDef; m_openedFile.m_frame = this; TextBox tb = new TextBox(); RichTextBox rtb = new RichTextBox(); if (System.IO.File.Exists(m_parent.m_filePath)) { Run run = new Run(); try { FileStream aFile = new FileStream(m_parent.m_filePath, FileMode.Open); StreamReader reader = new StreamReader(aFile, Encoding.Default); run.Text = reader.ReadToEnd(); mx_textPara.Inlines.Add(run); reader.Close(); } catch (IOException ex) { Public.ResultLink.createResult("\r\n打开文件失败。(" + ex + ")", Public.ResultType.RT_ERROR); } } m_isCheckChange = true; }
internal void RunNonlinearEquationsTest(MainWindow window) { FileTabItem tab = null; window.Dispatcher.Invoke(() => { tab = window.FileTab.SelectedItem as FileTabItem; }); if (tab == null) { return; } List <ErrorMessage> errorList = new List <ErrorMessage>(); window.Dispatcher.Invoke(() => { window.FileTab.Focus(); window.StatusText = "Расчёт"; }); //Thread.Sleep(4000); //Test of UI List <string> outputList = new List <string>(); try { string text = ""; window.Dispatcher.Invoke(() => { text = tab.Document.Text; }); Equations.Nonlinear.Compiler compiler = new Equations.Nonlinear.Compiler(); Equations.Nonlinear.NonlinearEquationDescription compiledEquation = compiler.CompileEquations(text); MathUtils.NonlinearSystemSymbolicAnalytic system = new MathUtils.NonlinearSystemSymbolicAnalytic(compiledEquation); //calc solution MathNet.Numerics.LinearAlgebra.Vector <double> solution = MathUtils.NewtonRaphsonSolver.Solve( system, MathNet.Numerics.LinearAlgebra.Vector <double> .Build.DenseOfArray(compiledEquation.InitialValues), 20, 0.01, 1.0 ); outputList.Add("Упрощённое представление"); outputList.Add(compiledEquation.PrintEquations()); outputList.Add("Решение"); FormOutput(solution, compiledEquation, ref outputList); } catch (Equations.CompilerException exc) { outputList.Add(exc.Message); var errors = exc.Errors; foreach (var error in errors) { errorList.Add(error); } } catch (Exception exc) { window.Dispatcher.Invoke(() => { window.OutputText += exc.Message; window.OutputText += "\n"; window.OutputText += exc.StackTrace; }); return; } try { window.Dispatcher.Invoke(() => { foreach (ErrorMessage error in errorList) { window.errors.Add(error); } foreach (var output in outputList) { window.OutputText += output; window.OutputText += "\n"; } window.StatusText = "Готово"; } ); } catch (Exception exc) { Console.Write(exc.Message); } return; }
private void PowerSystemExample_Click(object sender, RoutedEventArgs e) { string content = @" //power system example model: steadystate{ solver = newton{ iterations = 20, fAbsTol = 0.005, alpha = 1.0 }, baseFrequency = 60 }; /*transient{ solver = radauIIA3{ iterations = 20, fAbsTol = 0.01, alpha = 1.0, step = 0.002 }, baseFrequency = 60, t0 = 0, t1 = 5/60//5 cycles };*/ elements: generator1 = generatorY{ Peak = 100.0, Phase = 0.0, Z = 0.01+ j 0.001, Frequency = 60 //in Herz }; scope1 = scope3p { Label = ""Generator"" }; scope2 = scope3p { Label = ""Load"" }; scope3 = scope1p { Label = ""ground"" }; resistorGen1 = resistor{ R = 1000 }; line1 = linePiSection{ R = 0.02, L = 0.01, B = 0.1, G = 1000, Bp = 0.1 }; transformer1 = transformerDy{ K = 10, Zs = 0.1 + j 0.5, Zp = 0.01 + j 0.1, Rc = 1000, Xm = 10000, Group = Dy1 }; transformer2 = transformerDd{ K = 10, Zs = 0.1 + j 0.5, Zp = 0.01 + j 0.1, Rc = 1000.0, Xm = 10000, Group = Dd0 }; load1 = loadY{ ZA = 1, ZB = 1, ZC = 1 }; ground = ground{ }; connections: connect(generator1.n, resistorGen1.in); connect(resistorGen1.out,scope3.in); connect(scope3.out, ground.in); connect(generator1.out, scope1.in); connect(scope1.out, transformer1.in); connect(transformer1.out, line1.in); connect(transformer1.out_n, ground.in); connect(line1.out, transformer2.out); connect(transformer2.in, scope2.in); connect(scope2.out, load1.in); connect(load1.n, ground.in);"; FileTabItem tab = new FileTabItem("Power system example", null, content); _tabItems.Add(tab); FileTab.SelectedIndex = _tabItems.Count - 1; }
private void RLCSeriesCircuit_Click(object sender, RoutedEventArgs e) { string content = @" //rlc parallel scheme model: steadystate{ solver = newton{ iterations = 20, fAbsTol = 0.01, alpha = 1.0 } }; /*transient{ solver = radauIIA3{ iterations = 20, fAbsTol = 0.01, alpha = 1.0, step = 0.002 }, baseFrequency = 60, t0 = 0, t1 = 5/60//5 cycles };*/ elements: v1 = voltageSource{ Peak = 220, Phase = 0, Frequency = 50 }; g = ground{ }; scopeR = scope1p{ Label=""scopeR"" }; scopeL = scope1p{ Label=""scopeL"" }; scopeC = scope1p{ Label=""scopeC"" }; scopeV = scope1p{ Label=""scopeV"" }; r1 = resistor{ R = 10 }; l1 = inductor{ L = 5 }; c1 = capacitor{ C = 0.01 }; connections: connect(v1.in, g.in); connect(v1.out, scopeV.in); connect(scopeV.out, r1.in); connect(scopeV.out, l1.in); connect(scopeV.out, c1.in); connect(r1.out,scopeR.in); connect(l1.out,scopeL.in); connect(c1.out,scopeC.in); connect(scopeL.out,g.in); connect(scopeR.out,g.in); connect(scopeC.out,g.in);"; FileTabItem tab = new FileTabItem("RLC parallel circuit", null, content); _tabItems.Add(tab); FileTab.SelectedIndex = _tabItems.Count - 1; }
internal void RunDAETest(MainWindow window, double alpha, double fAbsTol, double step, int iterations, int method) { FileTabItem tab = null; window.Dispatcher.Invoke(() => { tab = window.FileTab.SelectedItem as FileTabItem; }); if (tab == null) { return; } List <ErrorMessage> errorList = new List <ErrorMessage>(); window.Dispatcher.Invoke(() => { window.FileTab.Focus(); window.StatusText = "Расчёт"; }); //Thread.Sleep(4000); //Test of UI List <string> outputList = new List <string>(); try { string text = ""; window.Dispatcher.Invoke(() => { text = tab.Document.Text; }); Equations.DAE.Compiler compiler = new Equations.DAE.Compiler(); Equations.DAE.Implicit.DAEIDescription compiledEquation = compiler.CompileDAEImplicit(text); //Equations.DAE.Implicit.RADAUIIA3 solver = new Equations.DAE.Implicit.RADAUIIA3(); Equations.DAE.Implicit.DAEISolver solver; switch (method) { case (int)METHOD.RADAUIIA3: solver = new Equations.DAE.Implicit.RADAUIIA3(fAbsTol, iterations, alpha, step); break; case (int)METHOD.RADAUIIA5: solver = new Equations.DAE.Implicit.RADAUIIA5(fAbsTol, iterations, alpha, step); break; case (int)METHOD.BDF: solver = new Equations.DAE.Implicit.BDF1(fAbsTol, iterations, alpha, step); break; case (int)METHOD.TRAPEZOID: throw new NotImplementedException(); default: throw new NotImplementedException(); } Equations.DAE.Solution solution = Equations.DAE.Implicit.DAEISolver.Solve(compiledEquation, solver); window.Dispatcher.Invoke(() => { solution.ShowResults(); }); } catch (Equations.CompilerException exc) { outputList.Add(exc.Message); var errors = exc.Errors; foreach (var error in errors) { errorList.Add(error); } } catch (Exception exc) { window.Dispatcher.Invoke(() => { window.OutputText += exc.Message; window.OutputText += "\n"; window.OutputText += exc.StackTrace; }); return; } try { window.Dispatcher.Invoke(() => { foreach (ErrorMessage error in errorList) { window.errors.Add(error); } foreach (var output in outputList) { window.OutputText += output; window.OutputText += "\n"; } window.StatusText = "Готово"; } ); } catch (Exception exc) { Console.Write(exc.Message); } return; }
internal void RunOldModel(MainWindow window) { FileTabItem tab = null; window.Dispatcher.Invoke(() => { tab = window.FileTab.SelectedItem as FileTabItem; }); if (tab == null) { return; } List <ErrorMessage> errorList = new List <ErrorMessage>(); window.Dispatcher.Invoke(() => { window.FileTab.Focus(); window.StatusText = "Расчёт"; }); //Thread.Sleep(4000); //Test of UI List <string> outputList = new List <string>(); try { string text = ""; window.Dispatcher.Invoke(() => { text = tab.Document.Text; }); PowerModel.MainInterpreter.RunModelOld(text, ref errorList, ref outputList); } catch (Equations.CompilerException exc) { outputList.Add(exc.Message); var errors = exc.Errors; foreach (var error in errors) { errorList.Add(error); } } catch (Exception exc) { window.Dispatcher.Invoke(() => { window.OutputText += exc.Message; window.OutputText += "\n"; window.OutputText += exc.StackTrace; }); return; } try { window.Dispatcher.Invoke(() => { foreach (ErrorMessage error in errorList) { window.errors.Add(error); } foreach (var output in outputList) { window.OutputText += output; window.OutputText += "\n"; } window.StatusText = "Готово"; } ); } catch (Exception exc) { Console.Write(exc.Message); } return; }
internal void RunDAEExpressionTest(MainWindow window) { FileTabItem tab = null; window.Dispatcher.Invoke(() => { tab = window.FileTab.SelectedItem as FileTabItem; }); if (tab == null) { return; } List <ErrorMessage> errorList = new List <ErrorMessage>(); window.Dispatcher.Invoke(() => { window.FileTab.Focus(); window.StatusText = "Расчёт"; }); //Thread.Sleep(4000); //Test of UI List <string> outputList = new List <string>(); try { string text = ""; window.Dispatcher.Invoke(() => { text = tab.Document.Text; }); Equations.DAE.Compiler compiler = new Equations.DAE.Compiler(); Equations.DAE.Implicit.DAEIDescription compiledEquation = compiler.CompileDAEImplicit(text); outputList.Add("Variables:"); outputList.Add(compiledEquation.PrintVariables()); outputList.Add("Equations:"); outputList.Add(compiledEquation.PrintEquations()); } catch (Equations.CompilerException exc) { outputList.Add(exc.Message); var errors = exc.Errors; foreach (var error in errors) { errorList.Add(error); } } catch (Exception exc) { window.Dispatcher.Invoke(() => { window.OutputText += exc.Message; window.OutputText += "\n"; window.OutputText += exc.StackTrace; }); return; } try { window.Dispatcher.Invoke(() => { foreach (ErrorMessage error in errorList) { window.errors.Add(error); } foreach (var output in outputList) { window.OutputText += output; window.OutputText += "\n"; } window.StatusText = "Готово"; } ); } catch (Exception exc) { Console.Write(exc.Message); } return; }