2014-07-23 10:47:09 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
|
using System.Windows.Shapes;
|
2014-07-23 20:27:14 +00:00
|
|
|
|
using RainmeterEditor.Model.Events;
|
|
|
|
|
using RainmeterEditor.UI.Controller;
|
|
|
|
|
using Xceed.Wpf.AvalonDock.Layout;
|
2014-07-23 10:47:09 +00:00
|
|
|
|
|
|
|
|
|
namespace RainmeterEditor
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
{
|
2014-07-23 20:27:14 +00:00
|
|
|
|
DocumentController documentController = new DocumentController();
|
|
|
|
|
|
2014-07-23 10:47:09 +00:00
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2014-07-23 20:27:14 +00:00
|
|
|
|
|
|
|
|
|
documentController.DocumentOpened += documentController_DocumentOpened;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void documentController_DocumentOpened(object sender, DocumentOpenedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Spawn a new window
|
|
|
|
|
LayoutDocument document = new LayoutDocument();
|
|
|
|
|
document.Content = e.Editor.EditorUI;
|
|
|
|
|
document.Title = e.Editor.Title;
|
|
|
|
|
document.Closing += document_Closing;
|
|
|
|
|
|
|
|
|
|
documentPane.Children.Add(document);
|
|
|
|
|
documentPane.SelectedContentIndex = documentPane.IndexOf(document);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void document_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
switch (MessageBox.Show("Are you sure?", "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
|
|
|
|
|
{
|
|
|
|
|
case MessageBoxResult.Yes:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MessageBoxResult.No:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void File_New_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2014-07-24 20:41:17 +00:00
|
|
|
|
documentController.Create(this);
|
2014-07-23 10:47:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2014-07-23 20:27:14 +00:00
|
|
|
|
}
|