-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProgram.cs
67 lines (56 loc) · 1.87 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using DevExpress.LookAndFeel;
using DevExpress.Skins;
using ShomreiTorah.Common;
using ShomreiTorah.Data;
using ShomreiTorah.Data.UI;
using ShomreiTorah.Data.UI.Forms;
using ShomreiTorah.Singularity;
using ShomreiTorah.Singularity.Sql;
using ShomreiTorah.WinForms;
using DevExpress.UserSkins;
namespace ShomreiTorah.Rafflizer {
class Program : AppFramework {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() { new Program().Run(); }
///<summary>Gets the path to the application's SQL CE database. This property is also available at design-time.</summary>
public string FilePath {
get {
//TODO: Design-time
if (IsDesignTime)
return @"C:\Users\SSL\Development\Source\Shul\Applications\ShomreiTorah.Rafflizer\Bin\Debug\RaffleData.sdf";
return "RaffleData.sdf";
}
}
//TODO: Create splash image
protected override ISplashScreen CreateSplash() { return null; }
protected override void RegisterSettings() {
Dialog.DefaultTitle = "Shomrei Torah Rafflizer";
SkinManager.EnableFormSkins();
UserLookAndFeel.Default.SkinName = "Office 2010 Blue";
RegisterRowDetail<Person>(p => new SimplePersonDetails(p).Show(MainForm));
}
protected override Form CreateMainForm() { return new MainForm(); }
protected override DataSyncContext CreateDataContext() {
var dc = new DataContext();
dc.Tables.AddTable(Person.CreateTable());
dc.Tables.AddTable(RaffleTicket.CreateTable());
var dsc = new DataSyncContext(dc, new SqlCeSqlProvider(FilePath));
dsc.Tables.AddPrimaryMappings();
if (!File.Exists(FilePath)) {
DB.CreateFile(FilePath, DatabaseFile.SqlCe);
try {
DBManager.SetupDatabase(dsc);
} catch { File.Delete(FilePath); }
}
return dsc;
}
}
}