Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* now events are user configurable from the setting window. posibility to have active (on the main window) a subset of all defined events * new database structure. the old database will be overwritten with a new empty one * added 50m pistol target
- Loading branch information
Showing
26 changed files
with
2,153 additions
and
728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Drawing; | ||
|
||
namespace freETarget { | ||
public class Event { | ||
|
||
public enum EventType { | ||
Practice, | ||
Match, | ||
Final | ||
} | ||
|
||
public long ID { get; } | ||
|
||
public string Name { get; set; } | ||
|
||
public bool DecimalScoring { get; set; } | ||
|
||
public EventType Type { get; set; } | ||
|
||
public int NumberOfShots { get; set; } | ||
|
||
public targets.aTarget Target { get; set; } | ||
|
||
public int Minutes { get; set; } | ||
|
||
public decimal ProjectileCaliber { get; set; } | ||
|
||
public int Final_NumberOfShotPerSeries { get; set; } //5 | ||
|
||
public int Final_SeriesSeconds { get; set; } //250 | ||
|
||
public int Final_NumberOfShotsBeforeSingleShotSeries { get; set; } //10 for air pistol/rifle | ||
|
||
public int Final_NumberOfShotsInSingleShotSeries { get; set; } //2 for air pistol/rifle | ||
|
||
public int Final_SingleShotSeconds { get; set; } //50 | ||
|
||
public Color TabColor { get; set; } | ||
|
||
public Event(long id, string name, bool decimalScoring, EventType type, int numberOfShots, targets.aTarget target, int minutes, decimal caliber, | ||
int final_seriesShots, int seriesSeconds, int shotsInSeries, int shotsInSingle, int singleSeconds, Color tabColor ) { | ||
this.ID = id; | ||
this.Name = name; | ||
this.DecimalScoring = decimalScoring; | ||
this.Type = type; | ||
this.NumberOfShots = numberOfShots; | ||
this.Target = target; | ||
this.Minutes = minutes; | ||
this.ProjectileCaliber = caliber; | ||
this.Final_NumberOfShotPerSeries = final_seriesShots; | ||
this.Final_SeriesSeconds = seriesSeconds; | ||
this.Final_NumberOfShotsBeforeSingleShotSeries = shotsInSeries; | ||
this.Final_NumberOfShotsInSingleShotSeries = shotsInSingle; | ||
this.Final_SingleShotSeconds = singleSeconds; | ||
this.TabColor = tabColor; | ||
} | ||
|
||
public override string ToString() { | ||
return this.Name; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Drawing; | ||
|
||
namespace freETarget { | ||
|
||
public class EventManager { | ||
|
||
private List<Event> eventList = new List<Event>(); | ||
private List<Event> activeEventList = new List<Event>(); | ||
|
||
StorageController storage; | ||
|
||
public EventManager(StorageController storage) { | ||
this.storage = storage; | ||
} | ||
|
||
/* | ||
* no events in the DB. create the default events | ||
*/ | ||
public void initializeEvents() { | ||
|
||
//air pistol practice | ||
Event evAPP = new Event(-1, "Pistol Practice", false, Event.EventType.Practice, -1, new targets.AirPistol(4.5m), -1, 4.5m, -1, -1, -1, -1, -1, Color.Gold); | ||
storage.storeEvent(evAPP); | ||
|
||
//air pistol match | ||
Event evAPM = new Event(-1, "Pistol Match", false, Event.EventType.Match, 60, new targets.AirPistol(4.5m), 75, 4.5m, -1, -1, -1, -1, -1, Color.Orange); | ||
storage.storeEvent(evAPM); | ||
|
||
//air pistol final | ||
Event evAPF = new Event(-1, "Pistol Final", true, Event.EventType.Final, 24, new targets.AirPistol(4.5m), 75, 4.5m, 5, 250, 10, 2, 50, Color.Red); | ||
storage.storeEvent(evAPF); | ||
|
||
//air rifle practice | ||
Event evARP = new Event(-1, "Rifle Practice", true, Event.EventType.Practice, -1, new targets.AirRifle(4.5m), -1, 4.5m, -1, -1, -1, -1, -1, Color.LimeGreen); | ||
storage.storeEvent(evARP); | ||
|
||
//air rifle match | ||
Event evARM = new Event(-1, "Rifle Match", true, Event.EventType.Match, 60, new targets.AirRifle(4.5m), 75, 4.5m, -1, -1, -1, -1, -1, Color.Turquoise); | ||
storage.storeEvent(evARM); | ||
|
||
//air rfile final | ||
Event evARF = new Event(-1, "Rifle Final", true, Event.EventType.Final, 24, new targets.AirRifle(4.5m), 75, 4.5m, 5, 250, 10, 2, 50, Color.DodgerBlue); | ||
storage.storeEvent(evARF); | ||
|
||
//reload events to get autogenerated IDs | ||
List<Event> evs = storage.loadEvents(); | ||
|
||
storage.updateActiveEvents(evs); | ||
} | ||
|
||
public void setEventsList(List<Event> list) { | ||
this.eventList = list; | ||
} | ||
|
||
public List<Event> getEventsList() { | ||
return this.eventList; | ||
} | ||
|
||
public void setActiveEventsList(List<long> idList) { | ||
|
||
if (eventList.Count == 0) { | ||
Console.WriteLine("Event list empty"); | ||
return; | ||
} | ||
|
||
this.activeEventList.Clear(); | ||
foreach (Event ev in eventList) { | ||
if (idList.Contains(ev.ID)) { | ||
this.activeEventList.Add(ev); | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
public List<Event> getActiveEventsList() { | ||
return this.activeEventList; | ||
} | ||
|
||
public Event findEventByID(long id) { | ||
Event ret = null; | ||
foreach(Event e in eventList) { | ||
if(e.ID == id) { | ||
ret = e; | ||
break; | ||
} | ||
} | ||
return ret; | ||
} | ||
|
||
public Event findEventByName(string name) { | ||
Event ret = null; | ||
foreach (Event e in eventList) { | ||
if (e.Name == name) { | ||
ret = e; | ||
break; | ||
} | ||
} | ||
return ret; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.