Skip to content

Commit

Permalink
Issue 279 - Intermediate commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sckaushal committed Jul 18, 2016
1 parent b2d2fa1 commit c2ab271
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 9 deletions.
28 changes: 21 additions & 7 deletions Client/Controls/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,14 @@
<KeyBinding Command="{StaticResource SortByFileOrder}" Key="D0" Modifiers="Control"/>
<KeyBinding Command="{StaticResource SortByFileOrder}" Key="NumPad0" Modifiers="Control"/>
</Window.InputBindings>
<Grid Name="stackPanel1" Margin="0,0,0,0" >
<Menu Height="23" Name="menu1" VerticalAlignment="Top" IsMainMenu="True" KeyboardNavigation.TabNavigation="None">
<Grid Name="stackPanel1" Margin="0,0,0,0" ShowGridLines="False" >
<Grid.RowDefinitions>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="*" ></RowDefinition>
<RowDefinition Height="23"></RowDefinition>
</Grid.RowDefinitions>
<Menu Grid.Row="0" Height="23" Name="menu1" VerticalAlignment="Top" IsMainMenu="True" KeyboardNavigation.TabNavigation="None">
<MenuItem Header="_File">
<MenuItem Header="_New" Command="{StaticResource NewFile}" InputGestureText="Ctrl+N"/>
<MenuItem Header="_Open" Command="{StaticResource OpenFile}" InputGestureText="Ctrl+O"/>
Expand Down Expand Up @@ -266,11 +272,11 @@
</LinearGradientBrush>
</Menu.Background>
</Menu>
<local:IntellisenseTextBox Height="23" Margin="0,23,0,0" x:Name="taskText" AcceptsReturn="False" Cursor="IBeam" VerticalAlignment="Top"
<local:IntellisenseTextBox Grid.Row="1" Height="23" Margin="0,0,0,0" x:Name="taskText" AcceptsReturn="False" Cursor="IBeam" VerticalAlignment="Top"
KeyUp="taskText_PreviewKeyUp"
TaskList="{Binding TaskList}"
CaseSensitive="{Binding Source={x:Static local:User.Default}, Path=IntellisenseCaseSensitive}" />
<ListBox ItemsSource="{Binding Tasks}" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding SelectedItem}" Name="lbTasks" Margin="0,46,0,0" SelectedIndex="0" IsTextSearchEnabled="False" AlternationCount="2" BorderBrush="{x:Null}" SelectionMode="Extended" Style="{StaticResource WordWrapEnabledListBox}">
<ListBox Grid.Row="2" ItemsSource="{Binding Tasks}" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding SelectedItem}" Name="lbTasks" Margin="0,10,0,0" SelectedIndex="0" IsTextSearchEnabled="False" AlternationCount="2" BorderBrush="{x:Null}" SelectionMode="Extended" Style="{StaticResource WordWrapEnabledListBox}">
<ListBox.CommandBindings>
<CommandBinding Command="ApplicationCommands.Copy" CanExecute="WhenTasksSelectedCanExecute" Executed="CopyTasksExecuted" />
<CommandBinding Command="ApplicationCommands.Paste" CanExecute="PasteTasksIntoTaskListCanExecute" Executed="PasteTasksIntoTaskListExecuted" />
Expand Down Expand Up @@ -368,8 +374,16 @@
</GroupStyle>
</ListBox.GroupStyle>
</ListBox>
<WebBrowser Height="Auto" HorizontalAlignment="Stretch" Margin="0,46,0,0" Name="webBrowser1" VerticalAlignment="Stretch" Width="Auto" Visibility="Hidden" Grid.ColumnSpan="2" />
<Button Content="Print" Height="23" HorizontalAlignment="Left" Margin="0,23,207,0" Name="btnPrint" VerticalAlignment="Top" Width="92" Visibility="Hidden" Click="btnPrint_Click" />
<Button Content="Cancel" Height="23" HorizontalAlignment="Left" Margin="97,23,0,0" Name="btnCancelPrint" VerticalAlignment="Top" Width="92" Visibility="Hidden" Click="btnCancelPrint_Click" />

<WebBrowser Grid.Row="2" Height="Auto" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="webBrowser1" VerticalAlignment="Stretch" Width="Auto" Visibility="Hidden" Grid.ColumnSpan="2" />
<Button Grid.Row="0" Grid.RowSpan="2" Content="Print" Height="23" HorizontalAlignment="Left" Margin="0,23,207,0" Name="btnPrint" VerticalAlignment="Top" Width="92" Visibility="Hidden" Click="btnPrint_Click" />
<Button Grid.Row="0" Grid.RowSpan="2" Content="Cancel" Height="23" HorizontalAlignment="Left" Margin="97,23,0,0" Name="btnCancelPrint" VerticalAlignment="Top" Width="92" Visibility="Hidden" Click="btnCancelPrint_Click" />
<StatusBar Grid.Row="3">
<TextBlock Name="lblFilterStatus" Text="{Binding FilterDescription, Mode=OneWay}" VerticalAlignment="Bottom" ></TextBlock>
<Separator></Separator>
<TextBlock Text="Sort:"/>
<TextBlock Text="{Binding SortType, Mode=OneWay}"/>
</StatusBar>

</Grid>
</Window>
42 changes: 40 additions & 2 deletions Client/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

namespace Client
{
public class MainWindowViewModel
// INotifyPropertyChanged interface implemented to notify UI for status bar changes.
public class MainWindowViewModel : INotifyPropertyChanged
{
private CollectionView _myView;
private FileChangeObserver _changefile;
Expand All @@ -39,16 +40,41 @@ public SortType SortType
get { return _sortType; }
set
{
bool raiseEvent = false;
if (_sortType != value)
{
User.Default.CurrentSort = (int)value;
User.Default.Save();
raiseEvent = true;
}

_sortType = value;

if(raiseEvent)
{
RaiseProperyChanged(nameof(SortType));
}
}
}

private String _filterDescription = String.Empty;
public String FilterDescription
{
get
{
return _filterDescription;
}
private set
{
if (!_filterDescription.Equals(value))
{
_filterDescription = value;
RaiseProperyChanged(nameof(FilterDescription));
}
}
}

public event PropertyChangedEventHandler PropertyChanged;

public MainWindowViewModel(MainWindow window)
{
Expand All @@ -61,6 +87,7 @@ public MainWindowViewModel(MainWindow window)

SortType = (SortType)User.Default.CurrentSort;

FilterDescription = "Filter: None";

if (!string.IsNullOrEmpty(User.Default.FilePath))
{
Expand Down Expand Up @@ -571,8 +598,9 @@ private void ApplyFilterPreset(int filterPresetNumber)
SetSelectedTasks();

User.Default.Save();

FilterDescription = String.Format("Filter #{0}", filterPresetNumber);
}

#endregion

#region Sort Methods
Expand Down Expand Up @@ -1645,5 +1673,15 @@ private string EmitGroupHeader()
}

#endregion

#region Utility Methods
private void RaiseProperyChanged(String propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}
}

0 comments on commit c2ab271

Please sign in to comment.