예제 #1
0
        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
 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);
 }