Interaction logic for InputDialog.xaml
Inheritance: System.Windows.Window
        public MainWindow()
        {
            UpdateManager.ApplyUpdateIfAvailable(true, 10);
            Mapper.CreateMap<SoundBoardItem, Model.SoundBoardItem>().ForMember(s => s.IsFavorite, source => source.MapFrom(s => _settings.Favorites.Any(d => d == s.Id)));


            while (string.IsNullOrEmpty(_settings.Username))
            {
                var inputDialog = new InputDialog("Please enter your name:");
                if (inputDialog.ShowDialog() == true)
                {
                    _settings.Username = inputDialog.Answer;
                    SettingsHelper.StoreSettings(_settings);
                }
                else
                {
                    //close the app, we don't want anonymous users
                    Close();
                }
            }

            SelectedAccentColor = AccentColors.First(d => d.Name == (!string.IsNullOrEmpty(_settings.PreferedColorSchema) ? _settings.PreferedColorSchema : "Blue"));

            InitializeComponent();

            _serverAddress = ConfigurationManager.AppSettings["ServerAddress"].TrimEnd('/') + "/api";
            CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, OnCloseWindow));
            CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, OnMaximizeWindow, OnCanResizeWindow));
            CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, OnMinimizeWindow, OnCanMinimizeWindow));
            CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, OnRestoreWindow, OnCanResizeWindow));
            CommandBindings.Add(new CommandBinding(PlaySoundBoardItemCommand, PlaySoundBoardItem));
            CommandBindings.Add(new CommandBinding(ToggleFavoriteCommand, ToggleFavorite));
            CommandBindings.Add(new CommandBinding(ToggleLoggingCommand, ToggleLogging));
            CommandBindings.Add(new CommandBinding(EditNameCommand, EditName));

            Task.Run(async () => await GetSoundBoardItemsAsync());
            Task.Run(async () => await GetCurrentQueue());
        }
 private void EditName(object sender, ExecutedRoutedEventArgs executedRoutedEventArgs)
 {
     var settings = SettingsHelper.GetSettings();
     var inputDialog = new InputDialog("Please enter your name:", settings.Username);
     if (inputDialog.ShowDialog() == true)
     {
         settings.Username = inputDialog.Answer;
         SettingsHelper.StoreSettings(settings);
     }
     while (string.IsNullOrEmpty(settings.Username))
     {
         inputDialog = new InputDialog("Please enter your name:", settings.Username);
         if (inputDialog.ShowDialog() != true) continue;
         settings.Username = inputDialog.Answer;
         SettingsHelper.StoreSettings(settings);
     }
 }