mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
67 lines
2.0 KiB
C#
67 lines
2.0 KiB
C#
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;
|
|
using RainmeterEditor.Model.Events;
|
|
using RainmeterEditor.UI.Controller;
|
|
using Xceed.Wpf.AvalonDock.Layout;
|
|
|
|
namespace RainmeterEditor
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
DocumentController documentController = new DocumentController();
|
|
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
|
|
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)
|
|
{
|
|
documentController.Create(this);
|
|
}
|
|
}
|
|
} |