Ejemplo n.º 1
0
        private void RewriteClientUiConfiguration(ClientUiConfiguration configuration)
        {
            configuration.ServerAddress = httpClientProvider.ServerAddress;
            configuration.TimeoutMs     = httpClientProvider.TimeoutMs;
            configuration.Login         = httpClientProvider.Login;
            configuration.Password      = httpClientProvider.Password;

            configuration.WriteConfiguration();
        }
Ejemplo n.º 2
0
        private void CreateMenuAuthorization()
        {
            if (httpClientProvider.IsAuthorize)
            {
                var menuItemSignOut = new MenuItem {
                    Header = "Выйти"
                };
                menuItemSignOut.Click += (sender, args) => {
                    httpClientProvider.GetParameretsClient().SingOut();
                    clientUiConfiguration.Login    = httpClientProvider.Login;
                    clientUiConfiguration.Password = httpClientProvider.Password;
                    clientUiConfiguration.WriteConfiguration();
                    ComboBoxBoards.SelectedItem = string.Empty;
                    boardControl.LoadBoard(string.Empty);
                    CreateMenuAuthorization();
                };

                MenuAuthorization.ItemsSource = new[] {
                    new MenuItem {
                        Header = httpClientProvider.Login, ItemsSource = new[] { menuItemSignOut }, VerticalContentAlignment = VerticalAlignment.Center, Height = 26
                    }
                };
            }
            else
            {
                var menuItemSignIn = new MenuItem {
                    Header = "Войти", VerticalContentAlignment = VerticalAlignment.Center, Height = 26
                };
                menuItemSignIn.Click += (sender, args) => {
                    if (new AuthorizationWindow(httpClientProvider.GetParameretsClient()).ShowDialog() != true)
                    {
                        return;
                    }

                    clientUiConfiguration = ClientUiConfiguration.ReadConfiguration();
                    CreateMenuAuthorization();
                };

                MenuAuthorization.ItemsSource = new[] { menuItemSignIn };
            }
        }