| 12 | [[BR]][[BR]][[BR]] |
| 13 | == Create a scoring formula == |
| 14 | Create a DLL named "!FsSf_<formula id>.dll" which implement the interface described below. |
| 15 | |
| 16 | Put it in the folder where !FsComp.exe is and it should show up on the list for selecting a scoring formula. |
| 17 | |
| 18 | The "!EditScoreFormula" method is called from FsComp when one select and edits a scoring formula. |
| 19 | |
| 20 | The "!ScoreTask" method is called when the menuitem Tasks > Score Task is used, or when any report is created (Reports > ...) and the task needs to be scored because there has been changes. |
| 21 | |
| 22 | (any time one changes anything about one or more pilot's flightdata in a task, all FsResult elements for that task will be removed). |
| 23 | [[BR]][[BR]][[BR]] |
| 24 | {{{ |
| 25 | using System.Xml; |
| 26 | |
| 27 | /* |
| 28 | * Fs/FsCompetition/FsScoreFormula |
| 29 | * Fs/FsCompetition/FsTask/FsScoreFormula |
| 30 | * Fs/FsCompetition/FsTask/FsParticipants/FsParticipant/FsFlightData |
| 31 | * Fs/FsCompetition/FsTask/FsParticipants/FsParticipant/FsResult |
| 32 | */ |
| 33 | namespace FlightSys.FsFsdb |
| 34 | { |
| 35 | public interface ISf |
| 36 | { |
| 37 | /// <summary> |
| 38 | /// Should only change the FsParticipants/FsParticipant/FsResult under the xe_task_clone element. |
| 39 | /// Remove any existing FsResult elements and add a new one for each pilot in task that has a FsFlightData element. |
| 40 | /// FsParticipants/FsParticipant elements with no FsFlightData element is ABS and should not be counted in scoring. |
| 41 | /// Empty FsFlightData element means DNF. DNF pilot may affect scoring. |
| 42 | /// Best not to change anything else or FS might be confused. |
| 43 | /// </summary> |
| 44 | /// <param name="xe_task_clone">A clone of FsTask element. Should not have any parent. |
| 45 | /// To access the rest of the fsdb xml document use OwnerDocument property of the param.</param> |
| 46 | /// <param name="msg">any messages regarding scoring</param> |
| 47 | /// <returns>true if task was scored, false if not.</returns> |
| 48 | bool ScoreTask(XmlElement xe_task_clone, out string msg); |
| 49 | |
| 50 | /// <summary> |
| 51 | /// Should provide a UI for setting scoring formula params. |
| 52 | /// Should only change the xe_sf_clone element. |
| 53 | /// Best not to change anything else or FS might be confused. |
| 54 | /// </summary> |
| 55 | /// <param name="xe_sf_clone">A clone of a FsScoreFormula element. Should not have any parent. |
| 56 | /// To access the rest of the fsdb xml document use OwnerDocument property of the param.</param> |
| 57 | /// <returns>Return true if any changes to xe_sf_clone where done, false if not.</returns> |
| 58 | bool EditScoreFormula(XmlElement xe_sf_clone); |
| 59 | } |
| 60 | } |
| 61 | }}} |