<Window.Resources>
<ResourceDictionary>
<ContextMenu x:Key="RowMenu" DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
- <MenuItem Header="{Binding FilePath}" cal:Message.Attach="[Event MouseLeftButtonUp]=[Action GoToFile($dataContext)]"
- cal:Action.TargetWithoutContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=DataGrid}, Path=DataContext}"/>
+ <MenuItem Header="{Binding FilePath}" cal:Message.Attach="GoToFile"/>
</ContextMenu>
<Style x:Key="DefaultRowStyle" TargetType="{x:Type DataGridRow}">
<Setter Property="ContextMenu" Value="{StaticResource RowMenu}" />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
- <ListBox x:Name="Conflicts" HorizontalContentAlignment="Stretch" Grid.Row="0">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <TextBlock x:Name="FilePath" Text="{Binding FilePath}" Grid.Row="0" Margin="5"/>
+ <DataGrid x:Name="Conflicts" HorizontalContentAlignment="Stretch" Grid.Row="0" AutoGenerateColumns="false" RowStyle="{StaticResource DefaultRowStyle}">
+ <DataGrid.Columns>
+ <DataGridTextColumn x:Name="FilePath" Binding="{Binding FilePath}" Header="File" Width="*" />
+ <DataGridTextColumn x:Name="LocalModified" Binding="{Binding LocalModified}" Header="Local Date" Width="Auto" />
+ <DataGridTemplateColumn x:Name="Action" Header="Action" Width="Auto">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
<ComboBox x:Name="Action" ItemsSource="{cnv:EnumValues model:ConflictAction}"
- SelectedValue="{Binding Action}" Grid.Row="1"
+ SelectedValue="{Binding Action}" Grid.Column="2"
HorizontalAlignment="Right"
HorizontalContentAlignment="Left"
Width="110" Margin="5" Padding="5,2"
/>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ </DataGrid.Columns>
+ </DataGrid>
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right">
<Button Name="Apply" Content="OK" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}" IsDefault="False" />
<Button Name="Cancel" Content="Cancel" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}" IsCancel="True" />
}
}
- private ConflictAction _action;
+ private string _reason;
+ public string Reason
+ {
+ get { return _reason; }
+ set
+ {
+ _reason = value;
+ NotifyOfPropertyChange(() => Reason);
+ }
+ }
+ private ConflictAction _action;
public ConflictAction Action
{
get { return _action; }
NotifyOfPropertyChange(()=>Action);
}
}
+
+ public DateTime LocalModified { get; set; }
+
+ public DateTime CloudModified { get; set; }
+
+ public void GoToFile()
+ {
+ if (!File.Exists(FilePath) && !Directory.Exists(FilePath))
+ return;
+ Process.Start("explorer.exe", "/select, " + FilePath);
+ }
}
[Export(typeof(ConflictsViewModel))]
class ConflictsViewModel:Screen
var conflicts = from state in FileState.Queryable
/*where state.FileStatus == FileStatus.Conflict ||
state.OverlayStatus == FileOverlayStatus.Conflict*/
- select new ConflictFile {FilePath = state.FilePath};
+ let info=FileInfoExtensions.FromPath(state.FilePath)
+ select new ConflictFile {FilePath = state.FilePath,Reason=state.ConflictReason,LocalModified = info.LastWriteTime};
_conflicts = new ObservableCollection<ConflictFile>(conflicts.ToList());
}
{
//If the previous and local hash don't match, there was a local conflict
//that was not uploaded to the server. We have a conflict
- ReportConflict(downloadPath);
+ ReportConflictForMismatch(downloadPath);
}
}
}
- private void ReportConflict(string downloadPath)
+ private void ReportConflictForMismatch(string downloadPath)
{
if (String.IsNullOrWhiteSpace(downloadPath))
throw new ArgumentNullException("downloadPath");