Init
This commit is contained in:
85
ViewModels/WorkspaceViewModel.cs
Normal file
85
ViewModels/WorkspaceViewModel.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Input;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using TradeBlotter.Command;
|
||||
|
||||
namespace TradeBlotter.ViewModels
|
||||
{
|
||||
public delegate void InstantiateWorkspace(SaveParameters saveParameters);
|
||||
public abstract class WorkspaceViewModel : ViewModelBase
|
||||
{
|
||||
private RelayCommand closeCommand;
|
||||
public event EventHandler RequestClose;
|
||||
private InstantiateWorkspace workspaceInstantiator;
|
||||
private bool canClose=true;
|
||||
private bool isClosed=false;
|
||||
private String title="WorkspaceViewModel";
|
||||
public WorkspaceViewModel Referer{get;set;}
|
||||
|
||||
protected WorkspaceViewModel()
|
||||
{
|
||||
}
|
||||
public InstantiateWorkspace WorkspaceInstantiator
|
||||
{
|
||||
get
|
||||
{
|
||||
return workspaceInstantiator;
|
||||
}
|
||||
set
|
||||
{
|
||||
workspaceInstantiator = value;
|
||||
}
|
||||
}
|
||||
public ICommand CloseCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == closeCommand) closeCommand = new RelayCommand(param => this.OnRequestClose());
|
||||
return closeCommand;
|
||||
}
|
||||
}
|
||||
public bool IsClosed
|
||||
{
|
||||
get { return isClosed; }
|
||||
set
|
||||
{
|
||||
if (isClosed != value)
|
||||
{
|
||||
isClosed = value;
|
||||
base.OnPropertyChanged("IsClosed");
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool CanClose
|
||||
{
|
||||
get { return canClose; }
|
||||
set
|
||||
{
|
||||
if (canClose != value)
|
||||
{
|
||||
canClose = value;
|
||||
base.OnPropertyChanged("CanClose");
|
||||
}
|
||||
}
|
||||
}
|
||||
public virtual String Title
|
||||
{
|
||||
get
|
||||
{
|
||||
return title;
|
||||
}
|
||||
set
|
||||
{
|
||||
title=value;
|
||||
base.OnPropertyChanged("Title");
|
||||
}
|
||||
}
|
||||
private void OnRequestClose()
|
||||
{
|
||||
EventHandler handler = this.RequestClose;
|
||||
if (null != handler) handler(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user