private async void OkButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(UserNameTextBox.Text) || String.IsNullOrEmpty(PathTextBox.Text))
                {
                    return;
                }

                var settingsNew = new Models.Models.Settings()
                {
                    User = UserNameTextBox.Text,
                    Path = PathTextBox.Text
                };

                SettingsManager.SaveSettings(settingsNew);


                UserManager.SaveUser(await UserManager.GetNewUser(UserNameTextBox.Text));

                mainWindow.InitializeUI();
                mainWindow.SettingsButton.IsEnabled = true;

                Close();
            }
            catch (Exception exception)
            {
                logsManager.Log(exception.ToString());
            }
        }
Exemple #2
0
 private void SendFollowRequestButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         new Follow().RequestFollow(Convert.ToInt64(User));
         mainWindow.SyncButton.IsEnabled = true;
         Close();
     }
     catch (Exception exception)
     {
         logsManager.Log(exception.ToString());
     }
 }
        public Settings(MainWindow _window)
        {
            try
            {
                logsManager = new LogsManager();

                InitializeComponent();

                var settings = SettingsManager.GetSettings();
                mainWindow = _window;
                mainWindow.SettingsButton.IsEnabled = false;

                if (settings == null)
                {
                    return;
                }

                UserNameTextBox.Text = settings.User;
                PathTextBox.Text     = settings.Path;
            }
            catch (Exception exception)
            {
                logsManager.Log(exception.ToString());
            }
        }
        public Settings()
        {
            try
            {
                logsManager = new LogsManager();

                InitializeComponent();
            }
            catch (Exception exception)
            {
                logsManager.Log(exception.ToString());
            }
        }
Exemple #5
0
        //private VisualState visualState = VisualState.Start;

        #endregion

        #region constructors

        public MainWindow()
        {
            try
            {
                logsManager = new LogsManager();

                InitializeComponent();

                InitializeUI();
            }
            catch (Exception exception)
            {
                logsManager.Log(exception.ToString());
            }
        }
Exemple #6
0
        public FollowRequest(string message, string userName, MainWindow _mainWindow)
        {
            try
            {
                logsManager = new LogsManager();

                mainWindow = _mainWindow;
                User       = userName;

                InitializeComponent();

                mainWindow.SyncButton.IsEnabled = false;
                MessageLabel.Content            = message;
            }
            catch (Exception exception)
            {
                logsManager.Log(exception.ToString());
            }
        }
Exemple #7
0
        public void InitializeUI()
        {
            try
            {
                var user = UserManager.GetUser();

                if (user == null)
                {
                    return;
                }

                ProfileImage.Source   = ImageHelper.GetImage(user.Image);
                UserNameLabel.Content = user.UserName;
            }
            catch (Exception exception)
            {
                logsManager.Log(exception.ToString());
            }
        }
Exemple #8
0
 public void Log(object obj)
 {
     Debug(obj);
     _logsManager?.Log(obj);
 }