114 lines
2.7 KiB
C#
Executable File
114 lines
2.7 KiB
C#
Executable File
/* ItemCommentViewModel.cs
|
|
* part of zaaReloaded2
|
|
*
|
|
* Copyright 2015-2018 Daniel Kraus
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Bovender.Mvvm;
|
|
using Bovender.Mvvm.ViewModels;
|
|
using Bovender.Mvvm.Messaging;
|
|
using zaaReloaded2.Controller.Comments;
|
|
|
|
namespace zaaReloaded2.ViewModels
|
|
{
|
|
/// <summary>
|
|
/// View model for zaaReloaded2.Controller.Comments.ItemComment.
|
|
/// </summary>
|
|
public class ItemCommentViewModel : ViewModelBase
|
|
{
|
|
#region Properties
|
|
|
|
public string Item { get { return _itemComment.Item; } }
|
|
|
|
public string Prefix { get { return _itemComment.Prefix; } }
|
|
|
|
public string Value
|
|
{
|
|
get
|
|
{
|
|
return _value;
|
|
}
|
|
set
|
|
{
|
|
_value = value;
|
|
OnPropertyChanged("Value");
|
|
}
|
|
}
|
|
|
|
public string Suffix { get { return _itemComment.Suffix; } }
|
|
|
|
#endregion
|
|
|
|
#region Commands
|
|
|
|
public DelegatingCommand SaveCommand
|
|
{
|
|
get
|
|
{
|
|
if (_saveCommand == null)
|
|
{
|
|
_saveCommand = new DelegatingCommand(
|
|
param => DoSave());
|
|
}
|
|
return _saveCommand;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
public ItemCommentViewModel(ItemComment itemComment)
|
|
{
|
|
_itemComment = itemComment;
|
|
_value = _itemComment.Value;
|
|
_itemComment.IsCancelled = true;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Implementation of ViewModelBase
|
|
|
|
public override object RevealModelObject()
|
|
{
|
|
return _itemComment;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Private methods
|
|
|
|
void DoSave()
|
|
{
|
|
_itemComment.Value = Value;
|
|
_itemComment.IsCancelled = false;
|
|
DoCloseView();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Fields
|
|
|
|
string _value;
|
|
DelegatingCommand _saveCommand;
|
|
ItemComment _itemComment;
|
|
|
|
#endregion
|
|
}
|
|
}
|