Merge branch 'item-comments' into develop

Conflicts:
	zaaReloaded2/Formatter/Formatter.cs
	zaaReloaded2/zaaReloaded2.csproj
This commit is contained in:
Daniel Kraus
2015-09-04 17:08:13 +02:00
30 changed files with 1259 additions and 16 deletions

View File

@ -0,0 +1,126 @@
/* 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
}
}

View File

@ -0,0 +1,111 @@
/* PreferencesViewModel.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;
namespace zaaReloaded2.ViewModels
{
/// <summary>
/// View model for zaaReloaded2.Preferences.
/// </summary>
public class PreferencesViewModel : ViewModelBase
{
#region Singleton
public static PreferencesViewModel Default
{
get
{
return _instance;
}
}
static PreferencesViewModel() { }
static readonly PreferencesViewModel _instance = new PreferencesViewModel();
#endregion
#region Properties
public bool SuppressItemCommentInteraction { get; set; }
#endregion
#region Command
public DelegatingCommand SaveCommand
{
get
{
if (_saveCommand == null)
{
_saveCommand = new DelegatingCommand(
param => DoSave(),
param => CanSave());
}
return _saveCommand;
}
}
#endregion
#region Constructor
public PreferencesViewModel()
{
SuppressItemCommentInteraction = Preferences.Default.SuppressItemCommentInteraction;
}
#endregion
#region Private methods
void DoSave()
{
Preferences.Default.SuppressItemCommentInteraction = SuppressItemCommentInteraction;
DoCloseView();
}
bool CanSave()
{
return true;
}
#endregion
#region Field
DelegatingCommand _saveCommand;
#endregion
#region ViewModelBase implementation
public override object RevealModelObject()
{
throw new NotImplementedException();
}
#endregion
}
}