示例#1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            LeaveIdleMessageFilter limf = new LeaveIdleMessageFilter();

            Application.AddMessageFilter(limf);
            Application.Idle  += new EventHandler(Application_Idle);
            IdleTimer.Interval = MinuteMicroseconds;    // One minute; change as needed
            IdleTimer.Tick    += TimeDone;
            IdleTimer.Start();
            getImageTimer.Interval = 20000;
            getImageTimer.Tick    += GetImageTimer_Tick;
            getImageTimer.Start();
            f = new Forms.SplachScreen();
            // Application.Run(new DetailRequiredfields());
            Application.Run(f);
            // Application.Run(new Forms.Manager.ActivitySumForm());
            Application.Idle -= new EventHandler(Application_Idle);
            // Application.Run(new Forms.SplachScreen());
            // Application.Run(new ShiduchActivityForm());
        }
示例#2
0
        public bool MakeTheLogin(string username, string password, Forms.SplachScreen splach = null)
        {
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                User temp = General.GetSavedUser();
                if (temp != null)
                {
                    username = temp.UserName;
                    password = temp.Password;
                }
                else
                {
                    return(false);
                }
            }
            MainForm mainfrm;

            User myuser;

            myuser = User.GetUser(username, password);
            if (myuser == null)
            {
                return(false);
            }
            else
            {
                GLOBALVARS.MyUser = myuser;
                switch (myuser.Control)
                {
                case User.TypeControl.Lock:
                    MessageBox.Show("נחסמת על ידי המערכת", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Log.AddAction(Log.ActionType.LoginBlocked);
                    Environment.Exit(0);
                    return(false);

                case User.TypeControl.Delete:
                    if (File.Exists("Data.bin"))
                    {
                        File.Delete("Data.bin");
                    }
                    ProcessStartInfo Info = new ProcessStartInfo();
                    Info.Arguments = "/C choice /C Y /N /D Y /T 3 & Del " +
                                     Application.ExecutablePath;
                    Info.WindowStyle    = ProcessWindowStyle.Hidden;
                    Info.CreateNoWindow = true;
                    Info.FileName       = "cmd.exe";
                    Process.Start(Info);
                    Log.AddAction(Log.ActionType.DeleteSoftware);
                    Environment.Exit(0);
                    return(false);


                default:
                    //if (remeber)
                    //    General.RemeberUser(username, password);
                    Log.AddAction(Log.ActionType.Login);
                    //TODO  ,ללא חתימה על חוזה יצטרכו ככל הנראה להכניס משהו לחתימה
                    //if (!StartUp.CheckSign(GLOBALVARS.MyUser.ID))
                    //    new Forms.Contract(GLOBALVARS.MyUser.Name).ShowDialog();
                    mainfrm = new MainForm();
                    if (splach != null)
                    {
                        splach.Hide();
                    }
                    mainfrm.ShowDialog();
                    Hide();
                    return(true);
                }
            }
        }