From 7f466a3a17388d4f77f63d43b939294f01ec3dee Mon Sep 17 00:00:00 2001 From: kirmir Date: Tue, 24 Feb 2015 22:55:13 +0200 Subject: [PATCH] Updated UI. Added row double click handling. --- ResxTranslationTool/Models/Translation.cs | 13 ++++++-- ResxTranslationTool/Views/MainWindow.xaml | 31 +++++++++++--------- ResxTranslationTool/Views/MainWindow.xaml.cs | 14 +++++++++ 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/ResxTranslationTool/Models/Translation.cs b/ResxTranslationTool/Models/Translation.cs index 71ea843..1777bd8 100644 --- a/ResxTranslationTool/Models/Translation.cs +++ b/ResxTranslationTool/Models/Translation.cs @@ -1,14 +1,21 @@ -namespace ResxTranslationTool.Models +using Microsoft.Practices.Prism.Mvvm; + +namespace ResxTranslationTool.Models { - public sealed class Translation + public sealed class Translation : BindableBase { + private string _translatedText; public string Id { get; set; } public string FileName { get; set; } public string OriginalText { get; set; } - public string TranslatedText { get; set; } + public string TranslatedText + { + get { return _translatedText; } + set { SetProperty(ref _translatedText, value); } + } public string Comment { get; set; } } diff --git a/ResxTranslationTool/Views/MainWindow.xaml b/ResxTranslationTool/Views/MainWindow.xaml index 15cd9cc..cd3a840 100644 --- a/ResxTranslationTool/Views/MainWindow.xaml +++ b/ResxTranslationTool/Views/MainWindow.xaml @@ -16,6 +16,7 @@ + diff --git a/ResxTranslationTool/Views/MainWindow.xaml.cs b/ResxTranslationTool/Views/MainWindow.xaml.cs index 1f6f660..4c982cd 100644 --- a/ResxTranslationTool/Views/MainWindow.xaml.cs +++ b/ResxTranslationTool/Views/MainWindow.xaml.cs @@ -1,5 +1,8 @@ using System.Diagnostics; +using System.Windows.Controls; +using System.Windows.Input; using System.Windows.Navigation; +using ResxTranslationTool.Models; using ResxTranslationTool.ViewModels; namespace ResxTranslationTool.Views @@ -21,5 +24,16 @@ private void homePageRequestNavigate(object sender, RequestNavigateEventArgs e) Process.Start(e.Uri.AbsoluteUri); e.Handled = true; } + + private void TranslationRow_DoubleClick(object sender, MouseButtonEventArgs e) + { + var row = (DataGridRow)sender; + var translation = (Translation)row.DataContext; + + if (string.IsNullOrEmpty(translation.TranslatedText)) + { + translation.TranslatedText = translation.OriginalText; + } + } } }