113 lines
3.4 KiB
C#
113 lines
3.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Input;
|
|
|
|
using BeWo.Controls;
|
|
using BeWo.Core;
|
|
using BeWo.ServiceProxy;
|
|
using BeWo.Validation;
|
|
using BeWo.View.Search;
|
|
using BeWo.ViewModel;
|
|
using BeWo.ViewModel.ListViewModel;
|
|
using BeWo.Core.Service;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.ClientPartials;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Services;
|
|
using BS.Shared.Translation;
|
|
using DevExpress.Xpf.RichEdit;
|
|
using SupportConceptService = BeWo.Core.Service.SupportConceptService;
|
|
|
|
namespace BeWo.View.Detail
|
|
{
|
|
public partial class VorlageEditView
|
|
{
|
|
private DokumentvorlageVM _ViewModel;
|
|
|
|
public DokumentvorlageDC Vorlage;
|
|
public event Action ButtonSavedClicked;
|
|
public event Action ButtonCancelClicked;
|
|
public DokumentvorlageVM ViewModel { get; set; }
|
|
|
|
public VorlageEditView()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public override bool IsDirty
|
|
{
|
|
get
|
|
{
|
|
|
|
//if (ViewModel.SelectedVMForEditing != null && _SelectedEmployee != null &&
|
|
// !_SelectedEmployee.Equals(ViewModel.SelectedVMForEditing.Employee))
|
|
// return true;
|
|
|
|
return _ViewModel != null && _ViewModel.IsDirty;
|
|
}
|
|
}
|
|
|
|
public void InitView(DokumentvorlageVM pVM)
|
|
{
|
|
InitializeComponent();
|
|
|
|
ViewModel = pVM;
|
|
DataContext = pVM;
|
|
|
|
|
|
Focus();
|
|
}
|
|
|
|
private void richEditControl1_ContentChanged(object sender, EventArgs e)
|
|
{
|
|
ViewModel.Text = richEditControl1.Text;
|
|
ViewModel.RTFText = richEditControl1.RtfText;
|
|
}
|
|
|
|
private void btnSave_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if(TextEdit_Vorlagenname.Text.Equals(""))
|
|
{
|
|
MessageBox.Show("Der Volagenname darf nicht leer gelassen werden.", "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
return;
|
|
}
|
|
|
|
ButtonSavedClicked?.Invoke();
|
|
}
|
|
|
|
private void btnClose_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
bool close = true;
|
|
if (ViewModel.IsDirty)
|
|
{
|
|
if (MessageBox.Show(
|
|
Translator.Translate("Möchten Sie wirklich abbrechen und die Änderungen verwerfen?"),
|
|
"BeWoPlaner", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.Cancel)
|
|
{
|
|
close = false;
|
|
}
|
|
}
|
|
|
|
if (close)
|
|
{
|
|
ButtonCancelClicked?.Invoke();
|
|
}
|
|
}
|
|
private void TextEdit_Vorlagenname_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
|
|
{
|
|
if(TextEdit_Vorlagenname.EditValue != null)
|
|
ViewModel.Name = TextEdit_Vorlagenname.EditValue.ToString();
|
|
}
|
|
private void TextEdit_Beschreibung_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
|
|
{
|
|
if (TextEdit_Beschreibung.EditValue != null)
|
|
ViewModel.Beschreibung = TextEdit_Beschreibung.EditValue.ToString();
|
|
}
|
|
}
|
|
} |