mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-06 09:40:50 +08:00
主题还得完善下
This commit is contained in:
@@ -19,12 +19,19 @@ using AIStudio.Wpf.DiagramDesigner.Additionals;
|
||||
using AIStudio.Wpf.DiagramDesigner.Additionals.Commands;
|
||||
using AIStudio.Wpf.DiagramDesigner.ViewModels;
|
||||
using AIStudio.Wpf.DiagramDesigner.ViewModels.BaseViewModel;
|
||||
using AIStudio.Wpf.Mind;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
{
|
||||
public class MainWindowViewModel : BindableBase
|
||||
{
|
||||
private IDiagramServiceProvider _service { get { return DiagramServicesProvider.Instance.Provider; } }
|
||||
private IDiagramServiceProvider _service
|
||||
{
|
||||
get
|
||||
{
|
||||
return DiagramServicesProvider.Instance.Provider;
|
||||
}
|
||||
}
|
||||
private string _history = System.AppDomain.CurrentDomain.BaseDirectory + "history.json";
|
||||
|
||||
public MainWindowViewModel()
|
||||
@@ -50,7 +57,10 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
}
|
||||
|
||||
#region 属性
|
||||
public ToolBoxViewModel ToolBoxViewModel { get; private set; }
|
||||
public ToolBoxViewModel ToolBoxViewModel
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private ObservableCollection<PageViewModel> _diagramsViewModels;
|
||||
public ObservableCollection<PageViewModel> DiagramsViewModels
|
||||
@@ -118,7 +128,10 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public Color[] StandardColor { get; set; }
|
||||
public Color[] StandardColor
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public IDrawModeViewModel DrawModeViewModel
|
||||
{
|
||||
@@ -222,8 +235,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
get
|
||||
{
|
||||
return
|
||||
() =>
|
||||
{
|
||||
() => {
|
||||
return new PageViewModel(NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", DiagramType.Normal);
|
||||
};
|
||||
}
|
||||
@@ -239,6 +251,15 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand _newMindCommand;
|
||||
public ICommand NewMindCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._newMindCommand ?? (this._newMindCommand = new DelegateCommand<string>(para => this.NewMind_Executed(para)));
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand _openCommand;
|
||||
public ICommand OpenCommand
|
||||
{
|
||||
@@ -650,7 +671,10 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
|
||||
public ItemActionCallback ClosingTabItemHandler
|
||||
{
|
||||
get { return ClosingTabItemHandlerImpl; }
|
||||
get
|
||||
{
|
||||
return ClosingTabItemHandlerImpl;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -723,11 +747,11 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
|
||||
var para = e.KeyboardDevice.Modifiers == ModifierKeys.None ? e.Key.ToString() : e.KeyboardDevice.Modifiers.ToString() + "+" + e.Key.ToString();
|
||||
bool executed = true;
|
||||
switch (para)
|
||||
switch (para)
|
||||
{
|
||||
case "Control+O": OpenExecuted(); break;
|
||||
case "Control+N": New_Executed(); break;
|
||||
case "Control+S": SaveExecuted(); break;
|
||||
case "Control+S": SaveExecuted(); break;
|
||||
default: executed = false; break;
|
||||
}
|
||||
|
||||
@@ -746,7 +770,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
|
||||
private void SelectedAllExecuted()
|
||||
{
|
||||
PageViewModel?.DiagramViewModel?.SelectAllCommand.Execute(null);
|
||||
PageViewModel?.DiagramViewModel?.SelectAllCommand.Execute(null);
|
||||
}
|
||||
|
||||
private void OpenExecuted(string para = null)
|
||||
@@ -911,10 +935,6 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
{
|
||||
PageViewModel = new SFCViewModel(NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", (DiagramType)Enum.Parse(typeof(DiagramType), type));
|
||||
}
|
||||
else if (type == DiagramType.Mind.ToString())
|
||||
{
|
||||
PageViewModel = new MindViewModel(NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", (DiagramType)Enum.Parse(typeof(DiagramType), type));
|
||||
}
|
||||
else
|
||||
{
|
||||
PageViewModel = new PageViewModel(NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", (DiagramType)Enum.Parse(typeof(DiagramType), type));
|
||||
@@ -923,6 +943,16 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
DiagramsViewModels.Add(PageViewModel);
|
||||
}
|
||||
|
||||
private void NewMind_Executed(string mindtype = "Mind")
|
||||
{
|
||||
IsOpenBackstage = false;
|
||||
|
||||
PageViewModel = new MindViewModel(NewNameHelper.GetNewName(DiagramsViewModels.Select(p => p.Title), "新建-"), "*", DiagramType.Mind, (MindType)Enum.Parse(typeof(MindType), mindtype));
|
||||
|
||||
|
||||
DiagramsViewModels.Add(PageViewModel);
|
||||
}
|
||||
|
||||
private void ExitExecuted()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -948,11 +978,11 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
PageViewModel?.DiagramViewModel?.AlignVerticalCentersCommand.Execute(para);
|
||||
}
|
||||
private void AlignBottomExecuted(object para)
|
||||
{
|
||||
{
|
||||
PageViewModel?.DiagramViewModel?.AlignBottomCommand.Execute(para);
|
||||
}
|
||||
private void AlignLeftExecuted(object para)
|
||||
{
|
||||
{
|
||||
PageViewModel?.DiagramViewModel?.AlignLeftCommand.Execute(para);
|
||||
}
|
||||
private void AlignHorizontalCentersExecuted(object para)
|
||||
|
||||
Reference in New Issue
Block a user