Skip to content

Commit

Permalink
Add New Favorite Enhancements
Browse files Browse the repository at this point in the history
- fix focus issues
- fix up file names - dash to spaces and Camel Case reversion
  • Loading branch information
RickStrahl committed May 14, 2019
1 parent b5cc59d commit 1ff23b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions MarkdownMonster/Windows/Favorites/FavoritesControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@
</Grid>

<TextBox Text="{Binding EditedFavorite.Title, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
mah:TextBoxHelper.Watermark="Title" Foreground="LightSteelBlue" Name="TextFavoriteTitle"
mah:TextBoxHelper.Watermark="Title"
mah:TextBoxHelper.SelectAllOnFocus="True"
Foreground="LightSteelBlue" Name="TextFavoriteTitle"
FontSize="14" FontWeight="SemiBold" Margin="5,5,5,3" Width="Auto"/>
<Grid Margin="5,3">
<Grid.ColumnDefinitions>
Expand All @@ -170,13 +172,14 @@

<TextBox Text="{Binding EditedFavorite.File, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
mah:TextBoxHelper.Watermark="File Name"
mah:TextBoxHelper.SelectAllOnFocus="True"
FontSize="12" FontWeight="Normal"
/>
<Button Grid.Column="1" Padding="6,0" Margin="3,0,0,0" Click="ButtonFileSelection_Click">...</Button>
</Grid>

<CheckBox IsChecked="{Binding EditedFavorite.IsFolder}" Content="Is Grouping"
FontSize="12" FontWeight="Normal" Margin="5,3" />
FontSize="12" FontWeight="Normal" Margin="5,3" Style="{StaticResource CompactCheckBox}" />

<!--<Button Name="ButtonEditComplete"
HorizontalAlignment="Left"
Expand Down
9 changes: 6 additions & 3 deletions MarkdownMonster/_Classes/AppCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,14 +1197,17 @@ void AddFavorite()
var control = Model.Window.FavoritesTab.Content as FavoritesControl;
var fav = control.FavoritesModel;

var favorite = fav.AddFavorite(null, new FavoriteItem {File = file} );
var display = Path.GetFileNameWithoutExtension(file).Replace("-", " ").Replace("_", " ");
display = StringUtils.FromCamelCase(display);

var favorite = fav.AddFavorite(null, new FavoriteItem {File = file, Title = display } );
fav.SaveFavorites();

fav.EditedFavorite = favorite;
favorite.DisplayState.IsEditing = true;
control.TextFavoriteTitle.Focus();

Model.Window.Dispatcher.InvokeAsync(() => control.TextFavoriteTitle.Focus(),
System.Windows.Threading.DispatcherPriority.ApplicationIdle);
Model.Window.Dispatcher.Delay(900, (p) => control.TextFavoriteTitle.Focus(), null);

}, (p, c) => true);
}
Expand Down

0 comments on commit 1ff23b5

Please sign in to comment.