private void EnterButton_Click(object sender, RoutedEventArgs e)
 {
     if (ModelCheck())
     {
         try
         {
             _user.Login               = LoginTextBox.Text;
             _user.Password            = PassTextBox.Text;
             _user.IsBlocked           = false;
             _user.RoleId              = 1;
             _reader.FIO               = FIOTextBox.Text;
             _reader.BirthDate         = BirthDatePicker.SelectedDate;
             _reader.Phone             = PhoneTextBox.Text;
             _reader.IsCollegeEmployee = IsEmpCheckBox.IsChecked;
             _reader.Rating            = 0;
             dBQueryHelper.AddUserWithReader(_reader, _user);
             AuthorizationWindow mainWindow = new AuthorizationWindow();
             mainWindow.Show();
             this.Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
Esempio n. 2
0
        private void labelBack_MouseEnter(object sender, MouseEventArgs e)
        {
            AuthorizationWindow mainWindow = new AuthorizationWindow();

            mainWindow.Show();
            this.Close();
        }
Esempio n. 3
0
        public void AuthorizeTest()
        {
            AuthorizationWindow authorize = new AuthorizationWindow();

            Assert.IsTrue(authorize.Authorize("lerka", "123"));
            Assert.IsFalse(authorize.Authorize("", ""));
        }
Esempio n. 4
0
        private void ExitButton_Click(object sender, RoutedEventArgs e)
        {
            AuthorizationWindow mainWindow = new AuthorizationWindow();

            mainWindow.Show();
            this.Close();
        }
Esempio n. 5
0
        private void AuthorizationBtn_Click(object sender, RoutedEventArgs e)
        {
            AuthorizationWindow authorizationWindow = new AuthorizationWindow();

            Close();
            authorizationWindow.Show();
        }
Esempio n. 6
0
        private void AutificationWindow()
        {
            AuthorizationWindow login = new AuthorizationWindow(VisibilityAfterUutification, CloseProgram, SetName, SetImageProfile);

            login.ShowDialog();
            NameUser.Text = _nameUser;
        }
Esempio n. 7
0
        public static Authorization AuthorizeNewAccount(string redirectUrl, string scope)
        {
            Authorization       account    = new Authorization();
            AuthorizationWindow authWindow = new AuthorizationWindow(clientId, redirectUrl, scope);

            authWindow.AuthSuccess += authWindow_AuthSuccess;
            authWindow.Show();
            return(account);
        }
        private void ProfileButton_Click(object sender, RoutedEventArgs e)
        {
            ProfileWindow profileWindow = new ProfileWindow((int)InformationAboutCurrnetUser.UserId);

            if (profileWindow.ShowDialog() == true)
            {
                LogOutOnGoogle();
                InformationAboutCurrnetUser.NullAllSettings();
                AuthorizationWindow authorization = new AuthorizationWindow();
                authorization.Show();
                this.Close();
            }
        }
Esempio n. 9
0
        protected override void OnStartup(StartupEventArgs e)
        {
            IDbContextFactory <FileCabinetContext> dbContextFactory = new FileCabinetDbContextFactory();
            IUnitOfWork           unitOfWork = new UnitOfWork(dbContextFactory);
            IAuthorizationService service    = new AuthorizationService(unitOfWork);
            Window authorization             = new AuthorizationWindow(service, unitOfWork);

            authorization.Show();

            //var windowFactory = new SimpleWindowFactory(unitOfWork, 87);
            //var window = windowFactory.CreateWindow(WindowType.Admin);
            //window.Show();
            base.OnStartup(e);
        }
        /// <summary>
        /// Вызов модального окна для ввода IP-адресса, порта и логина
        /// </summary>
        private void Authorization()
        {
            AuthorizationWindow authorizationWindow = new AuthorizationWindow();

            if (authorizationWindow.ShowDialog() == true)
            {
                client             = authorizationWindow.ReadyClient;
                client.StopServer += ServerStatus_Changed;
                client.AddToLog   += LogList_AddData;
            }
            else
            {
                Application.Current.Shutdown();
            }
        }
Esempio n. 11
0
        public App()
        {
            var preloaderWindow = new PreloaderWindow();

            preloaderWindow.Show();

            InitializeComponent();

            MainWindow = new MainWindow();

            ResourceSet resourceSet = InCollege.Properties.Resources.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);

            if (!Directory.Exists(CommonVariables.TemplatesDirectory))
            {
                Directory.CreateDirectory(CommonVariables.TemplatesDirectory);
                foreach (DictionaryEntry entry in resourceSet)
                {
                    if (entry.Key.ToString().EndsWith("_TEMPLATE"))
                    {
                        File.WriteAllBytes(Path.Combine(CommonVariables.TemplatesDirectory, $"{entry.Key.ToString().Split(new[] { "_TEMPLATE" }, StringSplitOptions.RemoveEmptyEntries)[0]}.docx"), (byte[])entry.Value);
                    }
                }
            }

            var loginWindow = new AuthorizationWindow();
            var tokenValid  = Token != null && ValidateToken();

            preloaderWindow.Close();

            if (tokenValid ||
                loginWindow.ShowDialog().HasValue&& loginWindow.DialogResult.Value)
            {
                MainWindow.ShowDialog();
            }
            else
            {
                Shutdown();
            }

            try
            {
                NetworkUtils.Disconnect().Wait();
            }
            catch (Exception e) when(e is AggregateException || e is HttpRequestException || e is WebException)
            {
            }
        }
        /// <summary>
        /// Вызов модального окна для ввода IP-адресса и порта сервера
        /// </summary>
        public bool Authorization(out string address, out int port)
        {
            AuthorizationWindow authorizationWindow = new AuthorizationWindow();

            if (authorizationWindow.ShowDialog() == true)
            {
                address = authorizationWindow.Address;
                port    = int.Parse(authorizationWindow.Port);
                return(true);
            }
            else
            {
                address = "";
                port    = -1;
                return(false);
            }
        }
Esempio n. 13
0
        public MainWindow()
        {
            InitializeComponent();

            this.DataContext = MainViewModel.This;

            if (Settings.Default.token == "")
            {
                //скрываем главную форму если нет токена
                Visibility = Visibility.Hidden;
                //отображаем окно авторизации
                var authorization = new AuthorizationWindow {
                    main = this
                };
                //ссылка на главную форму
                authorization.Show();
            }
            else
            {
                VkSettings.Token = Settings.Default.token;
            }
        }
Esempio n. 14
0
 private Init()
 {
     AuthWindow = new AuthorizationWindow();
     ConnectApp = Connect.Instance();
 }
Esempio n. 15
0
        static void authWindow_AuthSuccess(object sender, AuthorizationWindow.AuthEventArgs e)
        {
            if (e != null)
            {

            }
        }
Esempio n. 16
0
 /// <summary>
 /// Opens a window where the user enters his credentals to authorize your app
 /// You MUST listen on the AuthSuccess event which will give you the access token on success
 /// Be aware that you need to change the registry to bring the WebBrowser control out of quirks mode as described on
 /// https://github.com/liGhun/AppNet.NET/blob/master/README.md
 /// See Model.Authorization.registerAppInRegistry() to do so automatically
 /// </summary>
 /// <param name="clientId">Your app's client ID</param>
 /// <param name="redirectUrl">The url where App.net will redirect the user on success. While not really important on the client side flow itself it needs to be an available URL</param>
 /// <param name="scope">The space separated list of the scopes your app needs</param>
 public clientSideFlow(string clientId, string redirectUrl, string scope)
 {
     authWindowClientSide              = new AuthorizationWindow(clientId, redirectUrl, scope);
     authWindowClientSide.AuthSuccess += authWindowServerSide_AuthSuccess;
 }
Esempio n. 17
0
 public serverSideFlow(string clientId, string redirectUrl, string scope)
 {
     throw new NotImplementedException();
     authWindowServerSide              = new AuthorizationWindow(clientId, redirectUrl, scope, true);
     authWindowServerSide.AuthSuccess += authWindowServerSide_AuthSuccess;
 }
Esempio n. 18
0
 public serverSideFlow(string clientId, string redirectUrl, string scope)
 {
     throw new NotImplementedException();
     authWindowServerSide = new AuthorizationWindow(clientId, redirectUrl, scope, true);
     authWindowServerSide.AuthSuccess += authWindowServerSide_AuthSuccess;
 }
 public AuthorizationViewModel(AuthorizationWindow mainWindow)
 {
     this.mainWindow = mainWindow;
     LoadView(ViewType.Authorization);
 }
Esempio n. 20
0
        private void AutificationWindow()
        {
            AuthorizationWindow login = new AuthorizationWindow(VisibilityAfterUutification, _db);

            login.ShowDialog();
        }
Esempio n. 21
0
 /// <summary>
 /// Opens a window where the user enters his credentals to authorize your app
 /// You MUST listen on the AuthSuccess event which will give you the access token on success
 /// Be aware that you need to change the registry to bring the WebBrowser control out of quirks mode as described on 
 /// https://github.com/liGhun/AppNet.NET/blob/master/README.md
 /// See Model.Authorization.registerAppInRegistry() to do so automatically
 /// </summary>
 /// <param name="clientId">Your app's client ID</param>
 /// <param name="redirectUrl">The url where App.net will redirect the user on success. While not really important on the client side flow itself it needs to be an available URL</param>
 /// <param name="scope">The space separated list of the scopes your app needs</param>
 public clientSideFlow(string clientId, string redirectUrl, string scope)
 {
     authWindowClientSide = new AuthorizationWindow(clientId, redirectUrl, scope);
     authWindowClientSide.AuthSuccess += authWindowServerSide_AuthSuccess;
 }
Esempio n. 22
0
 void authWindowServerSide_AuthSuccess(object sender, AuthorizationWindow.AuthEventArgs e)
 {
     AuthSuccess(this, e);
 }
Esempio n. 23
0
 public static Authorization AuthorizeNewAccount(string redirectUrl, string scope)
 {
     Authorization account = new Authorization();
     AuthorizationWindow authWindow = new AuthorizationWindow(clientId, redirectUrl, scope);
     authWindow.AuthSuccess += authWindow_AuthSuccess;
     authWindow.Show();
     return account;
 }
Esempio n. 24
0
 public UserAuthorizationViewModel(AuthorizationWindow window)
 {
     Window = window;
 }