Example #1
0
        public StartupForm()
        {
            InitializeComponent();

            // Контингент - Alt-S
            HotKeyManager.RegisterHotKey(Keys.S, (uint)KeyModifiers.Alt);

            // Аутентификация - Alt-A
            HotKeyManager.RegisterHotKey(Keys.A, (uint)KeyModifiers.Alt);

            // Группы студентов - Ctrl-Alt-S
            HotKeyManager.RegisterHotKey(Keys.S, (uint)(KeyModifiers.Control | KeyModifiers.Alt));

            // Факультеты - Alt-F
            HotKeyManager.RegisterHotKey(Keys.F, (uint)KeyModifiers.Alt);

            // Телефоны - Alt-P
            HotKeyManager.RegisterHotKey(Keys.P, (uint)KeyModifiers.Alt);

            // Кафедры - Alt-D
            HotKeyManager.RegisterHotKey(Keys.D, (uint)KeyModifiers.Alt);

            // Заметки - Alt-N
            HotKeyManager.RegisterHotKey(Keys.N, (uint)KeyModifiers.Alt);

            // Учебные планы - Alt-L
            HotKeyManager.RegisterHotKey(Keys.L, (uint)KeyModifiers.Alt);

            // Учебные планы студентов - Ctrl-Alt-L
            HotKeyManager.RegisterHotKey(Keys.L, (uint)(KeyModifiers.Control | KeyModifiers.Alt));

            // Карточки учебных поручений - Alt-C
            HotKeyManager.RegisterHotKey(Keys.C, (uint)KeyModifiers.Alt);

            // Карточки учебных поручений - Ctrl-Alt-H
            HotKeyManager.RegisterHotKey(Keys.H, (uint)(KeyModifiers.Control | KeyModifiers.Alt));

            // План и нагрузка на студента - Ctrl-Alt-P
            HotKeyManager.RegisterHotKey(Keys.P, (uint)(KeyModifiers.Control | KeyModifiers.Alt));

            // Оценки студентов - Alt-M
            HotKeyManager.RegisterHotKey(Keys.M, (uint)KeyModifiers.Alt);

            // Виды оценок - Ctrl-Alt-M
            HotKeyManager.RegisterHotKey(Keys.M, (uint)(KeyModifiers.Control | KeyModifiers.Alt));

            HotKeyManager.HotKeyPressed += ManageHotKeys;

            trayIcon.Visible = true;

            upRepo = new UserPermissionRepo(ApiEndpoint);

            ShowAuthForm();
        }
Example #2
0
        private async void OKButton_Click(object sender, EventArgs e)
        {
            StartupForm.username = LoginText.Text;
            StartupForm.password = PasswordText.Text;
            OKButton.Text        = "";
            OKButton.Enabled     = false;
            OKButton.Image       = Resources.Loading;

            var authFailed = false;

            await Task.Run(() => {
                var upRepo = new UserPermissionRepo(ApiEndpoint);
                try
                {
                    StartupForm.Permissions = upRepo.getByName(StartupForm.username);
                }
                catch (Exception exc)
                {
                    if (exc.Message == "Запрос был прерван: Соединение было неожиданно закрыто.")
                    {
                        MessageBox.Show("Комбинация логина и пароля неверна.", "Ошибка");
                        authFailed = true;
                    }
                    else
                    {
                        MessageBox.Show(exc.Message, "Ошибка");
                        authFailed = true;
                    }
                }
            });

            if (!authFailed)
            {
                Close();
            }
            else
            {
                OKButton.Image   = null;
                OKButton.Enabled = true;
                OKButton.Text    = "OK";
            }
        }
Example #3
0
 internal UserModule()
 {
     userRepo           = new UserRepo();
     userPermissionRepo = new UserPermissionRepo();
     permissionRepo     = new PermissionRepo();
 }