private static DialogResult RequestRegistrationKey()
 {
     using (var form = new RegisterForm())
     {
         return form.ShowDialog();
     }
 }
Пример #2
0
        static void Main(string[] argv)
        {
            faceSearch = new FaceSearchWrapper.FaceSearch();
            motionDetector = new MotionDetectWrapper.MotionDetector();
            ImageSampleCount = System.IO.Directory.GetFiles(Properties.Settings.Default.FaceSampleLib, "*.jpg").Length;

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

            #if !DEBUG

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

                return;
            }
            #endif

            if (argv.Length > 0)
            {
                directory = argv[0];
            }

            Application.Run(new MainForm());
        }
Пример #3
0
        static void Main(string[] argv)
        {
            faceSearch = new FaceSearchWrapper.FaceSearch();
            motionDetector = new MotionDetectWrapper.MotionDetector();
            ImageSampleCount = System.IO.Directory.GetFiles(Properties.Settings.Default.FaceSampleLib, "*.jpg").Length;

            SVMWrapper.InitSvmData(0, ImageLen, EigenNum);

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

            #if !DEBUG

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

                return;
            }
            #endif

            if (argv.Length > 0)
            {
                directory = argv[0];
            }

            string baseAddress = string.Format("net.tcp://{0}:8000", System.Net.IPAddress.Any);

            Uri netTcpBaseAddress = new Uri(baseAddress);
            ServiceHost host = new ServiceHost(typeof(Service.Service), netTcpBaseAddress);

            NetTcpBinding tcpBinding = BindingFactory.CreateNetTcpBinding();

            host.AddServiceEndpoint(typeof(RemoteControlService.IServiceFacade),
                tcpBinding, "TcpService");

            host.Open();

            Application.Run(new MainForm());
        }
Пример #4
0
        static void Main(string[] argv)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            #if !DEBUG

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

                return;
            }

            Login log = null;

            do
            {
                 log = new Login();
                 if (log.ShowDialog() != DialogResult.OK)
                     return;

            } while ( log.UserName != Properties.Settings.Default.UserName
                || log.Password != Properties.Settings.Default.PassWord );
            #endif

            if (argv.Length > 0)
            {
                directory = argv[0];
            }

            Application.Run(new MainForm());
        }
        void SingleInstanceController_Startup(object sender, Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
        {
            if (!Util.VerifyKey())
            {
                RegisterForm form = new RegisterForm();
                DialogResult res = form.ShowDialog();
                if (res == DialogResult.OK)
                {
                    Application.Restart();
                }

                e.Cancel = true;
                return;
            }

            Login log = null;
            Program.usersManager = UsersManager.LoadUsers();

            User currentUser = null;

            #if !DEBUG
            while (true)
            {
                log = new Login();
                log.LabelClicked += new EventHandler(log_LabelClicked);
                log.LoginButtonClick += new EventHandler(log_LoginButtonClick);
                if (log.ShowDialog() != DialogResult.OK)
                {
                    e.Cancel = true;
                    return;
                }

                currentUser = Program.usersManager.GetUser(log.UserName, log.Password);
                if (currentUser != null)
                    break;
                else
                    Util.ShowErrorMessage(Properties.Resources.ErrorUserNameOrPassword);
            }
            #endif

            #if DEBUG
            currentUser = Program.usersManager.GetUser("admin", "admin");
            #endif

            System.Threading.Thread.CurrentPrincipal = currentUser.ToPrincipal();

            if (e.CommandLine.Count > 0)
            {
                Program.directory = e.CommandLine[0];
            }
        }