127 lines
3.0 KiB
C#
Executable File
127 lines
3.0 KiB
C#
Executable File
/* ItemCommentViewModel.cs
|
|
* part of zaaReloaded2
|
|
*
|
|
* Copyright 2015 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 _itemComment.Value;
|
|
}
|
|
set
|
|
{
|
|
_itemComment.Value = value;
|
|
OnPropertyChanged("Value");
|
|
}
|
|
}
|
|
|
|
public string Suffix { get { return _itemComment.Suffix; } }
|
|
|
|
#endregion
|
|
|
|
#region Commands
|
|
|
|
DelegatingCommand CancelCommand
|
|
{
|
|
get
|
|
{
|
|
if (_cancelCommand == null)
|
|
{
|
|
_cancelCommand = new DelegatingCommand(
|
|
param => DoCancel());
|
|
}
|
|
return _cancelCommand;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Message
|
|
|
|
public Message<ViewModelMessageContent> CancelMessage
|
|
{
|
|
get
|
|
{
|
|
if (_cancelMessage == null)
|
|
{
|
|
_cancelMessage = new Message<ViewModelMessageContent>();
|
|
}
|
|
return _cancelMessage;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
public ItemCommentViewModel(ItemComment itemComment)
|
|
{
|
|
_itemComment = itemComment;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Implementation of ViewModelBase
|
|
|
|
public override object RevealModelObject()
|
|
{
|
|
return _itemComment;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Private methods
|
|
|
|
void DoCancel()
|
|
{
|
|
CancelMessage.Send(new ViewModelMessageContent(this));
|
|
DoCloseView();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Fields
|
|
|
|
DelegatingCommand _cancelCommand;
|
|
Message<ViewModelMessageContent> _cancelMessage;
|
|
ItemComment _itemComment;
|
|
|
|
#endregion
|
|
}
|
|
}
|