89 lines
2.5 KiB
C#
89 lines
2.5 KiB
C#
![]() |
using Bricscad.ApplicationServices;
|
|||
|
using Bricscad.Windows;
|
|||
|
using Prism.Dialogs;
|
|||
|
using Prism.Ioc;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Input;
|
|||
|
using Telerik.Windows.Controls;
|
|||
|
using Unity;
|
|||
|
|
|||
|
namespace CAD.Extend.ViewModels
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// abstract 不同于接口,可以实现具体的代码
|
|||
|
/// </summary>
|
|||
|
public abstract class DialogBase : ViewModelBase
|
|||
|
{
|
|||
|
public DialogBase()
|
|||
|
{
|
|||
|
_dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
|
|||
|
window_loaded = new DelegateCommand(onWindow_loaded);
|
|||
|
CloseCommand = new DelegateCommand(ExecuteCloseCommand);
|
|||
|
OKCommand = new DelegateCommand(ExecuteOKCommandAsync);
|
|||
|
|
|||
|
}
|
|||
|
#region binding
|
|||
|
private bool _isbusy;
|
|||
|
|
|||
|
public bool IsBusy
|
|||
|
{
|
|||
|
get { return _isbusy; }
|
|||
|
set { _isbusy = value; RaisePropertyChanged(nameof(IsBusy)); }
|
|||
|
}
|
|||
|
private string _BusyContent;
|
|||
|
|
|||
|
public string BusyContent
|
|||
|
{
|
|||
|
get { return _BusyContent; }
|
|||
|
set { _BusyContent = value; RaisePropertyChanged(nameof(BusyContent)); }
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 加载后
|
|||
|
/// </summary>
|
|||
|
public ICommand window_loaded { get; }
|
|||
|
public ICommand CloseCommand { get; }
|
|||
|
|
|||
|
public ICommand OKCommand { get; }
|
|||
|
private string _title;
|
|||
|
|
|||
|
public string title
|
|||
|
{
|
|||
|
get { return _title; }
|
|||
|
set { _title = value; RaisePropertyChanged(nameof(title)); }
|
|||
|
}
|
|||
|
#endregion
|
|||
|
IUnityContainer _unityContainer;
|
|||
|
public readonly IDialogService _dialogService;
|
|||
|
/// <summary>
|
|||
|
/// CODE-BEHAND里设置为this.close以关闭。调用时,.invoke即可
|
|||
|
/// </summary>
|
|||
|
public Action CloseWindowAction { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// virtual 可以重写
|
|||
|
/// </summary>
|
|||
|
/// <param name="parameter"></param>
|
|||
|
public virtual void ExecuteCloseCommand(object parameter)
|
|||
|
{
|
|||
|
// 关闭窗口 (需要通过 CommandParameter 传入窗口实例)
|
|||
|
if (parameter is System.Windows.Window window)
|
|||
|
{
|
|||
|
window.Close();
|
|||
|
}
|
|||
|
}
|
|||
|
public virtual void onWindow_loaded(object para)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
public virtual void ExecuteOKCommandAsync(object para)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|