private void SaveCurrentWork(object obj)
        {
            if (list == null)
            {
                return;
            }
            string fileName = string.Empty;
            if (obj != null)
            {
                fileName = obj.ToString();
            }

            if (string.IsNullOrEmpty(fileName))
            {
                if (!list.Any(vm => !string.IsNullOrEmpty(vm.NewValue)))
                {//nothing to save
                    return;
                }
                string directory = System.IO.Path.GetDirectoryName(referenceFileName);
                directory = System.IO.Path.Combine(directory, "Backup");
                fileName = System.IO.Path.Combine(directory, DateTime.Now.ToString("dd_MM_yyyy_HH_mm") + ".properties");
                if (!System.IO.Directory.Exists(directory))
                {
                    System.IO.Directory.CreateDirectory(directory);
                }
            }

            PropsDocument doc = new PropsDocument();
            foreach (CompViewModelItem vm in list)
            {
                string value = vm.IsComment ? vm.ReferenceValue : vm.NewValue;
                doc.Add(new PropsElement(vm.Key, value));
            }
            doc.Save(fileName);
        }
        private void loadReferenceFileButton_Click(object sender, RoutedEventArgs e)
        {
            if (referenceDocument != null)
            {
                if (MessageBox.Show(
            @"If you load a new document you may loose your work.
            You might want to save your work first.
            If you click yes you current work will be overriden.", "Save before.", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
                {
                    return;
                }
            }

            ChangeIsEnableControls(false);

            referenceFileName = SelectOpenFile();
            if (string.IsNullOrEmpty(referenceFileName))
            {
                ChangeIsEnableControls(true);
                return;
            }
            SetMessage("Loading properties...");

            ExecuteAsync(() =>
            {
                referenceDocument = new PropsDocument(true);
                referenceDocument.Load(referenceFileName);

                //creating a new document for translation
                transDocument = new PropsDocument();

                list = new ObservableCollection<CompViewModelItem>();
                foreach (PropsElement element in referenceDocument.Elements)
                {
                    PropsElement copyElement = new PropsElement(element.Key, string.Empty);
                    list.Add(new CompViewModelItem { Key = element.Key, ReferenceValue = element.Value, NewValue = string.Empty });
                    transDocument.Add(copyElement);
                }
            }, () =>
            {
                SetMessage(referenceFileName + " loaded");
                ClearSearch();
                ListControl.ItemsSource = list;

                ChangeIsEnableControls(true);
            });
        }