コード例 #1
0
ファイル: Program.cs プロジェクト: ChocolateSlayer/CookBook
        static void Main()
        {
            string executable = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string path = (System.IO.Path.GetDirectoryName(executable));
            AppDomain.CurrentDomain.SetData("DataDirectory", path);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SkinManager.EnableFormSkins();
            DevExpress.UserSkins.BonusSkins.Register();UserLookAndFeel.Default.SetSkinStyle("Coffee");

            var startupPath = Application.StartupPath;
            ConnectionString =string.Format(
                    @"Data Source=(LocalDB)\v11.0;AttachDbFilename={0}\CookBookDb.mdf;Integrated Security=True", startupPath);

            if (!Database.Exists(ConnectionString))
            {
                Database.SetInitializer(new MigrateDatabaseToLatestVersion<Models, Configuration>());
                using (var context = new Models())
                {
                    context.Database.Initialize(true);
                }
            }

            Application.Run(new MainForm());
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: ChocolateSlayer/CookBook
 public MainForm()
 {
     InitializeComponent();
     Context = new Models();
     var control = new ucRecipeFind(Context);
     control.Dock = DockStyle.Fill;
     pcSearchContainer.Controls.Add(control);
 }
コード例 #3
0
 public ucRecipeFind(Models context)
     : this()
 {
     _service = new RecipesService(context);
 }