Exemple #1
1
        static void Main(string[] argv)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.ThreadException += Application_ThreadException;

            #if !DEBUG
            //if (!Util.VerifyKey())
            //{
            //    using (var form = new RegisterForm())
            //    {
            //        DialogResult res = form.ShowDialog();
            //        if (res == DialogResult.OK)
            //            Application.Restart();
            //    }

            //    return;
            //}
            #endif
            try
            {
                DevExpress.UserSkins.OfficeSkins.Register();
                DevExpress.UserSkins.BonusSkins.Register();
                DevExpress.Skins.SkinManager.EnableFormSkins();

                DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Devexpress Style");

                int count = 0;
                IDataStore dataStore = null;
            RETRY:
                try
                {
                    dataStore = XpoDefault.GetConnectionProvider(
                        MSSqlConnectionProvider.GetConnectionString(Properties.Settings.Default.SqlInstanceName, "FaceCapture"),
                        AutoCreateOption.DatabaseAndSchema);

                }
                catch (Exception ex)
                {
                    ++count;
                    if (count == 3)
                    {
                        MessageBox.Show("无法连接数据库,请确认数据库已经正确安装。", "数据库", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        //让sqlserver有时间启动。
                        System.Threading.Thread.Sleep(3000);
                        goto RETRY;
                    }
                }

                using (SimpleDataLayer dataLayer = new SimpleDataLayer(dataStore))
                {
                    using (Session session = new Session(dataLayer))
                    {
                        session.UpdateSchema();
                        session.CreateObjectTypeRecords(
                            typeof(Damany.PortraitCapturer.DAL.DTO.CapturedImageObject),
                            typeof(Damany.PortraitCapturer.DAL.DTO.Video),
                            typeof(Damany.PortraitCapturer.DAL.DTO.Portrait),
                            typeof(Damany.PortraitCapturer.DAL.DTO.Frame),
                            typeof(Damany.PortraitCapturer.DAL.DTO.TargetPerson));
                        var cachNode = new DataCacheNode(new DataCacheRoot(dataStore));
                        XpoDefault.DataLayer = new ThreadSafeDataLayer(session.Dictionary, cachNode);
                    }
                }

                try
                {

            #if !DEBUG
                    //if (!Util.VerifyKey())
                    //{
                    //    RegisterForm form = new RegisterForm();
                    //    DialogResult res = form.ShowDialog();
                    //    if (res == DialogResult.OK)
                    //    {
                    //        Application.Restart();
                    //    }

                    //    return;
                    //}
            #endif

                    var modeCollection = new DevExpress.Xpo.XPCollection<WorkModeCamSetting>();
                    modeCollection.Load();

                    if (modeCollection.Count == 0)
                    {
                        var workingModeSettings = new WorkModeCamSetting();
                        workingModeSettings.ModeName = "室外模式";
                        workingModeSettings.ShutterSpeed = 3;
                        workingModeSettings.IrisLevel = 40;
                        workingModeSettings.Save();

                        workingModeSettings = new WorkModeCamSetting();
                        workingModeSettings.ShutterSpeed = 1;
                        workingModeSettings.IrisLevel = 50;
                        workingModeSettings.ModeName = "室内模式";
                        workingModeSettings.Save();
                    }

                    foreach (var workModeCamSetting in modeCollection)
                    {
                        var dummy = workModeCamSetting;
                        System.Diagnostics.Debug.WriteLine(dummy);
                    }

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

                    var strapper = new StartUp();
                    strapper.Start();

                    var mainForm = strapper.Container.Resolve<RemoteImaging.RealtimeDisplay.MainForm>();
                    var controller = strapper.Container.Resolve<MainController>();
                    mainForm.AttachController(controller);

                    mainForm.ButtonsVisible =
                        (ButtonsVisibleSectionHandler)System.Configuration.ConfigurationManager.GetSection("FaceDetector.ButtonsVisible");

                    try
                    {
                        //StartLicensePlateMonitor(strapper.Container);
                        WireupNavigation(strapper.Container);

                        //RegisterLicensePlateRepository(strapper);
                    }
                    catch (Exception e)
                    {
                        HandleException(e);
                    }

                    Application.Run(mainForm);

                }
                catch (Exception e)
                {
                    HandleException(e);
                }

            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
Exemple #2
0
        static void Main(string[] argv)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.ThreadException += Application_ThreadException;


#if !DEBUG
            //if (!Util.VerifyKey())
            //{
            //    using (var form = new RegisterForm())
            //    {
            //        DialogResult res = form.ShowDialog();
            //        if (res == DialogResult.OK)
            //            Application.Restart();
            //    }

            //    return;
            //}
#endif
            try
            {
                DevExpress.UserSkins.OfficeSkins.Register();
                DevExpress.UserSkins.BonusSkins.Register();
                DevExpress.Skins.SkinManager.EnableFormSkins();

                DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Devexpress Style");


                int        count     = 0;
                IDataStore dataStore = null;
RETRY:
                try
                {
                    dataStore = XpoDefault.GetConnectionProvider(
                        MSSqlConnectionProvider.GetConnectionString(Properties.Settings.Default.SqlInstanceName, "FaceCapture"),
                        AutoCreateOption.DatabaseAndSchema);
                }
                catch (Exception ex)
                {
                    ++count;
                    if (count == 3)
                    {
                        MessageBox.Show("无法连接数据库,请确认数据库已经正确安装。", "数据库", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        //让sqlserver有时间启动。
                        System.Threading.Thread.Sleep(3000);
                        goto RETRY;
                    }
                }


                using (SimpleDataLayer dataLayer = new SimpleDataLayer(dataStore))
                {
                    using (Session session = new Session(dataLayer))
                    {
                        session.UpdateSchema();
                        session.CreateObjectTypeRecords(
                            typeof(Damany.PortraitCapturer.DAL.DTO.CapturedImageObject),
                            typeof(Damany.PortraitCapturer.DAL.DTO.Video),
                            typeof(Damany.PortraitCapturer.DAL.DTO.Portrait),
                            typeof(Damany.PortraitCapturer.DAL.DTO.Frame),
                            typeof(Damany.PortraitCapturer.DAL.DTO.TargetPerson));
                        var cachNode = new DataCacheNode(new DataCacheRoot(dataStore));
                        XpoDefault.DataLayer = new ThreadSafeDataLayer(session.Dictionary, cachNode);
                    }
                }

                try
                {
#if !DEBUG
                    //if (!Util.VerifyKey())
                    //{
                    //    RegisterForm form = new RegisterForm();
                    //    DialogResult res = form.ShowDialog();
                    //    if (res == DialogResult.OK)
                    //    {
                    //        Application.Restart();
                    //    }

                    //    return;
                    //}
#endif

                    var modeCollection = new DevExpress.Xpo.XPCollection <WorkModeCamSetting>();
                    modeCollection.Load();

                    if (modeCollection.Count == 0)
                    {
                        var workingModeSettings = new WorkModeCamSetting();
                        workingModeSettings.ModeName     = "室外模式";
                        workingModeSettings.ShutterSpeed = 3;
                        workingModeSettings.IrisLevel    = 40;
                        workingModeSettings.Save();

                        workingModeSettings = new WorkModeCamSetting();
                        workingModeSettings.ShutterSpeed = 1;
                        workingModeSettings.IrisLevel    = 50;
                        workingModeSettings.ModeName     = "室内模式";
                        workingModeSettings.Save();
                    }

                    foreach (var workModeCamSetting in modeCollection)
                    {
                        var dummy = workModeCamSetting;
                        System.Diagnostics.Debug.WriteLine(dummy);
                    }

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

                    var strapper = new StartUp();
                    strapper.Start();

                    var mainForm   = strapper.Container.Resolve <RemoteImaging.RealtimeDisplay.MainForm>();
                    var controller = strapper.Container.Resolve <MainController>();
                    mainForm.AttachController(controller);

                    mainForm.ButtonsVisible =
                        (ButtonsVisibleSectionHandler)System.Configuration.ConfigurationManager.GetSection("FaceDetector.ButtonsVisible");

                    try
                    {
                        //StartLicensePlateMonitor(strapper.Container);
                        WireupNavigation(strapper.Container);

                        //RegisterLicensePlateRepository(strapper);
                    }
                    catch (Exception e)
                    {
                        HandleException(e);
                    }

                    Application.Run(mainForm);
                }
                catch (Exception e)
                {
                    HandleException(e);
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
Exemple #3
0
 private static void RegisterLicensePlateRepository(StartUp strapper)
 {
     var repository = strapper.Container.Resolve <LicensePlateRepository>();
     var suspectLicensePlateCheck = strapper.Container.Resolve <SuspectLicensePlateChecker>();
 }
Exemple #4
0
 private static void RegisterLicensePlateRepository(StartUp strapper)
 {
     var repository = strapper.Container.Resolve<LicensePlateRepository>();
     var suspectLicensePlateCheck = strapper.Container.Resolve<SuspectLicensePlateChecker>();
 }