Пример #1
0
        private void AutificationWindow()
        {
            AuthorizationWindow login = new AuthorizationWindow(VisibilityAfterUutification, CloseProgram, SetName, SetImageProfile);

            login.ShowDialog();
            NameUser.Text = _nameUser;
        }
        /// <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();
            }
        }
Пример #3
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);
            }
        }
Пример #5
0
        private void AutificationWindow()
        {
            AuthorizationWindow login = new AuthorizationWindow(VisibilityAfterUutification, _db);

            login.ShowDialog();
        }